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

Energy minimization with fix rigid/small #3801

Open
demkowicz opened this issue May 31, 2023 · 15 comments
Open

Energy minimization with fix rigid/small #3801

demkowicz opened this issue May 31, 2023 · 15 comments
Assignees

Comments

@demkowicz
Copy link

Under the "Restrictions" heading on the bottom of the minimize command manual entry (https://docs.lammps.org/minimize.html), there is a statement you'd be interested in implementing energy minimization under the fix rigid constraint. I believe this could be achieved pretty easily, at least for fix rigid/small using derivative methods such as conjugate gradient. I'm not familiar with LAMMPS source code, but, if there is interest, I would be happy to work with someone who knows it to implement this functionality. I would personally very much like to see such functionality in LAMMPS.
M. J. Demkowicz (demkowicz@tamu.edu)

@athomps
Copy link
Contributor

athomps commented May 31, 2023

I could certainly give you some guidance. I suggest starting out by looking at two functions: MinLineSearch::alpha_step() and Min::energy_force(). Let me know how you feel after that :-)

@sjplimp
Copy link
Contributor

sjplimp commented May 31, 2023

You should look at this paper for HOOMD. I don't have a copy at the moment, but it has a section on energy min with rigid body constraints. My recollection is it uses FIRE (damped dynamics) not a CG based method.
@ndtrung81 Trung can comment as he is the lead author. I think this is likely a better match to how LAMMPS would use MPI (or GPU) parallelism.

Nguyen, T. D., Phillips, C. L., Anderson, J. A., & Glotzer, S. C. (2011). Rigid body constraints realized in massively-parallel molecular dynamics on graphics processing units. Computer Physics Communications, 182(11), 2307-2313. https://doi.org/10.1016/j.cpc.2011.06.005

@ndtrung81
Copy link
Contributor

Correct, in that paper we extended the FIRE algorithm (E. Bitzek et al, Phys. Rev. Lett. 97 (2006)) to account for the contribution of the body rotational degrees of freedom to the power (body torque times angular velocity in the space-fixed frame). I think it would be possible to either extend the current MinFire to handle rigid bodies (when fix rigid is present), or to have a separate MinFireRigid deriving from MinFire. The former approach would allow energy minimization of systems composed of non-rigid parts and rigid bodies but need changes to MinFire. In the latter, it is difficult to ensure two MinFire* instances update the atoms in the non-rigid parts and those in the bodies consistently.

@demkowicz
Copy link
Author

demkowicz commented Jun 1, 2023 via email

@demkowicz
Copy link
Author

demkowicz commented Jun 1, 2023 via email

@demkowicz
Copy link
Author

demkowicz commented Jun 1, 2023 via email

@demkowicz
Copy link
Author

demkowicz commented Jun 1, 2023 via email

@athomps
Copy link
Contributor

athomps commented Jun 1, 2023

@demkowicz A lot of the difficulties with minimization in LAMMPS is that atoms may migrate between processors after every energy evaluation. This requires carefully updating all data structures, including those for rigid constraints. It is perfectly doable, but requires some effort.

@demkowicz
Copy link
Author

demkowicz commented Jun 1, 2023 via email

@athomps
Copy link
Contributor

athomps commented Jun 1, 2023

Yes, but not every timestep, because the halo region is buffered. Also, there is something else. The line search methods, like CG, do backtracking, so they start out with a big step and then shrink it.

@demkowicz
Copy link
Author

demkowicz commented Jun 1, 2023 via email

@demkowicz
Copy link
Author

Well, I wrote my little poor man's rigid body relaxation algorithm. It works! It takes about 70 iterations (about 1s on a single CPU) to relax 64 tip4p H2O molecules in an ice Ih structure to within about 0.01eV. Script available upon request.

@mm5986
Copy link

mm5986 commented Jul 5, 2023

Well, I wrote my little poor man's rigid body relaxation algorithm. It works! It takes about 70 iterations (about 1s on a single CPU) to relax 64 tip4p H2O molecules in an ice Ih structure to within about 0.01eV. Script available upon request.

This is great! I've been looking for a rigid body relaxation algorithm. Could you please send/post your script.

@demkowicz
Copy link
Author

See attached. Note that I have not done anything more than a proof of concept. In particular, I did not do any validation or optimization, so I give absolutely no guarantees on performance. There is also clear room for improvement, e.g., replacing the energy-based convergence criterion with a force/torque-based one.

in.lammps_relax.txt

@mm5986
Copy link

mm5986 commented Jul 6, 2023 via email

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

No branches or pull requests

6 participants