Source code for openff.interchange.exceptions

"""Custom exceptions used in Interchange."""


[docs]class InterchangeException(Exception): """Base class for all Interchange exceptions."""
[docs]class SMIRNOFFParameterAttributeNotImplementedError(InterchangeException): """ Exception for when a parameter attribute is supported by the SMIRNOFF specification but not yet implemented. For example, this was raised when k_bondorder (used in bond order-based interpolation of force constants) before the behavior was supported. """
[docs]class SMIRNOFFHandlersNotImplementedError(InterchangeException): """ Exception for when some parameter handlers in the SMIRNOFF specification are not implemented here. """
[docs]class SMIRNOFFVersionNotSupportedError(InterchangeException): """ Exception for when a parameter handler's version is not supported. """
[docs]class InvalidParameterHandlerError(InterchangeException, ValueError): """ Generic exception for mismatch between expected and found ParameterHandler types. """
[docs]class InvalidBoxError(InterchangeException, ValueError): """ Generic exception for errors reading box data. """
[docs]class InvalidTopologyError(InterchangeException, ValueError): """ Generic exception for errors reading chemical topology data. """
[docs]class NonbondedEnergyError(InterchangeException, AssertionError): """ Exception for when non-bonded energies computed from different objects differ. """
[docs]class InvalidExpressionError(InterchangeException, ValueError): """ Exception for when an expression cannot safely be interpreted. """
[docs]class UnsupportedCutoffMethodError(InterchangeException): """ Exception for a cutoff method that is invalid or not supported by an engine. """
[docs]class UnimplementedCutoffMethodError(InterchangeException): """ Exception for a cutoff method that should be supported but it not yet implemented. """
[docs]class UnsupportedMixingRuleError(InterchangeException): """ Raised when attempting to use a mixing rule is invalid, unsupported or otherwise not implemented. """
[docs]class UnsupportedParameterError(InterchangeException, ValueError): """ Exception for parameters having unsupported values, i.e. non-1.0 idivf. """
[docs]class UnsupportedBoxError(InterchangeException, ValueError): """ Exception for processing an unsupported box, probably non-orthogonal. """
[docs]class UnsupportedImportError(InterchangeException): """ Generic exception for attempting to import from an unsupported data format. """
[docs]class UnsupportedExportError(InterchangeException): """ Exception for attempting to write to an unsupported file format. """
[docs]class UnsupportedCombinationError(InterchangeException): """General exception for something going wrong in Interchange object combination."""
[docs]class CutoffMismatchError(UnsupportedCombinationError): """Non-bonded cutoffs do not match."""
[docs]class SwitchingFunctionMismatchError(UnsupportedCombinationError): """Switching distances or the use of a switching function does not match."""
[docs]class PluginCompatibilityError(InterchangeException): """A plugin is incompatible with the current version of Interchange in the way it is called."""
[docs]class CannotSetSwitchingFunctionError(InterchangeException): """ Unable to set a switching function. """
[docs]class CannotInferEnergyError(InterchangeException): """ Failed to infer a physical interpretation of this energy term. """
[docs]class CannotInferNonbondedEnergyError(CannotInferEnergyError): """ Failed to infer a physical interpretation of this non-bonded energy. """
[docs]class InvalidWriterError(InterchangeException): """ An unknown or unimplemnted writer was specified. """
[docs]class ConversionError(InterchangeException): """ Base exception for error handling during object conversion. """
[docs]class MissingBoxError(InterchangeException): """ Exception for when box vectors are needed but missing. """
[docs]class MissingPositionsError(InterchangeException): """ Exception for when positions are needed but missing. """
[docs]class MissingParameterHandlerError(InterchangeException): """ Exception for when a parameter handler is requested but not found. """
[docs]class MissingParametersError(InterchangeException): """ Exception for when parameters are needed but missing. """
[docs]class MissingBondOrdersError(InterchangeException): """ Exception for when a parameter handler needs fractional bond orders but they are missing. """
[docs]class DuplicateMoleculeError(InterchangeException, ValueError): """ Exception for when molecules are not unique. """
[docs]class MissingUnitError(InterchangeException, ValueError): """ Exception for data missing a unit tag. """
[docs]class UnitValidationError(InterchangeException, ValueError): """ Exception for bad behavior when validating unit-tagged data. """
[docs]class NonbondedCompatibilityError(InterchangeException): """ Exception for unsupported combination of nonbonded methods. """
[docs]class MissingNonbondedCompatibilityError(InterchangeException): """ Exception for uncovered combination of nonbonded methods. """
[docs]class InternalInconsistencyError(InterchangeException): """ Fallback exception for bad behavior releating to a self-inconsistent internal state. These should not be reached but are raised to safeguard against problematic edge cases silently passing. """
[docs]class AmberError(InterchangeException): """ Base exception for handling Amber-related errors. """
[docs]class AmberExecutableNotFoundError(AmberError): """ Exception for when an Amber-related excutable is not found. """
[docs]class SanderError(AmberError): """ Exception for when a sander subprocess fails. """
[docs]class GMXError(InterchangeException): """ Exception for when a GROMACS subprocess fails. """
[docs]class GMXNotFoundError(GMXError): """ Exception for when no GROMACS executable is found. """
[docs]class GMXGromppError(GMXError): """ Exception for when `gmx grompp` fails. """
[docs]class GMXMdrunError(GMXError): """ Exception for when `gmx mdrun` fails. """
[docs]class LAMMPSError(InterchangeException): """ Base exception for handling LAMMPS-related errors. """
[docs]class LAMMPSNotFoundError(LAMMPSError): """ Exception for when no LAMMPS executable is found. """
[docs]class LAMMPSRunError(LAMMPSError): """ Exception for when a LAMMPS subprocess fails. """
[docs]class EnergyError(InterchangeException): """ Base class for energies in reports not matching. """
[docs]class InvalidEnergyError(InterchangeException): """ Energy type not understood. """
[docs]class IncompatibleTolerancesError(InterchangeException): """ Exception for when one report has a value for an energy group but the other does not. """
[docs]class MissingVirtualSitesError(InterchangeException): """ Raise when virtual sites are expected to exist but are not found. """
[docs]class VirtualSiteTypeNotImplementedError(InterchangeException): """ Raised when this type of virtual site is not yet implemented. """
[docs]class NonIntegralMoleculeChargeError(InterchangeException): """ Exception raised when the partial charges on a molecule do not sum up to its formal charge. """
[docs]class MissingPartialChargesError(InterchangeException): """ A molecule is missing partial charges. """
[docs]class UnassignedValenceError(InterchangeException): """Exception raised when there are valence terms for which a ParameterHandler did not find matches."""
[docs]class UnassignedBondError(UnassignedValenceError): """Exception raised when there are bond terms for which a ParameterHandler did not find matches."""
[docs]class UnassignedAngleError(UnassignedValenceError): """Exception raised when there are angle terms for which a ParameterHandler did not find matches."""
[docs]class UnassignedTorsionError(UnassignedValenceError): """Exception raised when there are torsion terms for which a ParameterHandler did not find matches."""
[docs]class MissingValenceError(InterchangeException): """Exception raised when there are valence interactions for which no parameters are found."""
[docs]class MissingBondError(UnassignedValenceError): """Exception raised when there exists a bond for which no parameters are found."""
[docs]class MissingAngleError(UnassignedValenceError): """Exception raised when there exists an angle for which no parameters are found."""
[docs]class MissingTorsionError(UnassignedValenceError): """Exception raised when there exists a torsion for which no parameters are found."""
[docs]class PACKMOLRuntimeError(InterchangeException): """Exception raised when PACKMOL fails to execute / converge."""
[docs]class PACKMOLValueError(InterchangeException): """Exception raised when a bad input is passed to a PACKMOL wrapper."""
[docs]class MinimizationError(InterchangeException): """Exception raised when an energy minimization fails to converge."""
[docs]class ExperimentalFeatureException(InterchangeException): """Exception raised when an experimental feature is used without opt-in."""