[lammps-users] {Spam?} sw cross terms

Greetings all,

I am trying to use the sw potential with three different atoms, and having
trouble figuring out how the cross terms are used. In addition, I am using
a hybrid potential where the interactions type2-type2, type2-type3, and
type3-type3 are overwritten with a tabulated potential after I read in the
entire sw file. Here is what I am finding with the sw potential.

I have run five simulations in which I have changed only the sw lines that
define when all three atoms are different... atom1 atom2 atom3, for example.
I'll call these "ijk" lines. When I read the help file / documentation for
the sw potential, it seemed that these weren't going to play a role. I set
the sigma values to be zero on these ijk lines as a consequence. In these
four simulations I changed only the sigma value to correspond to 0
angstroms, 3, 5, 7, and 9. (case0, case3, case5, case7, case9)

Case0, case3, and case5 come out to have the exact same trajectorys. Case3
takes twice as long as case0, and case5 takes about 5 times as long as
case0. Both case7 and case9 show different trajectories (they are different
from each other too). The average energies are the same, radial
distribution functions are the same, but they take of course much longer

I must conclude that the lines do play role, but it seems to only play a big
role in how much time it takes to perform the calculations. I'm wondering
how these lines are used by lammps. Also it makes me wonder if the sw
potential does get calculated for these type2-type2, etc interactions, even
though they are replaced through the hybrid style. I'm including below the
input file, as well as three representative sw files.

I appreciate any input to help understand what's going on here! Thanks,


I'll let Aidan comment on the SW questions. I think he's
back in town mid next week. If there's still a problem with
pair_style hybrid after that's cleared up, then I'll take a look.



First of all, I suggest you stop running MD calculations until you are
confident that LAMMPS is giving you the potential you want. This is best
done by checking energies and forces for specific geometries.

Second of all, remember that LAMMPS does not do what you want, it does what
you say. Often these are the same thing by default, but in the case of SW
alloys, there are many ways to define interactions, and so we have made the
LAMMPS rules very general and somewhat complicated. Therefore, in order to
tell LAMMPS to do exactly what you want, you need to read the SW
documentation carefully.

Having said all that, it is true that the potential should not depend on the
value specified for sigma in ijk lines, but it will depend on epsilon in ijk
lines. Check if you are using the newest implementation of SW. The threebody
prototype should look like:

  void threebody(Param *, Param *, Param *, double, double, double *, double

Hi Aidan,

I've been looking more into the problem / question I posed a little while
back and have a specific question into how LAMMPS calculates a hybrid

As per your suggestion, I've been looking at specific geometries and making
sure that I am really asking LAMMPS to do what I think I am. I can
calculate correctly external to LAMMPS the potentials for the cases where I
am just using one pair_style (sw in particular). When I use a hybrid
command, however, I get disparate results.

I have three atoms, one of type A, and two of type B (B1 & B2). Using the
following commands, I initialize the simulation and subsequently have LAMMPS
calculate the total energy:

pair_style hybrid sw table linear 901
pair_coeff * * sw sw.sw A B
pair_coeff 2 2 table my.table BtoB 10.0

My calculations are not coming out to be the same as what LAMMPS gives me.
I don't know specifically how the three body terms are being handled.
Normally when I'd be calculating the energy with the sw potential, I'd have
three 2-body terms (A-B1, A-B2, B1-B2) and three 3-body terms (A-B1-B2,
B1-A-B2, B2-A-B1) in the summations. But when I replace the B-B interaction
with the table, do I still have those 3-body terms? Or just one of them?

I keep the atoms spaced 3 angstroms apart. The table I'm using has an
energy vale of about 14 kcal/mol at 3 angstroms. LAMMPS tells me I have a
total energy of around 15 kcal/mol, where I calculate it around 10 (the sw
energy between A-B1 and A-B2 adds up to around -5 kcal/mol). So perhaps I'm
not telling the hybrid what to do correctly... Any suggestions would help.

Robert DeMille


I am glad to hear you got the SW style to do what you want. I don't know how
the hybrid command works, so I can not help with this.


If what you are trying to do is substitute a portion of the SW potential
for B-B pairwise interactions with your own tabulated interaction, you can't
do that with pair hybrid.

What pair hybrid is designed for is to allow you to have multiple atom
types interacting with different potentials. Say you have A,B,C types and
want A,B to interact via SW. Then A-A and B-B and A-B will be computed
by SW. But you could have A-C and B-C and C-C computed by some other

The way to do what want might be to derive a new SW potential, call it SW/custom
that does not compute the B-B term. They you could use pair hybrid/overlay
to define a tabulated potential that computes B-B. I think that's the
only way to get SW to not compute its own B-B if its already computing A-A and