repESP.calc_fields module

Functions producing or acting on molecular fields

esp_from_charges(mesh: repESP.fields.AbstractMesh, molecule: repESP.types.Molecule[repESP.charges.AtomWithCoordsAndCharge][repESP.charges.AtomWithCoordsAndCharge]) → repESP.fields.Field[repESP.fields.Esp][repESP.fields.Esp][source]

Calculate ESP value at specified points due to charges on atoms

Parameters:
Returns:

The ESP field at the specified points reproduced from the partial charges on atoms of the given molecule.

Return type:

Field[Esp]

voronoi(mesh: repESP.fields.AbstractMesh, molecule: repESP.types.Molecule[repESP.types.AtomWithCoords][repESP.types.AtomWithCoords]) → repESP.fields.Field[typing.Tuple[typing.Union[int, NoneType], repESP.types.Dist]][Tuple[Optional[int], repESP.types.Dist]][source]

Find the atom closest to each point and its distance

Example

Imagine a molecule of carbon monoxide placed along the x-axis.

>>> mesh = Mesh([Coords([0, 0, 0])])
>>> molecule = Molecule([
    AtomWithCoords(6, Coords([-2, 0, 0])),
    AtomWithCoords(8, Coords([0.13, 0, 0]))
])
>>> print(voronoi(mesh, molecule).values)
[(1, 0.13)]

The result means that for the only point of the mesh (0, 0, 0), atom of index 1 (i.e. the second atom, oxygen) is closer than any other atom (carbon) and the distance to it is 0.13 a.u.

Parameters:
  • mesh (AbstractMesh) – The points at which the ESP values are to be calculated.
  • molecule (Molecule[AtomWithCoords]) – A molecule consisting of atoms with the coordinates specified.
Returns:

A Field object specifying for each point the atom to which the point is nearest (represented as ordinal, zero-based index into the molecule) and the distance from that atom.

Return type:

Field[Tuple[Optional[int], Dist]]

NumericValue = ~NumericValue

Generic type for numeric values

This type matches that of fields.Field.NumericValue and similarly it can be any type matching “bound=float”.

Type:TypeVar
calc_rms_value(values: Collection[NumericValue]) → NumericValue[source]

Calculate root-mean-square (RMS) value of a collection of values

Parameters:values (Collection[NumericValue]) – The values which RMS is to be calculated.
Returns:RMS value fo the given values.
Return type:NumericValue
calc_rms_error(values1: Collection[NumericValue], values2: Collection[NumericValue]) → NumericValue[source]

Calculate RMS error between two collections of values

Parameters:
  • values1 (Collection[NumericValue]) – One of the collections of values to be used for the calculation.
  • values2 (Collection[NumericValue]) – The other collection of values to be used for the calculation.
Returns:

RMS error between the two given collections of values

Return type:

NumericValue

calc_relative_rms_error(values1: Collection[NumericValue], values2: Collection[NumericValue]) → float[source]

Calculate relative RMS error of two collections of values

This is calculated as the RMS error between the two collections of values (as given by calc_rms_error) divided by the RMS error of the first collection of values.

Parameters:
  • values1 (Collection[NumericValue]) – One of the collections of values which are to be used for the calculation. The RMS error will be reported relative to the RMS value of this collection.
  • values2 (Collection[NumericValue]) – The other collection of values to be used for the calculation.
Returns:

Relative RMS error of the field values.

Return type:

float