Hello,all,
I got a question when i perform the per residue MMPBSA calculation, the sum of the per residue contribution donot match the whole since the sum of the solution PBEQ part not equal to the whole.

Input:
read RTF card unit 1 ...
read PARA card unit 1 ...
read psf card unit 1 ...
read coor card unit 1 ...

coor orie
coor copy comp
scalar charge store 1 ! Store charges for retrieval later

scalar wmain = radius

define ligand sele @ligand end
define target sele @target end

scalar wmain stat sele .not. type H* end
define check select (.not type H* ) .and. ( property wmain .eq. 0.0 ) show end
if ?nsel .ne. 0 stop !some heavy atom have a zero radius
scalar wmain store 2 ! Store radii for retrieval later

PBEQ
scalar charge set 0 sele all end !=========For whole complex=================
scalar charge recall 1 sele (ligand .or. target) end
SOLVE epsw 80.0 conc 0.15 ncel 162 dcel 0.45 epsp 4.0 intbp sele (ligand .or. target) end
set sol = ?enpb
SOLVE epsw 4.0 conc 0.0 ncel 162 dcel 0.45 epsp 4.0 intbp sele (ligand .or. target) end
set vac = ?enpb
calc gpbcomplex = @sol - @vac
scalar charge recall 1

scalar charge set 0 sele all end !======For ligand (no decompose)======
scalar charge recall 1 sele ligand end
SOLVE epsw 80.0 conc 0.15 ncel 162 dcel 0.45 epsp 4.0 intbp sele ligand end
set sol = ?enpb
SOLVE epsw 4.0 conc 0.0 ncel 162 dcel 0.45 epsp 4.0 intbp sele ligand end
set vac = ?enpb
calc gpbligand = @sol - @vac
scalar charge recall 1

scalar charge set 0 sele all end !======For whole target (with decompose)===
scalar charge recall 1 sele target end
SOLVE epsw 80.0 conc 0.15 ncel 162 dcel 0.45 epsp 4.0 intbp sele target end
set sol = ?enpb
SOLVE epsw 4.0 conc 0.0 ncel 162 dcel 0.45 epsp 4.0 intbp sele target end
set vac = ?enpb
calc gpbtarget = @sol - @vac
scalar charge recall 1

calc gpbwhole = @gpbcomplex - @gpbligand - @gpbtarget
end ! END Poisson-Bolztmann equation

open write unit 21 form name @outputname
write title unit 21
* @gpbwhole @gpbcomplex @gpbligand @gpbtarget
*

! Set up loop to calculate target residue contributions to ligand binding
calc count = 1

label res_loop
PBEQ
scalar charge set 0 sele all end !=========For residue complex=================
scalar charge recall 1 sele (ires @count .or. ligand) end
SOLVE epsw 80.0 conc 0.15 ncel 162 dcel 0.45 epsp 4.0 intbp sele (ires @count .or. ligand) end
set sol = ?enpb
SOLVE epsw 4.0 conc 0.0 ncel 162 dcel 0.45 epsp 4.0 intbp sele (ires @count .or. ligand) end
set vac = ?enpb
calc resgpbcomplex = @sol - @vac
scalar charge recall 1

scalar charge set 0 sele all end !======For residue target (with decompose)===
scalar charge recall 1 sele ires @count end
SOLVE epsw 80.0 conc 0.15 ncel 162 dcel 0.45 epsp 4.0 intbp sele ires @count end
set sol = ?enpb
SOLVE epsw 4.0 conc 0.0 ncel 162 dcel 0.45 epsp 4.0 intbp sele ires @count end
set vac = ?enpb
calc resgpbtarget = @sol - @vac
scalar charge recall 1

calc gpbres = @resgpbcomplex - @gpbligand - @resgpbtarget
end ! END Poisson-Bolztmann equation

write title unit 21
*@count @gpbres @resgpbcomplex @gpbligand @resgpbtarget
*

incr count by 1
if @count .lt. 193 goto res_loop


The output runs fine but just cannot be summed up right. i think should be some problems in the flags of PBEQ block or the selection for complex,ligand,and target pert. i can do per atom calculation in gbsw and the sum of per residue calculation exactly the same with the whole.i appreciate if anyone can share his/her experience.