def setUp(self): super().setUp() 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", "}", ]) self.driver_result = driver.run()
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(QiskitNatureError) as ctxmgr: _ = driver.run() self.assertTrue(str(ctxmgr.exception).startswith("'psi4 process return code"))
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) driver_result = driver.run() electronic_energy = cast(ElectronicEnergy, driver_result.get_property(ElectronicEnergy)) self.assertAlmostEqual(electronic_energy.reference_energy, -1.117, places=3)
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", "}", ] ) driver_result = driver.run() electronic_energy = cast(ElectronicEnergy, driver_result.get_property(ElectronicEnergy)) self.assertAlmostEqual(electronic_energy.reference_energy, -1.117, places=3)
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")
def test_lih_uhf(self): """lih uhf test""" driver = PSI4Driver(config=self.psi4_lih_config.format("uhf")) result = self._run_driver(driver, transformers=[FreezeCoreTransformer()]) self._assert_energy_and_dipole(result, "lih")
def setUp(self): super().setUp() PSI4Driver(config=self.psi4_lih_config.format("rhf"))
def test_input_format_fail(self): """input type failure""" with self.assertRaises(QiskitNatureError): _ = PSI4Driver(1.000)
def setUp(self): super().setUp() PSI4Driver.check_installed()