Esempio n. 1
0
def test_add_bond():
    m = mx.Molecule()
    v = mx.Atom()
    w = mx.Atom()
    m.add_atom(v)
    m.add_atom(w)
    m.add_bond(v, w)
    assert len(m.bonds()) == 1
    assert len(m.atoms()) == 2
Esempio n. 2
0
def test_atom():
    v = mx.Atom(symbol='H')
    assert v.element.number == 1
    assert v.element.symbol == 'H'
    assert v.element.mass == 1.00800

    v = mx.Atom(number=1)
    assert v.element.number == 1
    assert v.element.symbol == 'H'
    assert v.element.mass == 1.00800
Esempio n. 3
0
def test_atom_unknown_atom():
    with pytest.raises(KeyError):
        v = mx.Atom(symbol='X')
Esempio n. 4
0
def test_atom_element_number_mismatch():
    with pytest.raises(AssertionError):
        v = mx.Atom(number=1, symbol='C')
Esempio n. 5
0
def test_add_atom():
    m = mx.Molecule()
    v = mx.Atom()
    m.add_atom(v)
    assert len(m.atoms()) == 1