Potentials#
Directory: libfly/potential
The potential
folder contains a collection of potential energy functions. Everything is contained within the namespace fly::potential
.
Generic potential#
File: libfly/potential/generic.hpp
Generic potential energy class.
The potential completely describes the interatomic interactions present in a system.
-
class Generic#
Generalised interatomic potential.
Essentially a
std::variant
of all supported potentials.Public Functions
-
template<typename ...Args, typename = std::enable_if_t<std::is_constructible_v<variant, Args&&...>>>
inline explicit Generic(Args&&... args)# Construct a new Generic object.
- Parameters:
args – Forwarded to
std::variant
’s constructor.
-
inline auto energy(system::SoA<TypeID const&, Frozen const&> in, neigh::List const &nl, int threads = 1) -> double#
Compute the potential energy.
Can assume the neighbour list are ready.
- Parameters:
in – Per-atom data used by potential for computation.
nl – Neighbour list (in ready state i.e. neigh::List::update() or neigh::List::rebuild() called) configured with a cut-off at least
r_cut()
.threads – Number of openMP threads to use.
- Returns:
The potential energy of the system of atoms.
-
inline auto gradient(system::SoA<PotentialGradient&> out, system::SoA<TypeID const&, Frozen const&> in, neigh::List const &nl, int threads = 1) -> void#
Compute potential energy gradient.
Can assume the neighbour list are ready, force on frozen atoms must be zero.
- Parameters:
out – Result is written here.
in – Per-atom data used by potential for computation.
nl – Neighbour list (in ready state i.e. neigh::List::update() or neigh::List::rebuild() called) configured with a cut-off at least
r_cut()
.threads – Number of openMP threads to use.
-
inline auto hessian(system::Hessian &out, system::SoA<TypeID const&, Frozen const&> in, neigh::List const &nl, int threads = 1) -> void#
Compute hessian matrix.
Can assume the neighbour list are ready. The resulting hessian must be n by n (n = number of atoms * spatial dims) and only include contributions from the m active atoms i.e. have zeros for frozen atoms. As hessian matrices are always symmetric this function is only required to compute the lower diagonal portion.
- Parameters:
in – Per-atom data used by hessian for computation.
out – Hessian matrix to write output to.
nl – Neighbour list (in ready state i.e. neigh::List::update() or neigh::List::rebuild() called) configured with a cut-off at least
r_cut()
.threads – Number of openMP threads to use.
-
inline auto r_cut() const noexcept -> double#
Get this potentials cut-off radius.
This is the maximum distance two atoms can interact. The neighbour::List passed to the other functions should be configured with a cut-off equal or greater than this.
-
template<typename ...Args, typename = std::enable_if_t<std::is_constructible_v<variant, Args&&...>>>
EAM#
Parsing#
File: libfly/potential/EAM/data.hpp
EAM parsing and storage.
-
class DataEAM#
Parses/stores tabulated EAM data and reconstructs f, phi, v smoothly via splines.
Public Functions
-
DataEAM(Options const &opt, std::ifstream in)#
Parse the LAMMPS-style eam/fs stream and construct an DataEAM object.
For detail on file specification see: https://docs.lammps.org/pair_eam.html
-
inline auto phi(TypeID::scalar_t a, TypeID::scalar_t b) const -> Spline const&#
Fetch the electron density function.
Corresponding to the atom pair with TypeID’s
a
andb
.
-
inline auto r_cut() const noexcept -> double#
Fetch the cut-off radius.
-
DataEAM(Options const &opt, std::ifstream in)#
Evaluating#
File: libfly/potential/EAM/eam.hpp
EAM potential implementation.
-
class EAM#
EAM potential child class.
Public Functions
Construct a new EAM object.
- Parameters:
map – TypeMap of expected types to find in data.
data – Tabulated EAM data.
-
auto energy(system::SoA<TypeID const&, Frozen const&> in, neigh::List const &nl, int threads = 1) -> double#
Compute the potential energy.
Assumes the neighbour list are ready, ignores contributions from the frozen atoms.
- Parameters:
nl – Neighbour list (in ready state i.e. neigh::List::update() or neigh::List::rebuild() called).
threads – Number of openMP threads to use.
- Returns:
double The potential energy of the system of atoms.
-
auto gradient(system::SoA<PotentialGradient&> out, system::SoA<TypeID const&, Frozen const&> in, neigh::List const &nl, int threads = 1) -> void#
Compute potential energy gradient.
Assumes the neighbour list are ready, force on frozen atoms will be zero.
- Parameters:
out – Potential gradient written to this.
nl – Neighbour list (in ready state i.e. neigh::List::update() or neigh::List::rebuild() called).
threads – Number of openMP threads to use.
-
auto hessian(system::Hessian &out, system::SoA<TypeID const&, Frozen const&> in, neigh::List const &nl, int threads = 1) -> void#
Compute hessian matrix.
Assumes the neighbour list are ready. The resulting hessian will be n by n (n = number of atoms) and only include contributions from the m active atoms i.e. have zeros for frozen atoms. As hessian matrices are always symmetric this function only computes the lower diagonal portion.
- Parameters:
in – Input data.
out – Hessian matrix to write output to.
nl – Neighbour list (in ready state i.e. neigh::List::update() or neigh::List::rebuild() called).
threads – Number of openMP threads to use.
-
inline auto r_cut() const noexcept -> double#
Get this potentials cut-off radius.
This is the maximum distance two atom can interact. The neighbour::List passed to the other functions should be configured with a cut-off equal or greater than this.