Package schrodinger :: Package application :: Package matsci :: Module desmondutils
[hide private]
[frames] | no frames]

Module desmondutils

Utilities for working with Desmond.

Copyright Schrodinger, LLC. All rights reserved.

Classes [hide private]
  MSJStringer
A base class for setting up the information and generating a string describing that information for a stage in a Desmond MSJ file.
  MinimizeMSJStringer
An MSJStringer class for Minimizer stages
  MDMSJStringer
An MSJStringer class for Molecular Dynamics stages
  MSAnalysisMSJStringer
An MSJStringer class for MS MD Analysis stages
  BrownieMSJStringer
An MSJStringer class for Brownie stages
  SysbuildMSJStringer
An MSJStringer class for building systems
Functions [hide private]
float
make_chorus_orthorhombic(struct)
Zero out all the non-diagonal Chorus box properties.
float
determine_box_size(struct)
Determine the size of a cubic box that encloses the entire structure
 
add_cubic_chorus_box_props(struct)
Add the Chorus box properties to the structure for a cubic box
 
store_chorus_box_props(struct, ax, ay=0.0, az=0.0, bx=0.0, by=None, bz=0.0, cx=0.0, cy=0.0, cz=None)
Add properties to the structure that define the periodic boundary condition in the way Desmond wants it defined.
bool
has_chorus_box_props(struct)
Check if the structure has all the Chorus box properties
bool
has_space_group_pbc_props(struct)
Check if the structure has all the space group PBC properties
bool
is_opls3_model(model)
Check if the given Cms model was made with OPLS3
bool
is_opls2005_model(model)
Check if the given Cms model was made with OPLS_2005
str
get_model_ff_name(model)
If possible detect what force field the model was created with
(str, str)
write_builder_input(struct, out_name, forcefield='OPLS_2005', rezero_system=True)
Write input for the Desmond System Builder
 
remove_fatal_atom_properties(struct, fatal_atom_properties)
Remove atom properties from struct that cause the system builder to fail
 
