repESP.fields module

Types used to describe fields as values at selected points in space

class Esp[source]

Bases: float

Electrostatic potential value in atomic units (\(E_h/e\))

Parameters:value (Any) – Any value convertible to float representing the value in atomic units.
class Ed[source]

Bases: float

Electron density value in atomic units (\(e / \mathrm{a}_0^3\))

Parameters:value (Any) – Any value convertible to float representing the value in atomic units.
class AbstractMesh[source]

Bases: abc.ABC

Abstract base class for collections of points in space

Calling len on instances of this class will return the number of points.

points

Coordinates of points of which the mesh consists

The order of iteration must be defined.

Yields:Iterator[Coords] – Iterator over the point coordinates
class Mesh(points_: dataclasses.InitVar)[source]

Bases: repESP.fields.AbstractMesh

Collection of points in space without assumptions regarding structure

This class stores all the points given on initialization and hence it’s memory footprint is linear in the number of points.

Parameters:points (Collection[Coords]) – The coordinates of points to be stored
points

Coordinates of points of which the mesh consists

The order of iteration is the same as that of the collection provided during initialization.

Yields:Iterator[Coords] – Iterator over the point coordinates
class GridMesh(origin: repESP.types.Coords, axes: repESP.fields.GridMesh.Axes)[source]

Bases: repESP.fields.AbstractMesh

Collection of points in space organized in a grid

This class only stores information regarding the grid which underlies the spatial organization of the points and thus it’s memory footprint is constant with respect to the number of points it describes. This a trade-off for a small CPU cost whenever a point is retrieved from the points iterator.

Parameters:
  • origin (Coords) – The coordinates of the coordinates system origin.
  • axes (Axes) – The coordinates of the coordinates axes’ origin.
Axes[source]

Type alias for a tuple of three Axis objects. Note that currently only axes aligned with the coordinate system axes are supported, i.e. the axes’ vectors are expected to be:

((x_step, 0, 0), (0, y_step, 0), (0, 0, z_step))
Type:Tuple[GridMesh.Axis, GridMesh.Axis, GridMesh.Axis]
class Axis(vector: repESP.types.Coords, point_count: int)[source]

Bases: object

Dataclass describing a coordinate system axis

Parameters:
  • vector (Coords) –

    Unit vector in xyz coordinates, for example:

    (Dist(1), Dist(0), Dist(0))
    

    for a typical x-axis with a point every 1 a₀.

  • point_count (int) – The number of points that the grid places along this axis.
vector

See initialization parameter

point_count

See initialization parameter

class Axes[source]

Bases: tuple, typing.Generic

points

Coordinates of points of which the mesh consists

The order of iteration is the same as the order of values in a Gaussian “cube” file. Values of z are incremented first, then all values of y, and finally all values of x. This is best described with the following pseudocode:

for x in x_values:
    for y in y_values:
        for z in z_values:
            yield (x, y, z)
Yields:Iterator[Coords] – Iterator over the point coordinates
FieldValue = ~FieldValue

The generic type for the values of the Field class.

There are no restrictions on what this type can be.

Type:typing.TypeVar
class Field(mesh: repESP.fields.AbstractMesh, values_: dataclasses.InitVar)[source]

Bases: typing.Generic

Dataclass representing values of a field at a “mesh” of points in space

This class is generic in the type of the field value, which can be of any type. Classes where FieldValue matches NumericValue, additionally support arithmetic operations (currently only addition and subtraction).

Parameters:
  • mesh (AbstractMesh) – A “mesh” of points in space at which the field has values
  • values_ (Collection[FieldValue]) – A collection of values corresponding to the points in space given in the same order as the AbstractMesh.points iterator.
mesh

See initialization parameter

values

Converted from the values_ initialization parameter

Type:typing.List[FieldValue]
NumericValue

Generic type specifying a subset of FieldValue types for which arithmetic operations are defined. This can be any type matching “bound=float”.

Type:typing.TypeVar
NumericValue = ~NumericValue