def test_larger_tutorial_qubit_op(self): """Test the 3-modal qubit operator generated in the vibrational structure tutorial.""" num_modes = self.driver_result.num_modes num_modals = [3] * num_modes vibration_energy = self.driver_result.get_property("VibrationalEnergy") vibration_energy.basis = HarmonicBasis(num_modals) vibration_op = vibration_energy.second_q_ops()[0] mapper = DirectMapper() qubit_op = mapper.map(vibration_op) self.assertEqual(qubit_op, _num_modals_3_q_op)
def test_mapping(self): """Test mapping to qubit operator""" num_modes = self.driver_result.num_modes num_modals = [2] * num_modes vibration_energy = self.driver_result.get_property("VibrationalEnergy") vibration_energy.basis = HarmonicBasis(num_modals) vibration_op = vibration_energy.second_q_ops()[0] mapper = DirectMapper() qubit_op = mapper.map(vibration_op) self.assertEqual(qubit_op, _num_modals_2_q_op)
def test_mapping(self): """ Test mapping to qubit operator """ driver = GaussianForcesDriver(logfile=self.get_resource_path( 'CO2_freq_B3LYP_ccpVDZ.log', 'problems/second_quantization/vibrational/resources')) watson_hamiltonian = driver.run() num_modals = 2 truncation = 3 vibration_op = _build_vibrational_op(watson_hamiltonian, num_modals, truncation) mapper = DirectMapper() qubit_op = mapper.map(vibration_op) self.assertEqual(qubit_op, REFERENCE)
def test_mapping(self): """Test mapping to qubit operator""" with warnings.catch_warnings(): warnings.filterwarnings("ignore", category=DeprecationWarning) driver = GaussianForcesDriver(logfile=self.get_resource_path( "CO2_freq_B3LYP_ccpVDZ.log", "problems/second_quantization/vibrational/resources", )) driver_result = driver.run() num_modes = driver_result.num_modes num_modals = [2] * num_modes vibration_energy = driver_result.get_property("VibrationalEnergy") vibration_energy.basis = HarmonicBasis(num_modals) vibration_op = vibration_energy.second_q_ops()[0] mapper = DirectMapper() qubit_op = mapper.map(vibration_op) self.assertEqual(qubit_op, REFERENCE)