File: test_set_get_angle.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 (17 lines) | stat: -rw-r--r-- 484 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# fmt: off
from ase import Atoms


def test_set_get_angle():
    "Test that set_angle() and get_angle() in Atoms are consistent"

    atoms = Atoms('HHCCHH', [[-1, 1, 0], [-1, -1, 0], [0, 0, 0],
                             [1, 0, 0], [2, 1, 0], [2, -1, 0]])

    list = [2, 3, 4]
    theta = 20
    old_angle = atoms.get_angle(*list)
    atoms.set_angle(*list, angle=old_angle + theta)
    new_angle = atoms.get_angle(*list)

    assert abs(new_angle - (old_angle + theta)) < 1.0e-9