Skip to content

Commit

Permalink
Removing some comments and useless code and variables
Browse files Browse the repository at this point in the history
  • Loading branch information
mikicanyelles committed Feb 23, 2022
1 parent 8d39264 commit f624ef7
Showing 1 changed file with 5 additions and 24 deletions.
29 changes: 5 additions & 24 deletions RCBS/md_analyser/measurements.py
Original file line number Diff line number Diff line change
@@ -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



Expand Down Expand Up @@ -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 = {}

Expand All @@ -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):
Expand Down Expand Up @@ -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'):
Expand Down Expand Up @@ -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)
Expand All @@ -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']] = []

Expand Down Expand Up @@ -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']
Expand Down Expand Up @@ -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]])):
Expand Down

0 comments on commit f624ef7

Please sign in to comment.