Source code for schrodinger.application.jaguar.solvation_validation
"""
Solvation keywords input validation and specialized Exceptions
"""
# Contributors: Daniel S. Levine
import schrodinger.application.jaguar.workflow_validation as wv
from schrodinger.application.jaguar.exceptions import JaguarRuntimeError
#------------------------------------------------------------------------------
[docs]def check_conflicts(kwd, all_keywords):
    """
    Raise Exception if keyword value is inconsistent with the
    other keywords.  This is done in an adhoc case-by-case way.
    :type  kwd: SolvationKeyword
    :param kwd: reference Solvation keyword
    :type  all_keywords: dict of SolvationKeyword instances indexed by name
    :param all_keywords: all the other Solvation keywords set
    :raise WorkflowKeywordConflictError if conflicting values found.
    """
    # add other known conflicts here...
    if kwd.name == 'xxx' and kwd.value == 'yyy':
        pass
    return True 
[docs]def validate_structures(sinp):
    """
    Perform a check to ensure that charge/multiplicity
    are consistent with structures.
    A WorkflowConservationError is raised if any test fails.
    """
    charge = sinp.getValue("charge")
    mult = sinp.getValue("multiplicity")
    r = sinp.getInputMolecule()
    if r is None:
        raise JaguarRuntimeError("No input molecule specified")
    _validate_charges(r, charge, mult) 
def _validate_charges(r, charge, mult):
    """
    Validate a structure.
    will raise a WorkflowConservationError if the specification is invalid.
    """
    wv.estate_is_physical(r, charge, mult)
    wv.charge_is_consistent(r, charge)