Skip to content
Snippets Groups Projects
Commit 1d753bb0 authored by Armin Co's avatar Armin Co
Browse files

Merge branch 'master' into feature_heapBuffer

parents f42ffe0d 0fbdfb4e
No related branches found
No related tags found
No related merge requests found
......@@ -8,9 +8,8 @@
Dependencies:
* cmake
* gtkmm
* fftw
* omp
* libgtkmm-3.0-dev
* libfftw3-dev
````
mkdir build && cd build
......
......@@ -55,6 +55,20 @@ Particle::~Particle()
void Particle::propagate()
{
#pragma omp parallel for
for (unsigned long iy = 0; iy < ny; iy++)
{
double y = yAt(iy);
for (unsigned long ix = 0; ix < nx; ix++)
{
constexpr double l = 0.001; //lambda
double x = xAt(ix);
double E = square(y) * l;
int index = nx * iy + ix;
m_psi[index] *= exp(-Ci * dt / hbar * E);
}
}
fftw_execute (m_planForward); // transform into impulse repr.
#pragma omp parallel for
for (unsigned long iy = 0; iy < ny; iy++)
......@@ -70,9 +84,9 @@ void Particle::propagate()
}
}
updateImpulseImage();
updateImpulseImage(); //momentum
fftw_execute(m_planBackward); // transform into local repr.
updateLocalImage();
updateLocalImage(); //position
}
......
......@@ -7,26 +7,26 @@
#include "QuantumMath.hpp"
const double xAt(unsigned i)
const double xAt(int i)
{
return (i - (int)nx / 2) * dx;
return ((int)i - (int)nx / 2) * dx;
}
const double yAt(unsigned iy)
const double yAt(int iy)
{
return (iy - (int)ny / 2) * dy;
return ((int)iy - (int)ny / 2) * dy;
}
const double pxAt(unsigned ix)
const double pxAt(int ix)
{
if (ix > (int)nx / 2)
if ((int)ix > (int)nx / 2)
ix -= (int)nx;
return ix * 2.0 * M_PI * hbar / (nx * dx);
}
const double pyAt(unsigned iy)
const double pyAt(int iy)
{
if (iy > (int)ny / 2)
if ((int)iy > (int)ny / 2)
iy -= (int)ny;
return iy * 2.0 * M_PI * hbar / (ny * dy);
}
......@@ -38,13 +38,13 @@ const double dy = 2.0 / ny;
///
/// @brief Get index to access array in local representation.
///
const double xAt(unsigned i);
const double yAt(unsigned iy);
const double xAt(int i);
const double yAt(int iy);
///
/// @brief Get index to access array in impulse representation.
///
const double pxAt(unsigned ix);
const double pxAt(int ix);
const double pyAt(unsigned iy);
const double pyAt(int iy);
#endif
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment