I’m trying to add a user-defined atom_style by way of plugin, the purpose is to add some internal variables to the atom, which need to be updated in the calculation. With the help of this webpage, I am able to emb my own fix and compute style correctly. But when I try to integrate my own class AtomVecMyperi : virtual public AtomVec as a plugin, I get the error “Loading plugins for atom styles not yet implemented”. The relevant registration code in my lammpsplugin_init function looks like
Does the latest version of LAMMPS (“12 Jun 2025”) support adding user-defined atom_style via plugin?
What kind of internal variables need to be put into a AtomVec? Assume a simple situation, each particle owns a “temperature”, which does not affect the force between particles, but needs to transfer part of the temperature (heat) to another particle when a collision occurs (close to each other). How should this routine be implemented?
There is a multi-part answer to this:
a) there is already the edpd atom style in the DPD-MESO package that stores a per-particle temperature and then some.
b) you can always add custom per-atom properties using fix property/atom
c) the steps to add a new atom style are documented in the manual: 3.5. Atom styles — LAMMPS documentation
Because there is fix property/atom (which is used by several styles) and many existing atom styles, which can also be combined with a hybrid atom style, the barrier for getting code included into the LAMMPS distribution including a new atom style is higher than what it used to be.
Also, when the per-atom data is maintained by a fix, it is often sufficient to maintain that data within the fix only. Examples are the qeq fixes or the rigid/small fix variants but there are many more.
Update: I just remembered that it is not going to be possible to have plugins for atom styles, since they need changes to the Atom class and that cannot be overridden.