예제 #1
0
 def test_create_nuclei_array_returns_array_of_nuclei_with_coordinates(
         self):
     nuclei_array, electron_count, multiplicity = read_mol_file('HeH+.mol')
     testing.assert_array_equal(nuclei_array[0].coordinates,
                                (0.0, 0.0, 0.487732042))
     testing.assert_array_equal(nuclei_array[1].coordinates,
                                (0.0, 0.0, -0.975464083))
예제 #2
0
def start(mol_file,
          basis_file,
          method,
          processors,
          symmetry=False,
          geometry_optimization=None):
    np.set_printoptions(linewidth=100000, threshold=np.inf)
    start_time = time.clock()

    nuclei_list, electrons, multiplicity = read_mol_file(mol_file)
    energy_object = Energy(electrons, multiplicity, processors, method)

    print(
        '\n*************************************************************************************************'
    )
    print('\nA BASIC QUANTUM CHEMICAL PROGRAM IN PYTHON\n\n\n{}'.format(
        [x.element for x in nuclei_list]))

    if geometry_optimization is not None:
        nelder_mead = NelderMead(basis_file, energy_object, nuclei_list)
        energy = nelder_mead.optimize()
    else:
        nuclei_list, point_group = MoleculeFactory(symmetry).create(
            nuclei_list)
        basis_set = read_basis_set_file(basis_file, nuclei_list)
        energy_object.symmetry_object = Symmetry(point_group, basis_set)
        energy = energy_object.calculate_energy(nuclei_list, basis_set)

    print(
        '\n*************************************************************************************************'
    )
    print('\nTIME TAKEN: ' + str(time.clock() - start_time) + 's')
    print("\nWhat I cannot create I cannot understand - Richard Feynman\n")

    return energy
예제 #3
0
 def test_create_nuclei_array_returns_array_of_nuclei_with_names(self):
     nuclei_array, electron_count, multiplicity = read_mol_file('HeH+.mol')
     self.assertEquals(nuclei_array[0].element, 'HELIUM')
     self.assertEquals(nuclei_array[1].element, 'HYDROGEN')
예제 #4
0
 def test_electron_count_return_two(self):
     nuclei_array, electron_count, multiplicity = read_mol_file('HeH+.mol')
     self.assertEquals(electron_count, 2)
예제 #5
0
 def test_create_nuclei_array_returns_array_of_nuclei_with_mass(self):
     nuclei_array, electron_count, multiplicity = read_mol_file('HeH+.mol')
     self.assertEquals(nuclei_array[0].mass, 4)
     self.assertEquals(nuclei_array[1].mass, 1)