Skip to content

Commit d6263a5

Browse files
committed
bring in latest changes in main
2 parents d177f5c + e943ba4 commit d6263a5

File tree

9 files changed

+88
-46
lines changed

9 files changed

+88
-46
lines changed

.github/workflows/bilbao-test.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Self-Test Bilbao access routines
2+
3+
on:
4+
schedule:
5+
# Run weekly on Mondays at 5:00 AM UTC
6+
- cron: '0 5 * * 1'
7+
workflow_dispatch:
8+
9+
# Default to bash
10+
defaults:
11+
run:
12+
shell: bash
13+
14+
jobs:
15+
test:
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- uses: actions/checkout@v4
20+
21+
- name: set up pixi
22+
uses: prefix-dev/[email protected]
23+
with:
24+
manifest-path: pixi/pixi.toml
25+
26+
- name: Use pixi to install GSAS-II
27+
run: |
28+
cd pixi
29+
pixi run install
30+
31+
- name: run Bilbao self-test
32+
run: |
33+
cd pixi
34+
pixi run python -m pytest ../tests/run_bilbao.py

GSASII/GSASIIctrlGUI.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2915,7 +2915,7 @@ def __init__(self,parent,title,prompt,value,limits=[0.,1.],fmt='%.5g'):
29152915
try:
29162916
w = int(a)
29172917
except:
2918-
w = 3+d
2918+
w = 5+d
29192919
self.OKbtn = wx.Button(self,wx.ID_OK)
29202920
CancelBtn = wx.Button(self,wx.ID_CANCEL)
29212921
valItem = ValidatedTxtCtrl(self,self.buffer,0,nDig=(w,d,f),

GSASII/GSASIIpath.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,8 @@ def getG2VersionInfo():
349349
elif len(rc) > 0:
350350
return f" GSAS-II: {gversion} posted {ctim} (\u2265{len(rc)} new updates) [{commit.hexsha[:8]}]{msg}"
351351
else:
352-
return f" GSAS-II: {gversion} posted {ctim} (no new updates) [{commit.hexsha[:8]}]{msg}"
352+
# return f" GSAS-II: {gversion} posted {ctim} (no new updates) [{commit.hexsha[:8]}]{msg}"
353+
return f" GSAS-II: {gversion} posted {ctim} [{commit.hexsha[:8]}]{msg}"
353354
elif gv is not None:
354355
vt = ''
355356
cvt = ''

GSASII/GSASIIphsGUI2.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,11 +355,13 @@ def OnNewHarm(event):
355355
def OnDelHarm(event):
356356
Obj = event.GetEventObject()
357357
dId = Indx[Obj.GetId()]
358+
minL = 1 #always an "Ne"
358359
for harm in data['Deformations'][dId]:
359360
if 'Sl' in harm[0]:
360361
Harm = harm
362+
minL = 2 # & 'kappa'
361363
Hkeys = list(Harm[1].keys())
362-
if len(Hkeys) > 1: #always an "Ne"
364+
if len(Hkeys) > minL:
363365
maxord = max([int(item[2]) for item in Hkeys if 'D' in item])
364366
for item in Hkeys:
365367
if 'D' in item and int(item[2]) == maxord:

GSASII/GSASIIplot.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3523,7 +3523,6 @@ def PlotDeform(G2frame,general,atName,atType,deform,UVmat,radial,neigh):
35233523
Y = 0.5*np.outer(npsind(PHI),npsind(PSI))
35243524
Z = 0.5*np.outer(np.ones(np.size(PHI)),npcosd(PSI))
35253525
XYZ = np.array([X.flatten(),Y.flatten(),Z.flatten()])
3526-
# XYZ = np.inner(UVmat,XYZ.T)
35273526
RAP = G2mth.Cart2Polar(XYZ[0],XYZ[1],XYZ[2])
35283527
P = np.zeros((31,31))
35293528
for shc in SHC:
@@ -7359,9 +7358,9 @@ def Draw(caller='',Fade=[],NPkey=False):
73597358
SGM = np.array(G2spc.GetOpFromCode(atom[cs-1],SGData)[0])
73607359
SHC = defParms[0][1]
73617360
SHC = {item.replace('D','C'):SHC[item] for item in SHC if item not in ['Ne','kappa']}
7362-
SGC = G2lat.CrysM2CartM(Amat,Bmat,SGM)
7363-
UVMat = np.inner(defCtrls['UVmat'],SGC)
7364-
# print(atom[ct-1],atom[cs-1],'\n',UVMat,'\n',SGC)
7361+
SGC = nl.inv(G2lat.CrysM2CartM(Amat,Bmat,SGM))
7362+
UVMat = np.inner(defCtrls['UVmat'],SGC.T)
7363+
# print(nl.det(UVMat),atom[ct-1],atom[cs-1],'\n',UVMat,'\n',SGC)
73657364
Npsi,Ngam = 90,45
73667365
PSI,GAM = np.mgrid[0:Npsi,0:Ngam] #[azm,pol]
73677366
PSI = PSI.flatten()*360./Npsi #azimuth 0-360 incl

GSASII/GSASIIpwdGUI.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5206,6 +5206,13 @@ def OnISODISTORT_kvec(event):
52065206
'''Search for k-vector using the ISODISTORT web service.
52075207
Developed by Yuanpeng Zhang with help from Branton Campbell.
52085208
'''
5209+
if symbols is None:
5210+
G2G.G2MessageBox(G2frame,
5211+
'Unable to perform ISODISTORT kvec search without the sympy module. Use Help/Add packages... to address','No sympy')
5212+
return
5213+
# symbolic "variables" needed below for routine to_fraction_strs()
5214+
a, b, g = symbols('a b g')
5215+
52095216
def _showWebPage(event):
52105217
'Show a web page when the user presses the "show" button'
52115218
import tempfile
@@ -5259,8 +5266,6 @@ def grab_all_kvecs(out_html):
52595266
else:
52605267
return None
52615268

5262-
a, b, g = symbols('a b g')
5263-
52645269
def frac_str(value, max_den=1000):
52655270
# Try to get a rational exactly; if huge, fall back to bounded approximation
52665271
try:
@@ -5323,10 +5328,6 @@ def setup_kvec_input(k_vec, k_vec_dict, isocif_cif):
53235328
return data_update
53245329

53255330
# start of OnISODISTORT_kvec computations
5326-
if symbols is None:
5327-
G2G.G2MessageBox(G2frame,
5328-
'Unable to perform ISODISTORT kvec search without the sympy module. Use Help/Add packages... to address','No sympy')
5329-
return
53305331
try:
53315332
import requests
53325333
except:

GSASII/GSASIIstrMath.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,8 @@ def MakePolar(Orient,QB):
553553
else:
554554
orKeys = [item for item in orKeys if 'Sl' in item]
555555
orbs = SHCdict[iAt]
556-
UVmat = np.inner(nl.inv(SHCdict[-iAt]['UVmat']),Bmat)
556+
# UVmat = np.inner(nl.inv(SHCdict[-iAt]['UVmat']),Bmat)
557+
UVmat = np.inner(SHCdict[-iAt]['UVmat'],Bmat)
557558
R,Th,Ph = G2lat.H2ThPh2(np.reshape(HKL,(-1,3)),UVmat)
558559
R = 1/R # correct dspacings
559560
atFlg.append(1.0)

GSASII/SUBGROUPS.py

Lines changed: 31 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -829,36 +829,37 @@ def createStdSetting(cifFile,rd):
829829
if not os.path.exists(cifFile):
830830
print(f'createStdSetting error: file {cifFile} not found')
831831
return False
832-
files = {'cifile': open(cifFile,'rb')}
833-
values = {'strtidy':''}
834-
print(f'''Submitting structure to Bilbao "CIF to Standard Setting" (strtidy)
835-
web service. Please cite:
836-
{G2G.GetCite('Bilbao: PSEUDOLATTICE',wrap=70,indent=5)}''')
837-
r0 = requests.post(bilbaoSite+cif2std, files=files, data=values)
838-
structure = r0.text[r0.text.lower().find('<pre>')+5:r0.text.lower().find('</pre>')].strip()
839-
spnum,celllist,natom = structure.split('\n')[:3]
840-
#spgNam = G2spc.spgbyNum[int(spnum)]
841-
cell = [float(i) for i in celllist.split()]
842-
# replace cell, space group and atom info with info from Bilbao
843-
# could try to xfer Uiso (Uij needs xform), but that would be too involved
844-
rd.Phase['General']['SGData'] = SGData = G2spc.SpcGroup(G2spc.spgbyNum[int(spnum)])[1]
845-
rd.Phase['General']['Cell'] = [False] + list(cell) + [G2lat.calc_V(G2lat.cell2A(cell))]
846-
rd.Phase['Atoms'] = []
847-
for i,line in enumerate(structure.split('\n')[3:]):
848-
atomlist = ['','Xe','',0.,0.,0.,1.0,'',0.,'I',0.01, 0.,0.,0.,0.,0.,0.,]
849-
elem,lbl,wyc,x,y,z = line.split()
850-
elem = elem.rstrip('0123456789-+')
851-
atomlist[0] = elem + lbl
852-
if G2elem.CheckElement(elem):
853-
atomlist[1] = elem
854-
atomlist[3:6] = [float(i) for i in (x,y,z)]
855-
atomlist[7],atomlist[8] = G2spc.SytSym(atomlist[3:6],SGData)[:2]
856-
atomlist[1] = G2elem.FixValence(atomlist[1])
857-
858-
atomlist.append(ran.randint(0,sys.maxsize)) # add a random Id
859-
rd.Phase['Atoms'].append(atomlist)
860-
if i == int(natom)-1: break
861-
del rd.SymOps['xyz'] # as-read sym ops now obsolete
832+
with open(cifFile,'rb') as fil:
833+
files = {'cifile': fil}
834+
values = {'strtidy':''}
835+
print(f'''Submitting structure to Bilbao "CIF to Standard Setting" (strtidy)
836+
web service. Please cite:
837+
{G2G.GetCite('Bilbao: PSEUDOLATTICE',wrap=70,indent=5)}''')
838+
r0 = requests.post(bilbaoSite+cif2std, files=files, data=values)
839+
structure = r0.text[r0.text.lower().find('<pre>')+5:r0.text.lower().find('</pre>')].strip()
840+
spnum,celllist,natom = structure.split('\n')[:3]
841+
#spgNam = G2spc.spgbyNum[int(spnum)]
842+
cell = [float(i) for i in celllist.split()]
843+
# replace cell, space group and atom info with info from Bilbao
844+
# could try to xfer Uiso (Uij needs xform), but that would be too involved
845+
rd.Phase['General']['SGData'] = SGData = G2spc.SpcGroup(G2spc.spgbyNum[int(spnum)])[1]
846+
rd.Phase['General']['Cell'] = [False] + list(cell) + [G2lat.calc_V(G2lat.cell2A(cell))]
847+
rd.Phase['Atoms'] = []
848+
for i,line in enumerate(structure.split('\n')[3:]):
849+
atomlist = ['','Xe','',0.,0.,0.,1.0,'',0.,'I',0.01, 0.,0.,0.,0.,0.,0.,]
850+
elem,lbl,wyc,x,y,z = line.split()
851+
elem = elem.rstrip('0123456789-+')
852+
atomlist[0] = elem + lbl
853+
if G2elem.CheckElement(elem):
854+
atomlist[1] = elem
855+
atomlist[3:6] = [float(i) for i in (x,y,z)]
856+
atomlist[7],atomlist[8] = G2spc.SytSym(atomlist[3:6],SGData)[:2]
857+
atomlist[1] = G2elem.FixValence(atomlist[1])
858+
859+
atomlist.append(ran.randint(0,sys.maxsize)) # add a random Id
860+
rd.Phase['Atoms'].append(atomlist)
861+
if i == int(natom)-1: break
862+
del rd.SymOps['xyz'] # as-read sym ops now obsolete
862863

863864
#if __name__ == '__main__':
864865
# Note that self-tests have been moved to file ``tests/run_bilbao.py``.

GSASII/tutorialIndex.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,14 @@
9595
['Magnetic-V', 'Magnetic-V.htm',"Magnetic Structure Analysis-V",
9696
'''Analysis of a complex Type IV antiferromagnet with two propagation vectorse using Bilbao k-SUBGROUPSMAG from TOF neutron powder data'''],
9797

98-
['k_vec_tutorial', 'k_vec_tutorial.html', 'k-vector searching in GSAS-II #1',
98+
['k_vec_tutorial', 'k_vec_tutorial.html', 'k-vector searching in GSAS-II #1 (all-zero vector)',
9999
'''Search neutron diffraction data of Er2Ge2O7 for a all-zero magnetic k-vector'''],
100100

101-
['k_vec_tutorial_non_zero', 'k_vec_tutorial_non_zero.html', 'k-vector searching in GSAS-II #2',
101+
['k_vec_tutorial_non_zero', 'k_vec_tutorial_non_zero.html', 'k-vector searching in GSAS-II #2 (non-zero vector)',
102102
'''Search neutron diffraction data used in Magnetic Structure Analysis-III for a non-zero magnetic k-vector'''],
103+
104+
['k_vec_isodistort', 'k_vec_isodistort.html', 'Use of ISODISTORT with a k-vector found by GSAS-II',
105+
'''Use ISODISTORT to find isotropic subgroups that are compatible with a magnetic k-vector'''],
103106

104107
#['ExampleDir', 'ExamplePage.html', 'Example Tutorial Title', '''Example descriptive text'''],
105108

0 commit comments

Comments
 (0)