21
21
import tempfile
22
22
import subprocess
23
23
import json
24
+ import warnings
24
25
25
26
import matplotlib
26
27
32
33
from ccdc .descriptors import CrystalDescriptors
33
34
34
35
try :
35
- import warnings
36
-
37
36
with warnings .catch_warnings ():
38
37
warnings .simplefilter ("ignore" , category = DeprecationWarning )
39
38
import docxtpl
@@ -344,6 +343,11 @@ def main(structure, work_directory, failure_directory, library, csdrefcode, forc
344
343
# for each coformer in the library, make a pair file for the api/coformer and run a HBP calculation
345
344
for i , f in enumerate (coformer_files ):
346
345
molecule_file , coformer_name = make_pair_file (api_molecule , tempdir , f , i + 1 )
346
+ if not io .CrystalReader (f )[0 ].molecule .is_3d :
347
+ failure_warning = f"Could not run for { coformer_name } no 3d coordinates present."
348
+ failures .append (failure_warning )
349
+ warnings .warn (failure_warning )
350
+ continue
347
351
print (coformer_name )
348
352
crystal_reader = io .CrystalReader (molecule_file )
349
353
crystal = crystal_reader [0 ]
@@ -366,7 +370,7 @@ def main(structure, work_directory, failure_directory, library, csdrefcode, forc
366
370
print ("Propensity calculation failure for %s!" % coformer_name )
367
371
print (error_message )
368
372
mc_dictionary [coformer_name ] = ["N/A" , "N/A" , "N/A" , "N/A" , "N/A" , crystal .identifier ]
369
- failures .append (f"coformer_name: { error_message } " )
373
+ failures .append (f"{ coformer_name } : { error_message } " )
370
374
371
375
# Make sense of the outputs of all the calculations
372
376
mc_hbp_screen = sorted (mc_dictionary .items (), key = lambda e : 0 if e [1 ][0 ] == 'N/A' else e [1 ][0 ], reverse = True )
0 commit comments