Changeset 4427
- Timestamp:
- May 20, 2020 7:33:57 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIphsGUI.py
r4425 r4427 4366 4366 atSeq = RMCPdict['atSeq'] 4367 4367 lenA = len(atSeq) 4368 for pair in [[' %s-%s'%(atSeq[i],atSeq[j]) for j in range(i,lenA) ] for i in range(lenA)]:4368 for pair in [[' %s-%s'%(atSeq[i],atSeq[j]) for j in range(i,lenA) if 'Va' not in atSeq[j]] for i in range(lenA) if 'Va' not in atSeq[i]]: 4369 4369 Pairs += pair 4370 4370 RMCPdict['Pairs'] = {pairs:[0.0,0.0,0.0] for pairs in Pairs} … … 4407 4407 for itype in range(nTypes): 4408 4408 atmChoice.Add(G2G.ValidatedTxtCtrl(G2frame.FRMC,RMCPdict['Oxid'][itype],1,min=0.),0,WACV) 4409 atmChoice.Add(wx.StaticText(G2frame.FRMC,label=' Set max shift: '),0,WACV) 4410 for iType in range(nTypes): 4411 atId = RMCPdict['atSeq'][iType] 4412 atmChoice.Add(G2G.ValidatedTxtCtrl(G2frame.FRMC,RMCPdict['aTypes'],atId,min=0.,max=1.),0,WACV) 4409 if G2frame.RMCchoice == 'RMCProfile': 4410 atmChoice.Add(wx.StaticText(G2frame.FRMC,label=' Set max shift: '),0,WACV) 4411 for iType in range(nTypes): 4412 atId = RMCPdict['atSeq'][iType] 4413 atmChoice.Add(G2G.ValidatedTxtCtrl(G2frame.FRMC,RMCPdict['aTypes'],atId,min=0.,max=1.),0,WACV) 4413 4414 return atmChoice 4414 4415 … … 4577 4578 corrChk.Bind(wx.EVT_CHECKBOX,OnCorrChk) 4578 4579 fileSizer.Add(corrChk,0,WACV) 4579 4580 4581 4582 4580 delBtn = wx.Button(G2frame.FRMC,label='Delete') 4581 delBtn.Bind(wx.EVT_BUTTON,OnDelBtn) 4582 Indx[delBtn.GetId()] = fil 4583 fileSizer.Add(delBtn,0,WACV) 4583 4584 else: 4584 4585 RMCPdict['files'][fil][0] = 'Select' … … 4630 4631 lenA = len(atSeq) 4631 4632 Pairs= [] 4632 for pair in [[' %s-%s'%(atSeq[i],atSeq[j]) for j in range(i,lenA) ] for i in range(lenA)]:4633 for pair in [[' %s-%s'%(atSeq[i],atSeq[j]) for j in range(i,lenA) if 'Va' not in atSeq[j]] for i in range(lenA) if 'Va' not in atSeq[i]]: 4633 4634 Pairs += pair 4634 4635 Pairs = {pairs:[0.0,0.0,0.0] for pairs in Pairs} … … 4715 4716 finally: 4716 4717 dlg.Destroy() 4718 wx.CallAfter(UpdateRMC) 4717 4719 4718 4720 def OnAddAngle(event): … … 4741 4743 4742 4744 Indx = {} 4743 atChoice = RMCPdict['atSeq']4745 atChoice = [atm for atm in RMCPdict['atSeq'] if 'Va' not in atm] 4744 4746 angleSizer = wx.FlexGridSizer(6,5,5) 4745 4747 fxcnLabels = [' ','Atom-A','Atom-B','Atom-C',' min angle',' max angle'] … … 4778 4780 4779 4781 Indx = {} 4782 atChoice = [atm for atm in RMCPdict['atSeq'] if 'Va' not in atm] 4780 4783 torsionSizer = wx.FlexGridSizer(11,5,5) 4781 4784 fxcnLabels = [' ','Atom-A','Atom-B','Atom-C','Atom-D',' min angle1',' max angle1',' min angle2',' max angle2',' min angle3',' max angle3'] … … 4788 4791 torsionSizer.Add(delBtn,0,WACV) 4789 4792 for i in [0,1,2,3]: 4790 atmSel = wx.ComboBox(G2frame.FRMC,choices=at Names,style=wx.CB_DROPDOWN|wx.TE_READONLY)4793 atmSel = wx.ComboBox(G2frame.FRMC,choices=atChoice,style=wx.CB_DROPDOWN|wx.TE_READONLY) 4791 4794 atmSel.SetStringSelection(torsion[i]) 4792 4795 atmSel.Bind(wx.EVT_COMBOBOX,OnTorsionAtSel) … … 4935 4938 lenA = len(atSeq) 4936 4939 Pairs= [] 4937 for pair in [[' %s-%s'%(atSeq[i],atSeq[j]) for j in range(i,lenA) ] for i in range(lenA)]:4940 for pair in [[' %s-%s'%(atSeq[i],atSeq[j]) for j in range(i,lenA) if 'Va' not in atSeq[j]] for i in range(lenA) if 'Va' not in atSeq[i]]: 4938 4941 Pairs += pair 4939 4942 Pairs = {pairs:[0.0,0.0,0.0] for pairs in Pairs} 4940 4943 BVSpairs = [] 4941 4944 if lenA > 1: 4942 for pair in [[' %s-%s'%(atSeq[i],atSeq[j]) for j in range(i+1,lenA)] for i in range(lenA)] :4945 for pair in [[' %s-%s'%(atSeq[i],atSeq[j]) for j in range(i+1,lenA)] for i in range(lenA)] and 'Va' not in pair: 4943 4946 BVSpairs += pair 4944 4947 BVS = {pairs:[0.0,0.0,0.0,0.0] for pairs in BVSpairs} … … 5077 5080 5078 5081 fxcnSizer = wx.FlexGridSizer(8,5,5) 5079 atChoice = RMCPdict['atSeq']5082 atChoice = [atm for atm in RMCPdict['atSeq'] if 'Va' not in atm] 5080 5083 fxcnLabels = [' ','Atom-1','Atom-2','min dist','max dist','CN','fraction','weight'] 5081 5084 for lab in fxcnLabels: … … 5113 5116 5114 5117 avcnSizer = wx.FlexGridSizer(7,5,5) 5115 atChoice = RMCPdict['atSeq']5118 atChoice = [atm for atm in RMCPdict['atSeq'] if 'Va' not in atm] 5116 5119 fxcnLabels = [' ','Atom-1','Atom-2','min dist','max dist','CN','weight'] 5117 5120 for lab in fxcnLabels: … … 5150 5153 RMCPdict['ReStart'][1] = True 5151 5154 5152 atChoice = RMCPdict['atSeq']5155 atChoice = [atm for atm in RMCPdict['atSeq'] if 'Va' not in atm] 5153 5156 angleSizer = wx.FlexGridSizer(8,5,5) 5154 5157 fxcnLabels = [' ','Atom-A','Atom-B','Atom-C',' ABC angle','AB dist','BC dist','potential'] … … 5188 5191 RMCPdict['ReStart'][1] = True 5189 5192 5190 atChoice = RMCPdict['atSeq']5193 atChoice = [atm for atm in RMCPdict['atSeq'] if 'Va' not in atm] 5191 5194 bondSizer = wx.FlexGridSizer(5,5,5) 5192 5195 fxcnLabels = [' ','Atom-A','Atom-B',' AB dist','potential'] -
trunk/GSASIIpwd.py
r4425 r4427 2509 2509 nbrs = G2mth.FindAllNeighbors(Phase,FrstName,list(AtDict.keys()),notName=notNames,Short=True)[0] 2510 2510 Atyp1 = AtDict[FrstName] 2511 if 'Va' in Atyp1: 2512 continue 2511 2513 for nbr in nbrs: 2512 2514 Atyp2 = AtDict[nbr[0]] 2515 if 'Va' in Atyp2: 2516 continue 2513 2517 try: 2514 2518 bndData = Pairs[' %s-%s'%(Atyp1,Atyp2)][1:] … … 2614 2618 # fullrmc imports (all that are potentially useful) 2615 2619 import numpy as np 2620 import time 2616 2621 from fullrmc.sincConvolution import sincConvolution 2617 2622 from fullrmc.Globals import LOGGER … … 2635 2640 from fullrmc.debugStuff import * 2636 2641 InvokeDebugOpts() 2642 time0 = time.time() 2637 2643 SwapGen = {} 2638 2644 # engine setup\n''' … … 2743 2749 rundata += ' ENGINE.run(restartPdb="%s",numberOfSteps=10000*(1.-sProb), saveFrequency=1000)\n'%restart 2744 2750 rundata += 'ENGINE.close()\n' 2751 rundata += 'print("ENGINE run time %.2f s"%(time.time()-time0))\n' 2745 2752 rfile = open(rname,'w') 2746 2753 rfile.writelines(rundata) … … 2755 2762 Dups,Fracs = findDup(Phase['Atoms']) 2756 2763 Sfracs = [np.cumsum(fracs) for fracs in Fracs] 2764 ifSfracs = np.any(np.array(Sfracs)-1.) 2757 2765 Supercell = RMCPdict['SuperCell'] 2758 2766 Cell = generalData['Cell'][1:7] … … 2764 2772 Atoms = newPhase['Atoms'] 2765 2773 2766 Natm = np.core.defchararray.count(np.array(Atcodes),'+') #no. atoms in original unit cell 2767 Natm = np.count_nonzero(Natm-1) 2768 Atoms = newPhase['Atoms'] 2769 Satoms = G2mth.sortArray(G2mth.sortArray(G2mth.sortArray(Atoms,5),4),3) 2770 Datoms = [[atom for atom in Satoms if atom[0] in dup] for dup in Dups] 2771 Natoms = [] 2772 for idup,dup in enumerate(Dups): 2773 ldup = len(dup) 2774 datoms = Datoms[idup] 2775 natm = len(datoms) 2776 i = 0 2777 while i < natm: 2778 atoms = datoms[i:i+ldup] 2779 try: 2780 atom = atoms[np.searchsorted(Sfracs[idup],rand.random())] 2781 Natoms.append(atom) 2782 except IndexError: #what about vacancies? 2783 if 'Va' not in Atseq: 2784 Atseq.append('Va') 2785 RMCPdict['aTypes']['Va'] = 0.0 2786 atom = atoms[0] 2787 atom[1] = 'Va' 2788 Natoms.append(atom) 2789 i += ldup 2790 2791 2792 2793 2774 if ifSfracs: 2775 Natm = np.core.defchararray.count(np.array(Atcodes),'+') #no. atoms in original unit cell 2776 Natm = np.count_nonzero(Natm-1) 2777 Satoms = [] 2778 for i in range(len(Atoms)//Natm): 2779 ind = i*Natm 2780 Satoms.append(G2mth.sortArray(G2mth.sortArray(G2mth.sortArray(Atoms[ind:ind+Natm],5),4),3)) 2781 Natoms = [] 2782 for satoms in Satoms: 2783 for idup,dup in enumerate(Dups): 2784 ldup = len(dup) 2785 natm = len(satoms) 2786 i = 0 2787 while i < natm: 2788 if satoms[i][0] in dup: 2789 atoms = satoms[i:i+ldup] 2790 try: 2791 atom = atoms[np.searchsorted(Sfracs[idup],rand.random())] 2792 Natoms.append(atom) 2793 except IndexError: #what about vacancies? 2794 if 'Va' not in Atseq: 2795 Atseq.append('Va') 2796 RMCPdict['aTypes']['Va'] = 0.0 2797 atom = atoms[0] 2798 atom[1] = 'Va' 2799 Natoms.append(atom) 2800 i += ldup 2801 else: 2802 i += 1 2803 else: 2804 Natoms = Atoms 2794 2805 2795 2806 XYZ = np.array([atom[3:6] for atom in Natoms]).T
Note: See TracChangeset
for help on using the changeset viewer.