Perhaps, I found a bug about compute property/atom nbonds keywords

Hello Lammps community:
When using stable lammps version (30 Oct 2014),i found that the compute property/atom nbonds keywords can’t compute the correct connected bond number of an atom.
The example is the “CH3OH” dreiding file in the standard example folder.
I added some test command to dump all the atom type and its connected bond number.

     #################for test##############
     compute 1 all property/atom type nbonds
     dump 4a all custom 1 dump.test1.* c_1[1] c_1[2]
     run 0
     variable new_O atom "c_1[1]==4&&c_1[2]==2"
     group newbond_O variable new_O
     variable newO_nu equal count(newbond_O)
     print "************${newO_nu} O atom have been founded!"

The dump file is as follow

ITEM: TIMESTEP
0
ITEM: NUMBER OF ATOMS
384
ITEM: BOX BOUNDS pp pp pp
0 19.9969
0 19.1282
0 19.4697
ITEM: ATOMS c_1[1] c_1[2]
3 4
1 0
3 4
4 1 # atom “O” which the correct nbonds is 2
1 0 # atom “H” which the nbonds should be 1!
1 0
1 0
2 0
1 0

The atom “C” (type 3)has the correct nbonds of 4, but “O”,”H” both get a wrong number!
The data file and in file are attached!
Thanks!

Kang Jingtian

data.dreiding (75.6 KB)

dump.test1.0 (2 KB)

in.dreiding (2.25 KB)

If you have newton bond on (which is the default)
than an I-J bond is only stored with either I or J.
So I’m guessing the total # of bonds you are tallying
will be 1/2 what you expect. The compute property/atom
doc page should be more clear about this.

Steve

hello,steve
would you please explain more clearly why atom C get the “full” bond num 4 rather than half of it,and why H got zero.
where to alter the default newton bond?
i just aim at getting the bond num of a certain atom on topology ,is the nbonds suitable for the task?if not, how to achieve these goals ?
thanks
kang jingtian

Steve meant “the TOTAL # of bonds you are tallying will be 1/2 what you expect.”, not each of the atoms has half of the number of bonds. This is due to the default setting of “newton on” so that information of I-J pair is only stored on either I or J, not on both I and J.

To change this, use “newton off”. See http://lammps.sandia.gov/doc/newton.html for more info.

Ray

Many thanks to both ray and steve. Altering the newton command really settled my problem.

Now compute property/atom nbonds can give what i want! :slight_smile:

Kang Jingtian