@@ -2791,25 +2791,24 @@ def OnSaveDist(event):
2791
2791
pName = generalData['Name']
2792
2792
fName = os.path.abspath(os.path.splitext(G2frame.GSASprojectfile)[0]+'_TOdist.csv')
2793
2793
fp = open(fName,'w')
2794
- fp.write('Phase name: %s\n '%pName)
2794
+ fp.write('Phase name: %s, '%pName)
2795
2795
Oatoms = generalData['Compare']['Oatoms']
2796
2796
Tatoms = generalData['Compare']['Tatoms']
2797
2797
bName = '%s-%s'%(Oatoms,Tatoms)
2798
2798
Bonds = generalData['Compare']['Bonds'][bName]
2799
- Vects = generalData['Compare']['Vects'][bName]
2800
- dVects = generalData['Compare']['dVects'][bName]
2799
+ # Vects = generalData['Compare']['Vects'][bName]
2800
+ # dVects = generalData['Compare']['dVects'][bName]
2801
2801
if len(Bonds['Obonds']):
2802
- fp.write('%s-%s Octahedral bond lengths'%(Oatoms,Tatoms))
2802
+ fp.write('\n %s-%s Octahedral bond lengths,\n '%(Oatoms,Tatoms))
2803
2803
for ib,bond in enumerate(Bonds['Obonds']):
2804
2804
fp.write('%7.4f,'%bond)
2805
2805
if not (ib+1)%10: fp.write('\n')
2806
2806
2807
2807
if len(Bonds['Tbonds']):
2808
- fp.write('%s-%s Tetrahedral bond lengths\n'%(Oatoms,Tatoms))
2808
+ fp.write('\n %s-%s Tetrahedral bond lengths, \n'%(Oatoms,Tatoms))
2809
2809
for ib,bond in enumerate(Bonds['Tbonds']):
2810
2810
fp.write('%7.4f,'%bond)
2811
2811
if not (ib+1)%10: fp.write('\n')
2812
-
2813
2812
fp.close()
2814
2813
print(' %s written'%fName)
2815
2814
@@ -5502,6 +5501,35 @@ def OnDistAnglePrt(event):
5502
5501
5503
5502
def OnDistAngleHist(event):
5504
5503
OnDistAngle(event,hist=True)
5504
+
5505
+ def OnSaveDAHist(event):
5506
+ Bonds = data.get('Bonds',{})
5507
+ Angles = data.get('Angles',{})
5508
+ if not len(Bonds) and not len(Angles):
5509
+ print('No bond or angle histograms to save!')
5510
+ return
5511
+ generalData = data['General']
5512
+ pName = generalData['Name']
5513
+ fName = os.path.abspath(os.path.splitext(G2frame.GSASprojectfile)[0]+'_BAdist.csv')
5514
+ fp = open(fName,'w')
5515
+ fp.write('Phase name: %s,'%pName)
5516
+ for Atypes in Bonds:
5517
+ fp.write('\nBond distances for %s, \n'%Atypes)
5518
+ for ib,bond in enumerate(Bonds[Atypes]):
5519
+ fp.write('%7.4f,'%bond)
5520
+ if not (ib+1)%10: fp.write('\n')
5521
+ for Atypes in Angles:
5522
+ fp.write('\nBond angles about %s, \n'%Atypes)
5523
+ for ib,angle in enumerate(Angles[Atypes]):
5524
+ fp.write('%7.2f,'%angle)
5525
+ if not (ib+1)%10: fp.write('\n')
5526
+ fp.close()
5527
+ print(' %s written'%fName)
5528
+
5529
+ def OnClearDAHist(event):
5530
+ data['Bonds'] = {}
5531
+ data['Angles'] = {}
5532
+ print('Bond & Angle histograms now empty')
5505
5533
5506
5534
def OnDistAngle(event,fp=None,hist=False):
5507
5535
'''Compute distances and angles in response to a menu command
@@ -5572,8 +5600,8 @@ def OnDistAngle(event,fp=None,hist=False):
5572
5600
DisAglData['covData'] = G2frame.GPXtree.GetItemPyData(G2gd.GetGPXtreeItemId(G2frame,G2frame.root, 'Covariance'))
5573
5601
try:
5574
5602
if hist:
5575
- Bonds = DisAglData ['Bonds'] = DisAglData .get('Bonds',{})
5576
- Angles = DisAglData ['Angles'] = DisAglData .get('Angles',{})
5603
+ Bonds = data ['Bonds'] = data .get('Bonds',{})
5604
+ Angles = data ['Angles'] = data .get('Angles',{})
5577
5605
pgbar = wx.ProgressDialog('Distance Angle calculation','Atoms done=',len(Oxyz)+1,
5578
5606
style = wx.PD_ELAPSED_TIME|wx.PD_AUTO_HIDE)
5579
5607
AtomLabels,DistArray,AngArray = G2stMn.RetDistAngle(DisAglCtls,DisAglData,pgbar)
@@ -5594,10 +5622,6 @@ def OnDistAngle(event,fp=None,hist=False):
5594
5622
Angles[Atypes] = angles
5595
5623
5596
5624
elif fp:
5597
- #from importlib import reload
5598
- #reload(G2stMn)
5599
- #reload(G2mth)
5600
- #print('reloading G2stMn & G2mth')
5601
5625
G2stMn.PrintDistAngle(DisAglCtls,DisAglData,fp)
5602
5626
else:
5603
5627
G2stMn.PrintDistAngle(DisAglCtls,DisAglData)
@@ -16878,6 +16902,8 @@ def FillMenus():
16878
16902
G2frame.Bind(wx.EVT_MENU, OnDistAngle, id=G2G.wxID_ATOMSDISAGL)
16879
16903
G2frame.Bind(wx.EVT_MENU, OnDistAnglePrt, id=G2G.wxID_ATOMSPDISAGL)
16880
16904
G2frame.Bind(wx.EVT_MENU, OnDistAngleHist, id=G2G.wxID_ATOMSBNDANGLHIST)
16905
+ G2frame.Bind(wx.EVT_MENU, OnSaveDAHist, id=G2G.wxID_ATOMSSAVEHIST)
16906
+ G2frame.Bind(wx.EVT_MENU, OnClearDAHist, id=G2G.wxID_ATOMSCLEARHIST)
16881
16907
G2frame.Bind(wx.EVT_MENU, OnFracSplit, id=G2G.wxID_ATOMFRACSPLIT)
16882
16908
G2frame.Bind(wx.EVT_MENU, OnDensity, id=G2G.wxID_ATOMSDENSITY)
16883
16909
G2frame.Bind(wx.EVT_MENU, OnShowIsoDistortCalc, id=G2G.wxID_ISODISP)
0 commit comments