- Timestamp:
- Jun 20, 2013 5:07:33 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/GSASIIobj.py ¶
r956 r963 143 143 ========== =============== ==================================================== 144 144 General \ Overall information for the phase (dict) 145 \ AtomPtrs ? (list) 145 \ AtomPtrs list of four locations to use to pull info 146 from the atom records (list) 146 147 \ F000X x-ray F(000) intensity (float) 147 148 \ F000N neutron F(000) intensity (float) … … 183 184 pId \ Phase Id number for current project (int). 184 185 Atoms \ Atoms in phase as a list of lists. The outer list 185 is for each atom, the inner list contains 18 186 items: 187 0) atom label, 1) the atom type, 188 2) the refinement flags, 3-6) x, y, z, frac 189 7) site symmetry, 8) site multiplicity, 190 9) 'I' or 'A' for iso/anisotropic, 191 10) Uiso, 10-16) Uij, 16) unique Id #. 186 is for each atom, the inner list contains varying 187 items depending on the type of phase, see 188 the :ref:`Atom Records <Atoms_table>` description. 192 189 (list of lists) 193 190 Drawing \ Display parameters (dict) … … 285 282 '111' is used (P 1, and ?). 286 283 ========== ==================================================== 284 285 Atom Records 286 ------------ 287 288 .. _Atoms_table: 289 290 .. index:: 291 single: Atoms record description 292 single: Data object descriptions; Atoms record 293 294 295 If ``phasedict`` points to the phase information in the data tree, then 296 atoms are contained in a list of atom records (list) in 297 ``phasedict['Atoms']``. Also needed to read atom information 298 are four pointers, ``cx,ct,cs,cia = phasedict['General']['AtomPtrs']``, 299 which define locations in the atom record, as shown below. 300 301 .. tabularcolumns:: |l|p{4.5in}| 302 303 ============== ==================================================== 304 location explanation 305 ============== ==================================================== 306 cx,cx+1,cx+2 the x,y and z coordinates 307 cx+3 fractional occupancy (also cs-1) 308 ct-1 atom label 309 ct atom type 310 ct+1 refinement flags 311 cs site symmetry string 312 cs+1 site multiplicity 313 cia ADP flag: Isotropic ('I') or Anisotropic ('A') 314 cia+1 Uiso 315 cia+2...cia+6 U11, U22, U33, U12, U13, U23 316 ============== ==================================================== 317 318 319 *Classes and routines* 320 ---------------------- 287 321 288 322 ''' -
TabularUnified trunk/GSASIIspc.py ¶
r956 r963 202 202 def AllOps(SGData): 203 203 ''' 204 Returns a list of all operators for a space group, including those for centering and a center of symmetry 204 Returns a list of all operators for a space group, including those for 205 centering and a center of symmetry 205 206 206 207 :param SGData: from :func:`SpcGroup` 207 :returns: list of strings of formatted symmetry operators 208 ''' 209 SGText = [] 208 :returns: (SGTextList,offsetList,symOpList,G2oprList) where 209 210 * SGTextList: a list of strings with formatted and normalized 211 symmetry operators. 212 * offsetList: a tuple of (dx,dy,dz) offsets that relate the GSAS-II 213 symmetry operation to the operator in SGTextList and symOpList. 214 these dx (etc.) values are added to the GSAS-II generated 215 positions to provide the positions that are generated 216 by the normalized symmetry operators. 217 * symOpList: a list of tuples with the normalized symmetry 218 operations as (M,T) values 219 (see ``SGOps`` in the :ref:`Space Group object<SGData_table>`) 220 * G2oprList: The GSAS-II operations for each symmetry operation as 221 a tuple with (center,mult,opnum), where center is (0,0,0), (0.5,0,0), 222 (0.5,0.5,0.5),...; where mult is 1 or -1 for the center of symmetry 223 and opnum is the number for the symmetry operation, in ``SGOps`` 224 (starting with 0). 225 ''' 226 SGTextList = [] 227 offsetList = [] 228 symOpList = [] 229 G2oprList = [] 210 230 onebar = (1,) 211 231 if SGData['SGInv']: … … 213 233 for cen in SGData['SGCen']: 214 234 for mult in onebar: 215 for M,T in SGData['SGOps']: 216 OPtxt = MT2text(mult*M,(mult*T)+cen) 217 SGText.append(OPtxt.replace(' ','')) 218 return SGText 219 235 for j,(M,T) in enumerate(SGData['SGOps']): 236 offset = [0,0,0] 237 Tprime = (mult*T)+cen 238 for i in range(3): 239 while Tprime[i] < 0: 240 Tprime[i] += 1 241 offset[i] += 1 242 while Tprime[i] >= 1: 243 Tprime[i] += -1 244 offset[i] += -1 245 OPtxt = MT2text(mult*M,Tprime) 246 SGTextList.append(OPtxt.replace(' ','')) 247 offsetList.append(tuple(offset)) 248 symOpList.append((mult*M,Tprime)) 249 G2oprList.append((cen,mult,j)) 250 return SGTextList,offsetList,symOpList,G2oprList 220 251 221 252 def MT2text(M,T): -
TabularUnified trunk/exports/G2cif.py ¶
r960 r963 6 6 import os.path 7 7 import GSASIIIO as G2IO 8 reload(G2IO)8 #reload(G2IO) 9 9 import GSASIIgrid as G2gd 10 10 import GSASIIstrIO as G2stIO … … 13 13 import GSASIIlattice as G2lat 14 14 import GSASIIspc as G2spg 15 reload(G2spg) 15 16 16 17 def getCallerDocString(): # for development … … 67 68 68 69 def WriteOverall(): 69 '''TODO: Write out overall refinement information 70 '''Write out overall refinement information. 71 72 More could be done here, but this is a good start. 70 73 ''' 71 74 WriteCIFitem('_pd_proc_info_datetime', self.CIFdate) … … 85 88 WriteCIFitem('_refine_ls_goodness_of_fit_all',GOF) 86 89 90 # get restraint info 91 # restraintDict = self.OverallParms.get('Restraints',{}) 92 # for i in self.OverallParms['Constraints']: 93 # print i 94 # for j in self.OverallParms['Constraints'][i]: 95 # print j 87 96 #WriteCIFitem('_refine_ls_number_restraints',TEXT) 88 97 … … 300 309 cia+1:'AUiso',cia+2:'AU11',cia+3:'AU22',cia+4:'AU33', 301 310 cia+5:'AU12',cia+6:'AU13',cia+7:'AU23'} 302 labellist = []311 self.labellist = [] 303 312 304 313 pfx = str(phasedict['pId'])+'::' … … 306 315 naniso = 0 307 316 for i,at in enumerate(Atoms): 308 s = PutInCol(MakeUniqueLabel(at[ct-1], labellist),6) # label317 s = PutInCol(MakeUniqueLabel(at[ct-1],self.labellist),6) # label 309 318 fval = self.parmDict.get(fpfx+str(i),at[cfrac]) 310 319 if fval == 0.0: continue # ignore any atoms that have a occupancy set to 0 (exact) … … 354 363 if fval == 0.0: continue # ignore any atoms that have a occupancy set to 0 (exact) 355 364 if at[cia] == 'I': continue 356 s = PutInCol( labellist[i],6) # label365 s = PutInCol(self.labellist[i],6) # label 357 366 for j in (2,3,4,5,6,7): 358 367 sigdig = -0.0009 … … 444 453 G2mth.ValEsd(cellmass/Z,-0.09,True)) 445 454 455 def WriteDistances(phasenam,SymOpList,offsetList,symOpList,G2oprList): 456 '''Report bond distances and angles for the CIF 457 458 Note that _geom_*_symmetry_* fields are values of form 459 n_klm where n is the symmetry operation in SymOpList (counted 460 starting with 1) and (k-5, l-5, m-5) are translations to add 461 to (x,y,z). See 462 http://www.iucr.org/__data/iucr/cifdic_html/1/cif_core.dic/Igeom_angle_site_symmetry_.html 463 464 TODO: need a method to select publication flags for distances/angles 465 ''' 466 phasedict = self.Phases[phasenam] # pointer to current phase info 467 Atoms = phasedict['Atoms'] 468 cx,ct,cs,cia = phasedict['General']['AtomPtrs'] 469 fpfx = str(phasedict['pId'])+'::Afrac:' 470 cfrac = cx+3 471 # loop over interatomic distances for this phase 472 WriteCIFitem('\n# MOLECULAR GEOMETRY') 473 WriteCIFitem('loop_' + 474 '\n\t_geom_bond_atom_site_label_1' + 475 '\n\t_geom_bond_atom_site_label_2' + 476 '\n\t_geom_bond_distance' + 477 '\n\t_geom_bond_site_symmetry_1' + 478 '\n\t_geom_bond_site_symmetry_2' + 479 '\n\t_geom_bond_publ_flag') 480 481 # Note that labels should be read from self.labellist to correspond 482 # to the values reported in the atoms table and zero occupancy atoms 483 # should not be included 484 fpfx = str(phasedict['pId'])+'::Afrac:' 485 for i,at in enumerate(Atoms): 486 if self.parmDict.get(fpfx+str(i),at[cfrac]) == 0.0: continue 487 lbl = self.labellist[i] 488 489 490 # loop over interatomic angles for this phase 491 WriteCIFitem('loop_' + 492 '\n\t_geom_angle_atom_site_label_1' + 493 '\n\t_geom_angle_atom_site_label_2' + 494 '\n\t_geom_angle_atom_site_label_3' + 495 '\n\t_geom_angle' + 496 '\n\t_geom_angle_site_symmetry_1' + 497 '\n\t_geom_angle_site_symmetry_2' + 498 '\n\t_geom_angle_site_symmetry_3' + 499 '\n\t_geom_angle_publ_flag') 500 501 446 502 def WritePhaseInfo(phasenam): 447 # see writepha.for 448 print 'TODO: phase info for',phasenam,'goes here' 449 # THINK: how to select publication flags for distances/angles? 503 WriteCIFitem('\n# phase info for '+str(phasenam) + ' follows') 450 504 phasedict = self.Phases[phasenam] # pointer to current phase info 451 505 WriteCIFitem('_pd_phase_name', phasenam) … … 478 532 479 533 # generate symmetry operations including centering and center of symmetry 480 WriteCIFitem('loop_ _symmetry_equiv_pos_site_id _symmetry_equiv_pos_as_xyz') 481 for i,op in enumerate(G2spg.AllOps(phasedict['General']['SGData']),start=1): 534 SymOpList,offsetList,symOpList,G2oprList = G2spg.AllOps( 535 phasedict['General']['SGData']) 536 WriteCIFitem('loop_ _space_group_symop_id _space_group_symop_operation_xyz') 537 for i,op in enumerate(SymOpList,start=1): 482 538 WriteCIFitem(' {:3d} {:}'.format(i,op.lower())) 483 539 … … 512 568 # report cell contents 513 569 WriteComposition(phasenam) 514 # if not self.quickmode: 515 # report distances and angles 516 # WriteDistances(phasenam) 570 if not self.quickmode: # report distances and angles 571 WriteDistances(phasenam,SymOpList,offsetList,symOpList,G2oprList) 517 572 518 573 #raise Exception,'Testing' 519 520 #C now loop over interatomic distances for this phase521 WriteCIFitem('\n# MOLECULAR GEOMETRY')522 WriteCIFitem('loop_' +523 '\n\t_geom_bond_atom_site_label_1' +524 '\n\t_geom_bond_atom_site_label_2' +525 '\n\t_geom_bond_distance' +526 '\n\t_geom_bond_site_symmetry_1' +527 '\n\t_geom_bond_site_symmetry_2' +528 '\n\t_geom_bond_publ_flag')529 530 #C now loop over interatomic angles for this phase531 WriteCIFitem('loop_' +532 '\n\t_geom_angle_atom_site_label_1' +533 '\n\t_geom_angle_atom_site_label_2' +534 '\n\t_geom_angle_atom_site_label_3' +535 '\n\t_geom_angle' +536 '\n\t_geom_angle_site_symmetry_1' +537 '\n\t_geom_angle_site_symmetry_2' +538 '\n\t_geom_angle_site_symmetry_3' +539 '\n\t_geom_angle_publ_flag')540 574 541 575 def WritePowderData(histlbl): … … 968 1002 WriteSingleXtalData(key1) 969 1003 970 # TODO: how to report _pd_proc_ls_peak_cutoff?971 1004 WriteCIFitem('#--' + 15*'eof--' + '#') 972 1005
Note: See TracChangeset
for help on using the changeset viewer.