schrodinger.application.macromodel.utils module

Utilities for writing MacroModel com, sbc, and hst (native input) files.

Copyright Schrodinger, LLC. All rights reserved.

schrodinger.application.macromodel.utils.write_hst_file(com_file, host_list)

Returns the name of the jobname.hst file written specifically for the passed com file. jobname.com -> jobname.hst. host_list is a list of hostentry name strings, the attributes are looked up by jobcontrol.get_host(). If schrodinger.job.jobcontrol can’t be imported it returns an empty string. These file are typically only used for NPRC distributed bmin jobs.

class schrodinger.application.macromodel.utils.ComUtil(ffld='oplsaa2005', solv=False, ddde=False, bdco=True, chgf=False, exnb=True, auto=True, auop=True, subs=False, serial=False, demx=True, demx_final=50, demx_prelim=100, algn=False, nant=False, chyd=True, nprc=False, flap=False, mcrc=False, ddebug=False, nice=False, wait=False, host='', hostfile='', arch='', local=False, interval=5, no_redirect=False, tmpdir='', ver='', rel='', proj='', disp='', user='', para_bmin=False, para_bmin_jobcts=100, para_bmin_njobs=10, para_bmin_output_org='', debug=False, beautify=True, refit_args=True)

Bases: object

A class for writing MacroModel com files.

The class has methods to write jobname.com files for a broad range of calculation types. The class is initallized with reasonable OPCD argument default values, so the methods like mini() are usable ‘out of the box’. The OPCD arguments are easily modified by accessing the dict values. There is a generic writeComFile() method that allows you write any com file by passing a list of arguments, IO and OPCDs.

If no arguments are provide to the constructor the defaults are:
  • Potential energy surface is OPLS_2005, gas phase, with extended non-bonded cutoffs.

  • Minimization run up to 50000 iterations of PRCG. Convergence is set to a gradient of 0.01.

  • Energy window is 50 kJ/mol and is only checked at the end of the minimization.

  • MacroModel/Maestro interaction files are not generated. Enable by setting self.mmod = True.

  • Atom distance for conformer equivalence is 0.25 angstroms.

API examples:

# Example 1 ############################################################
# Writing an energy listing com file via writeComFile.
import schrodinger.application.macromodel.utils as mmodutils
mcu = mmodutils.ComUtil() # create a default instance of the class
com_file_args = [
    'example1.com', # The name of the com file to write.
    'input.mae', # The name of the input structure file.
    'output.mae', # The name of the output structure file.
    'EXNB',
    'BDCO',
    'FFLD',
    'READ',
    'ELST'
]
mcu.writeComFile(com_file_args)

# Example 2 ############################################################
# Writing an energy listing com file via a utility methods.
import schrodinger.application.macromodel.utils as mmodutils
mcu = mmodutils.ComUtil()
com_file_name = mcu.elst('example2.mae')

# Example 3 ############################################################
# Writing an minimization com file with customized parameters.
import schrodinger.application.macromodel.utils as mmodutils
mcu = mmodutils.ComUtil()
mcu.MINI[1] = 9 # Use Truncated Newton Conjugate Gradient minimizer.
mcu.CONV[5] = 0.0001 # Halt when gradient reaches this stringent value.
mcu.mini('example3.mae')

# Example 4 ############################################################
# Writing an minimization com file that includes water GB/SA solvation.
import schrodinger.application.macromodel.utils as mmodutils
mcu = mmodutils.ComUtil(solv=True)
mcu.mini('example4.mae')

# Example 5 ############################################################
# Writing an minimization com file that requests a substructure.
# See the SbcUtil class for how to construct a .sbc file, this
# example assumes an appropriate .sbc file already exists.
import schrodinger.application.macromodel.utils as mmodutils
mcu = mmodutils.ComUtil(subs=True)
mcu.mini('example5.mae')
Variables
  • serial_nonconf_input (boolean) – If True enable DEBG 55 property management when self.serial is also True.

  • cgo3 (boolean) – If True enable the writing of CGO3 to com files. By default bdco=True and the opcode is written if it appears in the list of opcodes.

  • cgo4 (boolean) – If True enable the writing of CGO3 to com files. By default bdco=True and the opcode is written if it appears in the list of opcodes.

  • cgo5 (boolean) – If True enable the writing of CGO5 to com files. By default bdco=True and the opcode is written if it appears in the list of opcodes.

  • cgo6 (boolean) – If True enable the writing of CGO6 to com files. By default bdco=True and the opcode is written if it appears in the list of opcodes.

  • beautify (boolean) – If True don’t write disabled opcds. If False, disabled opcds are printed as commented-out lines. Default is True

  • refit_args (boolean) – If True reformat large float value to fit in the alternate field format (%6.3f - %9.0f). If False, values are printed as %5.4f Default is True.

  • mmod (boolean) – If True enable MMOD and write MacroModel/Maestro interaction-monitor files. This is seldom useful in a script context, but is provided to as an option to make com files look more like Maestro generated files. Default is False.

  • structure_file_ext (string) – Default structure file extention for file names automatically determined by outComFile(). Default is ‘.mae’.

__init__(ffld='oplsaa2005', solv=False, ddde=False, bdco=True, chgf=False, exnb=True, auto=True, auop=True, subs=False, serial=False, demx=True, demx_final=50, demx_prelim=100, algn=False, nant=False, chyd=True, nprc=False, flap=False, mcrc=False, ddebug=False, nice=False, wait=False, host='', hostfile='', arch='', local=False, interval=5, no_redirect=False, tmpdir='', ver='', rel='', proj='', disp='', user='', para_bmin=False, para_bmin_jobcts=100, para_bmin_njobs=10, para_bmin_output_org='', debug=False, beautify=True, refit_args=True)

This method loads the default data members and methods.

