Writing a new pair style

Dear all,

I’m trying to develop a special type of (attractive) potential for a coarse-grained system, in which we consider a site for some particles. The potential deals with the site-site interactions and adds up the potential/force to the particles’ total potential/force.

Now the problem with the this potential is that, when running it individually you can see the negative energies, but the particles get away from each other which is really odd. I have written other attractive and repulsive potentials that are working just fine but when I’m adding this one, the particles start to get away from each other. Any suggestions on what to check (or where to check in pair.cpp or force.cpp files)? Any help would be greatly appreciated!

Best,
H.A

1 Like

This is a very general description to start with, so there’s not enough information to make concrete suggestions.

I’d advise you to “prototype” your potential with either pair table or pair lepton so you can see whether (1) maybe your potential is correctly coded, but it really does have different dynamics from what you expect, or (2) you didn’t correctly code your potential.

1 Like

Thank you very much, really appreciate that!

And a quick thought – if you find the dynamics (and thus forces) are correct, you may have written wrongly the code for calculating and passing on the pair energy. But the biggest rule of software development is that bugs are very often not where you expect them to be.

Thank you very much, I tried following the doc for “writing new pair style” and it did help but this potential as I said is very specific and complex, the sites are kind of points locked to the particles and the potential is calculated based on the interaction between these sites (not particles) then the force is added to the force array of the corresponding particle, and also they move with the particle. Thank you very much again I’ll check that out!

H.A