Some issues in the vmc c++ code
Hi,
I was looking over your page here: http://compphysics.github.io/ComputationalPhysics2/doc/pub/vmc/html/vmc-bs.html and I noticed some possible issues. I did not compile and test the programs, though.
This line: https://github.com/CompPhysics/ComputationalPhysics2/blob/a840b97b651085090f99bf6a11abab57100c2e85/doc/pub/vmc/programs/c%2B%2B/vmcsolver.cpp#L52 has a multiplication with h, which is the derivation step (actually, it is 2*h but 2 cancels with the 2 from the quantum force, as the derivative of the square of the wavefunction is involved).
I think it should be a division, not a multiplication, like this:
QForceOld /= h*waveFunctionOld;
A similar issue exists here:
https://github.com/CompPhysics/ComputationalPhysics2/blob/a840b97b651085090f99bf6a11abab57100c2e85/doc/pub/vmc/programs/c%2B%2B/vmcsolver.cpp#L69 but the situation is worse, because QForceNew is not assigned. Should be:
QForceNew /= h*waveFunctionNew;
double VMCSolver::QuantumForce(const mat &r, mat &QForce) is declared as returning double but it returns nothing. Doesn't seem to be an issue, since the returned value is not used anywhere, but probably it should be declared with void.
It might be the case that you introduced those issues on purpose, to let the students figure them out, in which case I'm sorry I interfered, but I thought I should report those just in case.
Thank you for putting those materials public!