Changeset 2473
- Timestamp:
- Sep 20, 2016 1:58:10 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIElem.py
r1589 r2473 55 55 for El in atomTypes: 56 56 FFs = GetFormFactorCoeff(getElSym(El)) 57 for item in FFs: 58 if item['Symbol'] == El.upper(): 59 FFtable[El] = item 60 return FFtable 61 62 def GetMFtable(atomTypes): 63 ''' returns a dictionary of magnetic form factor data for atom types found in atomTypes 64 65 :param list atomTypes: list of atom types 66 :return: FFtable, dictionary of form factor data; key is atom type 67 68 ''' 69 FFtable = {} 70 for El in atomTypes: 71 FFs = GetMagFormFacCoeff(getElSym(El)) 57 72 for item in FFs: 58 73 if item['Symbol'] == El.upper(): … … 266 281 267 282 def GetMagFormFacCoeff(El): 268 """Read magnetic form factor data from at omdata.asc file283 """Read magnetic form factor data from atmdata.py 269 284 270 285 :param El: 2 character element symbol … … 283 298 284 299 """ 300 Els = El.capitalize().strip() 285 301 MagFormFactors = [] 286 mags = [ky for ky in atmdata.MagFF.keys() if El == getElSym(ky)]302 mags = [ky for ky in atmdata.MagFF.keys() if Els == getElSym(ky)] 287 303 for mag in mags: 288 304 magData = {} 289 305 data = atmdata.MagFF[mag] 290 magData['Symbol'] = mag 291 magData['Z'] = atmdata.XrayFF[getElSym(mag s)]['Z']306 magData['Symbol'] = mag.upper() 307 magData['Z'] = atmdata.XrayFF[getElSym(mag)]['Z'] 292 308 magData['mfa'] = [data['M'][i] for i in [0,2,4,6]] 293 mag data['mfb'] = [data['M'][i] for i in [1,3,5,7]]294 mag data['mfc'] = data['M'][8]309 magData['mfb'] = [data['M'][i] for i in [1,3,5,7]] 310 magData['mfc'] = data['M'][8] 295 311 magData['nfa'] = [data['N'][i] for i in [0,2,4,6]] 296 magdata['nfb'] = [data['N'][i] for i in [1,3,5,7]] 297 magdata['nfc'] = data['N'][8] 298 magdata['g-fac'] = data['N'][9] 299 MagFormFactors.append(magdata) 312 magData['nfb'] = [data['N'][i] for i in [1,3,5,7]] 313 magData['nfc'] = data['N'][8] 314 MagFormFactors.append(magData) 300 315 return MagFormFactors 301 316 … … 311 326 t = -fb[:,np.newaxis]*SQ 312 327 return np.sum(fa[:,np.newaxis]*np.exp(t)[:],axis=0)+El['fc'] 328 329 def MagScatFac(El, SQ,gfac): 330 """compute value of form factor 331 332 :param El: element dictionary defined in GetFormFactorCoeff 333 :param SQ: (sin-theta/lambda)**2 334 :param gfac: Lande g factor (normally = 2.0) 335 :return: real part of form factor 336 """ 337 mfa = np.array(El['mfa']) 338 mfb = np.array(El['mfb']) 339 nfa = np.array(El['nfa']) 340 nfb = np.array(El['nfb']) 341 mt = -mfb[:,np.newaxis]*SQ 342 nt = -nfb[:,np.newaxis]*SQ 343 MMF = np.sum(mfa[:,np.newaxis]*np.exp(mt)[:],axis=0)+El['mfc'] 344 NMF = np.sum(nfa[:,np.newaxis]*np.exp(nt)[:],axis=0)+El['nfc'] 345 return MMF+(2.0/gfac-1.0)*NMF 313 346 314 347 def BlenResCW(Els,BLtables,wave): -
trunk/GSASIIconstrGUI.py
r2434 r2473 250 250 for item in phaseList: 251 251 Split = item.split(':') 252 if Split[2][:2] in ['AU','Af','dA' ]:252 if Split[2][:2] in ['AU','Af','dA','AM']: 253 253 Id = int(Split[0]) 254 254 phaseAtNames[item] = AtomDict[Id][int(Split[3])][0] … … 304 304 elif 'AU' in name: 305 305 namelist = ['AUiso','AU11','AU22','AU33','AU12','AU13','AU23'] 306 elif 'AM' in name: 307 namelist = ['AMx','AMy','AMz'] 306 308 elif 'Tm' in name: 307 309 namelist = ['Tmin','Tmax'] -
trunk/GSASIIlattice.py
r2470 r2473 231 231 def TransformPhase(oldPhase,newPhase,Trans,Vec): 232 232 '''Transform atoms from oldPhase to newPhase by Trans & Vec 233 NB: doesnt transform moments correctly - TBD 233 234 234 235 :param oldPhase: dict G2 phase info for old phase -
trunk/GSASIIobj.py
r2433 r2473 1288 1288 'Afrac': 'Atomic occupancy parameter', 1289 1289 'Amul': 'Atomic site multiplicity value', 1290 'AM([xyz])$' : 'Atomic magnetic moment parameter, \\1', 1290 1291 # Hist & Phase (HAP) vars (p:h:<var>) 1291 1292 'Back': 'Background term', -
trunk/GSASIIphsGUI.py
r2471 r2473 50 50 import GSASIIobj as G2obj 51 51 import GSASIIctrls as G2G 52 import atmdata 52 53 import numpy as np 53 54 import numpy.linalg as nl … … 245 246 generalData['AtomMass'] = [] 246 247 generalData['Color'] = [] 248 if generalData['Type'] == 'magnetic' and not 'Lande g' in generalData: 249 generalData['MagDmin'] = 1.0 250 generalData['Lande g'] = [] 247 251 generalData['Mydir'] = G2frame.dirname 248 252 badList = {} … … 250 254 atom[ct] = atom[ct].lower().capitalize() #force to standard form 251 255 if generalData['AtomTypes'].count(atom[ct]): 252 generalData['NoAtoms'][atom[ct]] += atom[c s-1]*float(atom[cs+1])256 generalData['NoAtoms'][atom[ct]] += atom[cx+3]*float(atom[cs+1]) 253 257 elif atom[ct] != 'UNK': 254 258 Info = G2elem.GetAtomInfo(atom[ct]) … … 277 281 generalData['Isotope'][atom[ct]] = isotope 278 282 generalData['AtomMass'].append(Info['Mass']) 279 generalData['NoAtoms'][atom[ct]] = atom[c s-1]*float(atom[cs+1])283 generalData['NoAtoms'][atom[ct]] = atom[cx+3]*float(atom[cs+1]) 280 284 generalData['Color'].append(Info['Color']) 285 if generalData['Type'] == 'magnetic': 286 generalData['MagDmin'] = generalData.get('MagDmin',1.0) 287 if atom[ct] in atmdata.MagFF: 288 generalData['Lande g'].append(2.0) 289 else: 290 generalData['Lande g'].append(None) 281 291 if badList: 282 292 msg = 'Warning: element symbol(s) not found:' … … 651 661 if denSizer[2]: 652 662 denSizer[2].SetValue('%.3f'%(mattCoeff)) 663 664 def OnGfacVal(event): 665 Obj = event.GetEventObject() 666 ig = Indx[Obj.GetId()] 667 try: 668 val = float(Obj.GetValue()) 669 if val < 1. or val > 2.0: 670 raise ValueError 671 except ValueError: 672 val = generalData['Lande g'][ig] 673 generalData['Lande g'][ig] = val 674 Obj.SetValue('%.2f'%(val)) 653 675 654 676 elemSizer = wx.FlexGridSizer(0,len(generalData['AtomTypes'])+1,1,1) … … 697 719 colorTxt.SetBackgroundColour(wx.Colour(R,G,B)) 698 720 elemSizer.Add(colorTxt,0,WACV) 699 721 if generalData['Type'] == 'magnetic': 722 elemSizer.Add(wx.StaticText(General,label=' Lande g factor: '),0,WACV) 723 for ig,gfac in enumerate(generalData['Lande g']): 724 if gfac == None: 725 elemSizer.Add((5,0),) 726 else: 727 gfacTxt = wx.TextCtrl(General,value='%.2f'%(gfac),style=wx.TE_PROCESS_ENTER) 728 Indx[gfacTxt.GetId()] = ig 729 gfacTxt.Bind(wx.EVT_TEXT_ENTER,OnGfacVal) 730 gfacTxt.Bind(wx.EVT_KILL_FOCUS,OnGfacVal) 731 elemSizer.Add(gfacTxt,0,WACV) 700 732 return elemSizer 701 733 … … 733 765 text,table = G2spc.SGPrint(SGData,AddInv=True) 734 766 text[0] = ' Magnetic Space Group: '+SGData['MagSpGrp'] 767 text[3] = ' The magnetic lattice point group is '+SGData['MagPtGp'] 735 768 G2gd.SGMagSpinBox(General,msg,text,table,OprNames,SpnFlp).Show() 769 770 def OnDminVal(event): 771 event.Skip() 772 try: 773 val = float(dminVal.GetValue()) 774 if val > 0.7: 775 generalData['MagDmin'] = val 776 except ValueError: 777 pass 778 dminVal.SetValue("%.4f"%(generalData['MagDmin'])) 736 779 737 780 SGData = generalData['SGData'] … … 740 783 magSizer = wx.BoxSizer(wx.VERTICAL) 741 784 magSizer.Add(wx.StaticText(General,label=' Magnetic spin operator selection:'),0,WACV) 742 magSizer.Add(wx.StaticText(General,label=' NB: UNDER CONSTRUCTION - LS NOT AVAILABLE'),0,WACV)785 magSizer.Add(wx.StaticText(General,label=' NB: UNDER CONSTRUCTION - LS NOT AVAILABLE'),0,WACV) 743 786 if not len(GenSym): 744 787 magSizer.Add(wx.StaticText(General,label=' No spin inversion allowed'),0,WACV) … … 748 791 spCode = {-1:'red',1:'black'} 749 792 for isym,sym in enumerate(GenSym): 750 spinSizer.Add(wx.StaticText(General,label=' %s: '%(sym.strip())),0,WACV)793 spinSizer.Add(wx.StaticText(General,label=' %s: '%(sym.strip())),0,WACV) 751 794 spinOp = wx.ComboBox(General,value=spCode[SGData['SGSpin'][isym]],choices=spinColor, 752 795 style=wx.CB_READONLY|wx.CB_DROPDOWN) … … 759 802 SGData['OprNames'] = OprNames 760 803 SGData['SpnFlp'] = SpnFlp 761 spinSizer.Add(wx.StaticText(General,label=' OGMagnetic space group: %s '%(MagSym)),0,WACV)804 spinSizer.Add(wx.StaticText(General,label=' Magnetic space group: %s '%(MagSym)),0,WACV) 762 805 showSpins = wx.CheckBox(General,label=' Show spins?') 763 806 showSpins.Bind(wx.EVT_CHECKBOX,OnShowSpins) 764 807 spinSizer.Add(showSpins,0,WACV) 765 808 magSizer.Add(spinSizer) 809 dminSizer = wx.BoxSizer(wx.HORIZONTAL) 810 dminSizer.Add(wx.StaticText(General,label=' Magnetic reflection d-min: '),0,WACV) 811 dminVal = wx.TextCtrl(General,value='%.4f'%(generalData['MagDmin']),style=wx.TE_PROCESS_ENTER) 812 dminVal.Bind(wx.EVT_TEXT_ENTER,OnDminVal) 813 dminVal.Bind(wx.EVT_KILL_FOCUS,OnDminVal) 814 dminSizer.Add(dminVal,0,WACV) 815 magSizer.Add(dminSizer,0,WACV) 766 816 return magSizer 767 817 … … 2211 2261 if indx: 2212 2262 generalData = data['General'] 2263 Amat,Bmat = G2lat.cell2AB(generalData['Cell'][1:7]) 2213 2264 SpnFlp = generalData['SGData'].get('SpnFlp',[]) 2214 2265 colLabels = [Atoms.GetColLabelValue(c) for c in range(Atoms.GetNumberCols())] … … 2252 2303 atom[cuij:cuij+6] = Uij 2253 2304 if cmx: 2254 atom[cmx:cmx+3] = np.inner(M,np.array(atom[cmx:cmx+3])) 2305 mom = np.inner(np.array(atom[cmx:cmx+3]),Bmat) 2306 atom[cmx:cmx+3] = np.inner(np.inner(mom,M),Amat) 2255 2307 if New: 2256 2308 atomData.append(atom) … … 4200 4252 atomData = data['Drawing']['Atoms'] 4201 4253 generalData = data['General'] 4254 Amat,Bmat = G2lat.cell2AB(generalData['Cell'][1:7]) 4202 4255 SGData = generalData['SGData'] 4203 4256 SpnFlp = SGData.get('SpnFlp',[]) … … 4227 4280 if cmx: 4228 4281 opNum = G2spc.GetOpNum(OprNum,SGData) 4229 atom[cmx:cmx+3] = np.inner(M,np.array(atom[cmx:cmx+3])) 4282 mom = np.inner(np.array(atom[cmx:cmx+3]),Bmat) 4283 atom[cmx:cmx+3] = np.inner(np.inner(mom,M),Amat) 4230 4284 if atom[cui] == 'A': 4231 4285 Uij = atom[cuij:cuij+6] … … 4276 4330 if cmx: 4277 4331 opNum = G2spc.GetOpNum(item[2],SGData) 4278 atom[cmx:cmx+3] = np.inner(M,np.array(atom[cmx:cmx+3])) 4332 mom = np.inner(np.array(atom[cmx:cmx+3]),Bmat) 4333 atom[cmx:cmx+3] = np.inner(np.inner(mom,M),Amat) 4279 4334 atom[cs-1] = str(item[2])+'+' 4280 4335 atom[cuij:cuij+6] = item[1] … … 4307 4362 atomData = data['Drawing']['Atoms'] 4308 4363 generalData = data['General'] 4364 Amat,Bmat = G2lat.cell2AB(generalData['Cell'][1:7]) 4309 4365 SGData = generalData['SGData'] 4310 4366 SpnFlp = SGData.get('SpnFlp',[]) … … 4330 4386 if cmx: 4331 4387 opNum = G2spc.GetOpNum(OprNum,SGData) 4332 atom[cmx:cmx+3] = np.inner(M,np.array(atom[cmx:cmx+3])) 4388 mom = np.inner(np.array(atom[cmx:cmx+3]),Bmat) 4389 atom[cmx:cmx+3] = np.inner(np.inner(mom,M),Amat) 4333 4390 atomOp = atom[cs-1] 4334 4391 newOp = str(((Opr+1)+100*Cent)*(1-2*Inv))+'+'+ \ … … 4397 4454 if cmx: 4398 4455 opNum = G2spc.GetOpNum(OpN,SGData) 4399 newAtom[cmx:cmx+3] = np.inner(M,np.array(newAtom[cmx:cmx+3])) 4456 mom = np.inner(np.array(newAtom[cmx:cmx+3]),Bmat) 4457 newAtom[cmx:cmx+3] = np.inner(np.inner(mom,M),Amat) 4400 4458 atomData.append(newAtom[:cij+9]) #not SS stuff 4401 4459 finally: … … 4418 4476 cuij = cui+2 4419 4477 generalData = data['General'] 4478 Amat,Bmat = G2lat.cell2AB(generalData['Cell'][1:7]) 4420 4479 SGData = generalData['SGData'] 4421 4480 SpnFlp = SGData.get('SpnFlp',[]) … … 4435 4494 if cmx: 4436 4495 opNum = G2spc.GetOpNum(item[2],SGData) 4437 atom[cmx:cmx+3] = np.inner(SGData['SGOps'],np.array(atom[cmx:cmx+3])) 4496 mom = np.inner(np.array(atom[cmx:cmx+3]),Bmat) 4497 atom[cmx:cmx+3] = np.inner(np.inner(mom,M),Amat) 4438 4498 atom[cs-1] = str(item[2])+'+' \ 4439 4499 +str(item[3][0])+','+str(item[3][1])+','+str(item[3][2]) … … 4457 4517 if cmx: 4458 4518 opNum = G2spc.GetOpNum(item[1],SGData) 4459 atom[cmx:cmx+3] = np.inner(np.array(atom[cmx:cmx+3]),M) 4519 mom = np.inner(np.array(atom[cmx:cmx+3]),Bmat) 4520 atom[cmx:cmx+3] = np.inner(np.inner(mom,M),Amat) 4460 4521 atom[cs-1] = str(item[1])+'+' \ 4461 4522 +str(item[2][0])+','+str(item[2][1])+','+str(item[2][2]) -
trunk/GSASIIpwd.py
r2419 r2473 1758 1758 YI += (Icoef[1]*Eterm/x**5) 1759 1759 if 'Exponential' in Itype: 1760 for i in range(3,1 2,2):1760 for i in range(3,11,2): 1761 1761 Eterm = np.exp(-Icoef[i+1]*x**((i+1)/2)) 1762 1762 YI += Icoef[i]*Eterm -
trunk/GSASIIspc.py
r2470 r2473 719 719 GenSym = SGData['GenSym'] 720 720 if not len(SpnFlp): 721 SGLaue['MagPtGp'] = SGLaue 721 722 return SGData['SpGrp'] 722 723 magSym = SGData['SpGrp'].split() 723 724 if len(SpnFlp) == 1: #ok 725 SGData['MagPtGp'] = SGLaue 724 726 if SpnFlp[-1] == -1: 725 727 magSym[1] += "'" 728 SGData['MagPtGp'] += "'" 726 729 return ' '.join(magSym) 727 730 if SGLaue in ['mmm',]: 731 SGData['MagPtGp'] = '' 728 732 for i in [0,1,2]: 733 SGData['MagPtGp'] += 'm' 729 734 if SpnFlp[i] < 0: 730 735 magSym[i+1] += "'" 736 SGData['MagPtGp'] += "'" 731 737 if len(GenSym) > 3: 732 738 if magSym[0] == 'F': … … 743 749 elif SGLaue == '6/mmm': #ok 744 750 if len(GenSym) == 2: 751 magPtGp = ['6','m','m'] 745 752 for i in [0,1]: 746 753 if SpnFlp[i] < 0: 747 754 magSym[i+2] += "'" 755 magPtGp[i+1] += "'" 748 756 if SpnFlp[0]*SpnFlp[1] < 0: 749 757 magSym[1] += "'" 758 magPtGp[0] += "'" 750 759 else: 751 760 sym = magSym[1].split('/') 761 Ptsym = ['6','m'] 762 magPtGp = ['','m','m'] 752 763 for i in [0,1,2]: 753 764 if SpnFlp[i] < 0: 754 765 if i: 755 766 magSym[i+1] += "'" 767 magPtGp[i] += "'" 756 768 else: 757 769 sym[1] += "'" 770 Ptsym[0] += "'" 758 771 if SpnFlp[1]*SpnFlp[2] < 0: 759 772 sym[0] += "'" 773 Ptsym[0] += "'" 760 774 magSym[1] = '/'.join(sym) 775 magPtGp[0] = '/'.join(Ptsym) 776 SGData['MagPtGp'] = ''.join(magPtGp) 761 777 elif SGLaue == '4/mmm': 762 778 if len(GenSym) == 2: 779 magPtGp = ['4','m','m'] 763 780 for i in [0,1]: 764 781 if SpnFlp[i] < 0: 765 782 magSym[i+2] += "'" 783 magPtGp[i+1] += "'" 766 784 if SpnFlp[0]*SpnFlp[1] < 0: 767 785 magSym[1] += "'" 786 magPtGp[0] += "'" 768 787 else: 769 788 if '/' in magSym[1]: #P 4/m m m, etc. 770 789 sym = magSym[1].split('/') 790 Ptsym = ['4','m'] 791 magPtGp = ['','m','m'] 771 792 for i in [0,1,2]: 772 793 if SpnFlp[i] < 0: 773 794 if i: 774 795 magSym[i+1] += "'" 796 magPtGp[i] += "'" 775 797 else: 776 798 sym[1] += "'" 799 Ptsym[1] += "'" 777 800 if SpnFlp[1]*SpnFlp[2] < 0: 778 801 sym[0] += "'" 802 Ptsym[0] += "'" 779 803 magSym[1] = '/'.join(sym) 804 magPtGp[0] = '/'.join(Ptsym) 780 805 if SpnFlp[3] < 0: 781 806 magSym[0] += '(P)' … … 788 813 if SpnFlp[2] < 0: 789 814 magSym[0] += '(P)' 815 SGData['MagPtGp'] = ''.join(magPtGp) 790 816 elif SGLaue in ['2/m','4/m','6/m']: #all ok 791 817 Uniq = {'a':1,'b':2,'c':3,'':1} … … 794 820 id = [0,Uniq[SGData['SGUniq']]] 795 821 sym = magSym[id[1]].split('/') 822 Ptsym = SGLaue.split('/') 796 823 if len(GenSym) == 3: 797 824 for i in [0,1,2]: … … 801 828 else: 802 829 sym[i] += "'" 830 Ptsym[i] += "'" 803 831 else: 804 832 for i in [0,1]: … … 808 836 else: 809 837 sym[i] += "'" 838 Ptsym[i] += "'" 839 SGData['MagPtGp'] = '/'.join(Ptsym) 810 840 magSym[id[1]] = '/'.join(sym) 811 841 elif SGLaue in ['3','3m1','31m']: #ok 812 842 # GSASIIpath.IPyBreak() 813 magSym[0] = magSym[0].split('(')[0]843 Ptsym = list(SGLaue) 814 844 if len(GenSym) == 1: #all ok 815 845 id = 2 … … 821 851 if SpnFlp[0] < 0: 822 852 magSym[id] += "'" 853 Ptsym[id-1] += "'" 823 854 elif len(GenSym) == 2: 824 855 if 'R' in GenSym[1]: … … 826 857 if SpnFlp[0] < 0: 827 858 magSym[-1] += "'" 859 Ptsym[-1] += "'" 828 860 else: 829 861 i,j = [1,2] … … 831 863 i,j = [1,3] 832 864 magSym[i].strip("'") 865 Ptsym[i-1].strip("'") 833 866 magSym[j].strip("'") 867 Ptsym[j-1].strip("'") 834 868 if SpnFlp[:2] == [1,-1]: 835 869 magSym[i] += "'" 870 Ptsym[i-1] += "'" 836 871 elif SpnFlp[:2] == [-1,-1]: 837 872 magSym[j] += "'" 873 Ptsym[j-1] += "'" 838 874 elif SpnFlp[:2] == [-1,1]: 839 875 magSym[i] += "'" 876 Ptsym[i-1] += "'" 840 877 magSym[j] += "'" 878 Ptsym[j-1] += "'" 841 879 else: 842 880 if 'c' not in magSym[2]: 843 881 i,j = [1,2] 844 882 magSym[i].strip("'") 883 Ptsym[i-1].strip("'") 845 884 magSym[j].strip("'") 885 Ptsym[j-1].strip("'") 846 886 if SpnFlp[:2] == [1,-1]: 847 887 magSym[i] += "'" 888 Ptsym[i-1] += "'" 848 889 elif SpnFlp[:2] == [-1,-1]: 849 890 magSym[j] += "'" 891 Ptsym[j-1] += "'" 850 892 elif SpnFlp[:2] == [-1,1]: 851 893 magSym[i] += "'" 894 Ptsym[i-1] += "'" 852 895 magSym[j] += "'" 896 Ptsym[j-1] += "'" 897 SGData['MagPtGp'] = ''.join(Ptsym) 853 898 elif SGData['SGPtGrp'] == '23' and len(magSym): 899 SGData['MagPtGp'] = '23' 854 900 if SpnFlp[0] < 0: 855 901 magSym[0] += '(P)' 856 902 elif SGData['SGPtGrp'] == 'm3': 903 SGData['MagPtGp'] = "m3" 857 904 if SpnFlp[0] < 0: 858 905 magSym[1] += "'" 859 906 magSym[2] += "'" 907 SGData['MagPtGp'] = "m'3'" 860 908 if SpnFlp[1] < 0: 861 909 magSym[0] += '(P)' 862 if not 'm' in magSym[1]: 910 if not 'm' in magSym[1]: #only Ia3 863 911 magSym[1].strip("'") 912 SGData['MagPtGp'] = "m3'" 864 913 elif SGData['SGPtGrp'] in ['432','-43m']: 914 Ptsym = SGData['SGPtGrp'].split('3') 865 915 if SpnFlp[0] < 0: 866 916 magSym[1] += "'" 917 Ptsym[0] += "'" 867 918 magSym[3] += "'" 919 Ptsym[1] += "'" 868 920 if SpnFlp[1] < 0: 869 921 magSym[0] += '(P)' 922 SGData['MagPtGp'] = '3'.join(Ptsym) 870 923 elif SGData['SGPtGrp'] == 'm-3m': 924 Ptsym = ['m','3','m'] 871 925 if SpnFlp[:2] == [-1,1]: 872 926 magSym[1] += "'" 927 Ptsym[0] += "'" 873 928 magSym[2] += "'" 929 Ptsym[1] += "'" 874 930 elif SpnFlp[:2] == [1,-1]: 875 931 magSym[3] += "'" 932 Ptsym[2] += "'" 876 933 elif SpnFlp[:2] == [-1,-1]: 877 934 magSym[1] += "'" 935 Ptsym[0] += "'" 878 936 magSym[2] += "'" 937 Ptsym[1] += "'" 879 938 magSym[3] += "'" 939 Ptsym[2] += "'" 880 940 if SpnFlp[2] < 0: 881 941 magSym[0] += '(P)' 942 SGData['MagPtGp'] = ''.join(Ptsym) 882 943 # print SpnFlp 883 944 return ' '.join(magSym) -
trunk/GSASIIstrIO.py
r2450 r2473 808 808 print >>pFile,' %8s %9.5f %9.5f %9.5f %9.5f %9.5f %9.5f %9.5f %9.5f %9.5f' % \ 809 809 (Ename.ljust(8),fa[0],fa[1],fa[2],fa[3],fb[0],fb[1],fb[2],fb[3],ffdata['fc']) 810 811 def PrintMFtable(MFtable): 812 print >>pFile,'\n <j0> Magnetic scattering factors:' 813 print >>pFile,' Symbol mfa mfb mfc' 814 print >>pFile,99*'-' 815 for Ename in MFtable: 816 mfdata = MFtable[Ename] 817 fa = mfdata['mfa'] 818 fb = mfdata['mfb'] 819 print >>pFile,' %8s %9.5f %9.5f %9.5f %9.5f %9.5f %9.5f %9.5f %9.5f %9.5f' % \ 820 (Ename.ljust(8),fa[0],fa[1],fa[2],fa[3],fb[0],fb[1],fb[2],fb[3],mfdata['mfc']) 821 print >>pFile,'\n <j2> Magnetic scattering factors:' 822 print >>pFile,' Symbol nfa nfb nfc' 823 print >>pFile,99*'-' 824 for Ename in MFtable: 825 mfdata = MFtable[Ename] 826 fa = mfdata['nfa'] 827 fb = mfdata['nfb'] 828 print >>pFile,' %8s %9.5f %9.5f %9.5f %9.5f %9.5f %9.5f %9.5f %9.5f %9.5f' % \ 829 (Ename.ljust(8),fa[0],fa[1],fa[2],fa[3],fb[0],fb[1],fb[2],fb[3],mfdata['nfc']) 810 830 811 831 def PrintBLtable(BLtable): … … 915 935 print >>pFile,line 916 936 937 def PrintMoments(General,Atoms): 938 cx,ct,cs,cia = General['AtomPtrs'] 939 cmx = cx+4 940 print >>pFile,'\n Magnetic moments:' 941 line = ' name type refine? Mx My Mz ' 942 print >>pFile,line 943 print >>pFile,135*'-' 944 for i,at in enumerate(Atoms): 945 line = '%7s'%(at[ct-1])+'%7s'%(at[ct])+'%7s'%(at[ct+1])+'%10.5f'%(at[cmx])+'%10.5f'%(at[cmx+1])+ \ 946 '%10.5f'%(at[cmx+2]) 947 print >>pFile,line 948 949 917 950 def PrintWaves(General,Atoms): 918 951 cx,ct,cs,cia = General['AtomPtrs'] … … 1045 1078 pawleyLookup = {} 1046 1079 FFtables = {} #scattering factors - xrays 1080 MFtables = {} #Mag. form factors 1047 1081 BLtables = {} # neutrons 1048 1082 Natoms = {} … … 1061 1095 FFtables.update(FFtable) 1062 1096 BLtables.update(BLtable) 1097 if General['Type'] == 'magnetic': 1098 MFtable = G2el.GetMFtable(General['AtomTypes']) 1099 MFtables.update(MFtable) 1063 1100 Atoms = PhaseData[name]['Atoms'] 1064 1101 if Atoms and not General.get('doPawley'): … … 1115 1152 phaseDict.update({pfx+'AU11:'+str(i):at[cia+2],pfx+'AU22:'+str(i):at[cia+3],pfx+'AU33:'+str(i):at[cia+4], 1116 1153 pfx+'AU12:'+str(i):at[cia+5],pfx+'AU13:'+str(i):at[cia+6],pfx+'AU23:'+str(i):at[cia+7]}) 1154 if General['Type'] == 'magnetic': 1155 phaseDict.update({pfx+'AMx:'+str(i):at[cx+4],pfx+'AMy:'+str(i):at[cx+5],pfx+'AMz:'+str(i):at[cx+6]}) 1117 1156 if 'F' in at[ct+1]: 1118 1157 phaseVary.append(pfx+'Afrac:'+str(i)) … … 1163 1202 eqv[1] /= coef 1164 1203 G2mv.StoreEquivalence(name,equiv[1:]) 1204 if 'M' in at[ct+1]: 1205 pass #magnetic moment vary here 1165 1206 if General.get('Modulated',False): 1166 1207 AtomSS = at[-1]['SS1'] … … 1235 1276 PrintFFtable(FFtable) 1236 1277 PrintBLtable(BLtable) 1278 if General['Type'] == 'magnetic': 1279 PrintMFtable(MFtable) 1237 1280 print >>pFile,'' 1281 #how do we print magnetic symmetry table? TBD 1238 1282 if len(SSGtext): #if superstructure 1239 1283 for line in SSGtext: print >>pFile,line … … 1254 1298 PrintRBObjects(resRBData,vecRBData) 1255 1299 PrintAtoms(General,Atoms) 1300 if General['Type'] == 'magnetic': 1301 PrintMoments(General,Atoms) 1256 1302 if General.get('Modulated',False): 1257 1303 PrintWaves(General,Atoms) … … 1530 1576 print >>pFile,'\n Atoms:' 1531 1577 line = ' name x y z frac Uiso U11 U22 U33 U12 U13 U23' 1532 if General['Type'] == 'magnetic': 1533 line = line[:24]+' Mx My Mz'+line[24:] 1534 elif General['Type'] == 'macromolecular': 1578 if General['Type'] == 'macromolecular': 1535 1579 line = ' res no residue chain '+line 1536 1580 cx,ct,cs,cia = General['AtomPtrs'] … … 1575 1619 else: 1576 1620 sigstr += 8*' ' 1621 print >>pFile,name 1622 print >>pFile,valstr 1623 print >>pFile,sigstr 1624 1625 def PrintMomentsAndSig(General,Atoms,atomsSig): 1626 print >>pFile,'\n Magnetic Moments:' #add magnitude & angle, etc.? TBD 1627 line = ' name Mx My Mz' 1628 cx,ct,cs,cia = General['AtomPtrs'] 1629 cmx = cx+4 1630 print >>pFile,line 1631 print >>pFile,135*'-' 1632 fmt = {0:'%7s',ct:'%7s',cmx:'%10.5f',cmx+1:'%10.5f',cmx+2:'%10.5f'} 1633 noFXsig = {cmx:[10*' ','%10s'],cmx+1:[10*' ','%10s'],cmx+2:[10*' ','%10s']} 1634 for i,at in enumerate(Atoms): 1635 name = fmt[0]%(at[ct-1])+fmt[1]%(at[ct])+':' 1636 valstr = ' values:' 1637 sigstr = ' sig :' 1638 for ind in range(cmx,cmx+3): 1639 sigind = str(i)+':'+str(ind) 1640 valstr += fmt[ind]%(at[ind]) 1641 if sigind in atomsSig: 1642 sigstr += fmt[ind]%(atomsSig[sigind]) 1643 else: 1644 sigstr += noFXsig[ind][1]%(noFXsig[ind][0]) 1577 1645 print >>pFile,name 1578 1646 print >>pFile,valstr … … 1946 2014 1947 2015 PrintAtomsAndSig(General,Atoms,atomsSig) 2016 if General['Type'] == 'magnetic': 2017 PrintMomentsAndSig(General,Atoms,atomsSig) 1948 2018 if General.get('Modulated',False): 1949 2019 PrintWavesAndSig(General,Atoms,wavesSig) … … 2111 2181 elif 'T' in inst['Type'][0]: 2112 2182 dmin = limits[0]/inst['difC'][1] 2183 if Phases[phase]['General']['Type'] == 'magnetic': 2184 dmin = max(dmin,Phases[phase]['General']['MagDmin']) 2113 2185 pfx = str(pId)+':'+str(hId)+':' 2114 2186 for item in ['Scale','Extinction']: -
trunk/imports/G2phase.py
r2470 r2473 240 240 elif NPhas[result] in ['2','3']: 241 241 Ptype = 'magnetic' 242 MagDmin = 1.0 242 243 elif NPhas[result] == '4': 243 244 Ptype = 'macromolecular' … … 261 262 self.warnings += "Change this in phase's General tab." 262 263 elif 'SPNFLP' in key: 263 SpnFlp = [int(s) for s in EXPphase[key].split()] 264 SpnFlp = [int(s) for s in EXPphase[key].split()] 265 if SGData['SpGrp'][0] in ['A','B','C','I','R','F']: 266 SpnFlp += [1,1,1,1] 267 elif 'MXDSTR' in key: 268 MagDmin = float(EXPphase[key][:10]) 264 269 elif 'OD ' in key: 265 270 SHdata = EXPphase[key].split() # may not have all 9 values … … 343 348 elif general['Type'] =='magnetic': 344 349 general['AtomPtrs'] = [3,1,10,12] 345 general['SGData']['SGSpin'] = SpnFlp 350 general['SGData']['SGSpin'] = SpnFlp 351 general['MagDmin'] = MagDmin 346 352 else: #nuclear 347 353 general['AtomPtrs'] = [3,1,7,9]
Note: See TracChangeset
for help on using the changeset viewer.