Skip to content

potential

Potential energy terms.

create_electron_ion_coulomb_potential(ion_locations, ion_charges, strength=1.0, softening_term=0.0)

Computes the total coulomb potential attraction between electron and ion.

Parameters:

Name Type Description Default
ion_locations Array

an (n, d) array of ion positions, where n is the number of ion positions and d is the dimension of the space they live in

required
ion_charges Array

an (n,) array of ion charges, in units of one elementary charge (the charge of one electron)

required
strength jnp.float32

amount to multiply the overall interaction by. Defaults to 1.0.

1.0
softening_term jnp.float32

this amount squared is added to sum_i x_i^2 before taking the sqrt in the norm calculation. When zero, the usual vector 2-norm is used to compute distance. Defaults to 0.0.

0.0

Returns:

Type Description
Callable

function which computes the potential energy due to the attraction between electrons and ion. Has the signature (params, electron_positions of shape (..., n_elec, d)) -> array of potential energies of shape electron_positions.shape[:-2]

Source code in vmcnet/physics/potential.py
def create_electron_ion_coulomb_potential(
    ion_locations: Array,
    ion_charges: Array,
    strength: jnp.float32 = 1.0,
    softening_term: jnp.float32 = 0.0,
) -> ModelApply[ModelParams]:
    """Computes the total coulomb potential attraction between electron and ion.

    Args:
        ion_locations (Array): an (n, d) array of ion positions, where n is the
            number of ion positions and d is the dimension of the space they live in
        ion_charges (Array): an (n,) array of ion charges, in units of one
            elementary charge (the charge of one electron)
        strength (jnp.float32, optional): amount to multiply the overall interaction by.
            Defaults to 1.0.
        softening_term (jnp.float32, optional): this amount squared is added to
            sum_i x_i^2 before taking the sqrt in the norm calculation. When zero, the
            usual vector 2-norm is used to compute distance. Defaults to 0.0.

    Returns:
        Callable: function which computes the potential energy due to the attraction
        between electrons and ion. Has the signature
        (params, electron_positions of shape (..., n_elec, d))
        -> array of potential energies of shape electron_positions.shape[:-2]
    """

    def potential_fn(params: ModelParams, x: Array) -> Array:
        del params
        electron_ion_displacements = _compute_displacements(x, ion_locations)
        electron_ion_distances = _compute_soft_norm(
            electron_ion_displacements, softening_term=softening_term
        )
        coulomb_attraction = ion_charges / electron_ion_distances
        return -strength * jnp.sum(coulomb_attraction, axis=(-1, -2))

    return potential_fn

create_electron_electron_coulomb_potential(strength=1.0, softening_term=0.0)

Computes the total coulomb potential repulsion between pairs of electrons.

Parameters:

Name Type Description Default
strength jnp.float32

amount to multiply the overall interaction by. Defaults to 1.0.

1.0
softening_term jnp.float32

this amount squared is added to sum_i x_i^2 before taking the sqrt in the norm calculation. When zero, the usual vector 2-norm is used to compute distance. Defaults to 0.0.

0.0

Returns:

Type Description
Callable

function which computes the potential energy due to the repulsion between pairs of electrons. Has the signature (params, electron_positions of shape (..., n_elec, d)) -> array of potential energies of shape electron_positions.shape[:-2]

Source code in vmcnet/physics/potential.py
def create_electron_electron_coulomb_potential(
    strength: jnp.float32 = 1.0, softening_term: jnp.float32 = 0.0
) -> ModelApply[ModelParams]:
    """Computes the total coulomb potential repulsion between pairs of electrons.

    Args:
        strength (jnp.float32, optional): amount to multiply the overall interaction by.
            Defaults to 1.0.
        softening_term (jnp.float32, optional): this amount squared is added to
            sum_i x_i^2 before taking the sqrt in the norm calculation. When zero, the
            usual vector 2-norm is used to compute distance. Defaults to 0.0.

    Returns:
        Callable: function which computes the potential energy due to the repulsion
        between pairs of electrons. Has the signature
        (params, electron_positions of shape (..., n_elec, d))
        -> array of potential energies of shape electron_positions.shape[:-2]
    """

    def potential_fn(params: ModelParams, x: Array) -> Array:
        del params
        electron_electron_displacements = _compute_displacements(x, x)
        electron_electron_distances = _compute_soft_norm(
            electron_electron_displacements, softening_term=softening_term
        )
        return jnp.sum(
            jnp.triu(strength / electron_electron_distances, k=1), axis=(-1, -2)
        )

    return potential_fn

create_ion_ion_coulomb_potential(ion_locations, ion_charges)

Computes the total coulomb potential repulsion between stationary ions.

Parameters:

Name Type Description Default
ion_locations Array

an (n, d) array of ion positions, where n is the number of ion positions and d is the dimension of the space they live in

required
ion_charges Array

an (n,) array of ion charges, in units of one elementary charge (the charge of one electron)

required

Returns:

Type Description
Callable

function which computes the potential energy due to the attraction between electrons and ion. Has the signature (params, electron_positions of shape (..., n_elec, d)) -> array of potential energies of shape electron_positions.shape[:-2]

Source code in vmcnet/physics/potential.py
def create_ion_ion_coulomb_potential(
    ion_locations: Array, ion_charges: Array
) -> ModelApply[ModelParams]:
    """Computes the total coulomb potential repulsion between stationary ions.

    Args:
        ion_locations (Array): an (n, d) array of ion positions, where n is the
            number of ion positions and d is the dimension of the space they live in
        ion_charges (Array): an (n,) array of ion charges, in units of one
            elementary charge (the charge of one electron)

    Returns:
        Callable: function which computes the potential energy due to the attraction
        between electrons and ion. Has the signature
        (params, electron_positions of shape (..., n_elec, d))
        -> array of potential energies of shape electron_positions.shape[:-2]
    """
    ion_ion_displacements, charge_charge_prods = _get_ion_ion_info(
        ion_locations, ion_charges
    )
    ion_ion_distances = _compute_soft_norm(ion_ion_displacements)
    constant_potential = jnp.sum(
        jnp.triu(charge_charge_prods / ion_ion_distances, k=1), axis=(-1, -2)
    )

    def potential_fn(params: ModelParams, x: Array) -> Array:
        del params, x
        return constant_potential

    return potential_fn