It sets default OPCD arguments, and com file preferences (e.g. no solvent model, OPLSAA_2005, yes to BDCO).

Parameters
  • ffld (string) – String identifier for the force field. The FFLD value is assigned by regular expression evaluation of the string.

  • solv (boolean) – If True enable the writing of SOLV to com files. By default solv=False and the opcode is not written, even if it appears in the list of opcodes.

  • ddde (boolean) – If True enable distance-dependent dielectric electrostatic treatment, with a dielectric constant of 4.0.

  • serial (boolean) – If True enable serial processing mode. This sets AUTO arg6=1, and MCOP arg4=1 where appropriate.

  • bdco (boolean) – If True enable the writing of BDCO to com files. By default bdco=True and the opcode is written if it appears in the list of opcodes.

  • subs (boolean) – If True enable the writing of SUBS to com files. By default subs=False and the opcode is not written, even if it appears in the list of opcodes.

  • chgf (boolean) – If True enable the writing of CHGF to com files. By default chgf=False and the opcode is not written, even if it appears in the list of opcodes.

  • exnb (boolean) – If True enable the writing of EXNB to com files. By default exnb=True. If False it is not written, even if it appears in the list of opcodes.

  • auto (boolean) – If True enable the writing of AUTO to com files. By default auto=True. If False it is not written, even if it appears in the list of opcodes.

  • auop (boolean) – If True enable the writing of AUOP to com files. By default auop=True. If False it is not written, even if it appears in the list of opcodes.

  • nant (boolean) – If True enable the writing of NANT to com files. By default nant=False. If False it is not written, even if it appears in the list of opcodes.

  • algn (boolean) – If True enable the writing of COPY/ALGN to MBAE com files generated by the pre-defined methods, e.g. mbaeCsLmod()

  • demx (boolean) – If True enable the writing of DEMX to com files. By default demx=True. If False it is not written, even if it appears in the list of opcodes.

  • demx_final (float) – Energy window for the final DEMX test. Default is 50 kJ/mol

  • demx_prelim (float) – Energy window for the preliminary DEMX test. Default is 100 kJ/mol. By default DEMX arg2 is set to 10000, so the prelimnary test is seldom performed.

writeComFile(com_args=[])

This method writes a com file, and returns the name of the written com file.

It requires a list containing the name of the com file to be written, the name of the input file, the name of the output file, and a series of OPCDs. The arguments for the OPCDs are looked up in turn, evaluating the next eight elements for the specific OPCD argument dictionary, each time the OPCD is encountered. See setOpcdArgs(), getOpcdArgs(), and __init__() for more information about default arguments.

writeSbcFile(sbc_args=[])

Deprecated wrapper for SbcUtil.writeSbcFile.

getOpcdArgs(opcd='')

This method returns a formatted string of OPCD and arguments for the passed OPCD string.

The arguments come from the hash data members, any unknown or unassigned values default to 0 or 0.0. You may customize the self hash arguments to your heart’s content prior to invoking the method to get the exact behavior you want. The ‘OPCD’ lookup requires the passed argument to be a key for the hash, i.e. uppercase with no whitespace. The array of arg values are numbers, not strings.

This method keeps count of the number of times an OPCD is called and automatically increments the array of args for the passed OPCD. The first call for a given OPCD uses self[‘OPCD’] arg slices 1-8, the next call for that OPCD uses slices 9-16, the next 17-24, and so on. writeComFile() zeros the count after the com file is serialized.

setOpcdArgs(opcd='', arg1=0, arg2=0, arg3=0, arg4=0, arg5=0.0, arg6=0.0, arg7=0.0, arg8=0.0)

This method returns True after adding the passed values to the desired opcd dictionary.

The dictionary is selected by the first parameter, which is required. The rest of the parameters are mapped to the next eight argument indices in the dictionary. Unspecified values default to 0 or 0.0.

This method determines the highest existing index (numeric hash key), and then assigns the passed args to the next available slots. You may want to first blank the dictionary with the appropriate call of self[‘OPCD’].clear().

Assumming the dictionary has has been cleared, the first ‘set’ of a given OPCD assigns self[‘OPCD’] arg indices 1-8, the next call for that OPCD defines indices 9-16, the next 17-24, and so on.

static outComFile(file_name='', structure_file_ext='.mae')

This is a static helper method for the jobs that write com files. Returns an ‘out’ string for the passed ‘in’ string.

Raises an Exception if the file name can’t be determined.

Parameters
  • file_name (string) – If passed ‘jobname.com’ string argument, it returns the appropriate ‘jobname-out.mae’ string. If passed a ‘foo.mae’ file, it returns an appropriate ‘foo.com’ file name.

  • structure_file_ext (string) – Output structure file extension. Default is ‘.mae’.

setupAset(set_dict, arg7=0, arg8=0)

Define ASET arguments from a set dictionary.

Numeric hash keys index the lists of atom numbers. The numerical key is taken as the set number identifier.

getLaunchCommand(com_file='')

This method returns a list of arguments that form the toplevel command invocation with all the flags set in the instance.

It takes a string argument that specifies the name of the com file to run, and returns the fully qualified executable and all commandline arguments.

elst(mae_file=None, com_file=None, out_file=None)

This method writes a com file for a single point energy listing, returns the name of the com file written.

It requires a string containing the the name of a maestro format file that will be used as the job input, and returns the string name of the com file. It may also accept an optional string file name that becomes the name of the com file plus the root of the generated -out.mae file.

dlst(mae_file=None, com_file=None, out_file=None)

This method writes a com file for a single point energy listing of 1st and 2nd derivatives, returns the name of the com file written.

It requires a string containing the name of a maestro format file that will be used as the job input, and returns the string name of the com file. It may also accept an optional string file name that becomes the name of the com file plus the root of the generated -out.mae file.

mini(mae_file=None, com_file=None, out_file=None)

This method writes a com file for a geometry optimization, returns the name of the com file written.

It requires a string containing the name of a maestro format file that will be used as the job input, and returns the string name of the com file. It may also accept an optional string file name that becomes the name of the com file plus the root of the generated -out.mae file.

addc(mae_file=None, com_file=None, out_file=None)

This method writes a com file for redundant conformer elimination, returns the name of the com file written.

It requires a string containing the name of a maestro format file that will be used as the job input, and returns the string name of the com file. It may also accept an optional string file name that becomes the name of the com file plus the root of the generated -out.mae file.

COMP atoms must be set outside of this method.

filter(mae_file=None, com_file=None, out_file=None)

This method writes a com file for a special atom filtering, similar to premin’s, but with 0 minimization iterations; returns the name of the com file written.

It requires a string containing the name of a maestro format file that will be used as the job input, and returns the string name of the com file. It may also accept an optional string file name that becomes the name of the com file plus the root of the generated -out.mae file.

mult(mae_file=None, com_file=None, out_file=None)

This method writes a com file for a geometry optimization and filtering with MULT and COMP; returns the name of the com file written.

It requires a string containing the name of a maestro format file that will be used as the job input, and returns the string name of the com file. It may also accept an optional string file name that becomes the name of the com file plus the root of the generated -out.mae file. It is intended for filtering conformation search output.

driv(mae_file=None, com_file=None, out_file=None)

This method writes a com file for a geometry drive; returns the name of the com file written.

It requires a string containing the name of a maestro format file that will be used as the job input, and returns the string name of the com file. It may also accept an optional string file name that becomes the name of the com file plus the root of the generated -out.mae file. It is intended for filtering conformation search output.

DEGB 150 starts the drive from the input geometry, not the endpoint of the previous iteration.

lmod(mae_file=None, com_file=None, out_file=None)

This method writes a com file for a lowmode conformation search; returns the name of the com file written.

It requires a string containing the name of a maestro format file that will be used as the job input, and returns the string name of the com file. It may also accept an optional string file name that becomes the name of the com file plus the root of the generated -out.mae file.

llmd(mae_file=None, com_file=None, out_file=None)

This method writes a com file for a large scale lowmode conformation search; returns the name of the com file written.

It requires a string containing the name of a maestro format file that will be used as the job input, and returns the string name of the com file. It may also accept an optional string file name that becomes the name of the com file plus the root of the generated -out.mae file.

mcmm(mae_file=None, com_file=None, out_file=None)

This method writes a com file for a monte carlo multiple minimum conformation search; returns the name of the com file written.

It requires a string containing the name of a maestro format file that will be used as the job input, and returns the string name of the com file. It may also accept an optional string file name that becomes the name of the com file plus the root of the generated -out.mae file.

spmc(mae_file=None, com_file=None, out_file=None)

This method writes a com file for a systematic pseudo monte carlo multiple minimum conformation search; returns the name of the com file written.

It requires a string containing the name of a maestro format file that will be used as the job input, and returns the string name of the com file. It may also accept an optional string file name that becomes the name of the com file plus the root of the generated -out.mae file. This method always uses torsional memory and will preoptimize ring closure distances.

mcmmlmod(mae_file=None, com_file=None, out_file=None)

This method writes a com file for a mixed monte carlo multiple minimum/lowmode conformation search; returns the name of the com file written.

It requires a string containing the name of a maestro format file that will be used as the job input, and returns the string name of the com file. It may also accept an optional string file name that becomes the name of the com file plus the root of the generated -out.mae file.

mcmmllmd(mae_file=None, com_file=None, out_file=None)

This method writes a com file for a mixed monte carlo multiple minimum/large scale lowmode conformation search; returns the name of the com file written.

It requires a string containing the name of a maestro format file that will be used as the job input, and returns the string name of the com file. It may also accept an optional string file name that becomes the name of the com file plus the root of the generated -out.mae file.

cgen(mae_file=None, com_file=None, out_file=None)

This method writes a com file for a ligand torsion search with ConfGen; returns the name of the com file written.

It requires a string containing the name of a maestro format file that will be used as the job input, and returns the string name of the com file. It may also accept an optional string file name that becomes the name of the com file plus the root of the generated -out.mae file.

mdyn(mae_file=None, com_file=None, out_file=None)

This method writes a com file for a molecular dynamics simulation; returns the name of the com file written.

It requires a string containing the name of a maestro format file that will be used as the job input, and returns the string name of the com file. It may also accept an optional string file name that becomes the name of the com file plus the root of the generated -out.mae file.

mcsd(mae_file=None, com_file=None, out_file=None)

This method writes a com file for a mixed Monte Carlo/Stochastic Dynamics simulation; returns the name of the com file written.

It requires a string containing the name of a maestro format file that will be used as the job input, and returns the string name of the com file. It may also accept an optional string file name that becomes the name of the com file plus the root of the generated -out.mae file.

mmc(mae_file=None, com_file=None, out_file=None)

This method writes a com file for a Metropolis Monte Carlo ensemble generation; returns the name of the com file written.

It requires a string containing the name of a maestro format file that will be used as the job input, and returns the string name of the com file. It may also accept an optional string file name that becomes the name of the com file plus the root of the generated -out.mae file.

The arguments for ZMAT must be set outside this method. ZMAT makes all the structural changes so the min-max range should allow diverse sampling (5 deg bends, 180 tors).

adf(mae_file=None, com_file=None, out_file=None)

This method writes a com file for an All Degrees of Freedom simulation (a Metropolis Monte Carlo with passive Importance sampling) calculation; returns the name of the com file written.

It requires a string containing the name of a maestro format file that will be used as the job input, and returns the string name of the com file. It may also accept an optional string file name that becomes the name of the com file plus the root of the generated -out.mae file.

The arguments for ZMAT must be set outside this method. ZMAT makes all the structural changes so the min-max range should allow diverse sampling (5 deg bends, 180 tors).

jbw(mae_file=None, com_file=None, out_file=None)

This method writes a com file for a Jump Between Wells simulation (a Metropolis Monte carlo simulation with active Importance sampling); returns the name of the com file written.

It requires a string containing the name of a maestro format file that will be used as the job input, and returns the string name of the com file. It may also accept an optional string file name that becomes the name of the com file plus the root of the generated -out.mae file.

The arguments for ZMAT must be set outside this method.

jbw_sd(mae_file=None, com_file=None, out_file=None)

This method writes a com file for a Jump Between Wells/Stochastic Dynamics simulation (a MCSD simulation with active Importance sampling); returns the name of the com file written.

It requires a string containing the name of a maestro format file that will be used as the job input, and returns the string name of the com file. It may also accept an optional string file name that becomes the name of the com file plus the root of the generated -out.mae file.

The arguments for ZMAT must be set outside this method.

geom(mae_file=None, com_file=None, out_file=None)

This method writes a com file for a geometry analysis; returns the name of the com file written.

It requires a string containing the name of a maestro format file that will be used as the job input, and returns the string name of the com file. It may also accept an optional string file name that becomes the name of the com file plus the root of the generated -out.mae file.

The arguments for GEOM must be set outside this method.

copyalgn(mae_file=None, com_file=None, out_file=None)

This method writes a com file for an ALGN/COPY positioning of ligands on a reference ligand; returns the name of the com file written.

The ligands are positioned on the first ligand (all four ways) with ALGN/COPY.

It requires a string containing the name of a maestro format file that will be used as the job input, and returns the string name of the com file. It may also accept an optional string file name that becomes the name of the com file plus the root of the generated -out.mae file.

mbaeMiniEdiff(mae_file=None, com_file=None, out_file=None)

This method writes a com file for an MBAE multiple minimization run, in energy difference mode; returns the name of the com file written.

It requires a string containing the name of a maestro format file that will be used as the job input, and returns the string name of the com file. It may also accept an optional string file name that becomes the name of the com file plus the root of the generated -out.mae file.

mbaeMiniInter(mae_file=None, com_file=None, out_file=None, recep_atom=None)

This method writes a com file for an MBAE multiple minimization run, in set interaction mode; returns the name of the com file written. recep_atom is the last atomic index of the receptor structure. If recep_atom is None then the first structure in the mae_file is evaluated.

It requires a string containing the name of a maestro format file that will be used as the job input, and returns the string name of the com file. It may also accept an optional string file name that becomes the name of the com file plus the root of the generated -out.mae file.

The ASET arguments are set by snooping the input file for the number of atoms in the receptor.

raises IOError if the receptor atom total can’t be determined from the input structure file.

mbaeCsLmod(mae_file=None, com_file=None, out_file=None)

This method writes a com file for an MBAE low mode conformation search run, in energy difference mode; returns the name of the com file written.

It requires a string containing the name of a maestro format file that will be used as the job input, and returns the string name of the com file. It may also accept an optional string file name that becomes the name of the com file plus the root of the generated -out.mae file.

If ComUtil.algn is true, then a the job will positions the ligands on the reference ligand, with all four alignments.

mbaeCsMcmm(mae_file=None, com_file=None, out_file=None)

This method writes a com file for an MBAE monte carlo conformation search run, in energy difference mode; returns the name of the com file written.

It requires a string containing the name of a maestro format file that will be used as the job input, and returns the string name of the com file. It may also accept an optional string file name that becomes the name of the com file plus the root of the generated -out.mae file.

If ComUtil.algn is true, then a the job will positions the ligands on the reference ligand, with all four alignments.

mbaeCsMcmmLmod(mae_file=None, com_file=None, out_file=None)

This method writes a com file for an MBAE mixed lowmode monte carlo conformation search run, in energy difference mode; returns the name of the com file written.

It requires a string containing the name of a maestro format file that will be used as the job input, and returns the string name of the com file. It may also accept an optional string file name that becomes the name of the com file plus the root of the generated -out.mae file.

If ComUtil.algn is true, then a the job will positions the ligands on the reference ligand, with all four alignments.

logP(mae_file=None, com_file=None, out_file=None)

This method writes a com file for a multiple minimization with logP calculation; returns the name of the com file written.

It requires a string containing the name of a maestro format file that will be used as the job input, and returns the string name of the com file. It may also accept an optional string file name that becomes the name of the com file plus the root of the generated -out.mae file.

fep(mae_file=None, com_file=None, out_file=None)

This method writes a com file for a Free Energy Perturbation with stochastic dynamics sampling; returns the name of the com file written.

It requires a string containing the name of a maestro format file that will be used as the job input, and returns the string name of the com file. It may also accept an optional string file name that becomes the name of the com file plus the root of the generated -out.mae file.

loop(mae_file=None, com_file=None, out_file=None)

This method writes a com file for a protein LOOP conformation search; returns the name of the com file written.

It requires a string containing the name of a maestro format file that will be used as the job input, and returns the string name of the com file. It may also accept an optional string file name that becomes the name of the com file plus the root of the generated -out.mae file.

aset(mae_file=None, com_file=None, out_file=None)

This method writes a com file for a atom set interaction (ASET) analysis; returns the name of the com file written.

It requires a string containing the name of a maestro format file that will be used as the job input, and returns the string name of the com file. It may also accept an optional string file name that becomes the name of the com file plus the root of the generated -out.mae file.

The arguments for ASET must be set outside this method.

Uses a BGIN/END loop to process each input file member, but single structure input files are allowed.

