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)
Ejemplo n.º 2
0
    # Select calculations.
    force_recompute = 1
    run_scf = 1
    run_mp2 = 1
    run_cisd = 1
    run_ccsd = 1
    run_fci = 1
    verbose = 1
    tolerate_error = 1

    # Generate data.
    for n_electrons in range(2, max_electrons + 1):

        # Initialize.
        molecule = make_atomic_ring(n_electrons, spacing, basis)
        if os.path.exists(molecule.filename + '.hdf5'):
            molecule.load()

        # To run or not to run.
        if run_scf and not molecule.hf_energy:
            run_job = 1
        elif run_mp2 and not molecule.mp2_energy:
            run_job = 1
        elif run_cisd and not molecule.cisd_energy:
            run_job = 1
        elif run_ccsd and not molecule.ccsd_energy:
            run_job = 1
        elif run_fci and not molecule.fci_energy:
            run_job = 1
        else: