def test_make_atomic_lattice_0d_raise_error(self): spacing = 1.7 basis = 'sto-3g' atom_type = 'H' atom_dim = 0 with self.assertRaises(MolecularLatticeError): make_atomic_lattice(atom_dim, atom_dim, atom_dim, spacing, basis, atom_type)
def test_make_atomic_lattice_1d(self): spacing = 1.7 basis = 'sto-3g' atom_type = 'H' for n_atoms in range(2, 10): molecule = make_atomic_lattice(n_atoms, 1, 1, spacing, basis, atom_type) # Check that the spacing between the atoms is correct. for atom_index in range(n_atoms): if atom_index: atom_b = molecule.geometry[atom_index] coords_b = atom_b[1] atom_a = molecule.geometry[atom_index - 1] coords_a = atom_a[1] self.assertAlmostEqual(coords_b[0] - coords_a[0], spacing) self.assertAlmostEqual(coords_b[1] - coords_a[1], 0) self.assertAlmostEqual(coords_b[2] - coords_a[2], 0)
def test_make_atomic_lattice_2d(self): spacing = 1.7 basis = 'sto-3g' atom_type = 'H' atom_dim = 7 molecule = make_atomic_lattice(atom_dim, atom_dim, 1, spacing, basis, atom_type) # Check that the spacing between the atoms is correct. for atom in range(atom_dim**2): coords = molecule.geometry[atom][1] # Check y-coord. grid_y = atom % atom_dim self.assertAlmostEqual(coords[1], spacing * grid_y) # Check x-coord. grid_x = atom // atom_dim self.assertAlmostEqual(coords[0], spacing * grid_x)