matscipy.calculators package

Submodules

matscipy.calculators.eam.calculator module

Embedded-atom method potential.

class matscipy.calculators.eam.calculator.EAM(fn=None, atomic_numbers=None, F=None, f=None, rep=None, cutoff=None, kind='eam/alloy')

Bases: ase.calculators.calculator.Calculator

calculate(atoms, properties, system_changes)

Do the calculation.

properties: list of str

List of what needs to be calculated. Can be any combination of ‘energy’, ‘forces’, ‘stress’, ‘dipole’, ‘charges’, ‘magmom’ and ‘magmoms’.

system_changes: list of str

List of what has changed since last calculation. Can be any combination of these six: ‘positions’, ‘numbers’, ‘cell’, ‘pbc’, ‘initial_charges’ and ‘initial_magmoms’.

Subclasses need to implement this, but can ignore properties and system_changes if they want. Calculated properties should be inserted into results dictionary like shown in this dummy example:

self.results = {'energy': 0.0,
                'forces': np.zeros((len(atoms), 3)),
                'stress': np.zeros(6),
                'dipole': np.zeros(3),
                'charges': np.zeros(len(atoms)),
                'magmom': 0.0,
                'magmoms': np.zeros(len(atoms))}

The subclass implementation should first call this implementation to set the atoms attribute.

calculate_hessian_matrix(atoms, divide_by_masses=False)

Compute the Hessian matrix

The Hessian matrix is the matrix of second derivatives of the potential energy \(\mathcal{V}_\mathrm{int}\) with respect to coordinates, i.e.

\[\frac{\partial^2 \mathcal{V}_\mathrm{int}} {\partial r_{\nu{}i}\partial r_{\mu{}j}},\]

where the indices \(\mu\) and \(\nu\) refer to atoms and the indices \(i\) and \(j\) refer to the components of the position vector \(r_\nu\) along the three spatial directions.

The Hessian matrix has contributions from the pair potential and the embedding energy,

\[\frac{\partial^2 \mathcal{V}_\mathrm{int}}{\partial r_{\nu{}i}\partial r_{\mu{}j}} = \frac{\partial^2 \mathcal{V}_\mathrm{pair}}{ \partial r_{\nu i} \partial r_{\mu j}} + \frac{\partial^2 \mathcal{V}_\mathrm{embed}}{\partial r_{\nu i} \partial r_{\mu j}}.\]

The contribution from the pair potential is

\[\begin{split}\frac{\partial^2 \mathcal{V}_\mathrm{pair}}{ \partial r_{\nu i} \partial r_{\mu j}} &= -\phi_{\nu\mu}'' \left( \frac{r_{\nu\mu i}}{r_{\nu\mu}} \frac{r_{\nu\mu j}}{r_{\nu\mu}} \right) -\frac{\phi_{\nu\mu}'}{r_{\nu\mu}}\left( \delta_{ij}- \frac{r_{\nu\mu i}}{r_{\nu\mu}} \frac{r_{\nu\mu j}}{r_{\nu\mu}} \right) \\ &+\delta_{\nu\mu}\sum_{\gamma\neq\nu}^{N} \phi_{\nu\gamma}'' \left( \frac{r_{\nu\gamma i}}{r_{\nu\gamma}} \frac{r_{\nu\gamma j}}{r_{\nu\gamma}} \right) +\delta_{\nu\mu}\sum_{\gamma\neq\nu}^{N}\frac{\phi_{\nu\gamma}'}{r_{\nu\gamma}}\left( \delta_{ij}- \frac{r_{\nu\gamma i}}{r_{\nu\gamma}} \frac{r_{\nu\gamma j}}{r_{\nu\gamma}} \right).\end{split}\]

The contribution of the embedding energy to the Hessian matrix is a sum of eight terms,

