41 int main(
int argc,
char **argv)
50 std::string integralsfile =
"mo-integrals.h5";
53 std::string startinput;
55 struct option long_options[] =
57 {
"integrals", required_argument, 0,
'i'},
58 {
"start", required_argument, 0,
's'},
59 {
"boundary-point", no_argument, 0,
'b'},
60 {
"potential-reduction", no_argument, 0,
'p'},
61 {
"help", no_argument, 0,
'h'},
67 while( (j = getopt_long (argc, argv,
"hi:bps:", long_options, &i)) != -1)
72 cout <<
"Usage: " << argv[0] <<
" [OPTIONS]\n"
74 " -i, --integrals=integrals-file Set the input integrals file\n"
75 " -b, --boundary-point Use the boundary point method as solver (default)\n"
76 " -p, --potential-reduction Use the potential reduction method as solver\n"
77 " -s, --start Use this a start point for the Simulated Annealing\n"
78 " -h, --help Display this help\n"
83 integralsfile = optarg;
98 std::cout <<
"Tell me what to do..." << std::endl;
102 cout <<
"Reading: " << integralsfile << endl;
106 setenv(
"SAVE_H5_PATH",
"./", 0);
108 cout <<
"Using save path: " << getenv(
"SAVE_H5_PATH") << endl;
110 MPI_Init(&argc,&argv);
115 opt.UseBoundaryPoint();
117 opt.UsePotentialReduction();
119 auto& ham = opt.getHam();
121 const auto L = ham.getL();
122 const auto N = ham.getNe();
124 cout <<
"Starting with L=" << L <<
" N=" << N << endl;
125 auto start = std::chrono::high_resolution_clock::now();
127 opt.Set_start_temp(0.1);
128 opt.Set_delta_temp(0.99);
129 opt.Set_max_angle(1.3);
130 opt.Set_delta_angle(0.999);
138 opt.getMethod_BP().set_use_prev_result(
true);
139 }
catch (
const std::bad_cast err)
141 std::cerr <<
"Shit just hit the fan!\t" << err.what() << std::endl;
145 if(! startinput.empty())
146 opt.getMethod().getRDM().ReadFromFile(startinput.c_str());
152 auto end = std::chrono::high_resolution_clock::now();
154 cout <<
"Total Runtime: " << std::fixed << std::chrono::duration_cast<std::chrono::duration<double,std::ratio<1>>>(end-start).count() <<
" s" << endl;
157 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
160 std::stringstream h5_name1;
161 h5_name1 << getenv(
"SAVE_H5_PATH") <<
"/rdm.h5";
162 opt.getMethod().getRDM().WriteToFile(h5_name1.str().c_str());
164 std::stringstream h5_name2;
165 h5_name2 << getenv(
"SAVE_H5_PATH") <<
"/optimale-uni.h5";
166 opt.get_Optimal_Unitary().saveU(h5_name2.str());
static Hamiltonian CreateFromH5(const string filename)
sig_atomic_t stopping_min
int main(int argc, char **argv)