3232from GSASII import GSASIIpath
3333from GSASII import GSASIIspc as G2spc
3434
35- def test_pseudosym ():
36- postdict = {'formulae' : '' , 'cifile' : '' , 'filename' : '' , 'what' : 'minsup' ,
37- 'maxik' : '1' , 'onlythisik' : '1' , 'mysuper2' : '211' ,
38- 'x1' : '1' , 'x2' : '0' , 'x3' : '0' ,
39- 'y1' : '0' , 'y2' : '1' , 'y3' : '0' ,
40- 'z1' : '0' , 'z2' : '0' , 'z3' : '1' , 'x4' : '0' ,
41- 'y4' : '0' , 'z4' : '0' ,
42- 'angtol' : '5' , 'submit' : 'Show' , 'maxdelta' : '2.0' ,
43- 'stru' : '# Space Group ITA number\n 227\n # Lattice parameters\n 5.43123 5.43123 5.43123 90.0 90.0 90.0\n # number of atoms & atoms\n 1\n Si 1 - 0.12500 0.12500 0.12500\n ' }
44- savedcookies = {}
45- URL = SUBGROUPS .bilbaoSite + SUBGROUPS .pseudosym
46- print ('test PSEUDOSYM' )
47- page0 = GSASIIpath .postURL (URL ,postdict ,
48- getcookie = savedcookies ,timeout = SUBGROUPS .timeout )
49- if page0 is None : assert False ,"Web access failed"
50- res = SUBGROUPS .scanBilbaoSymSearch1 (page0 ,postdict )+ [savedcookies ]
51- assert res [2 ]['1' ][0 ] == 'Pn-3m'
52- assert abs (float (res [2 ]['1' ][5 ].split ()[0 ]) - 5.43123 / 2 ) < 2e-5
35+ def test_Bilboa_access ():
36+ assert not SUBGROUPS .BCS_init (),'No BCS API Key available'
37+
38+ # def test_pseudosym():
39+ # postdict = {'formulae': '', 'cifile': '', 'filename': '', 'what': 'minsup',
40+ # 'maxik': '1', 'onlythisik': '1', 'mysuper2': '211',
41+ # 'x1': '1', 'x2': '0', 'x3': '0',
42+ # 'y1': '0', 'y2': '1', 'y3': '0',
43+ # 'z1': '0', 'z2': '0', 'z3': '1', 'x4': '0',
44+ # 'y4': '0', 'z4': '0',
45+ # 'angtol': '5', 'submit': 'Show', 'maxdelta': '2.0',
46+ # 'stru': '# Space Group ITA number\n227\n# Lattice parameters\n5.43123 5.43123 5.43123 90.0 90.0 90.0\n# number of atoms & atoms\n1\nSi 1 - 0.12500 0.12500 0.12500\n'}
47+ # savedcookies = {}
48+ # URL = SUBGROUPS.bilbaoSite+ SUBGROUPS.pseudosym
49+ # print('test PSEUDOSYM')
50+ # page0 = GSASIIpath.postURL(URL,postdict,
51+ # getcookie=savedcookies,timeout=SUBGROUPS.timeout)
52+ # if page0 is None: assert False,"Web access failed"
53+ # res = SUBGROUPS.scanBilbaoSymSearch1(page0,postdict)+[savedcookies]
54+ # assert res[2]['1'][0] == 'Pn-3m'
55+ # assert abs(float(res[2]['1'][5].split()[0]) - 5.43123/2) < 2e-5
5356
5457def test_BilbaoSymSearch1 ():
5558 print ('\n \n test Bilbao PSEUDO' )
@@ -116,7 +119,6 @@ def test_SUBGROUPS():
116119 assert results [0 ][0 ] == "P21/c"
117120 assert results [- 1 ][0 ] == "P1"
118121
119-
120122def test_GetStdSGset ():
121123 print ('\n \n test Bilbao IDENTIFY GROUP' )
122124 sgnum ,sgsym ,xmat ,xoff = SUBGROUPS .GetStdSGset (G2spc .SpcGroup ('R 3 C r' )[1 ])
@@ -133,6 +135,7 @@ def test_createStdSetting():
133135 rd .SymOps ['xyz' ] = None
134136 cifFile = os .path .join (home ,'testinp' ,'diamond.cif' )
135137 SUBGROUPS .createStdSetting (cifFile ,rd )
138+ assert 'Atoms' in rd .Phase ,'Web access failed'
136139 assert len (rd .Phase ['Atoms' ]) == 1
137140 assert rd .Phase ['General' ]['Cell' ][1 ] == 3.5668
138141 assert len (rd .Phase ['General' ]['SGData' ]['SGOps' ]) == 24
@@ -148,6 +151,7 @@ def test_createStdSetting():
148151if __name__ == '__main__' :
149152 #GSASIIpath.InvokeDebugOpts()
150153 # run self-tests
154+ test_Bilboa_access ()
151155 test_createStdSetting () # nph-cif2std
152156 test_GetStdSGset () # checkgr_gsas.pl
153157 # test_pseudosym() # nph-pseudosym, no longer available
0 commit comments