schrodinger.application.desmond.meta module

Module for all metadynamics backend functionality

class schrodinger.application.desmond.meta.CV(dim, width, wall, floor)

base class for collective variable

getMExpr(model, cvid)
class schrodinger.application.desmond.meta.CVAngle(p0, p1, p2, width, wall, floor)

Bases: schrodinger.application.desmond.meta.CV

A class to define angle collective variable. Note that due to numerical instability, cosine of the angle is used instead of radian.

cvangle_floor_template = "\n# lower bound wall or 'floor' params for %(cvname)s are: width is 0.57 degree;\n# location at %(floor)f; # hight is 1000\n%(cvname)s_floor = 1000/(1 + (exp((acos(%(cvname)s)- %(floor)f)/0.05)) );\n"
cvangle_grp_template = '\n# angle definition for group of atoms\n%(cvname)s_g0 = center_of_mass ( %(p0_atomsel)s );\n%(cvname)s_g1 = center_of_mass ( %(p1_atomsel)s );\n%(cvname)s_g2 = center_of_mass ( %(p2_atomsel)s );\n%(cvname)s_v0 = min_image(%(cvname)s_g0 - %(cvname)s_g1);\n%(cvname)s_v1 = min_image(%(cvname)s_g2 - %(cvname)s_g1);\n%(cvname)s = angle(%(cvname)s_v0, %(cvname)s_v1);\nprint ("%(cvname)s", acos(%(cvname)s) );\n# the width for %(cvname)s will be set to: %(width)s\n '
cvangle_template = '\n# angle definition\n%(cvname)s_p0 = %(p0_atomsel)s;\n%(cvname)s_p1 = %(p1_atomsel)s;\n%(cvname)s_p2 = %(p2_atomsel)s;\n%(cvname)s = angle_gid(%(cvname)s_p0, %(cvname)s_p1, %(cvname)s_p2);\nprint ("%(cvname)s", acos(%(cvname)s) );\n# the width for %(cvname)s will be set to: %(width)s\n'
cvangle_wall_template = '\n# the upper bound, wall params for %(cvname)s are: width is 0.57 degree;\n# location at %(wall)f; hight is 1000\n%(cvname)s_wall = 1000 / (1 + exp(( %(wall)f - acos(%(cvname)s))/0.05) );\n'
getMExpr(model, cvname)
class schrodinger.application.desmond.meta.CVDihedral(p0, p1, p2, p3, width, wall, floor)

Bases: schrodinger.application.desmond.meta.CV

A class to define dihedral collective variable. Note that this collective variable is a two dimensional one. The first element is the cosine of the dihedral, and the second element is the sine of the dihedral angle.

cvdihedral_grp_template = '\n# dihedral definition for group of atoms\n%(cvname)s_g0 = center_of_mass ( %(p0_atomsel)s);\n%(cvname)s_g1 = center_of_mass ( %(p1_atomsel)s);\n%(cvname)s_g2 = center_of_mass ( %(p2_atomsel)s);\n%(cvname)s_g3 = center_of_mass ( %(p3_atomsel)s);\n\n%(cvname)s_v0 = min_image(%(cvname)s_g1 - %(cvname)s_g0);\n%(cvname)s_v1 = min_image(%(cvname)s_g2 - %(cvname)s_g1);\n%(cvname)s_v2 = min_image(%(cvname)s_g3 - %(cvname)s_g2);\n\n%(cvname)s = dihedral(%(cvname)s_v0, %(cvname)s_v1, %(cvname)s_v2);\nprint ("%(cvname)s", atan2(%(cvname)s[1],%(cvname)s[0]));\n# the width for %(cvname)s will be set to: %(width)s\n'
cvdihedral_template = '\n# dihedral definition\n%(cvname)s_p0 = %(p0_atomsel)s;\n%(cvname)s_p1 = %(p1_atomsel)s;\n%(cvname)s_p2 = %(p2_atomsel)s;\n%(cvname)s_p3 = %(p3_atomsel)s;\n%(cvname)s = dihedral_gid(%(cvname)s_p0, %(cvname)s_p1, %(cvname)s_p2, %(cvname)s_p3);\nprint ("%(cvname)s", atan2(%(cvname)s));\n# the width for %(cvname)s will be set to: %(width)s\n'
getMExpr(model, cvname)
class schrodinger.application.desmond.meta.CVDist(p0, p1, width, wall, floor)

