Thanks for your answer.
However, I'm still a bit confused. I read the thread you indicated and I think my problem is slightly different from the problems described there (correct me if I'm wrong).
Cesar (cmp_fc2) didn't include cross-term (sidechain vs backbone) and this was the reason for discrepancy.
You found a small difference for coulomb term due to roundoff errors.
I think my problem is still a bit different (I'm interested in nonbonding terms only).
In my first calculation (inte sele segid prot .and. ires 2 end sele segid prot end) I have 8 atoms in the first selection and 1953 (the whole protein including res2) in the second selection.
In my second calculation I always have 8 atoms in the first selection and a variable number of atoms in the second selection (depending on the residue chosen). But a number of atoms in the second selection sums up to 1953 if I loop the second calculation over all residues (inluding res2).
Inte works by calculating pairwise calculations between all atoms in one selection against all atoms in the second selection and summing them up(is this right?). It should not matter if charmm does the summation (as in my 1st calculation), or if I do it myself (as in 2nd calculation). I'm using groups, but it shouldn't be a problems, because groups are always fully included in a residue, so in the 2nd calculation I don't cut through groups.
The difference between calculation one and two is bigger than roundff errors. For example for res3:
elec vdw eef1
1. calc: -20.25003 -15.36342 16.50047 3
2. calc: -31.2878 -17.2872 19.7074 inte3.out
So what is the reason for this difference?
Thank you for your time