-
Notifications
You must be signed in to change notification settings - Fork 14
/
order_parameters_calculatePOPS.sh
56 lines (46 loc) · 1.74 KB
/
order_parameters_calculatePOPS.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash
# bash wrapper for calculating Order Parameters of lipid bilayer
# meant for use with NMRlipids projects
scriptdir='/home/samuli/work/NMRlipids/MATCH/scratch/scriptsBYmelcr'
traj_file_name="run.trr" #"../traj.trr"
traj_pbc_nonwat_file_name="run_nonwat_pbc.xtc" #"../traj.trr"
top_file_name="last_frame_nonwat.gro"
tpr_file_name="run.tpr"
#op_def_file="../../Headgroup_Glycerol_OPs.def"
op_def_file="Headgroup_Glycerol_Order_Parameters_SimulationPOPS.def"
op_out_file="OrdParsPOPS.dat"
top="topol.top"
lipid="POPS"
f_conc=55430 # in mM/L
if ! [ -s $tpr_file_name ]
then
echo "We really need " $tpr_file_name " , but we can't find it!"
exit 1
fi
# remove PBC:
! [ -s $traj_pbc_nonwat_file_name ] && echo $lipid | gmx trjconv -f $traj_file_name -s $tpr_file_name -o $traj_pbc_nonwat_file_name -pbc mol
# get a non-water gro-file (topology)
if ! [ -s $top_file_name ]
then
if [ -s run.cpt ]
then
echo $lipid | gmx trjconv -f run.cpt -s $tpr_file_name -o $top_file_name -pbc mol
else
echo "Couldn't find state.cpt"
exit 1
fi
fi
#CALCULATE ORDER PARAMETERS
python $scriptdir/calcOrderParameters.py -i $op_def_file -t $top_file_name -x $traj_pbc_nonwat_file_name -o $op_out_file && rm $traj_pbc_nonwat_file_name
#getting concentration from topol.top file (if exists)
if [ -f $top ]
then
nwat=`grep -e "molecules" -A 10 $top | grep -e "^SOL" -e "^TIP" | cut -d " " -f1 --complement `
nion=`grep -e "molecules" -A 10 $top | grep -e "^NA" -e "^CA" | cut -d " " -f1 --complement `
[ -z $nion ] && nion=0
conc=`echo $f_conc "*" $nion / $nwat | bc`
echo conc: $conc
sed "s/conc/$conc/" -i ${op_out_file}.line
else
echo "Topology probably not present, can't calculate concentration."
fi