File: test_acn.py

package info (click to toggle)
python-ase 3.21.1-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 13,936 kB
  • sloc: python: 122,428; xml: 946; makefile: 111; javascript: 47
file content (25 lines) | stat: -rw-r--r-- 712 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
def test_acn():
    """Test ACN forces."""
    from ase import Atoms
    from ase.calculators.acn import ACN, m_me, r_mec, r_cn

    dimer = Atoms('CCNCCN',
                  [(-r_mec, 0, 0),
                   (0, 0, 0),
                   (r_cn, 0, 0),
                   (r_mec, 3.7, 0),
                   (0, 3.7, 0),
                   (-r_cn, 3.7, 0)])

    # Set mass of methyls
    masses = dimer.get_masses()
    masses[::3] = m_me
    dimer.set_masses(masses)

    dimer.calc = ACN(rc=5.0, width=2.0)  # Put C-C distance in the cutoff range
    F = dimer.get_forces()
    print(F)
    Fnum = dimer.calc.calculate_numerical_forces(dimer)
    dF = Fnum - F
    print(dF)
    assert abs(dF).max() < 2e-6