Source code for schrodinger.application.desmond.starter.ui.constant_ph
"""
Constant pH command line UI
Copyright Schrodinger, LLC. All rights reserved.
"""
import argparse
import os
import sys
from typing import List
from typing import Set
from schrodinger.application.desmond import util
from . import cmdline
from .cmdline import Option
[docs]class Args(cmdline.BaseArgs):
[docs] def __init__(self, opt: argparse.Namespace):
"""
:param opt: Command line options with corresponding values.
"""
self.copy_parser_attributes(opt)
super().__init__(opt)
[docs] def validate(self):
"""
:raise SystemExit: For invalid parameters.
"""
util.ensure_file_exists(self.inp_file)
super().validate()
[docs]def ui(argv: List[str]) -> Args:
"""
Parse the arguments and return an object containing the values.
"""
from schrodinger.application.scisol.packages.fep import utils as scisol_utils
usage = """
Runs a constant-pH simulation. This only works with the S-OPLS forcefield.
* Run a new job:
$SCHRODINGER/constant_ph -time 5000.0 -HOST <job-host> -JOBNAME <jobname> input.mae
"""
options = cmdline.get_common_options()
options.extend([
# name default help [dest]
Option("inp_file", None, "A Maestro structure file"),
Option("-time", 5000.0,
"Specify time (in ps) for the production simulation stage."
" Default: %(default)s. "),
Option("-titratable-residues", [],
"Specify a list of titratable residues to consider "
"in the format 'A:2B' or 'chain:resnum[inscode]'. "
"If no insertion code is present, just leave it off 'A:2'. "
" '_' can be used to indicate an blank chain letter in '_:2'."
" Only ASP/GLU/HIS residues may be titrated."
"Default: Mark all supported residues as titratable."),
Option(
"-skip-sidechain-mapping", False, argparse.SUPPRESS
# "Set to skip mapping the side chains"
), # Probably will become default True once the backend supports this
Option("-ph-lower-limit", 0.5,
"Set to the lower limit of pH's to run simulations at."),
Option("-ph-upper-limit", 9.0,
"Set to the upper limit of pH's to run simulations at."),
Option("-ph-interval", 0.5,
"Set to the interval in pH units to run the simulations at."),
])
cmdline.suppress_options(
options, {
"-skip_traj", "-checkpoint", "-buffer", "-no_concat", "-m", "-ff",
"-lambda-windows", "-ffbuilder", "-ff-host"
})
args = cmdline.parse_options(usage, options, argv[1:], add_subhost=False)
args.titratable_residues = list(
scisol_utils.flattened(args.titratable_residues))
return Args(args)