I am writing a custom pair potential, where I first need to read the
energy of every particle before the custom pair potential is applied, and
then apply the custom pair potential to certain particles based on their
I am guessing that I need to use the "pair->vdW" command.
Can anybody suggest a definite strategy in terms of writing necessary
not based on such insufficient and vague information provided. in fact,
your e-mail can serve as an example for how *not* to ask questions.
- you say you are writing a custom pair potential, but you are not saying
what its purpose is, what its underlying physics is, whether it is top be
used in combination with another (pairwise?) potential and so on.
- you ask about very unspecific things, e.g., "energy". there is a
gazillion kinds of energies. in MD specifically we differentiate between
kinetic and potential energy and the potential energy by the parts of the
model. do you need the "energy" at previous or the same time step?
- you "guess" what you should be doing (and are guessing something without
a reference to any part of the source code). not to mention, that it cannot
be a "command"
- you talk about "certain particles based on their energy readings",
which is a vague as it gets.
yet at the end, you ask about receiving specific help and a definite
strategy. how can anybody can provide "definite" help without having *any*
kind of useful information? the only "definite" strategy that can be
provided has to be as vague as your inquiry:
- make sure you have sufficient C++ programming (and reading other people's
- read the part of the LAMMPS manual concerning modifying and extending
- read the LAMMPS developer's guide
- with the information of the developer's guide in mind, study relevant
parts of the LAMMPS source code
- keep in mind, that per-atom energies either need to be computed (kinetic
energy) or explicitly requested to be tallied during force computation
- keep in mind, that forces/energies are computed in "stages" and you
cannot easily go back to a previous stage unless you are playing tricks,
e.g. hook a pairwise computation into fix to be run at a later stage. but
also keep in mind, that adding to forces *after* the second part of the
velocity verlet integration is ignored.