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())
|