Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add IonIon force observable to CoulombPotential in OBC #1820

Merged
merged 11 commits into from
Aug 28, 2019

Conversation

tiihonej
Copy link
Contributor

In response to issue #1769 from @rcclay, I've added code to compute IonIon forces due to coulomb potential in OBC, when "forces=yes" attribute is present. The value is accumulated with that of ACForce estimator. I've tested that the code works for more than two ions, and checked the validity by hand.

@qmc-robot
Copy link

Can one of the maintainers verify this patch?

Copy link
Contributor

@rcclay rcclay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks fine to me! The main thing I would like to add is a simple unit test. Can you add one to src/QMCHamiltonians/tests/test_force.cpp? You can copy/paste either the "Ceperley Force" or "Chiesa Force" test, but swapping out the ForceCeperley object with CoulombPotential. You should have reference force values on hand.

@jtkrogel
Copy link
Contributor

Is there a reason to keep the forces="yes" requirement? I would prefer for ion-ion to be included automatically anytime a force estimator is used.

@rcclay
Copy link
Contributor

rcclay commented Aug 22, 2019

@jtkrogel In the long run, no. In the short run, this allows the force components to be printed separately to scalar.dat for checking purposes, and also handles some potential one-off initializations that might be needed for forces. This will definitely need to be streamlined.

@jtkrogel
Copy link
Contributor

I think the total force and each sub-component should be written automatically every time. I guess the conditional initialization issue requires more coordination between the force estimator and the hamiltonian components?

@rcclay
Copy link
Contributor

rcclay commented Aug 22, 2019

I guess the conditional initialization issue requires more coordination between the force estimator and the hamiltonian components?

That's the tricky bit.

@tiihonej
Copy link
Contributor Author

I added a unit test. Not sure if it's very classy, but it seems to do the job. I take it we are still sticking with the 'forces=yes' practice for now. Enabling/disabling the feature should be easy enough using a flag in the initialization, but the logic behind this flag should probably be re-designed in the future. I would vote for making ion-ion force the default, provided that there is a force estimator present, otherwise not.

Copy link
Contributor

@rcclay rcclay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm happy. Once Rhea is up and it clears the CI tests, I'll merge it.

@qmc-robot
Copy link

Can one of the admins verify this patch?

@rcclay
Copy link
Contributor

rcclay commented Aug 26, 2019

Ok to test.

@ye-luo
Copy link
Contributor

ye-luo commented Aug 26, 2019

Complex builds are failing. Please have a look.

inline void evaluateAAForces(const DistanceTableData& d, const ParticleScalar_t* restrict Z)
{
forces = 0.0;
GradType forcetmp = 0.0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't tell for sure without reading the error log, but this will probably bite you in real vs. complex builds, because for real builds GradType will basically be a real 3d vector, whereas in complex it will be a complex 3d vector. Force should always be a real 3d vector. You should change this to PosType and see if it passes the tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right. I'll check this out and submit a correction shortly.

@tiihonej
Copy link
Contributor Author

The code should now compile and pass unit tests on both real and complex.

@tiihonej
Copy link
Contributor Author

Seems it breaks CUDA build, though. I have no CUDA system readily available to test and fix it, but I'll look into this tomorrow. Until then the changes are best left on hold. Sorry for the inconvenience.

@rcclay
Copy link
Contributor

rcclay commented Aug 27, 2019

Can you send me the CUDA log?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants