opan.error

Defines custom errors for Open Anharmonic

Error classes are subclassed from Exception via an abstract superclass, OpanError, which defines several common features:

  • Storage of a ‘typecode’ and a ‘source’ string along with the error message to allow passing of more fine-grained information to the exception stack
  • Implementation of the EnumIterMeta metaclass on OpanError, enabling typecode validity checking with in
  • Re-implementation of __str__() to enhance the usefulness of stack messages when one of these errors is raised

OpanError Subclasses

AnharmError – Raised as a result of OpanVPT2 actions

GradError – Raised during parsing of or calculations using gradient data

HessError – Raised during parsing of or calculations using Hessian data

InertiaError – Raised by opan.utils.inertia submodule functions

OutputError – Raised during parsing of or calculations using output data

RepoError – Raised by HDF5 repository interactions

SymmError – Raised by opan.utils.symm submodule functions

VectorError – Raised by opan.utils.vector submodule functions

XYZError – Raised during parsing of or calculations using XYZ data


API

exception opan.error.AnharmError(tc, msg, src)

Bases: opan.error.OpanError

Error relating to OpanVPT2 actions.

See the OpanError documentation for more information on attributes, methods, etc.

Todo

Add object references once the DOM is more established?

Typecodes

REPO = 'REPO'

OpanAnharmRepo conflict – no repo bound when assignment attempted, or attempt made to bind new repo when one already bound

STATUS = 'STATUS'

OpanVPT2 internal variables in inappropriate state for the requested operation

exception opan.error.GradError(tc, msg, src)

Bases: opan.error.OpanError

Error relating to parsing of or calculation from gradient data.

Not all typecodes may be relevant for all software packages.

See the OpanError documentation for more information on attributes, methods, etc.

Typecodes

BADATOM = 'BADATOM'

Missing or invalid atom symbols; SHOULD only be used by SuperOpanGrad

BADGEOM = 'BADGEOM'

Missing or invalid geometry data; SHOULD only be used by SuperOpanGrad

BADGRAD = 'BADGRAD'

Missing or invalid gradient data; SHOULD only be used by SuperOpanGrad

ENERGY = 'ENERGY'

Energy value not found

GEOMBLOCK = 'GEOMBLOCK'

Malformed or missing geometry block

GRADBLOCK = 'GRADBLOCK'

Malformed or missing gradient block

NUMATS = 'NUMATS'

Invalid number-of-atoms specification, or specification not found

OVERWRITE = 'OVERWRITE'

Object already initialized (overwrite not supported)

exception opan.error.HessError(tc, msg, src)

Bases: opan.error.OpanError

Error relating to parsing of or calculation from Hessian data.

Not all typecodes may be relevant for all software packages.

See the OpanError documentation for more information on attributes, methods, etc.

Typecodes

AT_BLOCK = 'AT_BLOCK'

Malformed or missing atom/geometry specification block

BADATOM = 'BADATOM'

Missing or invalid atom symbols; SHOULD only be used by SuperOpanHess

BADGEOM = 'BADGEOM'

Missing or invalid geometry data; SHOULD only be used by SuperOpanHess

BADHESS = 'BADHESS'

Missing or invalid Hessian data; SHOULD only be used by SuperOpanHess

DIPDER_BLOCK = 'DIPDER_BLOCK'

Malformed dipole derivatives block

EIGVAL_BLOCK = 'EIGVAL_BLOCK'

Malformed mass-weighted-Hessian eigenvalues block

EIGVEC_BLOCK = 'EIGVEC_BLOCK'

Malformed mass-weighted-Hessian eigenvectors block

ENERGY = 'ENERGY'

Malformed or missing energy value

FREQ_BLOCK = 'FREQ_BLOCK'

Malformed or missing frequencies block

HESS_BLOCK = 'HESS_BLOCK'

Malformed or missing Hessian block

IR_BLOCK = 'IR_BLOCK'

Malformed IR spectrum block

JOB_BLOCK = 'JOB_BLOCK'

Malformed job list block

MODES_BLOCK = 'MODES_BLOCK'

Malformed or missing normal modes block

OVERWRITE = 'OVERWRITE'

Object already initialized (overwrite not supported)

POLDER_BLOCK = 'POLDER_BLOCK'

Malformed polarizability derivatives block

RAMAN_BLOCK = 'RAMAN_BLOCK'

Malformed Raman spectrum block

TEMP = 'TEMP'

Malformed or missing temperature value

exception opan.error.InertiaError(tc, msg, src)

Bases: opan.error.OpanError

Error relating to opan.utils.inertia submodule functions.

See the OpanError documentation for more information on attributes, methods, etc.

Typecodes

BAD_GEOM = 'BAD_GEOM'

A geometry being parsed was unsuitable for a particular type of calculation/manipulation

NEG_MOMENT = 'NEG_MOMENT'

A negative principal inertial moment was computed

TOP_TYPE = 'TOP_TYPE'

No valid molecular top type was identified

exception opan.error.OpanError(tc, msg, src)

Bases: Exception

Base class for custom errors defined for Open Anharmonic

OpanError is an abstract superclass of any custom errors defined under the Open Anharmonic umbrella. It defines all common methods shared among the various subtype error classes, such that the only contents that must be declared by a subclass are str class variables with contents identical to their names. These are recognized by the __iter__() defined in opan.const.EnumIterMeta as being the set of valid typecodes.

Parameters:
  • tcstr – String representation of typecode to be associated with the OpanError subclass instance. Must be a validly constructed typecode defined for the relevant subclass.
  • msgstr – Explanation of the nature of the error being reported
  • srcstr – Further detail of the code/file source of the error behavior, if relevant
Raises:
  • NotImplementedError – Upon attempt to instantiate abstract OpanError base class
  • KeyError – Upon instantiation with an invalid typecode
msg

str – Explanation of the nature of the error being reported

src

str – Further detail of the code source of the error behavior

subclass_name

str – String representation of the OpanError subclass name

tc

str – String typecode associated with the instance

exception opan.error.OutputError(tc, msg, src)

Bases: opan.error.OpanError

Error relating to parsing of or calculation from output data.

See the OpanError documentation for more information on attributes, methods, etc.

Typecodes

(none yet)

exception opan.error.RepoError(tc, msg, src)

Bases: opan.error.OpanError

Error relating to HDF5 repository interactions.

See the OpanError documentation for more information on attributes, methods, etc.

Typecodes

DATA = 'DATA'

Problem with a dataset in linked HDF5 File

GROUP = 'GROUP'

Problem with a group in linked HDF5 File

STATUS = 'STATUS'

HDF5 repo in improper status for requested operation

exception opan.error.SymmError(tc, msg, src)

Bases: opan.error.OpanError

Error relating to opan.utils.symm submodule functions.

See the OpanError documentation for more information on attributes, methods, etc.

Todo

Add note about this being subject to future development?

Typecodes

NOTFOUND = 'NOTFOUND'

Symmetry element expected but not found

exception opan.error.VectorError(tc, msg, src)

Bases: opan.error.OpanError

Error relating to opan.utils.vector submodule functions.

See the OpanError documentation for more information on attributes, methods, etc.

Typecodes

NONPRL = 'NONPRL'

Insufficient non-parallel character in some manner of calculation

ORTHONORM = 'ORTHONORM'

Vectors which should have been orthonormal were determined not to be

exception opan.error.XYZError(tc, msg, src)

Bases: opan.error.OpanError

Error relating to parsing of or calculation using XYZ data.

See the OpanError documentation for more information on attributes, methods, etc.

Typecodes

DIHED = 'DIHED'

Dihedral angle calculation requested for a set of atoms containing an insufficiently nonlinear trio of atoms

NONPRL = 'NONPRL'

Insufficient non-parallel character in some manner of calculation

OVERWRITE = 'OVERWRITE'

Object already initialized (overwrite not supported)

XYZFILE = 'XYZFILE'

Inconsistent geometry in an OpenBabel XYZ file

  • ORCA.xyz or .trj