Writing/modifying compute for a custom order function

Good morning/whatever time it may be for you all

I’m working with a LAMMPS script that creates alternating solid/liquid regions, and am trying to plot the variation of the interfaces using a custom order function.

Is it possible to modify compute centro/atom (or a different /atom compute) so that it calculates an output value phi given by the formula

phi = 1/12 * (sum over nearest 12 neighbours):(|position of neighbour - idealised position of neighbour in fcc lattice|^2)

For atoms in an fcc lattice this would give phi = 0, and phi > 0 for atoms deviating from their ideal position.

If anyone’s able to help I’d be very grateful for your time, and if you need clarifications on any details please ask

I appreciate that this is badly formatted and apologise: if someone could correct me then feel free to as well

That is mostly a question of how skilled are you in C++ programming and reading / understanding other people’s code. Short of doing the implementation on your behalf, there is very little that can be done beyond asking you to study existing compute implementation that utilize a neighbor list.

The forum uses a particular kind of markup that also supports embedded LaTeX constructs, so something like:

$\frac{1}{2}$

will render as: \frac{1}{2} an so on.

Why not check if compute centro/atom can successfully distinguish solid and liquid regions, before going to all the trouble of programming something new?

See also the Common Neighborhood Parameter, compute cnp/atom, which serves a similar purpose.