Bases: schrodinger.application.desmond.meta.CV

distance collective variable

cvdist_floor_template = "\n# lower bound wall or 'floor' params for %(cvname)s are: width is 0.2;\n# location at %(floor)f; # hight is 1000\n%(cvname)s_floor = 1000 / (1 + exp((%(cvname)s - %(floor)f) / 0.2) );\n\n"
cvdist_grp_template = '\n# distance definition for group of atoms\n%(cvname)s_g0 = center_of_mass ( %(p0_atomsel)s );\n%(cvname)s_g1 = center_of_mass ( %(p1_atomsel)s );\n%(cvname)s = norm(min_image(%(cvname)s_g0 - %(cvname)s_g1));\nprint ("%(cvname)s", %(cvname)s);\n# the width for %(cvname)s will be set to: %(width)s\n'
cvdist_template = '\n# distance definition\n%(cvname)s_p0 = %(p0_atomsel)s;\n%(cvname)s_p1 = %(p1_atomsel)s;\n%(cvname)s = dist(%(cvname)s_p0, %(cvname)s_p1);\nprint ("%(cvname)s", %(cvname)s);\n# the width for %(cvname)s will be set to: %(width)s\n'
cvdist_wall_template = '\n# the upper bound, wall params for %(cvname)s are: width is 0.2;\n# location at %(wall)f; hight is 1000\n%(cvname)s_wall = 1000 / (1 + exp(( %(wall)f - %(cvname)s) / 0.2) );\n'
getMExpr(model, cvname)
class schrodinger.application.desmond.meta.CVrgyr(atomlist, width)

Bases: schrodinger.application.desmond.meta.CV

Radius of Gyration Collective Variable

cvrgyr_template = '\n#radius of gyration definition\n%(cvname)s_sel = %(atomlist)s;\n%(cvname)s_cog = center_of_geometry(%(cvname)s_sel);\n%(cvname)s_coord_range = series (i=0:length(%(cvname)s_sel))\n norm2(min_image(pos(%(cvname)s_sel[i])-%(cvname)s_cog));\n%(cvname)s=sqrt(%(cvname)s_coord_range/length(%(cvname)s_sel));\nprint ("%(cvname)s", %(cvname)s);\n# the width for %(cvname)s will be set to: %(width)s\n'
getMExpr(model, cvname)
class schrodinger.application.desmond.meta.CVrgyr_mass(atomlist, width)

Bases: schrodinger.application.desmond.meta.CV

Radius of Gyration Collective Variable

cvrgyr_mass_template = '\n#mass-weighted radius of gyration definition\n%(cvname)s_sel = %(atomlist)s;\n%(cvname)s_com = center_of_mass(%(cvname)s_sel);\n%(cvname)s_coord_range = series (i=0:length(%(cvname)s_sel))\n mass(%(cvname)s_sel[i])*norm2(min_image(pos(%(cvname)s_sel[i])-%(cvname)s_com));\n%(cvname)s=sqrt(%(cvname)s_coord_range/sum(mass(%(cvname)s_sel)));\nprint ("%(cvname)s", %(cvname)s);\n# the width for %(cvname)s will be set to: %(width)s\n\n'
getMExpr(model, cvname)
class schrodinger.application.desmond.meta.CVrmsd(atomlist, xyz_coords_ref, width, rmsd_weights=None, superpos_weights=None)

Bases: schrodinger.application.desmond.meta.CV

rmsd collective variable

