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

Including Forcefield methods #450

Closed
JaGeo opened this issue Jul 26, 2023 · 9 comments
Closed

Including Forcefield methods #450

JaGeo opened this issue Jul 26, 2023 · 9 comments

Comments

@JaGeo
Copy link
Member

JaGeo commented Jul 26, 2023

Currently, the forcefields rely on the TrajectoryObserver from chgnet and megnet (it looks extremely similar in both codes). This, however, means that we would need to rely on it (or a similar class) for any kind of forcefield in the future. It also always includes magnetic moments by default (I don't think all force fields consider them; I ran into an issue with one ML potential). Any ideas how to solve this? Should we include our own TrajectoryObserver into atomate2?

Currently, we also don't have any ForcefieldBaseMaker or similar.

I plan to write a RelaxMaker for EMT to test this in more detail.

Any ideas, thoughts? @utf @matthewkuner @arosen93 @janosh ?

@Andrew-S-Rosen
Copy link
Member

Andrew-S-Rosen commented Jul 26, 2023

Strictly speaking, TrajectoryObserver should only be needed if the force field method is being used as an ASE Calculator, right? So, presumably, if one made an Atomate2 recipe using (for example) GULP-based force fields using the GULP internal relaxation engine, then there would be no need for a TrajectoryObserver for that code in practice.

It's also worth noting that TrajectoryObserver does the exact same thing as the regular TrajectoryWriter in ASE except in the case of the former it stores it in memory instead of writing out the trajectory file to the disk. This can be helpful to speed up calculations since the steps are quick and file I/O would be the bottleneck, which is why it's used.

@JaGeo
Copy link
Member Author

JaGeo commented Jul 26, 2023

@arosen93 thanks for the clarification with regard to the TrajectoryObserver. Maybe worth adding it to ase as well?

@Andrew-S-Rosen
Copy link
Member

@JaGeo: Yes, I think that it is probably worth adding TrajectoryObserver to ASE as a class alongside TrajectoryReader and TrajectoryWriter. Someone with knowledge of ASE would have to open a PR for it of course. I'll probably get to it one day if nobody else does, but it's not high on my priority list...

@JaGeo
Copy link
Member Author

JaGeo commented Jul 26, 2023

@arosen93 Thanks! For now, I would probably need to include it into atomate2 to add further ase-based force fields and ML potentials.

We probably also need to add a BaseForceFieldMaker to simplify writing workflows for all forcefields...

I will then include it into my on-going PR of the phonon workflow for forcefields. #398

@Andrew-S-Rosen
Copy link
Member

@JaGeo: Makes sense. In the meantime, I've opened an ASE issue here for the sake of bookkeeping: https://gitlab.com/ase/ase/-/issues/1293.

@Andrew-S-Rosen
Copy link
Member

@JaGeo: The lead dev of ASE responded to the above issue --- there isn't actually ever a need for TrajectoryObserver in practice. The same can be done just by passing a trajectory kwarg to the ASE Optimizer class (see here) and then adjusting the IO buffer size (as noted here) so that it doesn't flush to disk every step. In the meantime, of course it might be easier to just copy the TrajectoryObserver to atomate2 directly, but longer term I think it's a class that doesn't really have to exist in the first place.

@matthewkuner
Copy link
Collaborator

matthewkuner commented Jul 26, 2023

@JaGeo Do you mean that the TrajectoryObserver always includes magmoms, or the ForceFieldTaskDocument? I'm unfamiliar with the larger pros/cons of storing this data in different forms and outsourced that opinion when I wrote the original forcefield code for Atomate2.
In the ForceFieldTaskDocument, I convert the TrajectoryObserver to a IonicStep object as well. So we would just need a way to convert other code's convention for storing trajectories to this IonicStep object if we want to implement other forcefields, no?

@JaGeo
Copy link
Member Author

JaGeo commented Jul 26, 2023

I think both. It caused an issues for me in case they were not defined. I will try to adapt the whole code for this case.

I will try to come up with something, I think. I mainly wanted to hear opinions on the TrajectoryObserver.

@utf
Copy link
Member

utf commented Aug 14, 2023

This has been resolved in #398

@utf utf closed this as completed Aug 14, 2023
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

No branches or pull requests

4 participants