@@ -120,33 +120,40 @@ def GetISODISTORT(Phase):
120120 print ('method 3 TBD' )
121121 return [],[]
122122 elif ISOdata ['ISOmethod' ] == 4 :
123- childcif = ISOdata ['ChildCIF' ]
124- if 'Use this phase' in childcif :
125- childcif = MakePhaseCif (Phase )
126- print (' Run ISODISTORT with %s as child cif' % childcif )
127- ISOchildcif = UploadCIF (childcif )
128- data ['input' ] = 'uploadsubgroupcif'
129- data ['filename' ] = ISOchildcif
130- out24 = requests .post (isoformsite ,data = data ).text
131- posB = out24 .index ('OPTION VALUE=' )
132- posF = out24 [posB :].index ('>' )+ posB
133- value = out24 [posB + 13 :posF ]
134- data ['input' ] = 'distort'
135- data ['origintype' ] = 'method4'
136- data ['inputbasis' ] = 'list'
137- data ['basisselect' ] = value [1 :- 1 ]
138- data ['chooseorigin' ] = False
139- data ['trynearest' ] = True
140- data ['dmax' ] = '1'
141- out25 = requests .post (isoformsite ,data = data ).text
142- cifout = GetISOcif (out25 ,4 )
143- if cifout is None :
144- return None ,None
145- cifFile = '%s_%s.cif' % (Phase ['General' ]['Name' ],'child' )
146- fl = open (cifFile ,'wb' )
147- fl .write (cifout .encode ("utf-8" ))
148- fl .close ()
149- return [],cifFile
123+ try :
124+ childcif = ISOdata ['ChildCIF' ]
125+ if 'Use this phase' in childcif :
126+ childcif = MakePhaseCif (Phase )
127+ print (' Run ISODISTORT with %s as child cif' % childcif )
128+ ISOchildcif = UploadCIF (childcif )
129+ data ['input' ] = 'uploadsubgroupcif'
130+ data ['filename' ] = ISOchildcif
131+ out24 = requests .post (isoformsite ,data = data ).text
132+ posB = out24 .index ('OPTION VALUE=' )
133+ posF = out24 [posB :].index ('>' )+ posB
134+ value = out24 [posB + 13 :posF ]
135+ data ['input' ] = 'distort'
136+ data ['origintype' ] = 'method4'
137+ data ['inputbasis' ] = 'list'
138+ data ['basisselect' ] = value [1 :- 1 ]
139+ data ['chooseorigin' ] = False
140+ data ['trynearest' ] = True
141+ data ['dmax' ] = '1'
142+ out25 = requests .post (isoformsite ,data = data ).text
143+ cifout = GetISOcif (out25 ,4 )
144+ if cifout is None :
145+ return None ,None
146+ cifFile = '%s_%s.cif' % (Phase ['General' ]['Name' ],'child' )
147+ fl = open (cifFile ,'wb' )
148+ fl .write (cifout .encode ("utf-8" ))
149+ fl .close ()
150+ return [],cifFile
151+ except :
152+ print ('Output from ISODISTORT follows' )
153+ if '<H1>' in out24 : out24 = out24 .split ('<H1>' ,1 )[1 ]
154+ print (out24 )
155+ print ('Scan of output from ISODISTORT failed, see above' )
156+ return [],[]
150157
151158 #do the distortion search - result is radio button list of choices
152159
0 commit comments