Changeset 5083
- Timestamp:
- Nov 14, 2021 10:35:51 AM (6 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/imports/G2phase_CIF.py
r5070 r5083 785 785 raise Exception("Rank of _iso_displacivemode != _iso_deltacoordinate") 786 786 787 # normalization constants 788 normlist = [] 789 idlist = [] 790 for id,exp in zip( 791 blk.get('_iso_displacivemodenorm_ID'), 792 blk.get('_iso_displacivemodenorm_value'), 793 ): 794 idlist.append(int(id)) 795 normlist.append(float(exp)) 796 normlist = [i for i,j in sorted(zip(normlist,idlist),key=lambda k:k[1])] 787 797 # get mapping of modes to atomic coordinate displacements 788 798 displacivemodematrix = np.zeros((len(G2varObj),len(G2varObj))) … … 797 807 modeVarList = [] 798 808 modeDispl = [] 799 for i, row in enumerate(Var2ModeMatrix):809 for i,(row,norm) in enumerate(zip(Var2ModeMatrix,normlist)): 800 810 constraint = [] 801 811 for j,(lbl,k) in enumerate(zip(coordVarLbl,row)): 802 812 if k == 0: continue 803 constraint.append([k ,G2varObj[j]])813 constraint.append([k/norm,G2varObj[j]]) 804 814 modeVar = G2obj.G2VarObj( 805 815 (self.Phase['ranId'],None,shortmodelist[i],None)) … … 808 818 self.Constraints.append(constraint) 809 819 modeDispl.append(0.0) 810 # normalization constants811 normlist = []812 idlist = []813 for id,exp in zip(814 blk.get('_iso_displacivemodenorm_ID'),815 blk.get('_iso_displacivemodenorm_value'),816 ):817 idlist.append(int(id))818 normlist.append(float(exp))819 normlist = [i for i,j in sorted(zip(normlist,idlist),key=lambda k:k[1])]820 820 #---------------------------------------------------------------------- 821 821 # save the ISODISTORT info for "mode analysis" … … 1005 1005 print('ISO modes from Iso coordinate vars (using Var2ModeMatrix, IsoVarList, G2VarList & G2ModeList)' ) 1006 1006 for i,row in enumerate(self.Phase['ISODISTORT']['Var2ModeMatrix']): 1007 head = ' ' + str(self.Phase['ISODISTORT']['G2ModeList'][i]) + ' = ' 1007 norm = self.Phase['ISODISTORT']['NormList'][i] 1008 head = ' ' + str(self.Phase['ISODISTORT']['G2ModeList'][i]) + ' = (' 1008 1009 line = '' 1009 1010 for j,(lbl,k) in enumerate(zip(coordVarLbl,row)): 1010 1011 var = self.Phase['ISODISTORT']['IsoVarList'][j] 1011 1012 head,line = fmtEqn(j,head,line,var,k) 1013 print(head+line+') / {:.3g}'.format(norm)) 1014 head = ' = ' 1015 line = '' 1016 for j,(lbl,k) in enumerate(zip(coordVarLbl,row)): 1017 var = self.Phase['ISODISTORT']['IsoVarList'][j] 1018 head,line = fmtEqn(j,head,line,var,k/norm) 1012 1019 print(head+line) 1013 1020 print('\nConstraints') … … 1040 1047 self.Phase['ISODISTORT']['NormList'])): 1041 1048 line = '' 1042 head = str(self.Phase['ISODISTORT']['G2ModeList'][i])+' = (' 1049 print(str(self.Phase['ISODISTORT']['IsoModeList'][i])+' = ') 1050 head = ' = (' 1043 1051 for j,(lbl,k) in enumerate(zip(coordVarLbl,row)): 1044 1052 head,line = fmtEqn(j,head,line,lbl,k) 1045 1053 print(head+line+') / '+('%.3f'%n)) 1046 1054 line = '' 1047 head = str(self.Phase['ISODISTORT']['G2ModeList'][i])+'= ('1055 head = ' = (' 1048 1056 vsum = 0. 1049 1057 for j,(lbl,k) in enumerate(zip(coordVarLbl,row)): … … 1054 1062 fileval = modeVarDelta[self.Phase['ISODISTORT']['IsoModeList'][i]] 1055 1063 print("{} = {:4g} (value read from CIF = {:4g})\n".format( 1056 self.Phase['ISODISTORT'][' G2ModeList'][i], vsum, fileval))1064 self.Phase['ISODISTORT']['IsoModeList'][i], vsum, fileval)) 1057 1065 1058 1066 print( 70*'=') … … 1079 1087 l1 += ' + ' 1080 1088 l += '{:} {:3g} * {:4g} * {:}'.format( 1081 l1, k1, n, self.Phase['ISODISTORT'][' G2ModeList'][j])1089 l1, k1, n, self.Phase['ISODISTORT']['IsoModeList'][j]) 1082 1090 1083 1091 s += n * modeVarDelta[self.Phase['ISODISTORT']['IsoModeList'][j]] * k … … 1124 1132 for mode,G2mode in zip(self.Phase['ISODISTORT']['IsoModeList'], 1125 1133 self.Phase['ISODISTORT']['G2ModeList']): 1126 print( " "+str(G2mode),' ==>', mode)1134 print('{} ==> {}'.format(str(G2mode), mode)) 1127 1135 print('\nConstraint help dict info') 1128 1136 for i in self.Constraints:
Note: See TracChangeset
for help on using the changeset viewer.