schrodinger.application.desmond.ene_utils module¶
- class schrodinger.application.desmond.ene_utils.EneGrpProp¶
Bases:
object
Class that contains the information in a Desmond .enegrp (energy group) file
- RAW_POTENTIAL = 'en'¶
- POTENTIAL_ENERGY = 'E_p'¶
- KINETIC_ENERGY = 'E_k'¶
- EXTENDED_ENERGY = 'E_x'¶
- PRESSURE = 'P'¶
- VOLUME = 'V'¶
- DISP_CORR = 'Dispersion_Correction'¶
- ENERGY_CORR = 'Self_Energy_Correction'¶
- CHARGE_CORR = 'Net_Charge_Correction'¶
- GBL_FORCE = 'Global_Force_Sum'¶
- DRIFT_VEL = 'Kinetic'¶
- PAIR_ELEC = 'pair_elec'¶
- PAIR_VDW = 'pair_vdw'¶
- BOND_ENERGY = 'stretch'¶
- ANGLE_ENERGY = 'angle'¶
- DIHED_ENERGY = 'dihedral'¶
- FAR_EXCLUSION = 'far_exclusion'¶
- NON_BONDED_ELEC = 'nonbonded_elec'¶
- NON_BONDED_VDW = 'nonbonded_vdw'¶
- FAR_TERMS = 'far_terms'¶
- TOTAL_ENERGY = 'Total'¶
- VIRIAL = 'Virial'¶
- KINETIC_TENSOR = 'K.E.tensor'¶
- PRESS_TENSOR = 'Pressure_Tensor'¶
- SIM_BOX = 'Simulation_Box'¶
- class schrodinger.application.desmond.ene_utils.ENEGRP_VALUE(time, value)¶
Bases:
tuple
- time¶
Alias for field number 0
- value¶
Alias for field number 1
- schrodinger.application.desmond.ene_utils.parse_ene_file(filename=None, fileobj=None, prop=None, gcmc=False)¶
Parse data from a Desmond .ene file. All the data from the file can be returned in a dictionary, or just the data from a single property can be returned in a list.
- Parameters
filename (str) – The name of the .ene file to read
fileobj (file or io.BufferedReader) – The open file object for the .ene file. Only one of filename or fileobj should be supplied. If both are given, filename will take precedence. io.BufferedReader objects come from tarfile.extractfile, for instance. Note - in Python 3, open file objects are io.TextIOWrapper
prop (str) – If given, should match one of the properties in the ene file header (such as ‘V’). The return value will be a list of values for this property only
gcmc (bool) – Whether to parse GMCM or a standard MD file
- Return type
dict, dict, or list, list or dict or list
- Returns
If prop is not specified, the return value is a dict if gcmc is False, otherwise two dicts. Keys are property names from the ene header (without units, such as ‘V’) and values are lists of floating point values for that property in the order obtained from the .ene file. If prop is specified, the return value is a list if gcmc is False, otherwise two lists of those property values in the order found in the .ene file.
- Raises
ValueError – If a line of unknown format is found while reading the file, or if neither filename or fileobj is specified.
TypeError – If prop is supplied but does not match a property in the header line
- schrodinger.application.desmond.ene_utils.get_density_from_ene(ene_file, struct, fraction=0.2)¶
Parse the volume from the ene file and compute the density from it. The density is averaged over the last fraction of frames.
- Parameters
ene_file (str) – The name of the file to read in.
struct (
schrodinger.structure.Structure
) – The structure to compute the density forfraction (float) – The fraction of frames to average the density over. For instance, use 0.20 to compute the density over the final 20% of frames. Use the special value 0 to just use the final density. With fraction=0, the returned standard deviation is 0.
- Return type
(float, float)
- Returns
The mean density and standard deviation of the density.
- Raises
IOError – If unable to read the volumes from the ene file (from get_prop_from_ene method)
- schrodinger.application.desmond.ene_utils.get_prop_from_ene(ene_file, prop, fraction=0.2, reciprocal=False, include_first=False, average=True)¶
Parse the ene file and compute mean and std for a specific property. The property is averaged over the last fraction of frames.
- Parameters
ene_file (str) – The name of the file to read in.
prop (str) – The name of the property to read in
fraction (float) – The fraction of frames to average the density over. For instance, use 0.20 to compute the prop over the final 20% of frames. Use the special value 0 to just use the final density. With fraction=0, the returned standard deviation is 0.
reciprocal (bool) – If True, the mean and std will be done on the reciprocal of the property values.
include_first (bool) – If true, the first entry of the ene file will be included in averaging.
average (bool) – If true, the average and std of the property will be returned. If false, then a list of the values will be returned.
- Return type
(float, float) or list
- Returns
The mean property and standard deviation of the property or the list of values if average=False. (or the reciprocal ones if reciprocal=True)
- Raises
IOError – If unable to read the volumes from the ene file
ValueError – If data have zeros, and the reciprocal of them are requested.
- schrodinger.application.desmond.ene_utils.get_cutoff(length: int, percent: float)¶
Get cutoff given length and percent
- Parameters
length – Length
percent – Percent for the cutoff
- Return int
Cutoff (minimum 1)
- schrodinger.application.desmond.ene_utils.parse_enegrp_file(enegrp_fn, props=['angle', 'stretch', 'Net_Charge_Correction', 'dihedral', 'Dispersion_Correction', 'Kinetic', 'Self_Energy_Correction', 'E_x', 'far_exclusion', 'far_terms', 'Global_Force_Sum', 'E_k', 'K.E.tensor', 'nonbonded_elec', 'nonbonded_vdw', 'pair_elec', 'pair_vdw', 'E_p', 'P', 'Pressure_Tensor', 'en', 'Simulation_Box', 'Total', 'Virial', 'V'])¶
Parse data from a Desmond
*enegrp.dat
file. All the data from the file can be returned in a dictionary where key is the property name and values are dict, key is the time and values are the property value at that time.- Parameters
enegrp_fn (str) – name of enegrp file to read
- Props list props
list of properties to parse. Check ALL_ENEGRP_PROPS for the list of supported properties.
- Return type
dict
- Returns
dictionary where key is the property name and values are namedtuple. The namedtuple has two fields, time and value. The value is the value for the property at that timestep. Value at the timestep can be a float or a list depending on the property.
- schrodinger.application.desmond.ene_utils.get_ptensor_from_enegrp(enegrp_fn, percent_to_avg, log=None)¶
Extract and calculate average pressure from an energy group file.
- Parameters
enegrp_fn (str) – Energy group filename
percent_to_avg (float) – Percent to use when averaging pressure tensor
log (method) – Log method
- Return type
numpy.array()
- Returns
Averaged pressure tensor
- schrodinger.application.desmond.ene_utils.get_lattice_param_from_enegrp(enegrp_fn, percent_to_avg)¶
Extract and calculate average lattice parameter from an energy group file.
- Parameters
enegrp_fn (str) – Energy group filename
percent_to_avg (float) – Percent to use when averaging lattice parameter
- Raises
IOError – fail in reading enegrp file
- Return type
numpy.ndarray
- Returns
Averaged lattice parameters matrix