Closed b-butler closed 3 years ago
Is hoomd.lattice
being removed in v3? If not, HOOMD's own feature should be the preferred mechanism for doing this, not freud. hoomd.lattice
still shows in the docs for next
:
https://hoomd-blue.readthedocs.io/en/next/module-hoomd-lattice.html#hoomd.lattice.bcc
@bdice the plan is to remove it for version 3.0. It just hasn’t been done yet since the whole API is still transitioning.
We may want to discuss the plan a little more before v3 is finalized. I had suggested that we maybe wanted to unify this kind of initialization logic in something like crystaldb to avoid duplication between freud and HOOMD. Part of the issue with depending only on freud for this purpose is that some properties like particle mass don't really make sense to include in the freud API but are crucial for HOOMD. We need to consider a more robust, generalizable solution to this problem if hoomd.lattice
is going away because it's a very common method of initialization now.
For context: I am considering removing lattice initialization in v3.0 for several reasons. 1) HOOMD is a simulation engine, not an initialization engine. 2) It is inherently inflexible and really does not serve the needs of the user base well. 3) I think it is widely used only because the example scripts use it - its use has propagated by copy and paste.
Brandon and I discussed it agreed this makes sense to us. I am happy to continue the discussion with a larger group before committing to removing lattice initialization. In either case, hoomd-examples is well-served by a minimal example demonstrating how to implement this in pure python (no external libs) so that users have something to copy and paste and build on.
I agree that hoomd.lattice
is maybe not a great fit, and almost certainly propagated because it is used in examples. I do think that the basic functionality is a common enough use-case that it should belong somewhere, though. Maybe we could find a way to roll it into something like mbuild
, although I'm hesitant to introduce that level of complexity when we don't care about the vast majority of atomic details that mbuild
supports.
With freud, we found that many users struggled to use our examples because they were not self-contained and relied on a util.py
file. We didn't want to include system generation in every freud example script, so we made the exact opposite choice -- expanding the library to include simple system generation.
For HOOMD, I think it's worth keeping the feature just to have a self-contained utility for testing and code examples. The cost of user confusion and responding to those kind of questions is much higher than the cost of maintaining the lattice
code, in my estimation.
I also agree with @vyasr -- if the crystaldb
prototype were available as a pure-Python library and could be included as a dependency, I think it that would be an even better solution than putting this code into freud.data
/ hoomd.lattice
.
There is minimal cost to maintaining the code itself. The main cost is in the mass confusion of users attempting to use lattice for things it was not meant to do and the time it takes to support them. See e.g. https://groups.google.com/forum/#!topic/hoomd-users/rCgM1QrtNDs
@vyasr, @bdice, @joaander The code doesn't have to be using freud
. I was just stating that some of its functionality could be helpful in a ~10 or so line script that generates a particular lattice. In my opinion, the optimal solution would be to have a package that or group uses that deals with simple initialization. I would rather the logic not be in hoomd
due to the potential headaches it can cause.
The current v3 tutorials use itertools and numpy to generate simple cubic lattices. We could write a tutorial that shows an example of a more complex structure using fedorov (https://fedorov.readthedocs.io/en/latest/) or another tool such as mbuild.
What would be the good complex structure candidates for the point particles to include in the tutorial?
Example description
Show how using freud to generate an arrangement of particles in different lattices and creating a gsd file from the configuration.
Section
Initialization