void calculate_to_recover(int *result,long double * e,int *L,long double *a,long double *t,long double *m){ wf NNYY; NNYY = wavefunction(e[0],L[0],a[0],t[0],m[0]); __RECOVERED_WAVEFUNCTION__ = NNYY.y; result[0] = NNYY.N; }
double Slater::localLaplacianNumerical(const mat &r, const int &k, const double &h) { /* Calculates the laplacian for particle k */ ddwavefunction = 0.0; rPlus = rMinus = r; wfCurrent = wavefunction(r); for (int i = 0; i < nDimensions; i++) { rPlus(k,i) += h; rMinus(k,i) -= h; wfMinus = wavefunction(rMinus); wfPlus = wavefunction(rPlus); ddwavefunction += wfMinus + wfPlus - 2.0*wfCurrent; rPlus(k,i) = rMinus(k,i) = r(k,i); } ddwavefunction /= (wfCurrent*h*h); return ddwavefunction; }
// debug stuff mat Slater::gradient(const mat &r, const double &h) { rPlus = rMinus = r; mat temp(nParticles, nDimensions); wfCurrent = wavefunction(r); dfactor = 1.0/(wfCurrent*2.0*h); for (int i = 0; i < nParticles; i++) { for (int j = 0; j < nDimensions; j++) { rPlus(i,j) += h; rMinus(i,j) -= h; wfMinus = wavefunction(rMinus); wfPlus = wavefunction(rPlus); temp(i,j) = (wfPlus - wfMinus)*dfactor; rPlus(i,j) = rMinus(i,j) = r(i,j); } } return temp; }
rowvec Slater::localGradientNumerical(const mat &r, const int &k, const double &h) { /* Calculates the the gradient for particle k */ dwavefunction = zeros<vec>(nDimensions); rPlus = rMinus = r; wfCurrent = wavefunction(r); for (int i = 0; i < nDimensions; i++) { rPlus(k,i) += h; rMinus(k,i) -= h; wfMinus = wavefunction(rMinus); wfPlus = wavefunction(rPlus); dwavefunction(i) = wfPlus - wfMinus; rPlus(k,i) = rMinus(k,i) = r(k,i); } dwavefunction /= (2.0*wfCurrent*h); // dwavefunction /= (2.0*h); // not local return dwavefunction; }
void Base::step() { if (!m_active) return; m_time += m_speed; if (m_cycles > 0.0 && m_time > m_cycles) { m_time = m_cycles; m_active = false; } update(m_time, wavefunction(m_time)); if (!m_active) { finished(this); finished(); } }