def setUp(self): super().setUp() try: driver = PyQuanteDriver(molecule=TestDriver.MOLECULE) except QiskitChemistryError: self.skipTest('PYQUANTE driver does not appear to be installed') self.qmolecule = driver.run()
def setUp(self): try: driver = PyQuanteDriver(atoms='H .0 .0 .0; H .0 .0 0.735', units=UnitsType.ANGSTROM, charge=0, multiplicity=1, basis=BasisType.BSTO3G) except QiskitChemistryError: self.skipTest('PYQUANTE driver does not appear to be installed') self.qmolecule = driver.run()
def test_oh_uhf(self): driver = PyQuanteDriver(atoms=self.OH, units=UnitsType.ANGSTROM, charge=0, multiplicity=2, basis=BasisType.BSTO3G, hf_method=HFMethodType.UHF) result = self._run_driver(driver) self._assert_energy(result, 'oh')
def test_lih_rohf(self): driver = PyQuanteDriver(atoms=self.LIH, units=UnitsType.ANGSTROM, charge=0, multiplicity=1, basis=BasisType.BSTO3G, hf_method=HFMethodType.ROHF) result = self._run_driver(driver) self._assert_energy(result, 'lih')
def get_qubit_op(dist): driver = PyQuanteDriver(atoms="Li .0 .0 .0; H .0 .0 " + str(dist), units=UnitsType.ANGSTROM, charge=0) molecule = driver.run() freeze_list = [0] remove_list = [-3, -2] repulsion_energy = molecule.nuclear_repulsion_energy num_particles = molecule.num_alpha + molecule.num_beta num_spin_orbitals = molecule.num_orbitals * 2 remove_list = [x % molecule.num_orbitals for x in remove_list] freeze_list = [x % molecule.num_orbitals for x in freeze_list] remove_list = [x - len(freeze_list) for x in remove_list] remove_list += [x + molecule.num_orbitals - len(freeze_list) for x in remove_list] freeze_list += [x + molecule.num_orbitals for x in freeze_list] ferOp = FermionicOperator(h1=molecule.one_body_integrals, h2=molecule.two_body_integrals) ferOp, energy_shift = ferOp.fermion_mode_freezing(freeze_list) num_spin_orbitals -= len(freeze_list) num_particles -= len(freeze_list) ferOp = ferOp.fermion_mode_elimination(remove_list) num_spin_orbitals -= len(remove_list) qubitOp = ferOp.mapping(map_type='parity', threshold=0.00000001) qubitOp = Z2Symmetries.two_qubit_reduction(qubitOp, num_particles) shift = energy_shift + repulsion_energy return qubitOp, num_particles, num_spin_orbitals, shift
def setUp(self): super().setUp() try: PyQuanteDriver(atoms=self.lih) except QiskitChemistryError: self.skipTest('PyQuante driver does not appear to be installed')