[gmx-users] problem with g_density -center

chris.neale at utoronto.ca chris.neale at utoronto.ca
Sun Aug 21 01:30:32 CEST 2011

g_density is not compatible with constant pressure simulations. You  
must modify it to construct the bins outward from the bilayer center  
when doing NPT:


Further, trjconv -center is misleading. I actually lost a lot of time  
thinking that trjconv -center would center the COM when it actually  
centers the value of (max-min)/2:


The short of it is that there are no out-of-the-box tools to construct  
the density profile along the normal to a bilayer when the z-dimension  
can fluctuate.

You can probably use the trjconv -center (COM) patch after resetting  
the box in the following scheme. I used this to create input for  
g_spatial, but I suspect that the distribution version of g_density  
would also work fine on these files. Note that the only non-standard  
thing about this processing is that I applied the trjconv patch to  
which I referred above. The idea is to make the box larger than it was  
in any of the frames but of a constant size and then center everything  
taking careful control of pbc.

echo "KSC_DOPC" | trjconv -f bothsides_center_adjusted_*.xtc -o  
/dev/shm/tmp.xtc -n cn.ndx

echo "NE_CZ_NH1_NH2_CB_CG_CD System" |  
-center -pbc mol -f /dev/shm/tmp.xtc -o /dev/shm/tmp2.xtc -s  
../../useful/dry.tpr -n cn.ndx
mv /dev/shm/tmp.xtc TEMPORARY_FILES

echo "DOPC System" |  
-center -pbc atom -f /dev/shm/tmp2.xtc -o /dev/shm/tmp3.xtc -s  
../../useful/dry.tpr -n cn.ndx
mv /dev/shm/tmp2.xtc TEMPORARY_FILES

## now make a new .tpr file in which the solute is at the center of the box
#first output a single frame
echo "NE_CZ_NH1_NH2_CB_CG_CD System" |  
-f /dev/shm/tmp3.xtc -dump 125000 -o /dev/shm/tmpgro.gro -s  
../../useful/dry.tpr -center -pbc mol -n cn.ndx
#make a new .tpr file
touch empty.mdp
/project/pomes/cneale/GPC/fromScratch/ARG/MANY_RUNS/TEMPLATE/FILES/complete_dry.top -c /dev/shm/tmpgro.gro -f empty.mdp -o centered.tpr -maxwarn  

echo "NE_CZ_NH1_NH2_CB_CG_CD System" |  
-fit transxy -pbc atom -f /dev/shm/tmp3.xtc -o /dev/shm/tmp4.xtc -s  
centered.tpr -n cn.ndx
mv /dev/shm/tmp3.xtc TEMPORARY_FILES

echo "System" |  
-box 6 6 14 -f /dev/shm/tmp4.xtc -o /dev/shm/tmp5.xtc -s centered.tpr  
-n cn.ndx
mv /dev/shm/tmp4.xtc TEMPORARY_FILES

echo "DOPC System" |  
-center -pbc none -f /dev/shm/tmp5.xtc -o /dev/shm/tmp6.xtc -s  
centered.tpr -n cn.ndx
mv /dev/shm/tmp5.xtc TEMPORARY_FILES

echo "NE_CZ_NH1_NH2_CB_CG_CD System" |  
-fit transxy -pbc none -f /dev/shm/tmp6.xtc -o /dev/shm/tmp7.xtc -s  
centered.tpr -n cn.ndx
mv /dev/shm/tmp6.xtc TEMPORARY_FILES

# Now center the solute at 0 0 0
echo "NE_CZ_NH1_NH2_CB_CG_CD" |  
-f /dev/shm/tmp7.xtc -ox -s ../../useful/dry.tpr -n cn.ndx -com
avg=($(cat coord.xvg|grep -v '[@|#]' | awk '{x+=$2;y+=$3;z+=$4;n++}  
END{print -1*x/n,-1*y/n}'))
-f /dev/shm/tmp7.xtc -o /dev/shm/tmp8.xtc -trans ${avg[0]} ${avg[1]} 0
mv /dev/shm/tmp7.xtc TEMPORARY_FILES


-- original message --

> Hi,
>   I am trying to calculate the density profile of  head group of  
> bilayer normal to z direction using gromacs 4.0.7. I was trying to  
> center the density profile about dx/2.dy/2,0 . But, I am finding  
> problem with using center option. I find using -center option does  
> not shift the bilayer to 0. The following was my command-lines:
> g_density_4mpi -f ../traj_npt -s ../topol -noxvgr -n ../index -b  
> 600000 -dens number -center -o density_phosphate_symm.xvg
> Any help on how to use the center option will be really helpful.

For this purpose, trjconv is more reliable.



Justin A. Lemkul
Ph.D. Candidate
ICTAS Doctoral Scholar
Department of Biochemistry
Virginia Tech
Blacksburg, VA
jalemkul[at]vt.edu | (540) 231-9080

More information about the gromacs.org_gmx-users mailing list