コード例 #1
0
    def test_vqe_mes(self):
        """ Test VQEUCCSDFactory with QEOM """
        solver = VQEUCCSDFactory(self.quantum_instance)
        gsc = GroundStateEigensolver(self.transformation, solver)
        esc = QEOM(gsc, 'sd')
        results = esc.solve(self.driver)

        for idx, _ in enumerate(self.reference_energies):
            self.assertAlmostEqual(results.computed_energies[idx], self.reference_energies[idx],
                                   places=4)
コード例 #2
0
    def test_numpy_mes(self):
        """ Test NumPyMinimumEigenSolver with QEOM """
        solver = NumPyMinimumEigensolver()
        gsc = GroundStateEigensolver(self.transformation, solver)
        esc = QEOM(gsc, 'sd')
        results = esc.solve(self.driver)

        for idx, _ in enumerate(self.reference_energies):
            self.assertAlmostEqual(results.computed_energies[idx], self.reference_energies[idx],
                                   places=4)
コード例 #3
0
    def test_numpy_mes(self):
        """ Test with NumPyMinimumEigensolver """
        solver = NumPyMinimumEigensolverFactory(
            use_default_filter_criterion=True)
        gsc = GroundStateEigensolver(self.transformation, solver)
        esc = QEOM(gsc, 'sd')
        results = esc.solve(self.driver)

        for idx, _ in enumerate(self.reference_energies):
            self.assertAlmostEqual(results.computed_vibronic_energies[idx],
                                   self.reference_energies[idx],
                                   places=4)
コード例 #4
0
 def test_vqe_uvccsd_factory(self):
     """ Test with VQE plus UVCCSD """
     optimizer = COBYLA(maxiter=5000)
     solver = VQEUVCCSDFactory(QuantumInstance(
         BasicAer.get_backend('statevector_simulator')),
                               optimizer=optimizer)
     gsc = GroundStateEigensolver(self.transformation, solver)
     esc = QEOM(gsc, 'sd')
     results = esc.solve(self.driver)
     for idx, _ in enumerate(self.reference_energies):
         self.assertAlmostEqual(results.computed_vibronic_energies[idx],
                                self.reference_energies[idx],
                                places=0)