3 body energy problem as found in pair_e3b.cpp - newbie data structures question

I’m very new to lammps and have jumped into the middle.

It would help us to get started understanding the lammps code if someone could tell us what is in the following data structures:

tag
sumExp
exps
pairO
pairH

as found for example in the following starting at line 253 of pair_e3b.cpp

partB = eb *
(sumExp[tag[pairO[ii][otherO]] - 1] + sumExp[tag[pairH[ii][otherO][0]] - 1] +
sumExp[tag[pairH[ii][otherO][1]] - 1] - 2 * (exps[ii][otherO][0] + exps[ii][otherO][1]));

Also are we correct to assume that partA, partB, and partC in the code correspond to the three energy parts of equation 6 from “Water Simulation Model with Explicit Three-Molecule Interactions”, J. Phys. Chem. B 2008, 112, 8311-8318.

Almost never a good idea. It helps to start slowly and gradually build knowledge and experience.
A good starting point, for example, would be to review some well known (pairwise) interactions first.

I can only talk about “tag”. Which is effectively an alias for atom->tag due to the line:

tagint *tag = atom->tag;

Atom::tag stores the “atom-ID” for this and other per-atom properties see src/atom.h.

The remainder should become evident from properly studying the source code.

Again, this should be evident from the source code. If not, you would have to contact the author who contributed this pair style to LAMMPS. The name and contact should be in the source code.

Could you maybe point me to a good place in the code to start?

As I already wrote, check out some pair styles where you know the potential functions well.
There also is a lot of useful information in the Programmer’s guide section of the manual.

How much C++ experience do you have? I am asking because if you are reasonably proficient at C++, the LAMMPS code should be well-documented enough for you to find your way around. On the other hand, if you’re not that familiar with C++, you should brush up on that or you will be stuck reading the LAMMPS code.

In particular, the sumExp, exps, pairO and pairH lists are populated in the preceding loop starting at pair_e3b.cpp:169. Because I haven’t read the papers listed in the source code, I do not know what the corresponding calculations are – but the loop body looks well-written enough for you to work out what’s happening (it’s even commented nicely!).

If you are unsure about the atom indexing, read the Programmer’s Guide first. Also you should be able to examine the code and deduce (from pair.h from which pair_e3b.h is derived) that list is a pointer to an object of class NeighList, and thus neigh_list.h will tell you what all of its members are, such as list->inum and list->ilist.

All the best!

Those a great pointers, thanks. I am quite proficient in C++.
Thanks