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
(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
list
get_pbc_bonds_from_atoms(astructure, atoms)
Return any PBC bonds that exist between pairs of the given atoms.
bool
is_disconnected(astructure)
Return a boolean indicating whether the given structure is disconnected, meaning that it contains at least one molecule (more specifically finite molecule) with at least one PBC bond.
bool
is_infinite(astructure)
Return a boolean indicating whether the given structure is infinitely bonded, meaning that it is not disconnected (see is_disconnected) and has at least a single PBC bond (used to distinguish it from finite intact molecules).
(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
create_msj(stringers, filename=None, task_stage=True)
Write a Desmond .msj file based on the supplied stringers
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
Variables [hide private]
  __doc__ = ...
  DESMOND_TYPE_PROP = 's_ffio_ct_type'
  COMMAND_TEXT = '\ntask { task = "desmond:auto" }\nassign_force...
  OPLS2005 = 'OPLS_2005'
  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...
  PBC_BOND_KEY = 'b_matsci_PBC_bond'
  ALSO_REG_BOND_KEY = 'b_matsci_also_reg_bond'
  FATAL_ATOM_PROPERTIES = ['i_ffio_grp_ligand', 'i_ffio_grp_ener...
  __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

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.

get_pbc_bonds_from_atoms(astructure, atoms)

 

Return any PBC bonds that exist between pairs of the given atoms.

Parameters:
Returns: list
a list of schrodinger.structure._StructureBond objects for the PBC bonds

is_disconnected(astructure)

 

Return a boolean indicating whether the given structure is disconnected, meaning that it contains at least one molecule (more specifically finite molecule) with at least one PBC bond. As an example of a disconnected structure consider a fragmented molecule whose fragments are connected by PBC bonds. Assumes any PBC bonds in the input structure are marked with the PBC_BOND_KEY property.

Parameters:
Returns: bool
True if disconnected, False otherwise

is_infinite(astructure)

 

Return a boolean indicating whether the given structure is infinitely bonded, meaning that it is not disconnected (see is_disconnected) and has at least a single PBC bond (used to distinguish it from finite intact molecules). If any molecule in the given structure is not infinitely bonded then the structure itself is not considered infinite. As an example of an infinite structure consider graphene, gold, infinite polymer, etc. Assumes any PBC bonds in the input structure are marked with the PBC_BOND_KEY property.

Parameters:
Returns: bool
True if infinite, False otherwise

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.

create_msj(stringers, filename=None, task_stage=True)

 

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
Returns: str
The string that was written to the file

_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

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']