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 @@ ...@@ -8,9 +8,8 @@
Dependencies: Dependencies:
* cmake * cmake
* gtkmm * libgtkmm-3.0-dev
* fftw * libfftw3-dev
* omp
```` ````
mkdir build && cd build mkdir build && cd build
......
...@@ -55,6 +55,20 @@ Particle::~Particle() ...@@ -55,6 +55,20 @@ Particle::~Particle()
void Particle::propagate() 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. fftw_execute (m_planForward); // transform into impulse repr.
#pragma omp parallel for #pragma omp parallel for
for (unsigned long iy = 0; iy < ny; iy++) for (unsigned long iy = 0; iy < ny; iy++)
...@@ -70,9 +84,9 @@ void Particle::propagate() ...@@ -70,9 +84,9 @@ void Particle::propagate()
} }
} }
updateImpulseImage(); updateImpulseImage(); //momentum
fftw_execute(m_planBackward); // transform into local repr. fftw_execute(m_planBackward); // transform into local repr.
updateLocalImage(); updateLocalImage(); //position
} }
......
...@@ -7,26 +7,26 @@ ...@@ -7,26 +7,26 @@
#include "QuantumMath.hpp" #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; ix -= (int)nx;
return ix * 2.0 * M_PI * hbar / (nx * dx); 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; iy -= (int)ny;
return iy * 2.0 * M_PI * hbar / (ny * dy); return iy * 2.0 * M_PI * hbar / (ny * dy);
} }
...@@ -38,13 +38,13 @@ const double dy = 2.0 / ny; ...@@ -38,13 +38,13 @@ const double dy = 2.0 / ny;
/// ///
/// @brief Get index to access array in local representation. /// @brief Get index to access array in local representation.
/// ///
const double xAt(unsigned i); const double xAt(int i);
const double yAt(unsigned iy); const double yAt(int iy);
/// ///
/// @brief Get index to access array in impulse representation. /// @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 #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