From f624ef7bc1b72530e300686373e96e297cd8b832 Mon Sep 17 00:00:00 2001 From: Miquel Canyelles Date: Wed, 23 Feb 2022 13:47:03 +0100 Subject: [PATCH] Removing some comments and useless code and variables --- RCBS/md_analyser/measurements.py | 29 +++++------------------------ 1 file changed, 5 insertions(+), 24 deletions(-) diff --git a/RCBS/md_analyser/measurements.py b/RCBS/md_analyser/measurements.py index fb45cbb..8837ebd 100644 --- a/RCBS/md_analyser/measurements.py +++ b/RCBS/md_analyser/measurements.py @@ -1,10 +1,8 @@ -from MDAnalysis import Universe from MDAnalysis.core.groups import AtomGroup import MDAnalysis.lib.distances as mdadist -from ..exceptions import NotEnoughAtomsSetectedError, NotExistingInteraction, NotSingleAtomSelectionError, NotExistingInteraction, OutputFormatNotAvailable +from ..exceptions import NotExistingInteraction, NotSingleAtomSelectionError, NotExistingInteraction, OutputFormatNotAvailable from numpy import min as npmin -from numpy import array, matrix -from numpy.linalg import norm +from numpy import array @@ -33,10 +31,7 @@ class Measurements: def __init__(self, u): self.measurements = [] - #self.options = [] - #self.type = [] self.universe = u - #self.trajectory = u.trajectory self.results = {} self.boolean = {} @@ -54,16 +49,12 @@ def add_distance(self, name, sel1, sel2): - Shorter distance between sel1 and sel2 (in ang) """ - self.measurements.append( - { + self.measurements.append({ 'name' : name, 'type' : 'distance', 'sel' : [sel1, sel2], 'options' : None, - # 'measure' : None, - } - #npmin(mdadist.distance_array(array(sel1), array(sel2), backend='OpenMP')) - ) + }) def add_dihedral(self, name, sel1, sel2, sel3, sel4, units='degree', domain=360): @@ -250,9 +241,6 @@ def config_saver(self, config_filename, verbose=True): OUTPUT: - the dictionary saved in the file - - TODO: - - [] Check what happens when selections are not AtomGroups but indices or names """ if config_filename.split('.')[-1].lower() not in ('json', 'jsn', 'yaml', 'yml'): @@ -306,16 +294,13 @@ def config_saver(self, config_filename, verbose=True): return config - #def load_results(): - - def run_measure(self, save_output=False, input_config=False, verbose=True): + def run_measure(self, save_output=False, verbose=True): """ DESCRIPTION: Function for runninng all the configured measurments on a given trajectory (loaded as self.universe). It can take also a configuration stored in a file instead of taking the in-situ configurated measurement. OPTIONS: - save_output: Pseudoboolean value for storing the resutls as a file. False means no storing, any other string with the json or yaml extension means save the results in a file called as given. - - input_config: Pseudoboolean value for loading a configuration file. It is checked in order to find missing information that may lead to errors on the runninng. INPUT: - self: containing self.universe and self.measurements (if not loading a configuration file) @@ -324,7 +309,6 @@ def run_measure(self, save_output=False, input_config=False, verbose=True): - self.results: dictionary containing arrays of the results keyed by the given name of the configuration. """ - #results = {} for measurement in self.measurements: self.results[measurement['name']] = [] @@ -496,7 +480,6 @@ def bool_configs_checker(bool_configs): for b in bool_configs: - if b['mode'] == 'lim': if b['ref_val1'] >= b['ref_val2']: max_val = b['ref_val1'] @@ -545,8 +528,6 @@ def bool_configs_checker(bool_configs): self.boolean[b['measure_name']].append(bool(r_ <= max_val and r_ > min_val)) - - if combine == True: self.boolean['combination'] = [] for f in range(len(self.boolean[list(self.boolean.keys())[0]])):