Changeset 3464
- Timestamp:
- Jul 9, 2018 1:35:38 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/GSASIIpwdGUI.py ¶
r3460 r3464 3042 3042 controls[4] = 1 3043 3043 controls[5] = (SGData['SGLatt']+SGData['SGLaue']).replace('-','') 3044 if 'R' in controls[5]: controls[5] = 'R3-H' 3044 3045 controls[6:12] = Cell[1:8] 3045 3046 controls[13] = spaceGroups[bravaisSymb.index(controls[5])] … … 3059 3060 controls[4] = 1 3060 3061 controls[5] = (SGData['SGLatt']+SGData['SGLaue']).replace('-','') 3062 if 'R' in controls[5]: controls[5] = 'R3-H' 3061 3063 controls[6:12] = Cell[1:8] 3062 3064 controls[13] = spaceGroups[bravaisSymb.index(controls[5])] -
TabularUnified trunk/exports/G2export_CIF.py ¶
r3260 r3464 192 192 WriteCIFitem(fp, s) 193 193 194 def WriteAtomsMagnetic(fp, phasedict, phasenam, parmDict, sigDict, labellist): 195 'Write atom positions to CIF' 196 # phasedict = self.Phases[phasenam] # pointer to current phase info 197 General = phasedict['General'] 198 cx,ct,cs,cia = General['AtomPtrs'] 199 Atoms = phasedict['Atoms'] 200 cfrac = cx+3 201 fpfx = str(phasedict['pId'])+'::Afrac:' 202 for i,at in enumerate(Atoms): 203 fval = parmDict.get(fpfx+str(i),at[cfrac]) 204 if fval != 0.0: 205 break 206 else: 207 WriteCIFitem(fp, '\n# PHASE HAS NO ATOMS!') 208 return 209 210 WriteCIFitem(fp, '\n# ATOMIC COORDINATES AND DISPLACEMENT PARAMETERS') 211 WriteCIFitem(fp, 'loop_ '+ 212 '\n _atom_site_label'+ 213 '\n _atom_site_type_symbol'+ 214 '\n _atom_site_fract_x'+ 215 '\n _atom_site_fract_y'+ 216 '\n _atom_site_fract_z'+ 217 '\n _atom_site_occupancy'+ 218 '\n _atom_site_adp_type'+ 219 '\n _atom_site_U_iso_or_equiv'+ 220 '\n _atom_site_symmetry_multiplicity') 221 222 varnames = {cx:'Ax',cx+1:'Ay',cx+2:'Az',cx+3:'Afrac', 223 cx+4:'AMx',cx+5:'AMy',cx+6:'AMz', 224 cia+1:'AUiso',cia+2:'AU11',cia+3:'AU22',cia+4:'AU33', 225 cia+5:'AU12',cia+6:'AU13',cia+7:'AU23'} 226 # Empty the labellist 227 while labellist: 228 labellist.pop() 229 230 pfx = str(phasedict['pId'])+'::' 231 # loop over all atoms 232 naniso = 0 233 for i,at in enumerate(Atoms): 234 if phasedict['General']['Type'] == 'macromolecular': 235 label = '%s_%s_%s_%s'%(at[ct-1],at[ct-3],at[ct-4],at[ct-2]) 236 s = PutInCol(MakeUniqueLabel(label,labellist),15) # label 237 else: 238 s = PutInCol(MakeUniqueLabel(at[ct-1],labellist),6) # label 239 fval = parmDict.get(fpfx+str(i),at[cfrac]) 240 if fval == 0.0: continue # ignore any atoms that have a occupancy set to 0 (exact) 241 s += PutInCol(FmtAtomType(at[ct]),4) # type 242 if at[cia] == 'I': 243 adp = 'Uiso ' 244 else: 245 adp = 'Uani ' 246 naniso += 1 247 # compute Uequiv crudely 248 # correct: Defined as "1/3 trace of diagonalized U matrix". 249 # SEE cell2GS & Uij2Ueqv to GSASIIlattice. Former is needed to make the GS matrix used by the latter. 250 t = 0.0 251 for j in (2,3,4): 252 var = pfx+varnames[cia+j]+":"+str(i) 253 t += parmDict.get(var,at[cia+j]) 254 for j in (cx,cx+1,cx+2,cx+3,cia,cia+1): 255 if j in (cx,cx+1,cx+2): 256 dig = 11 257 sigdig = -0.00009 258 else: 259 dig = 10 260 sigdig = -0.009 261 if j == cia: 262 s += adp 263 else: 264 var = pfx+varnames[j]+":"+str(i) 265 dvar = pfx+"d"+varnames[j]+":"+str(i) 266 if dvar not in sigDict: 267 dvar = var 268 if j == cia+1 and adp == 'Uani ': 269 val = t/3. 270 sig = sigdig 271 else: 272 #print var,(var in parmDict),(var in sigDict) 273 val = parmDict.get(var,at[j]) 274 sig = sigDict.get(dvar,sigdig) 275 if dvar in G2mv.GetDependentVars(): # do not include an esd for dependent vars 276 sig = -abs(sig) 277 s += PutInCol(G2mth.ValEsd(val,sig),dig) 278 s += PutInCol(at[cs+1],3) 279 WriteCIFitem(fp, s) 280 if naniso == 0: return 281 # now loop over aniso atoms 282 WriteCIFitem(fp, '\nloop_' + '\n _atom_site_aniso_label' + 283 '\n _atom_site_aniso_U_11' + '\n _atom_site_aniso_U_22' + 284 '\n _atom_site_aniso_U_33' + '\n _atom_site_aniso_U_12' + 285 '\n _atom_site_aniso_U_13' + '\n _atom_site_aniso_U_23') 286 for i,at in enumerate(Atoms): 287 fval = parmDict.get(fpfx+str(i),at[cfrac]) 288 if fval == 0.0: continue # ignore any atoms that have a occupancy set to 0 (exact) 289 if at[cia] == 'I': continue 290 s = PutInCol(labellist[i],6) # label 291 for j in (2,3,4,5,6,7): 292 sigdig = -0.0009 293 var = pfx+varnames[cia+j]+":"+str(i) 294 val = parmDict.get(var,at[cia+j]) 295 sig = sigDict.get(var,sigdig) 296 s += PutInCol(G2mth.ValEsd(val,sig),11) 297 WriteCIFitem(fp, s) 298 # now loop over mag atoms (e.g. all of them) 299 WriteCIFitem(fp, '\nloop_' + '\n _atom_site_moment.label' + 300 '\n _atom_site_moment.crystalaxis_x' + 301 '\n _atom_site_moment.crystalaxis_y' + 302 '\n _atom_site_moment.crystalaxis_z') 303 for i,at in enumerate(Atoms): 304 fval = parmDict.get(fpfx+str(i),at[cfrac]) 305 if fval == 0.0: continue # ignore any atoms that have a occupancy set to 0 (exact) 306 s = PutInCol(labellist[i],6) # label 307 for j in (cx+4,cx+5,cx+6): 308 sigdig = -0.0009 309 var = pfx+varnames[j]+":"+str(i) 310 val = parmDict.get(var,at[j]) 311 sig = sigDict.get(var,sigdig) 312 s += PutInCol(G2mth.ValEsd(val,sig),11) 313 WriteCIFitem(fp, s) 194 314 195 315 # Refactored over here to allow access by GSASIIscriptable.py … … 1154 1274 self.parmDict, self.sigDict, self.labellist) 1155 1275 else: 1276 try: 1277 self.labellist 1278 except AttributeError: 1279 self.labellist = [] 1280 WriteAtomsMagnetic(self.fp, self.Phases[phasenam], phasenam, 1281 self.parmDict, self.sigDict, self.labellist) 1156 1282 raise Exception("no export for "+str(phasedict['General']['Type'])+" coordinates implemented") 1157 1283 # report cell contents
Note: See TracChangeset
for help on using the changeset viewer.