File: test_aic.py

package info (click to toggle)
python-ase 3.26.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 15,484 kB
  • sloc: python: 148,112; xml: 2,728; makefile: 110; javascript: 47
file content (18 lines) | stat: -rw-r--r-- 491 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# fmt: off
import numpy as np

from ase import Atoms
from ase.calculators.counterions import AtomicCounterIon as ACI
from ase.calculators.fd import calculate_numerical_forces


def test_aic():
    """Test Atomic Counter Ion calc forces."""

    atoms = Atoms('2Na', positions=np.array([[0, 0, 0], [0, 0, 4]]))

    atoms.calc = ACI(1, 1.6642, 0.0001201186, rc=4.5)
    f = atoms.get_forces()
    df = calculate_numerical_forces(atoms, 1e-6) - f
    print(df)
    assert abs(df).max() < 2e-6