Skip to content

Commit 16569c5

Browse files
committed
modify r-factors in scriptref test; remove Bilbao pseudosym cmd -- removed from website
1 parent 029522f commit 16569c5

7 files changed

Lines changed: 98 additions & 80 deletions

File tree

GSASII/GSASIIdataGUI.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6867,7 +6867,8 @@ def _makemenu(): # routine to create menu when first used
68676867
# PWDR / Unit Cells List
68686868
G2G.Define_wxId('wxID_INDEXPEAKS', 'wxID_REFINECELL', 'wxID_COPYCELL', 'wxID_MAKENEWPHASE',
68696869
'wxID_EXPORTCELLS','wxID_LOADCELL','wxID_IMPORTCELL','wxID_TRANSFORMCELL',
6870-
'wxID_RUNSUB','wxID_RUNSUBMAG','wxID_LATSYM')
6870+
'wxID_RUNSUB','wxID_RUNSUBMAG')
6871+
#G2G.Define_wxId('wxID_LATSYM')
68716872
G2G.Define_wxId('wxID_NISTLATSYM')
68726873
G2G.Define_wxId('wxID_SHOWGENHKLS')
68736874
G2G.Define_wxId('wxID_CLEARCELLS')
@@ -6878,9 +6879,9 @@ def _makemenu(): # routine to create menu when first used
68786879
self.IndexMenu.Append(menu=self.IndexEdit, title='Cell Index/Refine')
68796880
self.IndexPeaks = self.IndexEdit.Append(G2G.wxID_INDEXPEAKS,'Index Cell',
68806881
'Find cells that index fitted peaks')
6881-
self.IndexEdit.Append(G2G.wxID_LATSYM,'Cell Symmetry Search-Bilbao',
6882-
'Run Bilbao "Lattice Symmetry" to find higher symmetry cells')
6883-
self.IndexEdit.Append(G2G.wxID_NISTLATSYM,'Cell Symmetry Search-NIST*LATTICE',
6882+
# self.IndexEdit.Append(G2G.wxID_LATSYM,'Cell Symmetry Search-Bilbao',
6883+
# 'Run Bilbao "Lattice Symmetry" to find higher symmetry cells')
6884+
self.IndexEdit.Append(G2G.wxID_NISTLATSYM,'Cell Symmetry Search',
68846885
'Run NIST*LATTICE to find higher symmetry cells')
68856886
self.RunSubGroups = self.IndexEdit.Append(G2G.wxID_RUNSUB,'Run SUBGROUPS',
68866887
'If disabled, do Load Phase first')

GSASII/GSASIIpath.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1923,6 +1923,7 @@ def postURL(URL,postdict,getcookie=None,usecookie=None,
19231923
count += 1
19241924
r = None
19251925
repeat = False
1926+
if GetConfigValue('debug'): print('request to',URL)
19261927
try:
19271928
if timeout is not None:
19281929
r = reqopt(URL,params=postdict,cookies=usecookie,

GSASII/GSASIIpwdGUI.py

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -2044,7 +2044,7 @@ def OnCellChange(event):
20442044
Types = [wg.GRID_VALUE_FLOAT+':10,2',wg.GRID_VALUE_BOOL,
20452045
wg.GRID_VALUE_FLOAT+':12,5,g',wg.GRID_VALUE_BOOL,
20462046
wg.GRID_VALUE_FLOAT+':12,3,g',wg.GRID_VALUE_BOOL,
2047-
wg.GRID_VALUE_FLOAT+':12,5,g',wg.GRID_VALUE_BOOL]
2047+
wg.GRID_VALUE_FLOAT+':12,3,g',wg.GRID_VALUE_BOOL]
20482048
peaksTable = G2G.Table(data[1]['peaksList'],rowLabels=rowLabels,colLabels=colLabels,types=Types)
20492049
peaksGrid = G2G.GSGrid(parent=G2frame.dataWindow)
20502050
peaksGrid.SetRowLabelSize(45)
@@ -4825,45 +4825,45 @@ def TransformUnitCell(event):
48254825
OnHklShow(None,indexFrom=' Indexing from transformed unit cell & symmetry settings')
48264826
wx.CallAfter(UpdateUnitCellsGrid,G2frame,data)
48274827

4828-
def OnLatSym(event):
4829-
'Run Bilbao PseudoLattice cell search'
4830-
# look up a space group matching Bravais lattice (should not matter which one)
4831-
bravaisSPG = {'Fm3m':225,'Im3m':229,'Pm3m':221,'R3-H':146,'P6/mmm':191,
4832-
'I4/mmm':139,'P4/mmm':123,'Fmmm':69,'Immm':71,
4833-
'Cmmm':65,'Pmmm':47,'C2/m':12,'P2/m':10,'P1':2}
4834-
pUCid = G2gd.GetGPXtreeItemId(G2frame,G2frame.PatternId, 'Unit Cells List')
4835-
controls,bravais,cells,dminx,ssopt,magcells = G2frame.GPXtree.GetItemPyData(pUCid)
4836-
sgNum = bravaisSPG.get(controls[5],0)
4837-
if sgNum < 1:
4838-
wx.MessageBox('Sorry, only standard cell settings are allowed, please transform axes',caption='Bilbao requires standard settings',style=wx.ICON_EXCLAMATION)
4839-
return
4840-
cell = controls[6:12]
4841-
tolerance = 5.
4842-
dlg = G2G.SingleFloatDialog(G2frame,'Tolerance',
4843-
'Enter angular tolerance for search',5.0,[.1,30.],"%.1f")
4844-
if dlg.ShowModal() == wx.ID_OK:
4845-
tolerance = dlg.GetValue()
4846-
dlg.Destroy()
4847-
else:
4848-
dlg.Destroy()
4849-
return
4850-
wx.MessageBox(' For use of PSEUDOLATTICE, please cite:\n\n'+
4851-
G2G.GetCite('Bilbao: PSEUDOLATTICE'),
4852-
caption='Bilbao PSEUDOLATTICE',
4853-
style=wx.ICON_INFORMATION)
4854-
wx.BeginBusyCursor()
4855-
page = kSUB.subBilbaoCheckLattice(sgNum,cell,tolerance)
4856-
wx.EndBusyCursor()
4857-
if not page: return
4858-
cells.clear()
4859-
for i,(cell,mat) in enumerate(kSUB.parseBilbaoCheckLattice(page)):
4860-
cells.append([])
4861-
cells[-1] += [mat,0,16]
4862-
cells[-1] += cell
4863-
cells[-1] += [G2lat.calc_V(G2lat.cell2A(cell)),False,False]
4864-
G2frame.GPXtree.SetItemPyData(pUCid,data)
4865-
G2frame.OnFileSave(event)
4866-
wx.CallAfter(UpdateUnitCellsGrid,G2frame,data)
4828+
# def OnLatSym(event):
4829+
# 'Run Bilbao PseudoLattice cell search'
4830+
# # look up a space group matching Bravais lattice (should not matter which one)
4831+
# bravaisSPG = {'Fm3m':225,'Im3m':229,'Pm3m':221,'R3-H':146,'P6/mmm':191,
4832+
# 'I4/mmm':139,'P4/mmm':123,'Fmmm':69,'Immm':71,
4833+
# 'Cmmm':65,'Pmmm':47,'C2/m':12,'P2/m':10,'P1':2}
4834+
# pUCid = G2gd.GetGPXtreeItemId(G2frame,G2frame.PatternId, 'Unit Cells List')
4835+
# controls,bravais,cells,dminx,ssopt,magcells = G2frame.GPXtree.GetItemPyData(pUCid)
4836+
# sgNum = bravaisSPG.get(controls[5],0)
4837+
# if sgNum < 1:
4838+
# wx.MessageBox('Sorry, only standard cell settings are allowed, please transform axes',caption='Bilbao requires standard settings',style=wx.ICON_EXCLAMATION)
4839+
# return
4840+
# cell = controls[6:12]
4841+
# tolerance = 5.
4842+
# dlg = G2G.SingleFloatDialog(G2frame,'Tolerance',
4843+
# 'Enter angular tolerance for search',5.0,[.1,30.],"%.1f")
4844+
# if dlg.ShowModal() == wx.ID_OK:
4845+
# tolerance = dlg.GetValue()
4846+
# dlg.Destroy()
4847+
# else:
4848+
# dlg.Destroy()
4849+
# return
4850+
# wx.MessageBox(' For use of PSEUDOLATTICE, please cite:\n\n'+
4851+
# G2G.GetCite('Bilbao: PSEUDOLATTICE'),
4852+
# caption='Bilbao PSEUDOLATTICE',
4853+
# style=wx.ICON_INFORMATION)
4854+
# wx.BeginBusyCursor()
4855+
# page = kSUB.subBilbaoCheckLattice(sgNum,cell,tolerance)
4856+
# wx.EndBusyCursor()
4857+
# if not page: return
4858+
# cells.clear()
4859+
# for i,(cell,mat) in enumerate(kSUB.parseBilbaoCheckLattice(page)):
4860+
# cells.append([])
4861+
# cells[-1] += [mat,0,16]
4862+
# cells[-1] += cell
4863+
# cells[-1] += [G2lat.calc_V(G2lat.cell2A(cell)),False,False]
4864+
# G2frame.GPXtree.SetItemPyData(pUCid,data)
4865+
# G2frame.OnFileSave(event)
4866+
# wx.CallAfter(UpdateUnitCellsGrid,G2frame,data)
48674867

48684868
def OnNISTLatSym(event):
48694869
'Run NIST*LATTICE cell search'
@@ -6990,7 +6990,7 @@ def OnRefreshKeep(event):
69906990
G2frame.Bind(wx.EVT_MENU, OnIndexPeaks, id=G2G.wxID_INDEXPEAKS)
69916991
G2frame.Bind(wx.EVT_MENU, OnRunSubs, id=G2G.wxID_RUNSUB)
69926992
G2frame.Bind(wx.EVT_MENU, OnRunSubsMag, id=G2G.wxID_RUNSUBMAG)
6993-
G2frame.Bind(wx.EVT_MENU, OnLatSym, id=G2G.wxID_LATSYM)
6993+
#G2frame.Bind(wx.EVT_MENU, OnLatSym, id=G2G.wxID_LATSYM) # removed from site
69946994
G2frame.Bind(wx.EVT_MENU, OnNISTLatSym, id=G2G.wxID_NISTLATSYM)
69956995
G2frame.Bind(wx.EVT_MENU, CopyUnitCell, id=G2G.wxID_COPYCELL)
69966996
G2frame.Bind(wx.EVT_MENU, LoadUnitCell, id=G2G.wxID_LOADCELL)

GSASII/SUBGROUPS.py

Lines changed: 28 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,15 @@
2424
from . import GSASIIlattice as G2lat
2525
from . import GSASIIElem as G2elem
2626
from . import GSASIIctrlGUI as G2G
27-
bilbaoURL = "http://webbdcrista2.ehu.es"
27+
bilbaoURL = "http://cryst.ehu.es"
2828
bilbaoSite = f'{bilbaoURL}/cgi-bin/cryst/programs/'
29+
# routines used here:
2930
pseudosym = 'pseudosym/nph-pseudosym'
31+
#pseudolattice = "pseudosym/nph-pseudolattice"
32+
cif2std = 'nph-cif2std'
33+
subgrmag1 = 'subgrmag1_general_GSAS.pl?'
34+
checkgr = 'checkgr_gsas.pl'
35+
minsup = 'nph-minsup' # coded but not used
3036
timeout=150 # time to wait for Bilbao to respond; 2.5 minutes
3137

3238
def postpostURL(page):
@@ -38,7 +44,7 @@ def postpostURL(page):
3844
import re
3945
print(f"Website down? See message below:\n\n{re.sub('<.+>','',page)}")
4046
try:
41-
dlg = G2G.viewWebPage(wx.GetApp().GetMainTopWindow(),URL,HTML=page)
47+
G2G.viewWebPage(wx.GetApp().GetMainTopWindow(),HTML=page)
4248
except:
4349
pass
4450
return True
@@ -98,7 +104,7 @@ def getMatVec(item):
98104
break
99105
for i,k in zip(('x','y','z'),kvec[3*j-3:3*j]):
100106
postdict['knm%d%s'%(j,i)] = k
101-
page = GSASIIpath.postURL(bilbaoSite+'subgrmag1_general_GSAS.pl?',postdict)
107+
page = GSASIIpath.postURL(bilbaoSite+subgrmag1,postdict)
102108
if postpostURL(page): return None,None
103109
if not page:
104110
print('connection error - not on internet?')
@@ -212,7 +218,7 @@ def getMatVec(item):
212218
break
213219
for i,k in zip(('x','y','z'),kvec[3*j-3:3*j]):
214220
postdict['km%d%s'%(j,i)] = k
215-
page = GSASIIpath.postURL(bilbaoSite+'subgrmag1_general_GSAS.pl?',postdict)
221+
page = GSASIIpath.postURL(bilbaoSite+subgrmag1,postdict)
216222
if postpostURL(page): return None,None
217223
if not page:
218224
print('connection error - not on internet?')
@@ -267,20 +273,20 @@ def getMatVec(item):
267273
result = list(zip(SPGPs,BNSs,MVs,itemList,altList,superList))
268274
return result,baseList
269275

270-
def subBilbaoCheckLattice(spgNum,cell,tol=5):
271-
'''submit a unit cell to Bilbao PseudoLattice
272-
'''
273-
psSite = bilbaoSite + "pseudosym/nph-pseudolattice"
274-
cellstr = '+'.join(['{:.5f}'.format(i) for i in cell])
275-
datastr = "sgr={:}&cell={:}&tol={:}&submit=Show".format(
276-
str(int(spgNum)),cellstr,str(int(tol)))
277-
page = GSASIIpath.postURL(psSite,datastr,timeout=timeout)
278-
if postpostURL(page): return None
279-
if not page:
280-
print('connection error - not on internet?')
281-
return None
282-
page = page.replace('<font style= "text-decoration: overline;">','<font>-')
283-
return page
276+
# def subBilbaoCheckLattice(spgNum,cell,tol=5):
277+
# '''submit a unit cell to Bilbao PseudoLattice
278+
# '''
279+
# psSite = bilbaoSite + pseudolattice
280+
# cellstr = '+'.join(['{:.5f}'.format(i) for i in cell])
281+
# datastr = "sgr={:}&cell={:}&tol={:}&submit=Show".format(
282+
# str(int(spgNum)),cellstr,str(int(tol)))
283+
# page = GSASIIpath.postURL(psSite,datastr,timeout=timeout)
284+
# if postpostURL(page): return None
285+
# if not page:
286+
# print('connection error - not on internet?')
287+
# return None
288+
# page = page.replace('<font style= "text-decoration: overline;">','<font>-')
289+
# return page
284290

285291
def parseBilbaoCheckLattice(page):
286292
'''find the cell options from the web page returned by Bilbao PseudoLattice
@@ -320,7 +326,7 @@ def GetStdSGset(SGData=None, oprList=[]):
320326
Note that the new cell is given by G2lat.TransformCell([a,b,...],xformM)
321327
'''
322328
import re
323-
Site = bilbaoSite + 'checkgr.pl'
329+
Site = bilbaoSite + checkgr
324330

325331
if not bool(oprList) ^ bool(SGData):
326332
raise ValueError('GetStdSGset: Must specify oprList or SGData and not both')
@@ -376,7 +382,7 @@ def GetSupergroup(SGnum,dlg=None):
376382
Note that the new cell is given by G2lat.TransformCell([a,b,...],M)
377383
'''
378384
import re
379-
Site = bilbaoSite + 'nph-minsup'
385+
Site = bilbaoSite + minsup
380386
if dlg: dlg.Update(0,newmsg='Waiting for initial web response')
381387
out = GSASIIpath.postURL(Site,{'gnum':f'{SGnum:}'},timeout=timeout)
382388
if postpostURL(out): return None
@@ -825,7 +831,6 @@ def createStdSetting(cifFile,rd):
825831
# macs; it should not!
826832
print('Warning: failed to import requests. Python config error')
827833
return None
828-
cif2std = 'nph-cif2std'
829834
if not os.path.exists(cifFile):
830835
print(f'createStdSetting error: file {cifFile} not found')
831836
return False
@@ -835,6 +840,8 @@ def createStdSetting(cifFile,rd):
835840
print(f'''Submitting structure to Bilbao "CIF to Standard Setting" (strtidy)
836841
web service. Please cite:
837842
{G2G.GetCite('Bilbao: PSEUDOLATTICE',wrap=70,indent=5)}''')
843+
if GSASIIpath.GetConfigValue('debug'): print('request to',bilbaoSite+cif2std)
844+
838845
r0 = requests.post(bilbaoSite+cif2std, files=files, data=values)
839846
structure = r0.text[r0.text.lower().find('<pre>')+5:r0.text.lower().find('</pre>')].strip()
840847
spnum,celllist,natom = structure.split('\n')[:3]

docs/source/packages.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ The following web services can also be accessed from computers that
485485
have internet access. All software needed for this access is included
486486
with GSAS-II.
487487

488-
**Bilbao Crystallographic Server** (http://webbdcrista2.ehu.es/):
488+
**Bilbao Crystallographic Server** (http://cryst.ehu.es/):
489489
GSAS-II can directly access the Bilbao Crystallographic Server to
490490
utilize the k-SUBGROUPSMAG, k-SUBGROUPS and PseudoLattice web utilities for
491491
computation of space group subgroups, color (magnetic) subgroups &

tests/run_bilbao.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,10 @@ def test_GetStdSGset():
107107

108108
if __name__ == '__main__':
109109
# run self-tests
110-
test_GetStdSGset()
111-
test_SUBGROUPSMAG()
112-
test_SUBGROUPS()
113-
test_pseudosym()
114-
test_CheckLattice()
115-
test_createStdSetting()
110+
test_GetStdSGset() # checkgr_gsas.pl
111+
test_SUBGROUPSMAG() # subgrmag1_general_GSAS.pl
112+
test_SUBGROUPS() # subgrmag1_general_GSAS.pl
113+
test_pseudosym() # nph-pseudosym
114+
#test_CheckLattice() # nph-pseudolattice (removed from Bilbao)
115+
test_createStdSetting() # nph-cif2std
116116
print ("OK")

tests/test_scriptref.py

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def testR(msg,w1,w2):
4646
phase0 = gpx.add_phase(dataloc("PbSO4-Wyckoff.cif"),
4747
phasename="PbSO4", histograms=[h1,h2])
4848
gpx.set_Controls('cycles', 0)
49-
gpx.refine()
49+
gpx.refine(makeBack=True)
5050
testR('Before fitting',96.681098,99.748994)
5151
#
5252
#h1.set_refinements({'Limits': [16.,158.4]})
@@ -57,22 +57,31 @@ def testR(msg,w1,w2):
5757
gpx.set_Controls('cycles', 3) # also gains ~x1.5 in speed
5858
h1.set_refinements({"Background": { "no. coeffs": 6, "refine": True }})
5959
h2.set_refinements({"Background": { "no. coeffs": 3, "refine": True }})
60-
gpx.refine()
60+
gpx.refine(makeBack=True)
6161
testR('Fit scale & bkg',45.811562,17.864834)
6262
#
6363
phase0.set_refinements({'Cell':True})
6464
phase0.set_HAP_refinements({'HStrain':True},[h2])
65-
gpx.refine()
65+
gpx.refine(makeBack=True)
6666
testR('Fit cells',32.475886, 15.02412)
6767
#
6868
phase0.set_HAP_refinements({'Mustrain':{'refine':True}},[h1])
69+
#gpx.refine(makeBack=True)
70+
#msg = '?'
71+
#print(f"*** {msg}: Rwp(h1)={h1.residuals['wR']:.5f}, Rwp(h2)={h2.residuals['wR']:.5f}")
6972
#phase0.set_HAP_refinements({'Size':{'refine':True}},[h1])
7073
h1.set_refinements({"Sample Parameters": {"Shift": True}})
74+
#gpx.refine(makeBack=True)
75+
#print(f"*** {msg}: Rwp(h1)={h1.residuals['wR']:.5f}, Rwp(h2)={h2.residuals['wR']:.5f}")
7176
h2.set_refinements({"Sample Parameters":["DisplaceX","DisplaceY"]})
77+
#gpx.refine(makeBack=True)
78+
#print(f"*** {msg}: Rwp(h1)={h1.residuals['wR']:.5f}, Rwp(h2)={h2.residuals['wR']:.5f}")
7279
phase0.set_refinements({"Atoms":{"all":"XU"}})
73-
gpx.refine()
80+
#gpx.refine(makeBack=True)
81+
#print(f"*** {msg}: Rwp(h1)={h1.residuals['wR']:.5f}, Rwp(h2)={h2.residuals['wR']:.5f}")
82+
gpx.refine(makeBack=True)
7483
testR('add Mustrain, Shift, Displace[XY], atomic X & Uiso',
75-
13.407161, 6.360408)
84+
13.40599, 6.36131)
7685
#
7786
#h1.set_refinements({'Instrument Parameters': ['U', 'V', 'W']})
7887
#h2.set_refinements({'Instrument Parameters': ['U', 'V', 'W']})
@@ -81,12 +90,12 @@ def testR(msg,w1,w2):
8190
# change to Spherical Harmonics, order=2 for the 1st histogram & refine
8291
phase0.HAPvalue('PO',2,[h1])
8392
phase0.set_HAP_refinements({"Pref.Ori.":True})
84-
gpx.refine()
93+
gpx.refine(makeBack=True)
8594
POdict = phase0.HAPvalue('PO',targethistlist=[h1])[5]
8695
print('Spherical harmonics values:',POdict)
8796
npt.assert_allclose((POdict['C(2,0)'],POdict['C(2,2)']),
8897
[0.127404, 0.09406], rtol=0.001)
89-
testR('add PO',13.166705, 6.381183)
98+
testR('add PO',13.16483, 6.38230)
9099
#
91100
print('OK')
92101

0 commit comments

Comments
 (0)