@@ -314,14 +314,18 @@ def make_mc_report(identifier, results, directory, diagram_file, chart_file):
314
314
launch_word_processor (output_file )
315
315
316
316
317
- def main (structure , work_directory , failure_directory , library , csdrefcode ):
317
+ def main (structure , work_directory , failure_directory , library , csdrefcode , force_run ):
318
318
# This loads up the CSD if a refcode is requested, otherwise loads the structural file supplied
319
319
if csdrefcode :
320
320
try :
321
321
crystal = io .CrystalReader ('CSD' ).crystal (structure )
322
322
except RuntimeError :
323
323
print ('Error! %s is not in the database!' % structure )
324
324
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." )
325
329
else :
326
330
crystal = io .CrystalReader (structure )[0 ]
327
331
@@ -413,6 +417,9 @@ def main(structure, work_directory, failure_directory, library, csdrefcode):
413
417
parser .add_argument ('-f' , '--failure_directory' , type = str ,
414
418
help = 'The location where the failures file should be generated' )
415
419
420
+ parser .add_argument ('--force_run_disordered' , action = "store_true" ,
421
+ help = 'Forces running the script on disordered entries. (NOT RECOMMENDED)' , default = False )
422
+
416
423
args = parser .parse_args ()
417
424
refcode = False
418
425
args .directory = os .path .abspath (args .directory )
@@ -426,4 +433,5 @@ def main(structure, work_directory, failure_directory, library, csdrefcode):
426
433
if not os .path .isdir (args .coformer_library ):
427
434
parser .error ('%s - library not found.' % args .coformer_library )
428
435
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