Skip to content

Some issues in the vmc c++ code #9

@aromanro

Description

@aromanro

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:

QuantumForce(rOld, QForceOld); QForceOld = QForceOld*h/waveFunctionOld;

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:

QuantumForce(rNew,QForceNew) = QForceNew*h/waveFunctionNew;
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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions