@@ -314,14 +314,18 @@ def make_mc_report(identifier, results, directory, diagram_file, chart_file):
314314 launch_word_processor (output_file )
315315
316316
317- def main (structure , work_directory , failure_directory , library , csdrefcode ):
317+ def main (structure , work_directory , failure_directory , library , csdrefcode , force_run ):
318318 # This loads up the CSD if a refcode is requested, otherwise loads the structural file supplied
319319 if csdrefcode :
320320 try :
321321 crystal = io .CrystalReader ('CSD' ).crystal (structure )
322322 except RuntimeError :
323323 print ('Error! %s is not in the database!' % structure )
324324 quit ()
325+ if io .CrystalReader ('CSD' ).entry (structure ).has_disorder and not force_run :
326+ raise RuntimeError ("Disorder can cause undefined behaviour. It is not advisable to run this "
327+ "script on disordered entries.\n To force this script to run on disordered entries"
328+ " use the flag --force_run_disordered." )
325329 else :
326330 crystal = io .CrystalReader (structure )[0 ]
327331
@@ -413,6 +417,9 @@ def main(structure, work_directory, failure_directory, library, csdrefcode):
413417 parser .add_argument ('-f' , '--failure_directory' , type = str ,
414418 help = 'The location where the failures file should be generated' )
415419
420+ parser .add_argument ('--force_run_disordered' , action = "store_true" ,
421+ help = 'Forces running the script on disordered entries. (NOT RECOMMENDED)' , default = False )
422+
416423 args = parser .parse_args ()
417424 refcode = False
418425 args .directory = os .path .abspath (args .directory )
@@ -426,4 +433,5 @@ def main(structure, work_directory, failure_directory, library, csdrefcode):
426433 if not os .path .isdir (args .coformer_library ):
427434 parser .error ('%s - library not found.' % args .coformer_library )
428435
429- main (args .input_structure , args .directory , args .failure_directory , args .coformer_library , refcode )
436+ main (args .input_structure , args .directory , args .failure_directory , args .coformer_library , refcode ,
437+ args .force_run_disordered )
0 commit comments