Changeset 963 for trunk/exports/G2cif.py
- Timestamp:
- Jun 20, 2013 5:07:33 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.