Bond/local angle/local energy compared with thermo ebond eangle

Hello everyone,

I have some questions related to the energy term of compute bond/local and angle/local.
I simulated a mixture of 4000H2O+1714CH4. I used compute bond/local angle/local for bond and angle energy for H2O and CH4 group. I also output system bond and angle energy with thermo ebond and eangle. The following is my commands,

variable        eb equal ebond
variable        ea equal eangle

compute         1 H2O bond/local dist engpot force
compute         2 H2O reduce ave c_1[*]
compute         3 H2O angle/local theta eng
compute         4 H2O reduce ave c_3[*]
compute         5 CH4 bond/local dist engpot force
compute         6 CH4 reduce ave c_5[*]
compute         7 CH4 angle/local theta eng
compute         8 CH4 reduce ave c_7[*]

fix             eb all ave/time ${Nevery} ${Nrepeat} ${Nfreq} v_eb ave window 5
fix             ea all ave/time ${Nevery} ${Nrepeat} ${Nfreq} v_ea ave window 5
fix             b_H2O H2O ave/time ${Nevery} ${Nrepeat} ${Nfreq} c_2[*] ave window 5 file b_H2O.txt title2 'TimeStep dist engpot force'
fix             a_H2O H2O ave/time ${Nevery} ${Nrepeat} ${Nfreq} c_4[*] ave window 5 file a_H2O.txt title2 'TimeStep theta eng'
fix             b_CH4 CH4 ave/time ${Nevery} ${Nrepeat} ${Nfreq} c_6[*] ave window 5 file b_CH4.txt title2 'TimeStep dist engpot force'
fix             a_CH4 CH4 ave/time ${Nevery} ${Nrepeat} ${Nfreq} c_8[*] ave window 5 file a_CH4.txt title2 'TimeStep theta eng'

This is my result. Data ended with_log is from thermo eb and ea . Others are from compute local.

eb_log ea_log b_H2O a_H2O b_CH4 a_CH4
10630.452 9082.6596 0.737721 0.718825 0.689715 0.603594

My calculations of bond energy are,
4000 * b_H2O + 1714 * b_CH4 should equal to 10630.452, but I got 4133.05551.
But if I do 4000 * b_H2O * 2 (2 bonds per H2O) + 1714 * b_CH4 * 4 (4 bonds per CH4), then I got 10630.45404, very close to 10630.452.
This happens the same for angles,
4000 * a_H2O + 1714 * a_CH4 should equal to 9082.6596, but I got 3909.860116.
If I do 4000 * a_H2O + 1714 * a_CH4 * 6 (6 angles per CH4), then I got 9082.660696, very close to 9082.6596.
How should I interpret the above calculations? Especially the energy term of compute /local.
Thanks in advance.

Since you are averaging over individual bonds and angles, you have to use the total number of bonds and angles to compute the total sum, not the number of molecules.

I see. Thank you!