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
Refactor bonus struct for ellipsoid atom style #3999
Comments
A typical example would be ellipsoids in a stochastic rotation dynamics (SRD) solvent, see https://github.com/lammps/lammps/blob/develop/examples/ASPHERE/ellipsoid/in.ellipsoid and https://docs.lammps.org/fix_srd.html |
The documentation is a bit misleading, since the ASPHERE package pair style for Gay-Berne describes an ellipsoidal generalization of the LJ potential. Also, there are multi-point "tri" and "line" particles that interact with LJ like groups of LJ point particles. Please note that the bonus struct pointer is also used for atom style body and the pair styles in the BODY package. |
Thank you very much for the prompt answers and clarifications. I had found out that I was curious about I understand the memory concern for large systems with few actual ellipsoids like SRD. Given that I wanted to clarify that aspect (and potentially propose a refactor) before implementing contact detection. I will do so with the current bonus structure. Thank you |
I would have one more question regarding the rationale for deciding which variable goes into a bonus struct and which should be a general For example:
have a general definition and pointer in What are the main reasons why these particular variable are not part of a bonus struct? |
You have to understand that LAMMPS didn't happen instantly but has grown with contributions from different developers (some of which had quite different ideas of what is "obvious" programming). The attempts to remain consistent and even go so far to enforce consistent style and implementations are rather new (last few years and with extra force added during the pandemic, when there was more time to start more deeply reaching refactoring work). That said, most of the properties you list are required by atom style sphere. The question whether to use bonus or add a new atom style is a bit of a personal choice probably augmented by the suggestions of @sjplimp, althrough I don't recall who actually came up with adding the bonus field and the different structs. It may have been someone else. When using atom style sphere, e.g. for DEM, it is not as likely to have a mix of point particles with extended particles. Also, atom style sphere predates the bonus structs. |
The motivation for the bonus data structs for all the several atom styles (ellipsoid, line, tri, body) was to make Omega, torque, radius are all used by granular systems, which are typically all-granular, i.e. use of atom-style sphere. |
$ grep -l angmom src/atom_vec_*.cpp src/*/atom_vec_*.cpp
src/atom_vec_body.cpp
src/atom_vec_ellipsoid.cpp
src/atom_vec_tri.cpp |
Thank you very much for these clarifications. I will use the data structure as is, and interface it with If I may ask for advice, a circumscribed radius to the ellipsoid (i.e. the max of Alternatively, granular contact detection between ellipsoids ( I truly appreciate your guidance |
I think using the radius pointer for a property that is not "the radius" is not a good idea. I would suggest to append a new property "maxrad" to the bonus struct for ellipsoids. As for the super-ellipsoids, why not place a flag into the bonus struct for that and handle both in the same atom style? That we it may be possible to have both kinds of particles in the same simulation. |
We could handle both of them in the same That would also add 3 exponents to the struct (I wrote This might be a bit invasive to check and change for existing code that assumes exponents of 2, e.g., to compute moments of inertia, or in the data file parser . But if that is preferred over a new atom style I'll take that route. Thank you |
Although it would be a misnomer, one advantage of using |
That is a valid point. |
So far in #4008 , I have extended the ellipsoid data structure and properties (volume, inertia) so that the atom style
@akohlmey , based on @jtclemm 's comment, would you approve of using the I currently implemented the circumscribed radius as a bonus quantity per your suggestion: what would be the alternative way to build the neighbor list from that information? Thank you |
@jibril-b-coulibaly I don't want to be the only person that has a say in this. At this point it would be good to have input from @sjplimp. In fact, @sjplimp and I had a long discussion about refactoring the handling of per-atom data to make it simpler, future-proof and generally change the approach as we have a growing number of atom styles with overlapping feature sets. I think the major question you need to ask yourself when re-using a per-atom attribute like "radius" in this case is: would it be conceivable (even if very improbable) that somebody might want to set up a simulation using a hybrid atom style that would include the same attribute and would there be a conflict? E.g. in this case, would there be a situation where one would want to use particles requiring either atom styles ellipsoid or sphere. I don't think there is currently a way to build neighbor lists based on "bonus" information. |
Thank you for outlining the major question, it helps me clarify the thought process and I will use it now and in the future. I would argue in favor of using
|
Summary
I was looking into the ellipsoid atom style with the goal to implement granular contact between ellipsoids. I would like to better understand the rationale for the current
bonus
structure, which constainsshape
andquat
, and discuss possible refactoring.Detailed Description
The documentation mentions:
What are applications in which there is only a small number of ellipsoids and a large number of point particles, and for which defining the shape and quaternion only for actual ellipsoids saves up significant memory?
Atom style
sphere
does a similar thing whereHowever, per-atom data that is not valid for point particles, e.g.,
omega
is readily accessible and not located inside a bonus structure. What explains such difference?Given that a
quat
pointer already exists in theAtom
class, ashape
pointer could similarly be defined for finite-sized particles and used for ellipsoids, thereby getting rid of the bonus struct and the complexity associated with handling the information (e.g., special checks and communication).I would be happy to discuss more about the pros and cons of the current bonus structure vs having quaternion and shape for all ellipsoid atoms.
Thank you!
Further Information, Files, and Links
N/A
The text was updated successfully, but these errors were encountered: