[lammps-users] problem understanding pair_sw.cpp

Hi
  I am studying the code for the pair_sw.cpp, to make some modifications on it, but I don't understand this paragraph,

 if \(itag > jtag\) \{  // First condition
    if \(\(itag\+jtag\) % 2 == 0\) continue;
  \} 
  else if \(itag < jtag\) \{    // Second condition
    if \(\(itag\+jtag\) % 2 == 1\) continue;
  \} 
  else \{   // Last condition
    if \(x\[j\]\[2\] < ztmp\) continue;
    if \(x\[j\]\[2\] == ztmp && x\[j\]\[1\] < ytmp\) continue;
    if \(x\[j\]\[2\] == ztmp && x\[j\]\[1\] == ytmp && x\[j\]\[0\] < xtmp\) continue;
  \}

I can see that this code filters the neighbouring atoms. The last condition selects those atoms above the actual, but I don't understand the
purpose of the first and second conditions. Can anybody explain me the purpose of the first and second conditions?

Thanks a lot.

Hi
I am studying the code for the pair_sw.cpp, to make some modifications on it, but I don't understand this paragraph,

have you checked the comment a few lines above?
the whole construct makes sure that each pair i,j is
treated only once in the two-body interaction loop.

unlike in the "regular" pair styles, the sw pair style
requests a full neighbor list that has all i,j and j,i
pairs listed. if you leave this block out, you have
to divide all energies and forces computed in this
loop by 2 and wait a bit longer for the result.

cheers,
    axel.