예제 #1
0
 def setUp(self):
     super().setUp()
     try:
         driver = PSI4Driver(molecule=TestDriver.MOLECULE)
     except QiskitChemistryError as ex:
         print(ex)
         self.skipTest('PSI4 driver does not appear to be installed')
     self.qmolecule = driver.run()
예제 #2
0
 def test_input_format_list(self):
     """ input as a list"""
     driver = PSI4Driver([
         'molecule h2 {', '  0 1', '  H  0.0 0.0 0.0', '  H  0.0 0.0 0.735',
         '  no_com', '  no_reorient', '}', '', 'set {', '  basis sto-3g',
         '  scf_type pk', '}'
     ])
     qmolecule = driver.run()
     self.assertAlmostEqual(qmolecule.hf_energy, -1.117, places=3)
 def setUp(self):
     try:
         driver = PSI4Driver([
             'molecule h2 {', '  0 1', '  H  0.0 0.0 0.0',
             '  H  0.0 0.0 0.735', '}', '', 'set {', '  basis sto-3g',
             '  scf_type pk', '}'
         ])
     except QiskitChemistryError:
         self.skipTest('PSI4 driver does not appear to be installed')
     self.qmolecule = driver.run()
예제 #4
0
    def test_input_format_string(self):
        """ input as a multi line string """
        cfg = """
molecule h2 {
0 1
H  0.0 0.0 0.0
H  0.0 0.0 0.735
no_com
no_reorient
}

set {
basis sto-3g
scf_type pk
}
"""
        driver = PSI4Driver(cfg)
        qmolecule = driver.run()
        self.assertAlmostEqual(qmolecule.hf_energy, -1.117, places=3)
    def test_psi4_failure(self):
        """ check we catch psi4 failures (bad scf type used here) """
        bad_cfg = """
molecule h2 {
0 1
H  0.0 0.0 0.0
H  0.0 0.0 0.735
no_com
no_reorient
}

set {
basis sto-3g
scf_type unknown
}
"""
        driver = PSI4Driver(bad_cfg)
        with self.assertRaises(QiskitChemistryError) as ctxmgr:
            _ = driver.run()
        self.assertTrue(str(ctxmgr.exception).startswith("'psi4 process return code"))
예제 #6
0
 def test_oh_uhf(self):
     """ oh uhf test """
     driver = PSI4Driver(config=self.psi4_oh_config.format('uhf'))
     result = self._run_driver(driver)
     self._assert_energy_and_dipole(result, 'oh')
예제 #7
0
 def test_lih_rohf(self):
     """ lih rohf test """
     driver = PSI4Driver(config=self.psi4_lih_config.format('rohf'))
     result = self._run_driver(driver)
     self._assert_energy_and_dipole(result, 'lih')
예제 #8
0
 def setUp(self):
     super().setUp()
     try:
         PSI4Driver(config=self.psi4_lih_config.format('rhf'))
     except QiskitChemistryError:
         self.skipTest('PSI4 driver does not appear to be installed')
예제 #9
0
 def test_input_format_fail(self):
     """ input type failure """
     with self.assertRaises(QiskitChemistryError):
         _ = PSI4Driver(1.000)
예제 #10
0
 def setUp(self):
     super().setUp()
     try:
         PSI4Driver._check_valid()
     except QiskitChemistryError:
         self.skipTest('PSI4 driver does not appear to be installed')