minta(mae_file=None, com_file=None, out_file=None)

This method writes a com file for a Mode integration MINTA calculation (conformational free energy); returns the name of the com file written.

It requires a string containing the name of a maestro format file that will be used as the job input, and returns the string name of the com file. It may also accept an optional string file name that becomes the name of the com file plus the root of the generated -out.mae file.

rrho(mae_file=None, com_file=None, out_file=None)

This method writes a com file for a Rigid Rotor Harmonic Oscillator calculation (normal mode analysis of thermodyanic quantities); returns the name of the com file written.

It requires a string containing the name of a maestro format file that will be used as the job input, and returns the string name of the com file. It may also accept an optional string file name that becomes the name of the com file plus the root of the generated -out.mae file.

The structure is minimized prior to RRHO calculation. The optimization can be omitted by setting MINI[3] = 0

vibr(mae_file=None, com_file=None, out_file=None)

This method writes a com file to visualize vibrational modes with VIBR; returns the name of the com file written.

It requires a string containing the name of a maestro format file that will be used as the job input, and returns the string name of the com file. It may also accept an optional string file name that becomes the name of the com file plus the root of the generated -out.mae file.

The structure is minimized prior to VIBR calculation. The optimization can be omitted by setting MINI[3] = 0

vbr2(mae_file=None, com_file=None, out_file=None)

This method writes a com file to visualize vibrational modes with VBR2; returns the name of the com file written.

It requires a string containing the name of a maestro format file that will be used as the job input, and returns the string name of the com file. It may also accept an optional string file name that becomes the name of the com file plus the root of the generated -out.mae file.

The structure is minimized prior to VBR2 calculation. The optimization can be omitted by setting MINI[3] = 0

class schrodinger.application.macromodel.utils.ComUtilAppSci

Bases: schrodinger.application.macromodel.utils.ComUtil

Subclass of ComUtil with defaults that are closer to the current Maestro version.

Defaults are:
  • Potential energy surface is OPLS_2005, GB/SA water solvent, with extended non-bonded cutoff.

  • Minimization run up to 500 iterations of PRCG. Convergence is set to a gradient of 0.05.

  • Energy window is 21 kJ/mol and an initial energy window of 42 kJ/mol is applied after 166 iteration.

  • MacroModel/Maestro interaction files are generated. Disable by setting self.mmod = False.

  • Atom distance for conformer equivalence is 0.50 angstroms.

  • The maximum number of degrees of freedom sampled per MC step is 5.

  • Automatic conformation search parameters scale the number of steps to the number of torsions.

  • Single point energy listing com file follows the Maestro form.

  • Input structure file is assumed to contain multiple non-conformer ligands. i.e. self.serial = True such that automatic variables are generated in serial mode by AUTO, and self.serial_nonconf_input = True such that DEBG 55 is set for improved property management of non conformer input structures.

  • The constructor takes no kwargs, but the instance data members can be altered.

__init__()

This method loads the default data members and methods.

It sets default OPCD arguments, and com file preferences (e.g. no solvent model, OPLSAA_2005, yes to BDCO).

Parameters
  • ffld (string) – String identifier for the force field. The FFLD value is assigned by regular expression evaluation of the string.

  • solv (boolean) – If True enable the writing of SOLV to com files. By default solv=False and the opcode is not written, even if it appears in the list of opcodes.

  • ddde (boolean) – If True enable distance-dependent dielectric electrostatic treatment, with a dielectric constant of 4.0.

  • serial (boolean) – If True enable serial processing mode. This sets AUTO arg6=1, and MCOP arg4=1 where appropriate.

  • bdco (boolean) – If True enable the writing of BDCO to com files. By default bdco=True and the opcode is written if it appears in the list of opcodes.

  • subs (boolean) – If True enable the writing of SUBS to com files. By default subs=False and the opcode is not written, even if it appears in the list of opcodes.

  • chgf (boolean) – If True enable the writing of CHGF to com files. By default chgf=False and the opcode is not written, even if it appears in the list of opcodes.

  • exnb (boolean) – If True enable the writing of EXNB to com files. By default exnb=True. If False it is not written, even if it appears in the list of opcodes.

  • auto (boolean) – If True enable the writing of AUTO to com files. By default auto=True. If False it is not written, even if it appears in the list of opcodes.

  • auop (boolean) – If True enable the writing of AUOP to com files. By default auop=True. If False it is not written, even if it appears in the list of opcodes.

  • nant (boolean) – If True enable the writing of NANT to com files. By default nant=False. If False it is not written, even if it appears in the list of opcodes.

  • algn (boolean) – If True enable the writing of COPY/ALGN to MBAE com files generated by the pre-defined methods, e.g. mbaeCsLmod()

  • demx (boolean) – If True enable the writing of DEMX to com files. By default demx=True. If False it is not written, even if it appears in the list of opcodes.

  • demx_final (float) – Energy window for the final DEMX test. Default is 50 kJ/mol

  • demx_prelim (float) – Energy window for the preliminary DEMX test. Default is 100 kJ/mol. By default DEMX arg2 is set to 10000, so the prelimnary test is seldom performed.

elst(mae_file=None, com_file=None, out_file=None)
Returns

The name of the single point energy listing com file written.

Return type

string

Parameters
  • mae_file (string) – Name of the structure file input.

  • com_file (string) – Optional com_file name. By default it is determined from the basename of the mae_file.

  • out_file (string) – Optional out_file name. By default it determined from the basename of the com_file.

class schrodinger.application.macromodel.utils.ComUtil_2010

Bases: schrodinger.application.macromodel.utils.ComUtilAppSci

This class will be deprecated in the next release. Consider ComUtilAppSci instead.

__init__()

This method loads the default data members and methods.

It sets default OPCD arguments, and com file preferences (e.g. no solvent model, OPLSAA_2005, yes to BDCO).

