Package schrodinger :: Package application :: Package jaguar :: Module reactiq_validation
[hide private]
[frames] | no frames]

Module reactiq_validation

Reactiq keywords input validation and specialized Exceptions

Classes [hide private]
  ReactiqKeywordException
Base exception class for all custom Reactiq keyword validation errors
  ReactiqConservationError
Runtime error due to a failure to conserve matter
  ReactiqKeywordError
Exception class raised when nonexistant Reactiq keyword is requested
  ReactiqKeywordValueTypeError
Exception class raised when Reactiq keyword value has wrong type
  ReactiqKeywordValueError
Exception class raised when Reactiq keyword value is invalid
  ReactiqKeywordConflictError
Exception class raised when Reactiq keywords have conflicting values
  ReactiqKeywordFormatError
Exception class raised when a string not in the keyword=value format is found
Functions [hide private]
 
raise_voluptuous_exception(exception, kwd)
Re-raise voluptuous Exceptions as ReactiqKeywordException's
 
check_conflicts(kwd, all_keywords)
Raise Exception if keyword value is inconsistent with the other keywords.
 
reaction_is_supported(reactants, products)
Check that the input reaction is supported, if not raise an UnsupportedReaction.
bool
matter_is_conserved(reactants, products)
Check the input structures to ensure that matter is conserved.
bool
charge_is_conserved(reactants, products)
Check the input structures to ensure that charge is conserved.
int
_calculate_num_electrons(structures)
Return the total number of electrons in structure(s) considering charges.
 
estate_is_physical(strs, charge, mult)
Check whether or not the requested electronic state is plausible.
Variables [hide private]
  SCHEMA_ERRORS = {re.compile(r'invalid list value.*'): <class '...
  __package__ = 'schrodinger.application.jaguar'
Function Details [hide private]

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.

Parameters:
  • kwd (ReactiqKeyword) - reference Reactiq keyword
  • all_keywords (dict of ReactiqKeyword instances indexed by name) - all the other Reactiq keywords set

    @raise ReactiqKeywordConflictError if conflicting values found.

matter_is_conserved(reactants, products)

 

Check the input structures to ensure that matter is conserved. If matter is not conserved a ReactiqConservationError is raised.

Parameters:
  • reactants (Structure object or iterable of Structure objects) - the reactants or reactant complex
  • products (Structure object or iterable of Structure objects) - the reactants or reactant complex
Returns: bool
whether or not matter is conserved

charge_is_conserved(reactants, products)

 

Check the input structures to ensure that charge is conserved. If charge is not conserved a ReactiqConservationError is raised.

Parameters:
  • reactants (Structure object or iterable of Structure objects) - the reactants or reactant complex
  • products (Structure object or iterable of Structure objects) - the reactants or reactant complex
Returns: bool
whether or not matter is conserved

_calculate_num_electrons(structures)

 

Return the total number of electrons in structure(s) considering charges.

Parameters:
  • structures (Structure object or iterable of Structure objects) - structures whose electrons must be added up
Returns: int
the total number of electrons

estate_is_physical(strs, charge, mult)

 

Check whether or not the requested electronic state is plausible. This is done by ensuring the number of electrons is consistent with the requested charge/multiplicity. Raises a ReactiqConservationError

Parameters:
  • strs (Structure object or iterable of Structure objects) - the reactants or reactant complex
  • charge (int) - overall charge
  • mult (int)

Variables Details [hide private]

SCHEMA_ERRORS

Value:
{re.compile(r'invalid list value.*'): <class 'schrodinger.application.\
jaguar.reactiq_validation.ReactiqKeywordValueError'>,
 re.compile(r'expected.*for dictionary value.*'): <class 'schrodinger.\
application.jaguar.reactiq_validation.ReactiqKeywordValueTypeError'>,
 re.compile(r'not a valid value for.*'): <class 'schrodinger.applicati\
on.jaguar.reactiq_validation.ReactiqKeywordValueError'>}