Exemplo n.º 1
0
def test_center_of_mass(ammonia):
    """See [1], Numerical Examples, p. 296, top left column."""
    atoms, coords3d, masses = ammonia
    com = center_of_mass(coords3d, masses)

    com_ref = np.array((0.0281, -0.0487, 0.0199)) / BOHR2ANG
    np.testing.assert_allclose(com, com_ref, atol=1e-4)
Exemplo n.º 2
0
def test_arrangement(func, ref_arr, kwargs):
    atoms, coords3d, masses = func()
    coords3d -= center_of_mass(coords3d, masses)

    pms, pas = diagonalized_inertia_tensor(coords3d, masses)
    print("pms", pms)
    arr = get_arrangement(pms, **kwargs)
    assert arr == ref_arr
Exemplo n.º 3
0
def test_proper_rotations(ammonia):
    atoms, coords3d, masses = ammonia
    coords3d = coords3d - center_of_mass(coords3d, masses)
    cdm = pdist(coords3d)
    dist_mat = squareform(cdm)
    se_atoms = find_se_atoms(atoms, dist_mat)
    h_se_atoms = se_atoms["h0"]
    find_proper_rotations(coords3d, masses, h_se_atoms)
Exemplo n.º 4
0
def test_inertia_tensor(ammonia):
    """See [1], Numerical Examples, p. 296, top left column."""
    atoms, coords3d, masses = ammonia
    coords3d = coords3d - center_of_mass(coords3d, masses)

    I = inertia_tensor(coords3d, masses)

    I_ref = np.array((
                ( 1.8871, -0.4175,  0.1704),
                (-0.4175,  2.3692, -0.2952),
                ( 0.1704, -0.2952,  1.7666),
    ))  # in Ų/amu
    I_ref = I_ref / BOHR2ANG**2  # to Bohr²/amu
    np.testing.assert_allclose(I, I_ref, atol=1.21e-4)
Exemplo n.º 5
0
 def center_of_mass(self):
     return center_of_mass(self.coords3d, self.masses)