Source code for schrodinger.application.jaguar.hydrokinetic_validation
"""
Hydrokinetic keywords input validation and specialized Exceptions
"""
# Contributors: Daniel S. Levine
import schrodinger.application.jaguar.workflow_validation as wv
#------------------------------------------------------------------------------
[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: HydrokineticKeyword
:param kwd: reference Hydrokinetic keyword
:type all_keywords: dict of HydrokineticKeyword instances indexed by name
:param all_keywords: all the other Hydrokinetic 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(hinp):
"""
Perform a check to ensure that matter is conserved and that
charge/multiplicity are consistent with structures.
A WorkflowConservationError is raised if any test fails.
"""
charge = hinp.getValue("charge")
mult = hinp.getValue("multiplicity")
r = hinp.getInputMolecule()
_validate_reaction([r], charge, mult)
def _validate_reaction(r, charge, mult):
"""
Validate a reaction specification.
will raise a WorkflowConservationError if the specification is invalid.
"""
wv.estate_is_physical(r, charge, mult)
wv.charge_is_consistent(r, charge)