def setUp(self): super().setUp() try: driver = PSI4Driver(molecule=TestDriver.MOLECULE) except QiskitNatureError as ex: print(ex) self.skipTest('PSI4 driver does not appear to be installed') self.qmolecule = driver.run()
def setUp(self): super().setUp() try: 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', '}' ]) except QiskitNatureError: self.skipTest('PSI4 driver does not appear to be installed') self.qmolecule = driver.run()
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 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 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(QiskitNatureError) as ctxmgr: _ = driver.run() self.assertTrue(str(ctxmgr.exception).startswith("'psi4 process return code"))
def setUp(self): super().setUp() try: 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", "}", ] ) except QiskitNatureError: self.skipTest("PSI4 driver does not appear to be installed") self.qmolecule = driver.run()
def test_input_format_fail(self): """ input type failure """ with self.assertRaises(QiskitNatureError): _ = PSI4Driver(1.000)
def setUp(self): super().setUp() try: PSI4Driver._check_valid() except QiskitNatureError: self.skipTest('PSI4 driver does not appear to be installed')
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() try: PSI4Driver(config=self.psi4_lih_config.format('rhf')) except QiskitNatureError: self.skipTest('PSI4 driver does not appear to be installed')
def test_oh_rohf(self): """oh rohf test""" driver = PSI4Driver(config=self.psi4_oh_config.format("rohf")) result = self._run_driver(driver) self._assert_energy_and_dipole(result, "oh")
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')