cvrmsd_template = '\n# rmsd definition\n%(cvname)s_sel = %(atomlist)s;\n%(cvname)s_ref = array( %(xyz_ref)s );\n%(cvname)s = rmsd( %(cvname)s_ref, %(cvname)s_sel );\nprint ("%(cvname)s", %(cvname)s);\n# the width for %(cvname)s will be set to: %(width)s\n'
cvrmsd_weights_template = '\n# rmsd definition\n%(cvname)s_sel = %(atomlist)s;\n%(cvname)s_ref = array( %(xyz_ref)s );\n%(cvname)s_rmsd_weights = array( %(rmsd_weights)s );\n%(cvname)s_superpos_weights = array( %(superpos_weights)s );\n%(cvname)s = rmsd( %(cvname)s_ref, %(cvname)s_sel, %(cvname)s_rmsd_weights, %(cvname)s_superpos_weights );\nprint ("%(cvname)s", %(cvname)s);\n# the width for %(cvname)s will be set to: %(width)s\n'
getMExpr(model, cvname)
class schrodinger.application.desmond.meta.CVrmsd_symm(atomlist, xyz_coords_ref_list, width)

Bases: schrodinger.application.desmond.meta.CV

rmsd collective variable

cvrmsd_conf_template = '\n# rmsd_symm definition #%(confnum)s\n%(cvname)s_ref_%(confnum)s = array( %(xyz_ref)s );\n%(cvname)s_%(confnum)s = rmsd( %(cvname)s_ref_%(confnum)s, %(cvname)s_sel );\n'
cvrmsd_setup_template = '\n# setting up rmsd_symm with total of %(nconfs)s conformations\n%(cvname)s_sel = %(atomlist)s;\n\n'
cvrmsd_template = '\n%(cvname)s = min( array( %(confs)s ));\nprint ("%(cvname)s", %(cvname)s );\n# the width for %(cvname)s will be set to: %(width)s\n'
getMExpr(model, cvname)
class schrodinger.application.desmond.meta.CVwhim(atomlist, eigval, width)

Bases: schrodinger.application.desmond.meta.CV

whim collective variable

cvwhim_template = '\n#whim definition\n%(cvname)s_sel = %(atomlist)s;\n%(cvname)s_whim = whim(%(cvname)s_sel, mass(%(cvname)s_sel));\n%(cvname)s = %(cvname)s_whim[%(eigval)i];\nprint ("%(cvname)s", %(cvname)s);\n# the width for %(cvname)s will be set to: %(width)s\n'
getMExpr(model, cvname)
class schrodinger.application.desmond.meta.CVzdist(atomlist, width, wall, floor)

Bases: schrodinger.application.desmond.meta.CV

This collective variable reports an absolute Z-distance. this CV is used for membrane penetration studies.

cvdist_floor_template = "\n# lower bound wall or 'floor' params for %(cvname)s are: width is 0.2;\n# location at %(floor)f; # hight is 1000\n%(cvname)s_floor = 1000 / (1 + exp((%(cvname)s - %(floor)f) / 0.2) );\n"
cvdist_wall_template = '\n# the upper bound, wall params for %(cvname)s are: width is 0.2;\n# location at %(wall)f; hight is 1000\n%(cvname)s_wall = 1000 / (1 + exp(( %(wall)f - %(cvname)s) / 0.2) );\n'
cvzdist_template = '\n# Z-dist definition\n%(cvname)s_g0 = center_of_mass ( %(atomlist)s );\n%(cvname)s = %(cvname)s_g0[2];\nprint ("%(cvname)s", %(cvname)s);\n# the width for %(cvname)s will be set to: %(width)s\n'
getMExpr(model, cvname)
class schrodinger.application.desmond.meta.CVzdist0(atomlist, width)

Bases: schrodinger.application.desmond.meta.CV

This collective variable reports an absolute Z-distance from the simulation box origin (Z==0). This cv is useful when for membrane penetration studies.

