Exemple #1
0
def test_a_user_can_compute_coordination_numbers_for_molecule(
        fluoromethane_coord):
    fileObject = open(fluoromethane_coord, "r+")
    atoms = ksr.read(fileObject)
    molecule = Molecule(symbols=atoms)
    cns = molecule.get_cns(cntype="exp")
    c1 = np.around(cns, decimals=1)
    got = c1[0]
    want = 4.0
    assert got == want
Exemple #2
0
def test_a_user_can_compute_coordination_numbers_for_molecule():
    with tempfile.NamedTemporaryFile(mode="w+", encoding="utf-8") as f:
        f.write("$coord" + s)
        f.write("  1.87167924 -0.101043656  0.1596818582  c" + s)
        f.write("  4.43543289 -0.101043656  0.1596818582  f" + s)
        f.write("  1.20847986 -1.386321988  1.6312493924  h" + s)
        f.write("  1.20847986 -0.732816897 -1.6891694984  h" + s)
        f.write("  1.20846096  1.816007916  0.5369845779  h" + s)
        f.write("$end")
        f.flush()
        fileObject = open(f.name, "r+")
        atoms = ksr.read(fileObject)
        molecule = Molecule(symbols=atoms)
        cns = molecule.get_cns(cntype="exp")
        c1 = np.around(cns, decimals=1)
        got = c1[0]
        want = 4.0
        assert got == want