コード例 #1
0
def test_molecule_repeated_hashing():

    mol = Molecule(**{
        'symbols': ['H', 'O', 'O', 'H'],
        'geometry': [
             1.7317,  1.2909,  1.037100000000001,
             1.3156, -0.0074, -0.2807,
            -1.3143,  0.0084, -0.2741,
            -1.7241, -1.3079,  1.0277
        ]
    }) # yapf: disable

    h1 = mol.get_hash()
    assert mol.get_molecular_formula() == "H2O2"

    mol2 = Molecule(orient=False, **mol.dict())
    assert h1 == mol2.get_hash()

    mol3 = Molecule(orient=False, **mol2.dict())
    assert h1 == mol3.get_hash()
コード例 #2
0
def test_molecule_repeated_hashing():

    mol = Molecule(
        **{
            "symbols": ["H", "O", "O", "H"],
            "geometry": [
                [1.7317, 1.2909, 1.037100000000001],
                [1.3156, -0.0074, -0.2807],
                [-1.3143, 0.0084, -0.2741],
                [-1.7241, -1.3079, 1.0277],
            ],
        })

    h1 = mol.get_hash()
    assert mol.get_molecular_formula() == "H2O2"

    mol2 = Molecule(orient=False, **mol.dict())
    assert h1 == mol2.get_hash()

    mol3 = Molecule(orient=False, **mol2.dict())
    assert h1 == mol3.get_hash()