Dear all,
I apologize if I didn’t give any detail, but I was frankly expecting a “YES”…
But probably I was wrong …
Here I provide all the details of my test, so that everything can be checked and looking for my possible error.
I am using lammps-1Feb14.
Attached you can find a folder with the test on Tersoff.
I am testing the forces on a simple and very symmetric system:
A simple cubic structure with lattice constant = 2.5 Angstrom.
I multiplied the cell with many atoms (512) to be sure that an atom was not interacting with its own images,
nor with the images of their own neighbors (to be 100% sure).
Sub-folder 01-* is the test on the forces:
- pair_tersoff.cpp = this is the original file where I simply added a print of the forces at lines 239 and 243-249 (with a loop equal to the one on ii in the same file)
- Test-cube.0.x4.y4.z4.data = is my cell data
- in.testcube.Ters = is my input file (maybe I should have inserted something else here? Did I make a mess?)
-
RUN-Lammps-pavilion-here.v01.sh = my script to run the calculation on my laptop
- out-DS.testcube.Ters = the output obtained by lammps
The lines starting with ^F-FINAL are the final forces as printed from the compute method in the format:
F-FINAL: i_atom = f[i_atom][0] f[i_atom][1] f[i_atom][2]
From here we see that a force of ~1.60 is registered for those atoms at the borders of the cells
(the ones that are interacting with some image atoms).
In this same file at line 1037-1038 the output of the zero-th step of the CG are printed:
Fmax = 4E-16.
This same results can be found in sub-folder 02-* (where I run the full CG) in the file
out-DS.testcube.Ters at lines 1037-1038 and 4114.
I admit that I might be doing something wrong, but I cannot really understand what …
Maybe I put the print of the forces in pair_tersoff.cpp in the wrong position ? But it is at the end of compute() just before the computation of the virial (that shouldn’t modify forces, or does it?)
Maybe the cell is wrong ?
Maybe I should have added another command in my input file to consider something that was necessary ?
But why this inconsistency between the forces that I print from compute() and the one revealed by CG ?
I apologize in advance if this is annoying: I am just trying to understand …
I made also some tests with a Morse-like potential (written by me) in order to delucidate better what compute() was doing.
In this other simple case I had a 8-atoms simple cubic cell with PBC just along z (subfolder 3).
In this case the cutoff was such that the only pair of atoms that were interacting were the one on the same edge of the cube.
The force of atom 0 (lower corner of the cube, number 1 in the data file)
should be zero due to the compensation of the interactions due to atom 4
(just above atom 0, number 3 in the data file)
and the replica of 4 below 0 (labelled atom 68 by LAMMPS).
The cycles in the compute() of the potential are made with the standard for sum_{i != j}:
inum = list->inum;
ilist = list->ilist;
for (int inow = 0; inow<inum ; inow++){
i_atom = ilist[inow]; // local index of the atom
num_neigh_i = numneigh[i_atom]; // number of neighbors of atom i_atom (NOT inow)
jlist = firstneigh[i_atom]; // list of neighbors
for (int jnow=0; jnow<num_neigh_i ; jnow++){
// here j_atom aumatically different from i_atom since it is the list of i_atom
j_atom = jlist[jnow]; // local index of the atom
j_atom &= NEIGHMASK; // needed (?)
---- here computation of the morse-like potential and of forces on i_atom and j_atom ----
}
}
It turns out that the final forces along z on atom 0 is NOT null.
The interactions registered in this case are:
0-4 (i.e. i_atom = 0 ; j_atom = 4) + 0-68 (68 is in the list of 0),
these 2 cancels.
BUT also
4-0
that is not cancelled by
68-0
since 68 is apparently not in the ilist (since it is a replica ?)
Should I modify the loops or put a condition in them in order to get the right results ?
If it is needed I can provide the file, but probably in order to understand focusing on Tersoff might be enough.
Thank you in advance for your help and my anticipated apologize if I messed up anything.
Best regards,
Daniele Scopece
Test-forces-Tersoff-x-mailing-list.tar.bz2 (21 KB)