-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtwo_dim_spo_TEST.cc
61 lines (51 loc) · 1.42 KB
/
two_dim_spo_TEST.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/* vim: set sw=4 sts=4 ft=cpp et foldmethod=syntax : */
/*
* Copyright (c) 2011 Tiziano Müller <[email protected]>
* Christian Reinhardt
*
*
*
*/
#include "two_dim_spo.hh"
#include "time_evolutions.hh"
#include <iostream>
#include <cmath>
#include <cassert>
#include <complex>
// make sure <complex> is included before fftw3.h
// to have FFTW use the datatype defined by gcc's complex
// rather than it's own
#include <fftw3.h>
#ifdef HAVE_OPENMP
#include <omp.h>
#endif
int main(int, char**)
{
#ifdef HAVE_OPENMP
int ret(fftw_init_threads());
assert(ret && "initializing fftw threads failed");
fftw_plan_with_nthreads(omp_get_num_threads());
#endif
std::function<complex (const double&, const double& y)> phi0 = [&](const double& x, const double& y)->complex {
double kx(0.0);
double ky(2.0*M_PI);
double dx(0.0);
double dy(0.0);
return exp(-0.5*((x-dx)*(x-dx)+(y-dy)*(y-dy)) - complex(0,1)*ky*y - complex(0,1)*kx*x);
};
const double dt(0.005);
const size_t numberOfSteps(100);
TwoDimSPO sim(1024, 1024);
Quantum3BodyTimeEvolution te;
sim.setTimeEvolution(&te);
sim.initialize(phi0);
std::cout << "Please wait..." << std::endl;
for (size_t i(0); i < numberOfSteps; ++i)
{
std::cout << ".";
std::flush(std::cout);
sim.evolveStep(dt);
}
std::cout << " done." << std::endl;
return 0;
}