Parameters
  • ffld (string) – String identifier for the force field. The FFLD value is assigned by regular expression evaluation of the string.

  • solv (boolean) – If True enable the writing of SOLV to com files. By default solv=False and the opcode is not written, even if it appears in the list of opcodes.

  • ddde (boolean) – If True enable distance-dependent dielectric electrostatic treatment, with a dielectric constant of 4.0.

  • serial (boolean) – If True enable serial processing mode. This sets AUTO arg6=1, and MCOP arg4=1 where appropriate.

  • bdco (boolean) – If True enable the writing of BDCO to com files. By default bdco=True and the opcode is written if it appears in the list of opcodes.

  • subs (boolean) – If True enable the writing of SUBS to com files. By default subs=False and the opcode is not written, even if it appears in the list of opcodes.

  • chgf (boolean) – If True enable the writing of CHGF to com files. By default chgf=False and the opcode is not written, even if it appears in the list of opcodes.

  • exnb (boolean) – If True enable the writing of EXNB to com files. By default exnb=True. If False it is not written, even if it appears in the list of opcodes.

  • auto (boolean) – If True enable the writing of AUTO to com files. By default auto=True. If False it is not written, even if it appears in the list of opcodes.

  • auop (boolean) – If True enable the writing of AUOP to com files. By default auop=True. If False it is not written, even if it appears in the list of opcodes.

  • nant (boolean) – If True enable the writing of NANT to com files. By default nant=False. If False it is not written, even if it appears in the list of opcodes.

  • algn (boolean) – If True enable the writing of COPY/ALGN to MBAE com files generated by the pre-defined methods, e.g. mbaeCsLmod()

  • demx (boolean) – If True enable the writing of DEMX to com files. By default demx=True. If False it is not written, even if it appears in the list of opcodes.

  • demx_final (float) – Energy window for the final DEMX test. Default is 50 kJ/mol

  • demx_prelim (float) – Energy window for the preliminary DEMX test. Default is 100 kJ/mol. By default DEMX arg2 is set to 10000, so the prelimnary test is seldom performed.

class schrodinger.application.macromodel.utils.SbcUtil(use_flat_bottom_asl2=False)

Bases: object

A class for writing substructure/constraint files to accompany jobname.com.

MacroModel has different ways to define freely moving, restrained and constrained atoms. A good understanding of the SUBS/FXAT behavior is often essential; see the MacroModel Reference Manual for more details. Below are a few examples of some common idioms.

This class now supports ASL2 with half-width flat-bottomed restraint potential. If self.use_flat_bottom_asl2 is True, then the ASL2 arguments are formatted thus:

ASL2 arg1 = Flat-bottom width, in units of tenths of an angstrom.
ASL2 arg2 = Force constant.
ASL2 arg3 = Atom selection language string

otherwise, ASL2 argument are formated as:

ASL2 arg1 = Force constant.
ASL2 arg2 = Atom selection language string

API examples:

# Example 1 ############################################################
# Writing a sbc file to restrain atoms during a minimization with ASL2.

# Write com file instructions for a simple geometry optimization.
# The ComUtil instance is configured such that it will write the
# SUBS opcode in the com file.
import schrodinger.application.macromodel.utils as mmodutils
mcu = mmodutils.ComUtil(subs=True)
com_file = mcu.mini("example_1.mae")
# MacroModel requires that the sbc file name match the input
# structure file, not the com file.
sbc_file = 'example_1.sbc'

# Write sbc file that will modify the geometry optimization such that
# all atoms are harmonically restrained about their starting coordinates.
sbu = mmodutils.SbcUtil()
sbu.ASL2[1] = 200 # force constant for Cartesian restraints.
sbu.ASL2[2] = 'mol.n 1' # ASL identifying the restrained atoms.
sbu_args = [sbc_file, 'ASL2']
sbu.writeSbcFile(sbu_args)


# Example 2 ############################################################
# Writing a sbc file to perform a conformation search on part of a
# structure with ASL1/ASL2.

# Write com file instructions for a simple conformation search.
# The ComUtil instance is configured such that it will write the
# SUBS opcode in the com file.
import schrodinger.application.macromodel.utils as mmodutils
mcu = mmodutils.ComUtil(subs=True)
mcu.MCMM[1] = 100 # Short test search.
com_file = mcu.mcmm("example_2.mae")
# MacroModel requires that the sbc file name match the input
# structure file, not the com file.
sbc_file = "example_2.sbc"

# Write an sbc file that will modify the search such that
# only sidechain atoms are assigned search parameters and sampled.
sbu = mmodutils.SbcUtil()
sbu.ASL1[1] = 0 # Add the substructure atoms (set up for search).
sbu.ASL1[2] = 'sidechain' # Substructure atoms (set up for search).

sbu.ASL2[1] = 250 # Restraint's harmonic force constant.
sbu.ASL2[2] = 'not sidechain' # The restrained atoms.
sbu_args = [sbc_file, 'ASL1', 'ASL2']
sbu.writeSbcFile(sbu_args)


# Example 3 ############################################################
# Writing a sbc file to restrain/constrain part of the structure
# with SUBS/FXAT during a simple minimization. Here, the input
# structure is a ligand-receptor complex where the ligand has
# residue name MTW. The ligand will be freely optimized within the
# context of the receptor. The side-chain atoms will be fixed
# (restrained with a flat-bottom potential, 0.1 angstrom half-width)
# and a ~3 angstrom shell of nearby atoms will be frozen
# (constrained). All other atoms are ignored.

# Write com file instructions for a simple geometry optimization.
# The ComUtil instance is configured such that it will write the
# SUBS opcode in the com file.
import schrodinger.application.macromodel.utils as mmodutils
import schrodinger.structure as structure
import schrodinger.structutils.analyze as analyze
mcu = mmodutils.ComUtil(subs=True)
com_file = mcu.mini("example_3.mae")
sbc_file = "example_3.sbc"

