File: test_atoms_get_positions.py

package info (click to toggle)
python-ase 3.24.0-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 15,448 kB
  • sloc: python: 144,945; xml: 2,728; makefile: 113; javascript: 47
file content (24 lines) | stat: -rw-r--r-- 569 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import numpy as np

from ase import Atoms

pbc = [1, 1, 0]
cell = [[1, 0, 0], [0, 1, 0], [0, 0, 4]]

positions = [[-0.1, 1.01, -0.5]]
positions_wrapped = [[0.9, 0.01, -0.5]]

atoms = Atoms("H", positions=positions, cell=cell, pbc=pbc)


def test_positions(atoms=atoms):
    assert np.allclose(positions, atoms.get_positions())


def test_positions_wrapped(atoms=atoms):
    assert np.allclose(positions_wrapped, atoms.get_positions(wrap=True))


def test_wrapped_positions(atoms=atoms):
    atoms.wrap()
    assert np.allclose(positions_wrapped, atoms.get_positions())