def test_make_atomic_ring(self): spacing = 1. basis = 'sto-3g' for n_atoms in range(2, 10): molecule = make_atomic_ring(n_atoms, spacing, basis) # Check that ring is centered. vector_that_should_sum_to_zero = 0. for atom in molecule.geometry: for coordinate in atom[1]: vector_that_should_sum_to_zero += coordinate self.assertAlmostEqual(vector_that_should_sum_to_zero, 0.) # 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] observed_spacing = numpy.sqrt( numpy.square(coords_b[0] - coords_a[0]) + numpy.square(coords_b[1] - coords_a[1]) + numpy.square(coords_b[2] - coords_a[2])) self.assertAlmostEqual(observed_spacing, spacing)
y_log = 0 # Set chemical series parameters. plot_elements = 0 max_electrons = 10 spacing = 0.7414 basis = 'sto-3g' # Get chemical series. molecular_series = [] for n_electrons in range(2, max_electrons + 1): if plot_elements: atomic_symbol = periodic_table[n_electrons] molecule = make_atom(atomic_symbol, basis) else: molecule = make_atomic_ring(n_electrons, spacing, basis) molecule.load() molecular_series += [molecule] # Get plot data. x_values = [] y_values = [] for molecule in molecular_series: # x-axis. x_label = 'Number of Electrons' x_values += [molecule.n_electrons] # y-axis. y_label = 'MP2 Energy' y_values += [molecule.mp2_energy]