\[\begin{split}\frac{\mathcal{V}_\mathrm{embed}}{\partial r_{\mu j} \partial r_{\nu i}} &= T_1 + T_2 + T_3 + T_4 + T_5 + T_6 + T_7 + T_8 \\ T_1 &= \delta_{\nu\mu}U_\nu'' \sum_{\gamma\neq\nu}^{N}g_{\nu\gamma}'\frac{r_{\nu\gamma i}}{r_{\nu\gamma}} \sum_{\gamma\neq\nu}^{N}g_{\nu\gamma}'\frac{r_{\nu\gamma j}}{r_{\nu\gamma}} \\ T_2 &= -u_\nu''g_{\nu\mu}' \frac{r_{\nu\mu j}}{r_{\nu\mu}} \sum_{\gamma\neq\nu}^{N} G_{\nu\gamma}' \frac{r_{\nu\gamma i}}{r_{\nu\gamma}} \\ T_3 &= +u_\mu''g_{\mu\nu}' \frac{r_{\nu\mu i}}{r_{\nu\mu}} \sum_{\gamma\neq\mu}^{N} G_{\mu\gamma}' \frac{r_{\mu\gamma j}}{r_{\mu\gamma}} \\ T_4 &= -\left(u_\mu'g_{\mu\nu}'' + u_\nu'g_{\nu\mu}''\right) \left( \frac{r_{\nu\mu i}}{r_{\nu\mu}} \frac{r_{\nu\mu j}}{r_{\nu\mu}} \right)\\ T_5 &= \delta_{\nu\mu} \sum_{\gamma\neq\nu}^{N} \left(U_\gamma'g_{\gamma\nu}'' + U_\nu'g_{\nu\gamma}''\right) \left( \frac{r_{\nu\gamma i}}{r_{\nu\gamma}} \frac{r_{\nu\gamma j}}{r_{\nu\gamma}} \right) \\ T_6 &= -\left(U_\mu'g_{\mu\nu}' + U_\nu'g_{\nu\mu}'\right) \frac{1}{r_{\nu\mu}} \left( \delta_{ij}- \frac{r_{\nu\mu i}}{r_{\nu\mu}} \frac{r_{\nu\mu j}}{r_{\nu\mu}} \right) \\ T_7 &= \delta_{\nu\mu} \sum_{\gamma\neq\nu}^{N} \left(U_\gamma'g_{\gamma\nu}' + U_\nu'g_{\nu\gamma}'\right) \frac{1}{r_{\nu\gamma}} \left(\delta_{ij}- \frac{r_{\nu\gamma i}}{r_{\nu\gamma}} \frac{r_{\nu\gamma j}}{r_{\nu\gamma}} \right) \\ T_8 &= \sum_{\substack{\gamma\neq\nu \\ \gamma \neq \mu}}^{N} U_\gamma'' g_{\gamma\nu}'g_{\gamma\mu}' \frac{r_{\gamma\nu i}}{r_{\gamma\nu}} \frac{r_{\gamma\mu j}}{r_{\gamma\mu}}\end{split}\]
Parameters
  • atoms (ase.Atoms) –

  • divide_by_masses (bool) – Divide block \(\nu\mu\) by \(m_\num_\mu\) to obtain the dynamical matrix

Returns

D – Block Sparse Row matrix with the nonzero blocks

Return type

numpy.matrix

Notes

Notation:
  • \(N\) Number of atoms

  • \(\mathcal{V}_\mathrm{int}\) Total potential energy

  • \(\mathcal{V}_\mathrm{pair}\) Pair potential

  • \(\mathcal{V}_\mathrm{embed}\) Embedding energy

  • \(r_{\nu{}i}\) Component \(i\) of the position vector of atom \(\nu\)

  • \(r_{\nu\mu{}i} = r_{\mu{}i}-r_{\nu{}i}\)

  • \(r_{\nu\mu{}}\) Norm of \(r_{\nu\mu{}i}\), i.e.\(\left(r_{\nu\mu{}1}^2+r_{\nu\mu{}2}^2+r_{\nu\mu{}3}^2\right)^{1/2}\)

  • \(\phi_{\nu\mu}(r_{\nu\mu{}})\) Pair potential energy of atoms \(\nu\) and \(\mu\)

  • \(\rho_nu\) Total electron density of atom \(\nu\)

  • \(U_\nu(\rho_nu)\) Embedding energy of atom \(\nu\)

  • \(g_{\delta}\left(r_{\gamma\delta}\right) \equiv g_{\gamma\delta}\) Contribution from atom \(\delta\) to \(\rho_\gamma\)

  • \(m_\nu\) mass of atom \(\nu\)

property cutoff
default_parameters = {}
energy_virial_and_forces(atomic_numbers_i, i_n, j_n, dr_nc, abs_dr_n)

Compute the potential energy, the virial and the forces.

Parameters
  • atomic_numbers_i (array_like) – Atomic number for each atom in the system

  • j_n (i_n,) – Neighbor pairs

  • dr_nc (array_like) – Distance vectors between neighbors

  • abd_dr_n (array_like) – Length of distance vectors between neighbors

Returns

  • epot (float) – Potential energy

  • virial_v (array) – Virial

  • forces_ic (array) – Forces acting on each atom

implemented_properties = ['energy', 'stress', 'forces']
name = 'EAM'

matscipy.calculators.eam module

Module contents