37 int main(
int argc,
char **argv)
46 std::string integralsfile =
"mo-integrals.h5";
49 bool read_startpoint =
false;
50 std::string startinput;
52 struct option long_options[] =
54 {
"integrals", required_argument, 0,
'i'},
55 {
"start", required_argument, 0,
's'},
56 {
"boundary-point", no_argument, 0,
'b'},
57 {
"potential-reduction", no_argument, 0,
'p'},
58 {
"help", no_argument, 0,
'h'},
64 while( (j = getopt_long (argc, argv,
"hi:bps:", long_options, &i)) != -1)
69 cout <<
"Usage: " << argv[0] <<
" [OPTIONS]\n"
71 " -i, --integrals=integrals-file Set the input integrals file\n"
72 " -b, --boundary-point Use the boundary point method as solver (default)\n"
73 " -p, --potential-reduction Use the potential reduction method as solver\n"
74 " -h, --help Display this help\n"
79 integralsfile = optarg;
83 read_startpoint =
true;
95 std::cout <<
"Tell me what to do..." << std::endl;
99 cout <<
"Reading: " << integralsfile << endl;
103 setenv(
"SAVE_H5_PATH",
"./", 0);
105 cout <<
"Using save path: " << getenv(
"SAVE_H5_PATH") << endl;
107 MPI_Init(&argc,&argv);
112 opt.UseBoundaryPoint();
114 opt.UsePotentialReduction();
116 auto& ham = opt.getHam();
118 const auto L = ham.getL();
119 const auto N = ham.getNe();
121 cout <<
"Starting with L=" << L <<
" N=" << N << endl;
122 auto start = std::chrono::high_resolution_clock::now();
124 opt.Set_start_temp(0.1);
125 opt.Set_delta_temp(0.99);
126 opt.Set_max_angle(1.3);
127 opt.Set_delta_angle(0.999);
134 opt.getMethod_BP().set_use_prev_result(
true);
135 }
catch (
const std::bad_cast err)
137 std::cerr <<
"Shit just hit the fan!\t" << err.what() << std::endl;
140 if(! startinput.empty())
141 opt.getMethod().getRDM().ReadFromFile(startinput.c_str());
147 auto end = std::chrono::high_resolution_clock::now();
149 cout <<
"Total Runtime: " << std::fixed << std::chrono::duration_cast<std::chrono::duration<double,std::ratio<1>>>(end-start).count() <<
" s" << endl;
152 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
155 std::stringstream h5_name1;
156 h5_name1 << getenv(
"SAVE_H5_PATH") <<
"/rdm.h5";
157 opt.getMethod().getRDM().WriteToFile(h5_name1.str().c_str());
159 std::stringstream h5_name2;
160 h5_name2 << getenv(
"SAVE_H5_PATH") <<
"/optimale-uni.h5";
161 opt.get_Optimal_Unitary().saveU(h5_name2.str());
static Hamiltonian CreateFromH5(const string filename)
int main(int argc, char **argv)