cvzdist0_template = '\n# Z-dist definition\n%(cvname)s_g0 = center_of_mass ( %(atomlist)s );\n%(cvname)s_z = %(cvname)s_g0[2];\n%(cvname)s = sqrt(%(cvname)s_z^2);\nprint ("%(cvname)s", %(cvname)s);\n# the width for %(cvname)s will be set to: %(width)s\n'
getMExpr(model, cvname)
class schrodinger.application.desmond.meta.CmsModel(model)
atid2atomsel(atid)
class schrodinger.application.desmond.meta.Meta
addCV(cv)
declare_template = '\ndeclare_meta(\n dimension = %(dimension)d,\n cutoff = %(cutoff)f,\n first = %(first)f,\n interval = %(interval)f,\n name = "%(meta_name)s",\n initial = "");\n\ndeclare_output(\n name = "%(output_name)s",\n first = %(first)f,\n interval= %(interval)f);\n'
generateCfg(model=None)
meta_template = '\n# height used for this run is: %(height)f\nmeta(0, %(height_width)s,\n %(cv)s);\n'
meta_well_tempered_template = '\n# height used for this run is: %(height)f, sampling temperature kT is: %(kTemp)f.\nmeta(0,\n array( %(height)f * exp( meta(0, %(height_width)s, %(cv)s )/(-1.0 * %(kTemp)f) ), %(width)s ),\n %(cv)s);\n'
class schrodinger.application.desmond.meta.MetaDynamicsAnalysis(data_fname, inp_fname=None, key=None)

Analysis tools for Desmond’s metadynamics jobs. The class can be used and run from the command-line or as a module.

computeFES(out_fname='', units='degrees', progress_callback=None)

This function figures out the grid from the ranges and the bins given the cfg. For each gaussian, add it to the previous gaussian sum for each grid point.

static convertDataToPlot(bins, data)

Converts data, usually read in from an exported plot result, to structures usable by the plot.

Parameters:
  • bins (list or tuple) – The FES shape
  • data – List of lists containing cv and FES values
Returns:

list of x and y values

Returns:

array of FES

static convertPlotToData(bins, edges, FES)

Takes data used to plot FES values and converts it to a list of lists for exporting purposes.

Parameters:
  • bins (list or tuple) – The FES shape
  • edges (List of lists) – The x and y values for the plot
  • FES (numpy.array) – The FES values for the plot
Returns:

List of lists containing cv and FES values

evaluate(x)
static writeFES(fname, data, fes_shape, cvs, units)

Write out the free energy distribution in a common way. The GUI utilizing this class needs to write out data from self.computeFES

schrodinger.application.desmond.meta.generate_meta_cfg(meta_def, model)

Generate part of the config file for metadynamics simulation :param meta_def: The content of definition file for collective variables. :param model: topology file. :type meta_def: sea.Sea object :type model: cms.Cms object :return a string. Exception will be raised if encounting any errors.

schrodinger.application.desmond.meta.get_backend()

A convenience function to see if we’re running under job control. If so, return a _Backend object. Otherwise, return None.

schrodinger.application.desmond.meta.get_distance(model, atom_list)

Check distance of the two groups of atoms defined in the atom list :param model: topology file :type model: cms.Cms object :param atom_list: atom list :type atom_list: list

schrodinger.application.desmond.meta.get_local_symmetry(st, atom_list)
schrodinger.application.desmond.meta.get_meta_cfg_filename(meta_def)

Returns the name of the kerseq and cvseq files given a metadynamics definition file :param meta_def: The content of definition file for collective variables. :param model: topology file.

schrodinger.application.desmond.meta.list2str(l)
schrodinger.application.desmond.meta.parse_meta(m, model)
schrodinger.application.desmond.meta.read_meta_cfg(config, model)

Read config file for metadynamics simulation :param meta_def: The content of definition file for collective variables. :param model: topology file. :type meta_def: string :type model: cms.Cms object :return a Meta