Source code for schrodinger.application.prime.input

"""
A class for reading and writing Prime simplified input files.

Copyright Schrodinger, LLC. All rights reserved.

"""
#Contributors: Matvey Adzhigirey

# Ev:67675

from schrodinger.application.inputconfig import InputConfig

spec_str = """
PRIME_TYPE           = option('SIDE_PRED', 'LOOP_BLD', 'REAL_MIN', 'SITE_OPT', 'ENERGY')
THREADS              = integer()
MAX_JOBS             = integer()
NUM_OUTPUT_STRUCT    = integer()
ECUTOFF              = float()
STRUCT_FILE          = string()
USE_RANDOM_SEED      = boolean()
SEED                 = integer()
USE_CRYSTAL_SYMMETRY = boolean()
INT_DIEL             = float()
EXT_DIEL             = float()
USE_MAE_CHARGES      = boolean()
USE_MEMBRANE         = boolean()
SELECT               = option('all', 'pick')
RESIDUE_FILE         = string()
LIGAND               = string()
NPASSES              = integer()
LOOP_i_RES_j         = string()
RES_SPHERE           = string()
MAX_CA_MOVEMENT      = float()
MIN_OVERLAP          = float()
RESIDUE_i            = string()
BUILD_TAIL           = boolean()
"""
prime_specs = []
for line in spec_str.split('\n'):
    prime_specs.append(line)


[docs]class Prime(InputConfig): """ Class for reading and writing simplified Prime input files. Example 1:: config = Prime(keyword_dict) config.write("path.inp") Example 2:: config = Prime("path.inp") inpath = config['STRUCT_FILE'] Example 3:: config = Prime() config['STRUCT_FILE'] = "path.mae" config.write("path.inp") """
[docs] def __init__(self, kw=None): """ Accepts one argument which is either a path or a keyword dictionary. """ InputConfig.__init__(self, kw, prime_specs) if kw: # Validate the InputConfig to specs (will convert to correct types) self.validateValues(preserve_errors=False, copy=False)
[docs] def write(self, filename): """ Writes a simplified input file to filename. This input file needs to be run via `$SCHRODINGER/prime`. """ if not filename.endswith('.inp'): raise ValueError("Prime input file should end with *.inp") self.writeInputFile(filename, ignore_none=True, yesno=True, smartsort=True) # smartsort is enabled as part of PYTHON-1815 return filename