File: test_eam_run.py

package info (click to toggle)
python-ase 3.22.1-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 14,344 kB
  • sloc: python: 126,379; xml: 946; makefile: 111; javascript: 47
file content (16 lines) | stat: -rw-r--r-- 482 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import numpy as np

from ase.calculators.eam import EAM

from ase.build import fcc111
from io import StringIO


def test_eam_run(pt_eam_potential_file):
    eam = EAM(potential=StringIO(pt_eam_potential_file.read_text()),
              form='eam', elements=['Pt'])
    slab = fcc111('Pt', size=(4, 4, 2), vacuum=10.0)
    slab.calc = eam

    assert(abs(-164.277599313 - slab.get_potential_energy()) < 1E-8)
    assert(abs(6.36379627645 - np.linalg.norm(slab.get_forces())) < 1E-8)