# Identify the atoms to optimize, restrain and constrain. All other
# atoms are ignored.
st = structure.Structure.read("example_3.mae")
ligand_atoms = analyze.evaluate_asl(st, 'res.pt MTW')
binding_site_atoms = analyze.evaluate_asl(
    st,
    'fillres (sidechain and within 5 res.pt MTW)'
)
nearby_atoms = analyze.evaluate_asl(
    st,
    'not (res.pt MTW or fillres (sidechain and within 5 res.pt MTW)) and within 10 res.pt MTW'
)

# Assign the atoms to SUBS and FXAT commands.
sbu = mmodutils.SbcUtil()
sbu_args = [sbc_file]
sbu_args.extend(sbu.setSubs(ligand_atoms))
sbu_args.extend(
    sbu.setFixed(
        binding_site_atoms,
        force_constant=500,
        half_width=1
    )
)
sbu_args.extend(sbu.setFrozen(nearby_atoms))
sbu.writeSbcFile(sbu_args)


# Example 4 ############################################################
# Writing a sbc file to restrain/constrain part of the structure
# with ASL1/ASL2, where the input is a series of non-conformers.
# Here, the structure file contains a series of non-conformer
# polypeptides. The side-chains will be freely optimized and the
# backbone will be restrained. Note well, READ arg1=-1 tells
# MacroModel to evaluate the sbc for each input structure; a
# requirement since the input are non-conformers.

# Write com file instructions for a geometry optimization on a
# series of structures. The ComUtil instance is configured such
# that it will write the SUBS opcode in the com file.
import schrodinger.application.macromodel.utils as mmodutils
mcu = mmodutils.ComUtil(subs=True)
mcu.READ[1] = -1 # re-evaluate substructure information.
com_file = mcu.mini("example_4.mae")
sbc_file = "example_4.sbc"

# Assign the ASL1/2 commands and write the file.
sbu = mmodutils.SbcUtil()
sbu.ASL1[1] = 0 # Add the substructure atoms (set up for search).
sbu.ASL1[2] = 'sidechain' # Substructure atoms (set up for search).
sbu.ASL2[1] = 200 # Restraint's harmonic force constant.
sbu.ASL2[2] = 'not sidechain' # The restrained atoms.
sbu_args = [sbc_file, 'ASL1', 'ASL2']
sbu.writeSbcFile(sbu_args)


# Example 5 ############################################################
# Writing a sbc file to restrain part of the structure with
# ASL1/ASL2 and flat-bottom restraints. Here, the structure file
# contains a series of non-conformer polypeptides. The side-chains
# will be freely optimized and the backbone will be restrained.
# Note well, READ arg1=-1 which tells MacroModel to evaluate the sbc
# for each input structure; a requirement since the input are
# non-conformers.

# Write com file instructions for a geometry optimization on a
# series of structures. The ComUtil instance is configured such
# that it will write the SUBS opcode in the com file.
import schrodinger.application.macromodel.utils as mmodutils
mcu = mmodutils.ComUtil(subs=True)
mcu.READ[1] = -1 # re-evaluate substructure information.
com_file = mcu.mini("example_5.mae")
sbc_file = "example_5.sbc"

# Assign the ASL1/2 commands and write the file.
sbu = mmodutils.SbcUtil(use_flat_bottom_asl2=True)
sbu.ASL1[1] = 0 # Add the substructure atoms (set up for search).
sbu.ASL1[2] = 'sidechain' # Substructure atoms (set up for search).
sbu.ASL2[1] = 5 # half-width, 0.5 angstroms.
sbu.ASL2[2] = 200.0 # restrain 200 kJ/mol*A^2.
sbu.ASL2[3] = 'not sidechain' # The restrained atoms.
sbu_args = [sbc_file, 'ASL1', 'ASL2']
sbu.writeSbcFile(sbu_args)


# Example 6 ############################################################
# Writing a sbc file to restrain atoms during a minimization
# with ASL2, confirming backwards compatible support for
# determining a suitable sbc file name.

# Write com file instructions for a simple geometry optimization.
# The ComUtil instance is configured such that it will write the
# SUBS opcode in the com file.
import schrodinger.application.macromodel.utils as mmodutils
mcu = mmodutils.ComUtil(subs=True)
com_file = mcu.mini("example_6.mae", "example_6_test.com")

# Write sbc file that will modify the geometry optimization such that
# all atoms are harmonically restrained about their starting coordinates.
sbu = mmodutils.SbcUtil()
sbu.ASL2[1] = 200 # force constant for Cartesian restraints.
sbu.ASL2[2] = 'mol.n 1' # ASL identifying the restrained atoms.
sbu_args = [com_file, 'ASL2']

# MacroModel requires that the sbc file name match the input
# structure file, not the com file.  The method expects a
# sbc file name as the first argument, but for backwards
# compatibility, supports .com extensions.
sbc_file = sbu.writeSbcFile(sbu_args)
__init__(use_flat_bottom_asl2=False)
writeSbcFile(sbc_args=[])

Writes a sbc file for the list of opcodes, and returns the name of the written sbc file.

Parameters

sbc_args (list) – List of arguments to serialize. The first element should be the file name to write, e.g. ‘jobname.sbc’, where the sbc file name corresponds to the input structure file name not the input com file name. The second and subsequent elements should be OPCD strings.

Raises

ValueError if the first element doesn’t end with .sbc and an appropriate sbc file name can’t be determined.

