"""
Mixed Solvent MD command line UI
Copyright Schrodinger, LLC. All rights reserved.
"""
import argparse
import os
import sys
from typing import List
from schrodinger.application.desmond.mxmd import mxmd_system_builder as msb
from ...mxmd import mxmd_system_builder
from . import cmdline
from .cmdline import Option
[docs]class MxmdArgs(cmdline.BaseArgs):
[docs] def __init__(self, opt: argparse.Namespace):
"""
:param opt: Command line options with corresponding values.
"""
super(MxmdArgs, self).__init__(opt)
self.ppj = 1
[docs] def validate(self):
"""
Validate the parameters for missing files.
:raise SystemExit: For invalid parameters.
"""
super().validate()
custom_dir = self.custom_probe_dir
if custom_dir:
dir_is_subdir = os.path.abspath(custom_dir).startswith(os.getcwd())
if not dir_is_subdir:
sys.exit(f"Custom probe directory ({custom_dir}) must be a "
f"subdirectory of your current directory")
# Make sure all solvent boxes are present
probe_names = [s.lower() for s in self.probe.split(',')]
_, _, missing_probes = msb.get_probe_paths(probe_names, custom_dir)
if missing_probes:
sys.exit(
f"Missing solvent box files for: {', '.join(missing_probes)}")
[docs]def ui(argv: List[str]) -> MxmdArgs:
"""
Parse the arguments and return an object containing the values.
"""
usage = """
Mixed Solvent Molecular Dynamics (MxMD) is a hotspot mapping technique that relies on
molecular simulations of proteins in binary solvent mixtures. These mixtures consist of
water and small organic cosolvent probes that mimic binding counterpart of your protein.
Application of MxMD has been effective in the identification and characterization
of binding sites or protein-protein interfaces (PPI) along a protein surface.
* Run a new job:
$SCHRODINGER/mxmd -probe acetone,acetonitrile,imidazole -time 5000.0 -HOST <main-host> -SUBHOST <subhost> -JOBNAME <jobname> -nsim_per_probe 10 input.mae
"""
options = cmdline.get_common_options()
options.extend([
# name default help [dest]
Option("inp_file", None, "A Maestro structure file", {"nargs": "?"}),
Option(
"-time", 5000.0,
"Specify time (in ps) for the production simulation stage."
" Default: 5000.0. "),
Option(
"-time-equilibrate", 15000.0,
"Specify time (in ps) for the equilibration simulation stage."
" Default: %(default)s"),
Option(
"-probe", mxmd_system_builder.DEFAULT_PROBES_STR,
"Specify the cosolvent probes. "
f"Default: {mxmd_system_builder.DEFAULT_PROBES_STR}; "
f"Supported probes: {', '.join(sorted(mxmd_system_builder.BUILTIN_PROBE_NAMES))}"
" For use of custom probe(s), additionally provide the -custom-dir "
"option"),
Option(
"-init-water-buffer", mxmd_system_builder.BIG_BOX_BUFFER,
"Specify a guess for the initial water box buffer. The box will "
"then be shrunk to match volume/volume ratio "
f"Default: {mxmd_system_builder.BIG_BOX_BUFFER}"),
Option(
["-nsim-per-probe", "-nsim_per_probe"],
10,
"Specify number of simulations per probe"
" Default: %(default)s",
),
Option(
"-custom-probe-dir",
None,
"Specify custom probe directory. There must be a "
"<probe_name>.box.mae file in this directory for each custom "
"probe passed in using -custom-probe-dir."
"Default: No custom probe directory",
),
])
cmdline.suppress_options(
options, {
"-ppj", "-seed", "-skip_traj", "-checkpoint", "-buffer",
"-lambda-windows", "-ffbuilder", "-ff-host"
})
args = cmdline.parse_options(usage, options, argv[1:])
return MxmdArgs(args)