#! /bin/bash # This script writes a Gromacs topology template from the final pdb file generated by MEMGEN # # http://memgen.uni-goettingen.de/ # # Please cite: # # Knight and Hub, MemGen: A general web server for the setup of lipid membrane simulation systems, submitted # if [ $# -ne 1 ]; then echo -e "\nUsage: finalpdb2GromacsTop.sh final.pdb\n" exit 1 fi pdb=$1 if [ ! -e "$pdb" ]; then echo "Error, file $pdb not found" exit 1 fi nSOL=$(grep REMARK "$pdb" | grep -w Water | tr -s ' ' | cut -d" " -f3) nNA=$(grep REMARK "$pdb" | grep -w "Na+" | tr -s ' ' | cut -d" " -f3) nCL=$(grep REMARK "$pdb" | grep -w "Cl-" | tr -s ' ' | cut -d" " -f3) grep REMARK "$pdb" | sed -n '/THIS PDB FILE CONTAINS/,$ p' | grep -v "REMARK$" | \ egrep -v 'Na\+|Cl-|Water' | sed 's/THIS PDB FILE CONTAINS://' > lipids.tmp lipids=() N=() while read x lipid n; do lipids+=$lipid N+=$n done < lipids.tmp nTypes=${#lipids[@]} echo Found $nTypes different lipids in $pdb. { cat < topol.top