The arguments for the OPCDs are looked up in turn, evaluating the next eight list elements for the specific OPCD argument list, each time the OPCD is encountered. See getOpcdArgs() and __init__() for more information about default arguments. For backwards compatibility, the first argument may also be a ‘.com’, which will write basename.sbc if the com file can’t be read, but will otherwise inspect the com file for the input structure file name and construct a suitable sbc file name.

setSubs(subs_list)
Returns

List of ‘SUBS’ strings after assiging all atom indexed in subs_list to the self.SUBS dict, . This is a simple wrapper for setOpcdArgs() to conveniently set a large number of atoms at once. Assigned SUBS have args5-8 set to 0.0 (the default).

Return type

list

Parameters

subs_list (list) – List of atom indexes

setFixed(fixed_list=[], force_constant=200, half_width=0)
Returns

List of ‘FXAT’ strings after assiging all atom indexed in fixed_list to the self.FXAT dict. This is a simple wrapper for setOpcdArgs() to conveniently set a large number of atoms at once. Assigned FXATs have arg5 = force_constant, and arg6 = half_width

Return type

list

Parameters
  • fixed_list (list) – List of atom indexes

  • force_constant (float) – Restraining force constant, typically in units of kJ/mol*A^2. Default is 200.

  • half_width (integer) – Half-width of the flat-bottom restraint potential, in tenths of an angstrom units. Default is 0.

setFrozen(frozen_list=[])
Returns

List of ‘FXAT’ strings after assiging all atom indexed in frozen_list to the self.FXAT dict, . This is a simple wrapper for setOpcdArgs() to conveniently set a large number of atoms at once. Assigned FXATs have arg5 = -1, to freeze (constrain) the atoms in place.

Return type

list

Parameters

frozen_list (list) – List of atom indexes

getOpcdArgs(opcd='')

The arguments come from the hash data members, any unknown or unassigned values default to 0 or 0.0. You may customize the self hash arguments to your heart’s content prior to invoking the method to get the exact behavior you want. The ‘OPCD’ lookup requires the passed argument to be a key for the hash, i.e. uppercase with no whitespace. The array of arg values are numbers, not strings.

This method keeps count of the number of times an OPCD is called and automatically increments the array of args for the passed OPCD. The first call for a given OPCD uses self[‘OPCD’] arg slices 1-8, the next call for that OPCD uses slices 9-16, the next 17-24, and so on. writeSbcFile() zeros the count after the com or sbc file is serialized.

Returns a formatted string of OPCD and arguments for the passed OPCD string.

param opcd

MacroModel operation code.

type opcd

string

setOpcdArgs(opcd='', arg1=0, arg2=0, arg3=0, arg4=0, arg5=0.0, arg6=0.0, arg7=0.0, arg8=0.0)

This method returns True after adding the passed values to the desired opcd dictionary.

The dictionary is selected by the first parameter, which is required. The rest of the parameters are mapped to the next eight argument indices in the dictionary. Unspecified values default to 0 or 0.0.

This method determines the highest existing index (numeric hash key), and then assigns the passed args to the next available slots. You may want to first blank the dictionary with the appropriate call of self[‘OPCD’].clear().

Assumming the dictionary has has been cleared, the first ‘set’ of a given OPCD assigns self[‘OPCD’] arg indices 1-8, the next call for that OPCD defines indices 9-16, the next 17-24, and so on.

class schrodinger.application.macromodel.utils.CluUtil(arms=['heavy'], nrms=[], trms=[], thresh=0, mmsym=True, nant=False)

Bases: object

A class for writing and running Cluster clu files.

The class can fabricate jobname.clu files, and optionally run them. The class allows running Cluster or Xcluster jobs.

__init__(arms=['heavy'], nrms=[], trms=[], thresh=0, mmsym=True, nant=False)

This method loads the default data members and methods.

writeCluFile(in_file='')

This method writes a jobname.clu command file for the passed ‘jobname.mae’, or ‘jobname.dst’ file; returns the name fo the clu file written.

The keyword values are taken from the self object, and need to be defined prior to calling this method. Returns a string for the ‘jobname.clu’ file written.

The first argument for either Arms: or Nrms: is checked for the value ‘heavy’ or ‘all’. If the first argument in these arrays does not match those values then the array is assumed to contain numerical values and is formatted.

If the provided input is a distance file, recognized by a .dst extention, then the job will be run in dfile mode. No additional options are used in dfile mode, and exiting self values for mmsym, nant, arms, and trms are set to false/empty values.

runCluFile(clu_file='')

This method uses jobcontrol.launch_job (or system call if import failed) to invoke cluster for the passed jobname.clu file. Returns True.

It requires a string containing the ‘jobname.clu’ file name.

runXCluFile(clu_file='')

This method uses jobcontrol.launch_job (or a system call if import failed) to invoke Xcluster for the passed jobname.clu file. Returns True.

It requires a string containing the ‘jobname.clu’ file name.

doCluster(in_file='')

This method writes and runs a cluster job for the passed mae or dst file name. returns True

A combination of writeCluFile and runCluFile.

doXCluster(in_file='')

This method writes and runs a Xcluster job for the passed mae or dst file name, returns True

A combination of writeCluFile and runXCluFile.

writeDstFile(dst_file='cluster.dst', values=[])

This method writes a distance file with the provided name, for the passed values. Returns the name of the distance file written, which is cluster.dst by default.

This method calculates the ‘distances’ between the passed values. The distances are calculated as the absolute value of i - j, truncated as 5.5f, right justified as 16 characters, and printed five per line.

For example, if passed a list with nine values, the distance file would look like:

9 d12 d13 d14 d15 d16 d17 d18 d19 d23 d24 d25 d26 d27 d28 d29 d34 d35 d36 d37 d38 d39 d45 d46 d47 d48 d49 d56 d57 d58 d59 d67 d68 d69 d78 d79 d89

where d12 is the formatted result of abs(values[0] - values[1])