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

Erster Ansatz für Interaktionen.

Der Impuls wird jetzt durch ein Potential beeinflusst.
Index Berechnung wurde korrigiert.
Pakete im Readme angepasst.
parent 9738b98b
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
......
...@@ -53,6 +53,20 @@ Particle::~Particle() ...@@ -53,6 +53,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
...@@ -69,9 +83,9 @@ void Particle::propagate() ...@@ -69,9 +83,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);
} }
...@@ -37,13 +37,13 @@ const double dy = 2.0 / ny; ...@@ -37,13 +37,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