Esempio n. 1
0
def test_user_can_set_an_array():
    reference = Molecule(atoms)
    reference.set_array("numbers", [1, 2, 3])
    numbers = reference.get_array("numbers")
    assert numbers[0] == 1
    assert numbers[1] == 2
    assert numbers[2] == 3
    reference.set_array("numbers", None)
    reference.set_array("numbers", None)
    with pytest.raises(Exception) as error:
        reference.get_array("numbers")
    assert error.value.args[0] == "numbers"
    reference.set_array("numbers", [1, 2, 3], None)
    numbers = reference.get_array("numbers")
    assert numbers[0] == 1
Esempio n. 2
0
def test_user_can_pass_information_from_mol_to_mol():
    reference = Molecule(atoms)
    ref = reference.get_number_of_atoms()
    molecule = Molecule(symbols=reference)
    nat = molecule.get_number_of_atoms()
    assert nat == ref
    positions = molecule.get_positions()
    assert positions[0][2] == 0
    assert positions[1][2] == 1
    assert positions[2][2] == 2
    numbers = molecule.get_array("numbers")
    assert numbers[0] == 1
Esempio n. 3
0
def test_user_can_copy_an_array():
    reference = Molecule(atoms)
    numbers = reference.get_array("numbers", True)
    assert numbers[0] == 1