Source code for schrodinger.application.desmond.starter.ui.constant_ph

"""
Constant pH command line UI

Copyright Schrodinger, LLC. All rights reserved.
"""
import argparse
from typing import List
import sys

from schrodinger.application.desmond.constants import UiMode
from . import cmdline
from .cmdline import Option


[docs]class Args(cmdline.BaseArgs): @property def mode(self) -> UiMode: if self.extend: return UiMode.EXTEND elif self.checkpoint or self.restart: return UiMode.RESTART else: return UiMode.NEW
[docs] def validate(self): """ :raise SystemExit: For invalid parameters. """ from schrodinger.application.scisol.packages.fep import utils as scisol_utils # Flatten list to simplify parsing self.titratable_sites = list( scisol_utils.flattened(self.titratable_sites)) if self.mode == UiMode.NEW and not self.titratable_sites: sys.exit( "-titratable-site must be specified. " "Use '-titratable-site all' to titrate all titratable sites.") super().validate()
[docs]def ui(argv: List[str]) -> Args: """ Parse the arguments and return an object containing the values. """ usage = """ Runs a constant-pH simulation. This only works with the S-OPLS forcefield. * Run a new job: $SCHRODINGER/constant_ph input.mae -time 5000.0 -HOST <job-host> -JOBNAME <jobname> -titratable-site all * Restart a previously interrupted job: $SCHRODINGER/constant_ph input.mae -HOST <job-host> -JOBNAME <jobname> -RESTART * Extend a completed job: $SCHRODINGER/constant_ph input.mae -time 1000.0 -HOST <job-host> -JOBNAME <jobname> -extend """ 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-site", [], "Specify the titratable site 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. Use 'all' " " to mark all supported residues as titratable. " " You may pass in the argument multiple times for multiple sites. ", { 'nargs': 1, 'action': 'extend', 'dest': 'titratable_sites' }), 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."), Option("-extend", False, "Set to True to run an extension for the original job."), ]) 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) return Args(args)