Dear LAMMPS users,
I was wondering if there was a way to implement a global variable in
lammps that can be used by different fixes in the simulation. For
instance, some calculated parameter in the form of an array that is
calculated by one fix and used by another.
global variables are almost always a very bad idea (no
consistent state and no concurrent access, especially in
a solution for your problem would probably be designing a class
that has a defined API to store and access the properties you're
interested in and have the different classes/fixes that need it
store a reference/pointer to it and then communicate via the
defined API. this will also allow a clean implementation of the
parallelization/distribution of the information across the nodes.
but then again, since LAMMPS is GPL you can implement it in any
way you like, but if you want to get your code integrated into
the distribution, you'd have to follow whatever steve prefers.