@@ -81,7 +81,7 @@ def calculate(self):
81
81
print (self .hbp .functional_groups )
82
82
83
83
# Generate Training Dataset
84
- self .hbp .match_fitting_data (count = 500 ) # set to 500 for better representation of functional groups
84
+ self .hbp .match_fitting_data (count = 50 ) # set to 500 for better representation of functional groups
85
85
86
86
self .hbp .analyse_fitting_data ()
87
87
@@ -190,13 +190,16 @@ def format_scores(scores, das, d_type):
190
190
return formatted_scores
191
191
192
192
193
- def get_mc_scores (propensities , identifier ):
193
+ def get_mc_scores (propensities , identifier , ignore_intra : bool ):
194
194
# Calculates the multi-component scores from the individual HBP calculation
195
195
AA_propensities = []
196
196
BB_propensities = []
197
197
AB_propensities = []
198
198
BA_propensities = []
199
199
200
+ if ignore_intra is True :
201
+ propensities = [p for p in propensities if p .is_intermolecular ]
202
+
200
203
for p in propensities :
201
204
t = "%s_d" % p .donor_label .split (" " )[0 ], "%s_a" % p .acceptor_label .split (" " )[0 ]
202
205
if '_A_' in t [0 ] and '_A_' in t [1 ]:
@@ -323,7 +326,7 @@ def make_mc_report(identifier, results, directory, diagram_file, chart_file):
323
326
launch_word_processor (output_file )
324
327
325
328
326
- def main (structure , work_directory , failure_directory , library , csdrefcode , force_run ):
329
+ def main (structure , work_directory , failure_directory , library , csdrefcode , ignore_intra , force_run ):
327
330
# This loads up the CSD if a refcode is requested, otherwise loads the structural file supplied
328
331
if csdrefcode :
329
332
try :
@@ -371,10 +374,9 @@ def main(structure, work_directory, failure_directory, library, csdrefcode, forc
371
374
propensities , donors , acceptors = hbp_calculator .calculate ()
372
375
coordination_scores = coordination_scores_calc (crystal , directory )
373
376
pair_output (crystal .identifier , propensities , donors , acceptors , coordination_scores , directory )
377
+ mc_dictionary [coformer_name ] = get_mc_scores (propensities , crystal .identifier , ignore_intra )
374
378
with open (os .path .join (directory , "success.json" ), "w" ) as file :
375
- tdata = get_mc_scores (propensities , crystal .identifier )
376
- json .dump (tdata , file )
377
- mc_dictionary [coformer_name ] = get_mc_scores (propensities , crystal .identifier )
379
+ json .dump (mc_dictionary [coformer_name ], file )
378
380
except Exception as error_message :
379
381
print ("Propensity calculation failure for %s!" % coformer_name )
380
382
error_string = f"{ coformer_name } : { error_message } "
@@ -429,7 +431,8 @@ def main(structure, work_directory, failure_directory, library, csdrefcode, forc
429
431
default = ccdc_coformers_dir )
430
432
parser .add_argument ('-f' , '--failure_directory' , type = str ,
431
433
help = 'The location where the failures file should be generated' )
432
-
434
+ parser .add_argument ('-i' , '--ignore_intra' , action = 'store_true' , default = 'False' ,
435
+ help = 'Ignore intramolecular hydrogen bonds when ranking pairs' )
433
436
parser .add_argument ('--force_run_disordered' , action = "store_true" ,
434
437
help = 'Forces running the script on disordered entries. (NOT RECOMMENDED)' , default = False )
435
438
@@ -447,4 +450,4 @@ def main(structure, work_directory, failure_directory, library, csdrefcode, forc
447
450
parser .error ('%s - library not found.' % args .coformer_library )
448
451
449
452
main (args .input_structure , args .directory , args .failure_directory , args .coformer_library , refcode ,
450
- args .force_run_disordered )
453
+ args .ignore_intra , args . force_run_disordered )
0 commit comments