Changeset 5081
- Timestamp:
- Nov 13, 2021 4:58:43 PM (7 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/exports/G2export_CIF.py
r5080 r5081 734 734 RBparms={}): 735 735 'Write atom positions to CIF using mmCIF items' 736 AA3letter = ['ALA','ARG','ASN','ASP','CYS','GLN','GLU','GLY','HIS','ILE', 737 'LEU','LYS','MET','PHE','PRO','SER','THR','TRP','TYR','VAL','MSE'] 736 738 # phasedict = self.Phases[phasenam] # pointer to current phase info 737 739 General = phasedict['General'] 738 740 cx,ct,cs,cia = General['AtomPtrs'] 739 GS = G2lat.cell2GS(General['Cell'][1:7])741 #GS = G2lat.cell2GS(General['Cell'][1:7]) 740 742 Amat = G2lat.cell2AB(General['Cell'][1:7])[0] 741 743 Atoms = phasedict['Atoms'] … … 752 754 WriteCIFitem(fp, '\n# ATOMIC COORDINATES AND DISPLACEMENT PARAMETERS') 753 755 WriteCIFitem(fp, 'loop_ '+ 756 '\n _atom_site.group_PDB'+ 754 757 '\n _atom_site.id'+ 755 758 '\n _atom_site.type_symbol'+ … … 766 769 '\n _atom_site.pdbx_PDB_ins_code'+ 767 770 '\n _atom_site.pdbx_formal_charge'+ 771 '\n _atom_site.pdbx_PDB_model_num' 768 772 '\n _atom_site.fract_x'+ 769 773 '\n _atom_site.fract_y'+ 770 774 '\n _atom_site.fract_z'+ 771 775 '\n _atom_site.occupancy'+ 772 '\n _atom_site.U_iso_or_equiv' 776 '\n _atom_site.U_iso_or_equiv'+ 777 '\n _atom_site.Cartn_x'+ 778 '\n _atom_site.Cartn_y'+ 779 '\n _atom_site.Cartn_z' 773 780 ) 774 781 775 # _atom_site.group_PDB776 # _atom_site.Cartn_x777 # _atom_site.Cartn_y778 # _atom_site.Cartn_z779 782 # _atom_site.Cartn_x_esd 780 783 # _atom_site.Cartn_y_esd 781 784 # _atom_site.Cartn_z_esd 782 785 # _atom_site.occupancy_esd 783 # _atom_site.pdbx_PDB_model_num786 # 784 787 785 788 varnames = {cx:'Ax',cx+1:'Ay',cx+2:'Az',cx+3:'Afrac', … … 789 792 pfx = str(phasedict['pId'])+'::' 790 793 # loop over all atoms 791 naniso = 0794 # naniso = 0 792 795 for i,at in enumerate(Atoms): 793 s = '' 794 s += PutInCol(str(i),5) # atom number 796 if at[ct-3] in AA3letter: 797 s = 'ATOM ' 798 else: 799 s = 'HETATM ' 800 s += PutInCol(str(i+1),5) # atom number 795 801 s += PutInCol(FmtAtomType(at[ct]),4) # type 796 802 s += PutInCol(at[ct-1],4) # _atom_id … … 806 812 s += PutInCol('?',2) # pdbx_PDB_ins_code 807 813 s += PutInCol('?',2) # pdbx_formal_charge 814 s += PutInCol('1',2) # pdbx_PDB_model_num 815 808 816 fval = parmDict.get(fpfx+str(i),at[cfrac]) 809 817 if fval == 0.0: continue # ignore any atoms that have a occupancy set to 0 (exact) 810 if at[cia] == 'I':811 adp = 'Uiso '812 else:813 adp = 'Uani '814 naniso += 1815 t = G2lat.Uij2Ueqv(at[cia+2:cia+8],GS,Amat)[0]816 for j in (2,3,4):817 var = pfx+varnames[cia+j]+":"+str(i)818 # if at[cia] == 'I': 819 # adp = 'Uiso ' 820 # else: 821 # adp = 'Uani ' 822 # naniso += 1 823 # t = G2lat.Uij2Ueqv(at[cia+2:cia+8],GS,Amat)[0] 824 # for j in (2,3,4): 825 # var = pfx+varnames[cia+j]+":"+str(i) 818 826 for j in (cx,cx+1,cx+2,cx+3,cia+1): 819 827 if j in (cx,cx+1,cx+2): … … 833 841 sig = -abs(sig) 834 842 s += PutInCol(G2mth.ValEsd(val,sig),dig) 843 # Cartesian coordinates 844 for xyz in np.inner(Amat,at[cx:cx+3]): 845 s += PutInCol(G2mth.ValEsd(xyz,-0.009),8) 835 846 WriteCIFitem(fp, s) 836 847 # save information about rigid bodies … … 2538 2549 WriteCIFitem(self.fp, '\n# phase info for '+str(phasenam) + ' follows') 2539 2550 phasedict = self.Phases[phasenam] # pointer to current phase info 2540 WriteCIFitem(self.fp, '_ pd_phase_name', phasenam)2551 WriteCIFitem(self.fp, '_cell.entry_id', phasenam) 2541 2552 cellList,cellSig = self.GetCell(phasenam) 2542 2553 if oneblock: … … 2636 2647 # report cell contents 2637 2648 WriteCompositionMM(self.fp, self.Phases[phasenam], phasenam, self.parmDict, self.quickmode, keV) 2638 if not self.quickmode and phasedict['General']['Type'] == 'nuclear': # report distances and angles2639 WriteDistances(phasenam)2649 #if not self.quickmode and phasedict['General']['Type'] == 'nuclear': # report distances and angles 2650 # WriteDistances(phasenam) 2640 2651 if 'Map' in phasedict['General'] and 'minmax' in phasedict['General']['Map']: 2641 2652 WriteCIFitem(self.fp, '\n# Difference density results') 2642 2653 MinMax = phasedict['General']['Map']['minmax'] 2643 WriteCIFitem(self.fp, '_refine _diff_density_max',G2mth.ValEsd(MinMax[0],-0.009))2644 WriteCIFitem(self.fp, '_refine _diff_density_min',G2mth.ValEsd(MinMax[1],-0.009))2654 WriteCIFitem(self.fp, '_refine.diff_density_max',G2mth.ValEsd(MinMax[0],-0.009)) 2655 WriteCIFitem(self.fp, '_refine.diff_density_min',G2mth.ValEsd(MinMax[1],-0.009)) 2645 2656 2646 2657 def Yfmt(ndec,val):
Note: See TracChangeset
for help on using the changeset viewer.