# [gmx-users] pair correlation function pbc=0?

Nguyen Hoang Phuong phuong at theochem.uni-frankfurt.de
Tue Jun 18 09:05:14 CEST 2002

```

On Mon, 17 Jun 2002, Mehmet Suezen wrote:

> Dear Gromacs Community,
>
> Does anybody have an idea that What is the main difference for
> the RDF algoritm  with and without pbc in gromacs/general? Normalization
> ?
>
> cheers,
>
> Mehmet
> _______________________________________________

Dear Mehmet,

In general, the difference in the algorithms is in the calculation of the
distance between two atoms before sorting into the histograms. The
following are the codes to compute the distance (considering the cubic
box):

1) with PBC:
------------
for(ii=1;ii<N-1;ii++){
for(jj=ii+1;jj<N;jj++){

distx = (xbox[ii] - xbox[jj]) ;
if (fabs(distx) > system_size_x/2.0) {
if (distx < 0) dx = distx + system_size_x ;
else dx = distx - system_size_x ;
} else dx = distx ;

disty = (ybox[ii] - ybox[jj]) ;
if (fabs(disty) > system_size_y/2.0) {
if (disty < 0) dy = disty + system_size_y ;
else dy = disty - system_size_y ;
} else dy = disty ;

distz = (zbox[ii] - zbox[jj]) ;
if (fabs(distz) > system_size_z/2.0) {
if (distz < 0) dz = distz + system_size_z ;
else dz = distz - system_size_z ;
} else dz = distz ;

dist = sqrt(dx*dx+dy*dy+dz*dz) ;

2) without PBC:
--------------
for(ii=1;ii<N-1;ii++){
for(jj=ii+1;jj<N;jj++){

distx = (xbox[ii] - xbox[jj]) ;

disty = (ybox[ii] - ybox[jj]) ;

distz = (zbox[ii] - zbox[jj]) ;

dist = sqrt(dx*dx+dy*dy+dz*dz) ;