Changeset 4420
 Timestamp:
 May 15, 2020 8:05:40 PM (3 years ago)
 Location:
 trunk
 Files:

 2 edited
Legend:
 Unmodified
 Added
 Removed

trunk/GSASIIphsGUI.py
r4418 r4420 4516 4516 fil = Indx[Obj.GetId()] 4517 4517 RMCPdict['files'][fil][3] = not RMCPdict['files'][fil][3] 4518 4519 def OnDelBtn(event): 4520 Obj = event.GetEventObject() 4521 fil = Indx[Obj.GetId()] 4522 RMCPdict['files'][fil][0] = 'Select' 4523 wx.CallAfter(UpdateRMC) 4518 4524 4519 4525 Indx = {} … … 4525 4531 titleSizer.Add(fitscale,0,WACV) 4526 4532 mainSizer.Add(titleSizer,0,WACV) 4527 ncol= 54528 Heads = ['Name','File','Format','Weight','Plot' ]4533 ncol= 6 4534 Heads = ['Name','File','Format','Weight','Plot','Delete'] 4529 4535 if G2frame.RMCchoice == 'fullrmc': 4530 4536 mainSizer.Add(wx.StaticText(G2frame.FRMC, 4531 4537 label=' NB: fullrmc data files must be 2 columns; all other lines preceeded by "#". Edit before use.'),0,WACV) 4532 Heads = ['Name','File','Weight','Plot','Corr' ]4538 Heads = ['Name','File','Weight','Plot','Corr','Delete'] 4533 4539 fileSizer = wx.FlexGridSizer(ncol,5,5) 4534 4540 Formats = ['RMC','GUDRUN','STOG'] … … 4569 4575 corrChk.Bind(wx.EVT_CHECKBOX,OnCorrChk) 4570 4576 fileSizer.Add(corrChk,0,WACV) 4577 delBtn = wx.Button(G2frame.FRMC,label='Delete') 4578 delBtn.Bind(wx.EVT_BUTTON,OnDelBtn) 4579 Indx[delBtn.GetId()] = fil 4580 fileSizer.Add(delBtn,0,WACV) 4571 4581 else: 4572 4582 RMCPdict['files'][fil][0] = 'Select' 4583 fileSizer.Add((5,5),0) 4573 4584 fileSizer.Add((5,5),0) 4574 4585 fileSizer.Add((5,5),0) … … 5500 5511 sitem = str(type(item)) 5501 5512 if 'PairDistribution' in sitem or 'StructureFactor' in sitem or 'PairCorrelation' in sitem: 5513 nameId = 'X' 5514 if 'neutron' in item.weighting: 5515 nameId = 'N' 5502 5516 found = True 5503 5517 Xlab = r'$\mathsf{r,\AA}$' 5504 5518 Ylab = r'$\mathsf{g(r),\AA^{2}}$' 5505 title = ' g(r) for '5519 title = ' g(r)%s for '%nameId 5506 5520 if 'StructureFactor' in sitem: 5507 eNames.append('S(Q)' )5521 eNames.append('S(Q)'+nameId) 5508 5522 Xlab = r'$\mathsf{Q,\AA^{1}}$' 5509 5523 Ylab = 'S(Q)' 5510 title = ' S(Q) for '5524 title = ' S(Q)%s for '%nameId 5511 5525 else: 5512 eNames.append('g(r)') 5513 title = frame+title 5526 eNames.append('g(r)'+nameId) 5514 5527 dataDict= item.get_constraints_properties(frame) 5515 5528 X = dataDict['framesexperimental_x'][0] … … 5534 5547 NamesT = [] 5535 5548 for item in rdfDict: 5536 PXYT.append([X,rdfDict[item]]) 5549 if 'rdf' not in item and 'g(r)' in title: 5550 Ylab = r'$\mathsf{G(r),\AA^{1}}$' 5551 PXYT.append([X,1.+rdfDict[item]/X]) 5552 else: 5553 PXYT.append([X,rdfDict[item]]) 5537 5554 NamesT.append(item) 5538 5555 if 'total' in item: 5539 PXY.append([X,rdfDict[item]]) 5556 if 'rdf' not in item and 'g(r)' in title: 5557 Ylab = r'$\mathsf{G(r),\AA^{1}}$' 5558 PXY.append([X,1.+rdfDict[item]/X]) 5559 else: 5560 PXY.append([X,rdfDict[item]]) 5540 5561 Names.append(item) 5541 5562 G2plt.PlotXY(G2frame,PXYT,labelX=Xlab, … … 5625 5646 start += 1 5626 5647 Gen = [] 5627 # Tr = []5628 # Acc = []5629 # Rem = []5630 5648 Err = [] 5631 5649 start = 1 
trunk/GSASIIpwd.py
r4417 r4420 2648 2648 filDat = RMCPdict['files'][File] 2649 2649 if filDat[0] != 'Select': 2650 sfwt = 'neutron s'2650 sfwt = 'neutronCohb' 2651 2651 if 'Xray' in File: 2652 sfwt = ' xrays'2652 sfwt = 'atomicNumber' 2653 2653 if 'G(r)' in File: 2654 2654 rundata += ' RGR = np.loadtxt("%s").T\n'%filDat[0] … … 2657 2657 rundata += ' GofR = PairDistributionConstraint(experimentalData=RGR.T, weighting="%s")\n'%sfwt 2658 2658 rundata += ' ENGINE.add_constraints([GofR])\n' 2659 wtDict['Pair '] = filDat[1]2659 wtDict['Pair'+sfwt] = filDat[1] 2660 2660 else: 2661 2661 rundata += ' SOQ = np.loadtxt("%s").T\n'%filDat[0] … … 2664 2664 rundata += ' FofQ = ReducedStructureFactorConstraint(experimentalData=SOQ.T, weighting="%s")\n'%sfwt 2665 2665 rundata += ' ENGINE.add_constraints([FofQ])\n' 2666 wtDict['Struct '] = filDat[1]2666 wtDict['Struct'+sfwt] = filDat[1] 2667 2667 rundata += ' ENGINE.add_constraints(InterMolecularDistanceConstraint())\n' 2668 2668 if RMCPdict['byMolec']: … … 2679 2679 rundata += 'else:\n' 2680 2680 rundata += ' ENGINE = ENGINE.load(path=engineFileName)\n' 2681 rundata += '#fill & change constraints  can be done without restart\n' 2681 rundata += '#fill & change constraints  can be done without restart\n' 2682 rundata += 'wtDict = %s\n'%str(wtDict) 2682 2683 rundata += 'Constraints = ENGINE.constraints\n' 2683 2684 rundata += 'for constraint in Constraints:\n' … … 2686 2687 rundata += ' constraint.set_default_distance(%f)\n'%RMCPdict['min Contact'] 2687 2688 rundata += ' elif "PairDistribution" in strcons:\n' 2688 rundata += ' constraint.set_variance_squared( %f)\n'%wtDict['Pair']2689 rundata += ' constraint.set_variance_squared(wtDict["Pair"+constraint.weighting])\n' 2689 2690 rundata += ' constraint.set_limits((%.3f,%.3f))\n'%(rmin,rmax) 2690 2691 if RMCPdict['FitScale']: 2691 2692 rundata += ' constraint.set_adjust_scale_factor((10, 0.01, 100.))\n' 2692 2693 rundata += ' elif "StructureFactor" in strcons:\n' 2693 rundata += ' constraint.set_variance_squared( %f)\n'%wtDict['Struct']2694 rundata += ' constraint.set_variance_squared(wtDict["Struct"+constraint.weighting])\n' 2694 2695 if RMCPdict['FitScale']: 2695 2696 rundata += ' constraint.set_adjust_scale_factor((10, 0.01, 100.))\n' … … 2728 2729 rundata += ' ENGINE.set_groups_as_atoms()\n' 2729 2730 rundata += ' ENGINE.run(restartPdb="%s",numberOfSteps=10000, saveFrequency=1000)\n'%restart 2730 rundata += ' for swaps in SwapGen:\n' 2731 rundata += ' AB = swaps.split("")\n' 2732 rundata += ' ENGINE.set_groups_as_atoms()\n' 2733 rundata += ' for g in ENGINE.groups:\n' 2734 rundata += ' if allNames[g.indexes[0]]==AB[0]:\n' 2735 rundata += ' g.set_move_generator(SwapGen[swaps][0])\n' 2736 rundata += ' elif allNames[g.indexes[0]]==AB[1]:\n' 2737 rundata += ' g.set_move_generator(SwapGen[swaps][1])\n' 2738 rundata += ' sProb = SwapGen[swaps][2]\n' 2739 rundata += ' ENGINE.run(restartPdb="%s",numberOfSteps=10000*sProb, saveFrequency=1000)\n'%restart 2740 rundata += ' ENGINE.set_groups_as_atoms()\n' 2741 rundata += ' ENGINE.run(restartPdb="%s",numberOfSteps=10000*(1.sProb), saveFrequency=1000)\n'%restart 2731 if len(RMCPdict['Swaps']): 2732 rundata += ' for swaps in SwapGen:\n' 2733 rundata += ' AB = swaps.split("")\n' 2734 rundata += ' ENGINE.set_groups_as_atoms()\n' 2735 rundata += ' for g in ENGINE.groups:\n' 2736 rundata += ' if allNames[g.indexes[0]]==AB[0]:\n' 2737 rundata += ' g.set_move_generator(SwapGen[swaps][0])\n' 2738 rundata += ' elif allNames[g.indexes[0]]==AB[1]:\n' 2739 rundata += ' g.set_move_generator(SwapGen[swaps][1])\n' 2740 rundata += ' sProb = SwapGen[swaps][2]\n' 2741 rundata += ' ENGINE.run(restartPdb="%s",numberOfSteps=10000*sProb, saveFrequency=1000)\n'%restart 2742 rundata += ' ENGINE.set_groups_as_atoms()\n' 2743 rundata += ' ENGINE.run(restartPdb="%s",numberOfSteps=10000*(1.sProb), saveFrequency=1000)\n'%restart 2742 2744 rundata += 'ENGINE.close()\n' 2743 2745 rfile = open(rname,'w')
Note: See TracChangeset
for help on using the changeset viewer.