Commit 970f6c1f authored by Mccaskey, Alex's avatar Mccaskey, Alex
Browse files

adding deuteron H2 expgen example


Signed-off-by: Mccaskey, Alex's avatarAlex McCaskey <mccaskeyaj@ornl.gov>
parent 84189e17
Pipeline #48830 passed with stages
in 2 minutes and 19 seconds
#include "qcor.hpp"
int main(int argc, char **argv) {
qcor::Initialize(argc, argv);
auto optimizer = qcor::getOptimizer(
"nlopt", {{"nlopt-optimizer", "cobyla"}, {"nlopt-maxeval", 20}});
auto op = qcor::getObservable(
"pauli", "5.907 - 2.1433 X0X1 - 2.1433 Y0Y1 + .21829 Z0 - 6.125 Z1");
auto future = qcor::submit([&](qcor::qpu_handler &qh) {
qh.vqe(
[&](double x) {
X(0);
exp_i_theta(x, {{"pauli", "X0 Y1 - Y0 X1"}});
},
op, optimizer);
});
auto results = future.get();
auto energy = mpark::get<double>(results->getInformation("opt-val"));
std::cout << "Results: " << energy << "\n";
}
......@@ -12,7 +12,11 @@ TEST(ExpTester, checkSimple) {
// NOW Test it somehow...
Exp exp;
auto f =
exp.generate({{"pauli","Y0 X1 X2 X3"}});
exp.generate({{"pauli","Y0 X1 X2"}});
std::cout << "F:\n" << f->toString() << "\n";
f =
exp.generate({{"pauli","X0 Y1 - X1 Y0"}});
std::cout << "F:\n" << f->toString() << "\n";
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment