Exemple #1
0
 def setUp(self):
     super().setUp()
     try:
         driver = GaussianDriver(molecule=TestDriver.MOLECULE)
     except QiskitChemistryError:
         self.skipTest('GAUSSIAN driver does not appear to be installed')
     self.qmolecule = driver.run()
Exemple #2
0
 def test_cfg_augment(self):
     """ test input configuration augmentation """
     cfg = '# rhf/sto-3g scf(conventional)\n\n' \
           'h2 molecule\n\n0 1\nH   0.0  0.0    0.0\nH   0.0  0.0    0.735\n\n'
     g16 = GaussianDriver(cfg)
     aug_cfg = g16._augment_config("mymatfile.mat", cfg)
     expected = '# rhf/sto-3g scf(conventional)\n' \
                '# Window=Full Int=NoRaff Symm=(NoInt,None)' \
                ' output=(matrix,i4labels,mo2el) tran=full\n\n' \
                'h2 molecule\n\n0 1\nH   0.0  0.0    0.0\nH   0.0  0.0    0.735' \
                '\n\nmymatfile.mat\n\n'
     self.assertEqual(aug_cfg, expected)
    def init_driver(self):

        if self.chem_driver.value == 'PySCF':
            if self.hf_method == HFMethodType.RHF and self.spin % 2 == 0:
                print(
                    f'WARNING: Restricted Hartree-Fock (RHF) cannot handle unpaired electrons!'
                )
                print(f'Switching to Unrestricted Hartree-Fock!')
                self.chem_driver = HFMethodType.UHF

            self.driver = PySCFDriver(atom=self.molecule_string,
                                      unit=self.length_unit,
                                      charge=self.charge,
                                      spin=self.spin,
                                      hf_method=self.hf_method,
                                      basis=self.basis)

        elif self.chem_driver.value == 'Gaussian':
            self.driver = GaussianDriver(config=self.gaussian_config())

        self.qmolecule = self.driver.run()
 def test_oh_uhf(self):
     """ oh uhf test """
     driver = GaussianDriver(config=self.g16_oh_config.format('uhf'))
     result = self._run_driver(driver)
     self._assert_energy_and_dipole(result, 'oh')
 def test_lih_rohf(self):
     """ lih rohf test """
     driver = GaussianDriver(config=self.g16_lih_config.format('rohf'))
     result = self._run_driver(driver)
     self._assert_energy_and_dipole(result, 'lih')
 def setUp(self):
     super().setUp()
     try:
         GaussianDriver(config=self.g16_lih_config.format('rhf'))
     except QiskitChemistryError:
         self.skipTest('GAUSSIAN driver does not appear to be installed')