[gmx-users] Removing water

Negar Parvizi negar.parvizi at yahoo.com
Sun May 6 21:13:13 CEST 2018


Dear all users,
I am using tutorial Kalp15 in DPPC from Justin's tutorials.I want to remove waters which are between bilayers so I use this script:
http://www.gromacs.org/Documentation/How-tos/Membrane_Simulations


#!/bin/bash
# give x.gro as first command line arguement
upperz=6.417
lowerz=0.820
sol=SOL
count=0
cat $1 | grep "$sol" | while read line; do
  for first in $line; do
    break
  done
  if [ "$count" = 3 ]; then
    count=0
  fi
  count=$(expr $count + 1)
  if [ "$count" != 1 ]; then
    continue
  fi
  l=${#line}
  m=$(expr $l - 24)  // would use -48 if velocities are also in .gro and -24 otherwise
  i=1
  for word in ${line:$m}; do
    if [ "$i" = 1 ]; then
      popex=$word
    else
      if [ "$i" = 2 ]; then
        popey=$word
      else
        if [ "$i" = 3 ]; then
          popez=$word
          break
        fi
      fi
    fi
    i=$(expr $i + 1)
  done
  nolx=`echo "$popez > $upperz" | bc`
  nohx=`echo "$popez < $lowerz" | bc`
  myno=$(expr $nolx + $nohx)
  if [ "$myno" != 0 ]; then
    z=${#first}
    if [ "$z" != 8 ]; then
      sfirst="[[:space:]]$first"
    else
      sfirst=$first
    fi
    `echo grep $sfirst $1`
  fi
done

the original file has 2626 molecule of water but after ruuning this command, just the file has 24 molecules of water  :
./keepbyz.sh new_waters.gro > keep_these_waters.gro
Here is my question:why is this command deletes 2602 molecules of water while 2626 molecules all are in box?and how can I understand that this command runs correctly?
Thanks in advanced,Negar


More information about the gromacs.org_gmx-users mailing list