def setUp(self): super().setUp() self.core_energy = 0.7199 self.num_molecular_orbitals = 2 self.num_electrons = 2 self.spin_number = 0 self.wf_symmetry = 1 self.orb_symmetries = [1, 1] self.mo_onee = [[1.2563, 0.0], [0.0, 0.4719]] self.mo_eri = [0.6757, 0.0, 0.1809, 0.6646, 0.0, 0.6986] try: driver = PySCFDriver( atom="H .0 .0 .0; H .0 .0 0.735", unit=UnitsType.ANGSTROM, charge=0, spin=0, basis="sto3g", ) driver_result = driver.run() with tempfile.NamedTemporaryFile() as dump: FCIDumpDriver.dump(driver_result, dump.name) # pylint: disable=import-outside-toplevel from pyscf.tools import fcidump as pyscf_fcidump self.dumped = pyscf_fcidump.read(dump.name) except QiskitNatureError: self.skipTest("PYSCF driver does not appear to be installed.") except ImportError: self.skipTest("PYSCF driver does not appear to be installed.")
def test_zmatrix(self): """Check z-matrix input""" atom = "H; H 1 1.0" driver = PySCFDriver(atom=atom, unit=UnitsType.ANGSTROM, charge=0, spin=0, basis="sto3g") driver_result = driver.run() electronic_energy = cast(ElectronicEnergy, driver_result.get_property(ElectronicEnergy)) self.assertAlmostEqual(electronic_energy.reference_energy, -1.0661086493179366, places=5)
def test_list_atom(self): """Check input with list of strings""" atom = ["H 0 0 0", "H 0 0 1"] driver = PySCFDriver(atom=atom, unit=UnitsType.ANGSTROM, charge=0, spin=0, basis="sto3g") driver_result = driver.run() electronic_energy = cast(ElectronicEnergy, driver_result.get_property(ElectronicEnergy)) self.assertAlmostEqual(electronic_energy.reference_energy, -1.0661086493179366, places=5)
def test_h4(self): """Test for H4 chain""" atom = "H 0 0 0; H 0 0 1; H 0 0 2; H 0 0 3" driver = PySCFDriver(atom=atom, unit=UnitsType.ANGSTROM, charge=0, spin=0, basis="sto3g") driver_result = driver.run() electronic_energy = cast(ElectronicEnergy, driver_result.get_property(ElectronicEnergy)) self.assertAlmostEqual(electronic_energy.reference_energy, -2.09854593699776, places=5)
def test_h3(self): """Test for H3 chain, see also https://github.com/Qiskit/qiskit-aqua/issues/1148.""" atom = "H 0 0 0; H 0 0 1; H 0 0 2" driver = PySCFDriver(atom=atom, unit=UnitsType.ANGSTROM, charge=0, spin=1, basis="sto3g") driver_result = driver.run() electronic_energy = cast(ElectronicEnergy, driver_result.get_property(ElectronicEnergy)) self.assertAlmostEqual(electronic_energy.reference_energy, -1.523996200246108, places=5)
def setUp(self): super().setUp() driver = PySCFDriver( atom="H .0 .0 .0; H .0 .0 0.735", unit=UnitsType.ANGSTROM, charge=0, spin=0, basis="sto3g", ) self.driver_result = driver.run()