"""
Absolute binding FEP command line UI
Copyright Schrodinger, LLC. All rights reserved.
"""
import argparse
from typing import List
from typing import Optional
from schrodinger.application.desmond import constants
from schrodinger.application.desmond.starter.ui.cmdline import get_sim_time_message
from schrodinger.application.desmond import struc
from schrodinger.infra import mm
from . import cmdline
from .cmdline import Option
_DEFAULT_FEP_TIME = 5000.0
[docs]class Args(cmdline.FepArgs):
PROGRAM_NAME = "Absolute Binding FEP"
SUPPORTED_FEP_TYPES = [constants.FEP_TYPES.ABSOLUTE_BINDING]
[docs] def copy_parser_attributes(self, opt: argparse.Namespace):
super().copy_parser_attributes(opt)
# time_complex and time_solvent are allowed to be 0.
self.time_complex = self.fep_sim_time if opt.time_complex is None else opt.time_complex
self.time_solvent = self.fep_sim_time if opt.time_solvent is None else opt.time_solvent
[docs] def validate(self):
from schrodinger.application.scisol.packages.fep import fepmae
super().validate()
self._validate_sim_times(
[self.md_sim_time, self.time_complex, self.time_solvent])
if (self.mode == constants.UiMode.NEW and
not self.inp_file.endswith("fmp")):
# Make sure ligand titles are unique
input_sts = struc.read_all_structures(self.inp_file)
_, _, _, ligand_sts = fepmae.filter_receptors_and_ligands(input_sts)
self.check_duplicate_titles(ligand_sts)
[docs] def get_time_for_leg(self, leg_type: str) -> Optional[float]:
if leg_type == constants.FepLegTypes.COMPLEX:
return self.time_complex
elif leg_type == constants.FepLegTypes.SOLVENT:
return self.time_solvent
[docs]def ui(argv: List[str]) -> Args:
usage = """
Absolute binding FEP driver (experimental)
Report issues to Desmond.
* Run a new job:
$SCHRODINGER/fep_absolute_binding -HOST <main-host> -SUBHOST <subhost> -JOBNAME <jobname> <input_pv>.mae
* Restart a previously interrupted job:
$SCHRODINGER/fep_absolute_binding -HOST <main-host> -SUBHOST <subhost> -JOBNAME <jobname> -RESTART -checkpoint <multisim-checkpoint-file>
Note that the following options have no effect when restarting:
-ppj
* Extend a completed job:
$SCHRODINGER/fep_absolute_binding -HOST <main-host> -SUBHOST <subhost> -JOBNAME <jobname> -extend <extend.ligand> -checkpoint <multisim-checkpoint-file> -fep-sim-time 5000.0
Note that the following options have no effect when extending:
-md-sim-time
-ppj
* Prepare the input files for multisim without running the job.
$SCHRODINGER/fep_absolute_binding -HOST <main-host> -SUBHOST <subhost> -JOBNAME <jobname> <input_pv>.mae -prepare
"""
options = cmdline.get_common_options()
options.extend(cmdline.get_common_fep_options())
options.extend([
Option(
"inp_file", None,
"A Maestro pv structure file containing one or more ligand "
"structures or a fmp generated for Absolute binding. The "
"structure file may optionally contain separate solvent and "
"membrane structures for membrane systems.", {"nargs": "?"}),
Option(
"-md-sim-time", 1000.0,
"Specify the MD production simulation time (in ps). Min value: 500.0. "
"Default: %(default)s.", {"metavar": "<sim-time>"}),
Option("-fep-sim-time", _DEFAULT_FEP_TIME,
get_sim_time_message(default_time=_DEFAULT_FEP_TIME),
{"metavar": "<sim-time>"}),
Option(
"-time-complex", None,
get_sim_time_message(default_time=_DEFAULT_FEP_TIME,
leg_type="complex",
default_arg="-fep-sim-time"), {
"type": float,
"metavar": "<sim-time>"
}),
Option(
"-time-solvent", None,
get_sim_time_message(default_time=_DEFAULT_FEP_TIME,
leg_type="solvent",
default_arg="-fep-sim-time"), {
"type": float,
"metavar": "<sim-time>"
}),
Option(
"-custom-charge-mode", constants.CUSTOM_CHARGE_MODE.ASSIGN,
"Set the custom charge calculation mode when using the "
f"{mm.OPLS_NAME_F16} forcefield. "
"Valid values are 'assign' to assign custom charges based on the input geometries, "
"'clear' to clear existing custom charges, and "
"'keep' to keep existing custom charges. "
"Default: %(default)s.\n",
{"metavar": "{%s}" % '|'.join(constants.CUSTOM_CHARGE_MODE)}),
Option(
"-ensemble",
constants.Ensembles.MUVT,
"Specify the ensemble class. Default: %(default)s.",
{"metavar": "{muVT|NPT|NVT}"},
),
Option("-ligand-restraint", False,
"Apply dihedral restraints on the ligand molecule."),
Option("-adaptive-ligand-restraint", False,
"Apply adaptive dihedral restraints on the ligand molecule."),
Option("-no-use-centroid", True, argparse.SUPPRESS, "use_centroid"),
Option(
"-use-final-frame", False,
"Use the final frame as the structure for FEP, instead of the representative structure."
),
Option(
"-extend",
"",
"Extend production simulations of specified ligands.",
{
"metavar": "<ligand-file>",
},
)
])
cmdline.suppress_options(options, {
"-skip_traj",
"-buffer",
"-no_concat",
"-lambda-windows",
})
opt = cmdline.parse_options(usage, options, argv[1:], add_subhost=True)
return Args(opt)