copy_atom_properties(struct1, struct2, atom_props)
str or None
run_system_builder(struct_in, output_basename, forcefield='OPLS_2005', rezero_system=True, logger=None, copy_output=True, atom_props_to_keep=[], fatal_atom_properties=['i_ffio_grp_ligand', 'i_ffio_grp_energy', 'i_psp_parent', 'f_...)
Run the Desmond multisim system builder
list
find_forcefield_invalid_structures(structs, ffield_num)
Check structures to see if the specified forcefield is valid for them
(str or None, int)
validate_ff_name_and_get_number(name)
Check that the given name is a valid force field name and if so, return the mmffld number associated with that name
(None, None), or (float, float)
read_density_from_eaf(density_eaf, fraction=0.2, logger=None)
Reads in a .eaf file generated by an ms_analysis stage of a Desmond MD run and returns density data.
str
get_bigger_rclone_setting(for_gpu, check_cg=None)
We use bigger_rclone = true for all non-gpu jobs
str
create_msj(stringers, filename=None, task_stage=True, extra_task_text='', check_cg=None)
Write a Desmond .msj file based on the supplied stringers
list
get_multisim_command(input_name, output_name, msj_name=None, job_name=None, gpu=False, procs=1)
Return a command to run the Desmond multisim utility
float
_get_default_timestep(index)
Get the default value for the timestep at the specified index
float
get_default_near_timestep()
Return the default near timestep
float
get_default_far_timestep()
Return the default far timestep
 
add_cms_property(cms, propname, value)
Add or change a property of cms model
 
delete_cms_property(cms, propname)
Delete a property from a cms model
dict or list
parse_ene_file(filename=None, fileobj=None, prop=None)
Parse data from a Desmond .ene file.
(float, float)
get_density_from_ene(ene_file, struct, fraction=0.2)
Parse the volume from the ene file and compute the density from it.
Variables [hide private]
  __doc__ = ...
  DESMOND_TYPE_PROP = 's_ffio_ct_type'
  COMMAND_TEXT = '\ntask { task = "desmond:auto" }\nassign_force...
  OPLS2005 = 'OPLS_2005'
  OPLS3 = 'OPLS3'
  CHORUS_PROP_PREFIX = 'r_chorus_box_'
  CHORUS_CUBIC_PROPS = ['r_chorus_box_ax', 'r_chorus_box_by', 'r...
  CHORUS_NON_CUBIC_PROPS = ['r_chorus_box_ay', 'r_chorus_box_az'...
  CHORUS_BOX_ALL_PROPS = ['r_chorus_box_ax', 'r_chorus_box_by', ...
  SPACE_GROUP_KEY = 's_pdb_PDB_CRYST1_Space_Group'
  A_KEY = 'r_pdb_PDB_CRYST1_a'
  B_KEY = 'r_pdb_PDB_CRYST1_b'
  C_KEY = 'r_pdb_PDB_CRYST1_c'
  ALPHA_KEY = 'r_pdb_PDB_CRYST1_alpha'
  BETA_KEY = 'r_pdb_PDB_CRYST1_beta'
  GAMMA_KEY = 'r_pdb_PDB_CRYST1_gamma'
  PDB_CRYSTAL_PROPS = ['r_pdb_PDB_CRYST1_a', 'r_pdb_PDB_CRYST1_b...
  FATAL_ATOM_PROPERTIES = ['i_ffio_grp_ligand', 'i_ffio_grp_ener...
  MSJ_FAMILY_HEADER = '\n set_family = {%s }\n '
  DESMOND_FAMILY_HEADER = '\n desmond = {%s\n ...
  __package__ = 'schrodinger.application.matsci'
  x = 'cy'
Function Details [hide private]

make_chorus_orthorhombic(struct)

 

Zero out all the non-diagonal Chorus box properties. The main use of this function is to remove numerical imprecision in the off-diagonal elements that causes Desmond to consider the box triclinic. The function returns the largest off-diagonal element pre-zeroing so the calling routine can decide what to do (warn user, etc) if the off-diagonals looked large enough to be intentionally non-zero.

Parameters:
Returns: float
The absolute value of the largest off-diagonal element before zeroing

determine_box_size(struct)

 

Determine the size of a cubic box that encloses the entire structure

Parameters:
Returns: float
The largest span in the X, Y or Z direction

add_cubic_chorus_box_props(struct)

 

Add the Chorus box properties to the structure for a cubic box

Parameters:

store_chorus_box_props(struct, ax, ay=0.0, az=0.0, bx=0.0, by=None, bz=0.0, cx=0.0, cy=0.0, cz=None)

 

Add properties to the structure that define the periodic boundary condition in the way Desmond wants it defined.

Parameters:
  • struct (schrodinger.structure.Structure) - The structure to add the properties to
  • ax - The value of the ax box property
  • ay - The value of the ay box property. Defaults to 0.
  • az - The value of the az box property. Defaults to 0.
  • bx - The value of the bx box property. Defaults to 0.
  • by - The value of the by box property. If not given, this value is set the same as ax.
  • bz - The value of the bz box property. Defaults to 0.
  • cx - The value of the cx box property. Defaults to 0.
  • cy - The value of the cy box property. Defaults to 0.
  • cz - The value of the cz box property. If not given, this value is set the same as ax.

has_chorus_box_props(struct)

 

Check if the structure has all the Chorus box properties

Parameters:
Returns: bool
Whether the structure has all the chorus box properties

has_space_group_pbc_props(struct)

 

Check if the structure has all the space group PBC properties

Parameters:
Returns: bool
Whether the structure has all the space group pbc properties

is_opls3_model(model)

 

Check if the given Cms model was made with OPLS3

Parameters:
Returns: bool
True if OPLS3 was detected, False if not

is_opls2005_model(model)

 

Check if the given Cms model was made with OPLS_2005

Parameters:
Returns: bool
True if OPLS_2005 was detected, False if not

get_model_ff_name(model)

 

If possible detect what force field the model was created with

Parameters:
Returns: str
The name of the detected forcefield or and empty string if no known force field was detected. FF names are the module constants OPLS3 or OPLS2005

write_builder_input(struct, out_name, forcefield='OPLS_2005', rezero_system=True)

 

Write input for the Desmond System Builder

Parameters:
  • struct (schrodinger.structure.Structure) - The structure to run the system builder on
  • out_name (str) - The base name for the output files
  • forcefield (str) - The forcefield to use
  • rezero_system (bool) - Whether to move the center of mass to the origin
Returns: (str, str)
The names of the .msj and .mae files that were created

remove_fatal_atom_properties(struct, fatal_atom_properties)

 

Remove atom properties from struct that cause the system builder to fail

Parameters:

copy_atom_properties(struct1, struct2, atom_props)

 
Parameters:

run_system_builder(struct_in, output_basename, forcefield='OPLS_2005', rezero_system=True, logger=None, copy_output=True, atom_props_to_keep=[], fatal_atom_properties=['i_ffio_grp_ligand', 'i_ffio_grp_energy', 'i_psp_parent', 'f_...)

 

Run the Desmond multisim system builder

Parameters:
  • struct_in (schrodinger.structure.Structure) - The structure to run the system builder on. If the chorus box properties are not set to define the periodic boundary condition, a cubic PBC will be imposed based on the largest span of the X, Y or Z coordinates.
  • output_basename (str) - The base name of the output file
  • forcefield (str) - The name of the force field to use. The default is 'OPLS_2005'. Note that any custom directory needed for OPLS3 is taken care of via the runtime environment as long as the script was launched via launcher with the oplsdir argument.
  • rezero_system (bool) - Whether to move the center of mass to the origin
  • logger (logging.Logger) - The logger to use to record any messages. If None, the messages are printed.
  • copy_output (bool) - specifies to copy output files back to the launch directory by adding them to the job control backend
  • atom_props_to_keep (list of strings) - Properties to copy to the final structure
  • fatal_atom_properties (tuple of strings) - Properties to remove from structure
Returns: str or None
The name of the resulting .cms file, or None if the file was not produced successfully

find_forcefield_invalid_structures(structs, ffield_num)

 

Check structures to see if the specified forcefield is valid for them

Parameters:
Returns: list
A list containing all the structures that fail the force field test. The list is empty if all structures are valid for the force field

validate_ff_name_and_get_number(name)

 

Check that the given name is a valid force field name and if so, return the mmffld number associated with that name

Parameters:
  • name (str) - The force field name to check
Returns: (str or None, int)
The first item is an error message if an error occurred. The second item is the mmffld integer for the given forcefield, or 0 if an error occurred.

read_density_from_eaf(density_eaf, fraction=0.2, logger=None)

 

Reads in a .eaf file generated by an ms_analysis stage of a Desmond MD run and returns density data.

Parameters:
  • density_eaf (str) - EAF file containing density information
  • fraction (float) - The last fraction of the frames to use in the density averaging
  • logger (logging.Logger) - The logger to use while logging errors. If not supplied, messages will be printed.
Returns: (None, None), or (float, float)
(None, None) if the density cannot be read from the file, or tuple of the calculated density and standard deviation.

get_bigger_rclone_setting(for_gpu, check_cg=None)

 

We use bigger_rclone = true for all non-gpu jobs

Parameters:
  • for_gpu (bool) - True if this is for a cpu run, False if not
  • check_cg (schrodinger.structure.Structure) - Check the given structure to see if it is coarse grain and return the value appropriate for coarse grain structures.
Returns: str
The value to set bigger_rclone to in the .msj file

create_msj(stringers, filename=None, task_stage=True, extra_task_text='', check_cg=None)

 

Write a Desmond .msj file based on the supplied stringers

Parameters:
  • filename (str) - If given, write the msj string to this path
  • stringers (list of MSJStringer objects) - Each item of the list is the MSJStringer for a single stage. The stages will be written in list order
  • task_stage (bool) - Whether the traditional desmond auto task stage should be written before the stages in stringers
  • extra_task_text (str) - Additional text to place in the task stage. Ignored if task_stage=False.
  • check_cg (schrodinger.structure.Structure) - Check the given structure to see if it is coarse grain. If it is, add the typical headers for the appropriate coarse grain structure type. Note that the interplay between extra_task_test and the headers used for coarse grain structures is uncertain and left to the caller to determine if the results are acceptable if both are used. Ignored if task_stage=False.
Returns: str
The string that was written to the file

get_multisim_command(input_name, output_name, msj_name=None, job_name=None, gpu=False, procs=1)

 

Return a command to run the Desmond multisim utility

Parameters:
  • input_name (str) - The name of the input file
  • output_name (str) - The name to use for the output CMS file
  • msj_name (str) - The name of the .msj command file
  • job_name (str) - The name to use for the job
  • gpu (bool) - Whether the job will run on gpu. Will override the procs keyword
  • procs (int) - The number of CPU processors to use. Will not be used if gpu=True
Returns: list
The command line command to use

_get_default_timestep(index)

 

Get the default value for the timestep at the specified index

Parameters:
  • index (int) - Index of the default timestep to return. Should be 0, 1 or 2
Returns: float
The default value of the far timestep in femtoseconds

get_default_near_timestep()

 

Return the default near timestep

Returns: float
Default near timestep in femtoseconds

get_default_far_timestep()

 

Return the default far timestep

Returns: float
Default far timestep in femtoseconds

add_cms_property(cms, propname, value)

 

Add or change a property of cms model

Parameters:
  • cms (cms.Cms) - cms model
  • propname (str) - property name
  • value (str, int, or float) - value of the property

delete_cms_property(cms, propname)

 

Delete a property from a cms model

Parameters:
  • cms (cms.Cms) - cms model
  • propname (str) - property name

parse_ene_file(filename=None, fileobj=None, prop=None)

 

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) - 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.
  • 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
Returns: dict or list
If prop is not specified, the return value is a dict. 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 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

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 for
  • fraction (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.
Returns: (float, float)
The mean density and standard deviation of the density.
Raises:
  • IOError - If unable to read the volumes from the ene file

Variables Details [hide private]

__doc__

Value:
"""
Utilities for working with Desmond.

Copyright Schrodinger, LLC. All rights reserved.
"""

COMMAND_TEXT

Value:
'''
task { task = "desmond:auto" }
assign_forcefield { compress = "" }
'''

CHORUS_CUBIC_PROPS

Value:
['r_chorus_box_ax', 'r_chorus_box_by', 'r_chorus_box_cz']

CHORUS_NON_CUBIC_PROPS

Value:
['r_chorus_box_ay',
 'r_chorus_box_az',
 'r_chorus_box_bx',
 'r_chorus_box_bz',
 'r_chorus_box_cx',
 'r_chorus_box_cy']

CHORUS_BOX_ALL_PROPS

Value:
['r_chorus_box_ax',
 'r_chorus_box_by',
 'r_chorus_box_cz',
 'r_chorus_box_ay',
 'r_chorus_box_az',
 'r_chorus_box_bx',
 'r_chorus_box_bz',
 'r_chorus_box_cx',
...

PDB_CRYSTAL_PROPS

Value:
['r_pdb_PDB_CRYST1_a',
 'r_pdb_PDB_CRYST1_b',
 'r_pdb_PDB_CRYST1_c',
 'r_pdb_PDB_CRYST1_alpha',
 'r_pdb_PDB_CRYST1_beta',
 'r_pdb_PDB_CRYST1_gamma']

FATAL_ATOM_PROPERTIES

Value:
['i_ffio_grp_ligand',
 'i_ffio_grp_energy',
 'i_psp_parent',
 'f_psp_parent',
 's_psp_parent']

DESMOND_FAMILY_HEADER

Value:
'''
      desmond = {%s
                       }
      '''