graph2mat.PointBasis

class graph2mat.PointBasis(type: str | int, R: float | ndarray, basis: str | Sequence[int | Tuple[int, int, int]] = (), basis_convention: str | Literal['cartesian', 'spherical', 'siesta_spherical', 'qe_spherical'] = 'spherical')[source]

Bases: object

Stores the basis set for a point type.

Parameters:
  • type (str | int) – The type ID, e.g. some meaningful name or a number.

  • R (Union[float, np.ndarray]) –

    The reach of the basis. If a float, the same reach is used for all functions.

    If an array, the reach is different for each SET of functions. E.g. for a basis with 3 l=0 functions and 2 sets of l=1 functions, you must provide an array of length 5.

    The reach of the functions will determine if the point interacts with other points.

  • basis (str | Sequence[int | Tuple[int, int, int]]) –

    Specification of the basis set that the point type has. It can be a list of specifications, then each item in the list can be the number of sets of functions for a given l (determined by the position of the item in the list), or a tuple specifying (n_sets, l, parity).

    It can also be a string representing the irreps of the basis in the e3nn format. E.g. “3x0e+2x1o” would mean 3 l=0 and 2 l=1 sets.

  • basis_convention (str | Literal['cartesian', 'spherical', 'siesta_spherical', 'qe_spherical']) – The convention used for the basis. It can be any combination of "xyz" with optional minus signs, e.g. "xyz", "-yz-x", "z-x-y". You can also use the aliases that we provide, such as "cartesian" or "spherical".

Examples

from graph2mat import PointBasis

# Let's create a basis with 3 l=0 functions and 2 sets of l=1 functions.
# The convention for spherical harmonics will be the standard one.
# We call this type of basis set "A", and functions have a reach of 5.
basis = PointBasis("A", R=5, basis=[3, 2], basis_convention="spherical")

# Same but with a different reach for l=0 (R=5) and l=1 functions (R=3).
basis = PointBasis("A", R=np.array([5, 5, 5, 3, 3, 3, 3, 3, 3]), irreps=[3, 2], basis_convention="spherical" )

# Equivalent specification of the basis using tuples:
basis = PointBasis("A", R=5, basis=[(3, 0, 1), (2, 1, -1)], basis_convention="spherical")

Methods

copy(**kwargs)

from_sisl_atom(atom[, basis_convention])

Creates a point basis from a sisl atom.

maxR()

Returns the maximum reach of the basis.

to_sisl_atom([Z])

Converts the basis to a sisl atom.

Attributes

basis

basis_convention

basis_size

Returns the number of basis functions per point.

e3nn_irreps

Returns the irreps in the e3nn format.

num_sets

Returns the number of sets of functions.

type

R

R: float | ndarray
basis: str | Sequence[int | Tuple[int, int, int]] = ()
basis_convention: str | Literal['cartesian', 'spherical', 'siesta_spherical', 'qe_spherical'] = 'spherical'
property basis_size: int

Returns the number of basis functions per point.

copy(**kwargs)[source]
property e3nn_irreps

Returns the irreps in the e3nn format.

classmethod from_sisl_atom(atom: Atom, basis_convention: str | Literal['cartesian', 'spherical', 'siesta_spherical', 'qe_spherical'] = 'siesta_spherical')[source]

Creates a point basis from a sisl atom.

Parameters:
  • atom – The atom from which to create the basis.

  • basis_convention – The spherical harmonics convention used for the basis.

maxR() float[source]

Returns the maximum reach of the basis.

property num_sets: int

Returns the number of sets of functions.

E.g. for a basis with 3 l=0 functions and 2 sets of l=1 functions, this returns 5.

to_sisl_atom(Z: int = 1) Atom[source]

Converts the basis to a sisl atom.

Parameters:

Z – The atomic number of the atom.

type: str | int