示例#1
0
def test_cartesian(atoms=atoms):
    """write cartesian coords and check if structure was preserved"""
    atoms.write(file, format=format)

    new_atoms = read((file))

    assert np.allclose(atoms.positions, new_atoms.positions)
示例#2
0
def test_scaled(atoms=atoms):
    """write fractional coords and check if structure was preserved"""
    atoms.write(file, format=format, scaled=True, wrap=False)

    new_atoms = read(file)

    assert np.allclose(atoms.positions, new_atoms.positions), (
        atoms.positions,
        new_atoms.positions,
    )
示例#3
0
def test_scaled_wrapped(atoms=atoms):
    """write fractional coords and check if structure was preserved"""
    atoms.write(file, format=format, scaled=True, wrap=True)

    new_atoms = read(file)

    try:
        assert np.allclose(atoms.positions, new_atoms.positions), (
            atoms.positions,
            new_atoms.positions,
        )
    except AssertionError:
        atoms.wrap()
        assert np.allclose(atoms.positions, new_atoms.positions), (
            atoms.positions,
            new_atoms.positions,
        )