1
0
mirror of https://github.com/TREX-CoE/qmc-lttc.git synced 2024-11-01 19:53:58 +01:00
qmc-lttc/hydrogen.h
2021-04-26 21:50:11 +02:00

63 lines
1.1 KiB
C

#include <math.h>
#include <stdio.h>
double potential(double *r, const int l) {
double pot;
pot = 0.0;
for (int i = 0; i < l; ++i) {
pot += r[i] * r[i];
}
if (pot > 0.0) {
return -1.0 / sqrt(pot);
}
return 1e6;
}
double psi(double a, double *r, const int l) {
double psival, rnorm;
psival = 0.0;
rnorm = 0.0;
for (int i = 0; i < l; ++i) {
rnorm += r[i]*r[i];
}
rnorm = sqrt(rnorm);
psival = exp(-a * rnorm);
return psival;
}
double kinetic(double a, double *r, const int l) {
double rnorm;
for (int i = 0; i < l; ++i) {
rnorm += r[i]*r[i];
}
rnorm = sqrt(rnorm);
return a * (1 / rnorm - 0.5 * a);
}
double e_loc(double a, double *r, const int l) {
return kinetic(a, r, l) + potential(r, l);
}
void drift(double a, double *r, double *d, const int l) {
double rnorm, fact;
for (int i = 0; i < l; ++i) {
rnorm += r[i]*r[i];
}
rnorm = sqrt(rnorm);
fact = -a / rnorm;
for (int i = 0; i < l; ++i) {
d[i] = r[i] * fact;
}
}