示例#1
0
 def test_freeze_core_orb_reduction(self):
     core = Hamiltonian(transformation=TransformationType.FULL,
                        qubit_mapping=QubitMappingType.PARITY,
                        two_qubit_reduction=False,
                        freeze_core=True,
                        orbital_reduction=[-3, -2])
     input_object = core.run(self.qmolecule)
     self._validate_vars(core, energy_shift=-7.7962196)
     self._validate_info(core, num_particles=2, num_orbitals=6)
     self._validate_input_object(input_object, num_qubits=6, num_paulis=118)
示例#2
0
 def test_output(self):
     core = Hamiltonian(transformation=TransformationType.FULL,
                        qubit_mapping=QubitMappingType.JORDAN_WIGNER,
                        two_qubit_reduction=False,
                        freeze_core=False,
                        orbital_reduction=[])
     input_object = core.run(self.qmolecule)
     self._validate_vars(core)
     self._validate_info(core)
     self._validate_input_object(input_object)
示例#3
0
 def test_parity(self):
     core = Hamiltonian(transformation=TransformationType.FULL,
                        qubit_mapping=QubitMappingType.PARITY,
                        two_qubit_reduction=True,
                        freeze_core=False,
                        orbital_reduction=[])
     input_object = core.run(self.qmolecule)
     self._validate_vars(core)
     self._validate_info(core, actual_two_qubit_reduction=True)
     self._validate_input_object(input_object, num_qubits=10)
示例#4
0
 def test_particle_hole(self):
     core = Hamiltonian(transformation=TransformationType.PH,
                        qubit_mapping=QubitMappingType.JORDAN_WIGNER,
                        two_qubit_reduction=False,
                        freeze_core=False,
                        orbital_reduction=[])
     input_object = core.run(self.qmolecule)
     self._validate_vars(core, ph_energy_shift=-1.83696799)
     self._validate_info(core)
     self._validate_input_object(input_object)
示例#5
0
 def test_bravyi_kitaev(self):
     core = Hamiltonian(transformation=TransformationType.FULL,
                        qubit_mapping=QubitMappingType.BRAVYI_KITAEV,
                        two_qubit_reduction=False,
                        freeze_core=False,
                        orbital_reduction=[])
     input_object = core.run(self.qmolecule)
     self._validate_vars(core)
     self._validate_info(core)
     self._validate_input_object(input_object)
示例#6
0
 def test_jordan_wigner_2q(self):
     core = Hamiltonian(transformation=TransformationType.FULL,
                        qubit_mapping=QubitMappingType.JORDAN_WIGNER,
                        two_qubit_reduction=True,
                        freeze_core=False,
                        orbital_reduction=[])
     input_object = core.run(self.qmolecule)
     self._validate_vars(core)
     # Reported effective 2 qubit reduction should be false
     self._validate_info(core, actual_two_qubit_reduction=False)
     self._validate_input_object(input_object)
示例#7
0
 def test_orbital_reduction(
         self
 ):  # Remove virtual orbital just for test purposes (not sensible!)
     core = Hamiltonian(transformation=TransformationType.FULL,
                        qubit_mapping=QubitMappingType.JORDAN_WIGNER,
                        two_qubit_reduction=False,
                        freeze_core=False,
                        orbital_reduction=[-1])
     input_object = core.run(self.qmolecule)
     self._validate_vars(core)
     self._validate_info(core, num_orbitals=2)
     self._validate_input_object(input_object, num_qubits=2, num_paulis=4)
    def setUp(self):
        driver = HDF5Driver(
            hdf5_input=self._get_resource_path('test_driver_hdf5.hdf5'))
        self.qmolecule = driver.run()

        core = Hamiltonian(transformation=TransformationType.FULL,
                           qubit_mapping=QubitMappingType.PARITY,
                           two_qubit_reduction=True,
                           freeze_core=False,
                           orbital_reduction=[],
                           max_workers=4)

        self.algo_input = core.run(self.qmolecule)
        self.reference_energy = -1.857275027031588
示例#9
0
 def test_freeze_core_all_reduction_ph(self):
     core = Hamiltonian(transformation=TransformationType.PH,
                        qubit_mapping=QubitMappingType.PARITY,
                        two_qubit_reduction=True,
                        freeze_core=True,
                        orbital_reduction=[-2, -1])
     input_object = core.run(self.qmolecule)
     self._validate_vars(core,
                         energy_shift=-7.7962196,
                         ph_energy_shift=-1.05785247)
     self._validate_info(core,
                         num_particles=2,
                         num_orbitals=6,
                         actual_two_qubit_reduction=True)
     self._validate_input_object(input_object, num_qubits=4, num_paulis=52)
示例#10
0
    def setUp(self):
        hdf5_cfg = OrderedDict([
            ('hdf5_input', self._get_resource_path('test_driver_hdf5.hdf5'))
        ])
        section = {'properties': hdf5_cfg}
        driver = HDF5Driver()
        self.qmolecule = driver.run(section)

        core = Hamiltonian(transformation='full',
                           qubit_mapping='parity',
                           two_qubit_reduction=True,
                           freeze_core=False,
                           orbital_reduction=[],
                           max_workers=4)

        self.algo_input = core.run(self.qmolecule)
        self.reference_energy = -1.857275027031588