-
Notifications
You must be signed in to change notification settings - Fork 0
/
gmxpbsa0.sh
1521 lines (1222 loc) · 59.3 KB
/
gmxpbsa0.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/bin/bash
# GMXPBSA tool is free software. You can redistribute it and/or modify it under the GNU Lessere General Public Lincese as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version (http://www.gnu.org/licenses/lgpl-2.1.html).
# GMXPBSA is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
# For any problem, doubt, comment or suggestion please contact me at [email protected] or [email protected]
# Copyright 2013 Dimitrios Spiliotopoulos, Cristina Paissoni
#export LC_NUMERIC="en_US.UTF-8"
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source $DIR/function_base.dat
source $DIR/function_gmx.dat
source $DIR/function_apbs.dat
source $DIR/print_files.dat
#@@@@@@@@@@@@@@@@@@@#
# (0) Print version #
#@@@@@@@@@@@@@@@@@@@#
if ! [ $# -eq 0 ];then
if [ $1 == "-h" ]; then
clear
echo -e "\n\nGMXPBSA version 2.1.2_dev\n\n"
exit
fi
fi
#@@@@@@@@@@@@@@@@@@#
# (1) Let's start #
#@@@@@@@@@@@@@@@@@@#
clear
if [ -f REPORTFILE0 ] ; then rm REPORTFILE0; fi
if [ -f WARNINGS_gmxpbsa0.dat ] ; then rm WARNINGS_gmxpbsa0.dat; fi
touch REPORTFILE0
check INPUT.dat REPORTFILE0
rm -f \#* *~
#@@@@@@@@@@@@@@@#
# (2) Variables #
#@@@@@@@@@@@@@@@#
set_variable_default "run" "1";
set_variable "root";
set_variable_default "multitrj" "n";
if [ $multitrj == "y" ]; then
set_variable_multiple "root_multitrj";
N_start_dir=`echo $root_multitrj | awk '{N=split($0,v," "); print N}'`
for ((i=0; i<$N_start_dir; i++)); do
start_dir[$i]=`echo $root_multitrj | awk -v i=$(($i+1)) '{N=split($0,v," "); print v[i]}'`
check_DIR ${start_dir[$i]}
done
else
check_DIR $root
fi
# MD variables
set_variable_default "protein_alone" "n";
set_variable_default "name_xtc" "npt";
set_variable_default "name_tpr" "npt";
set_variable "complex";
if [ $protein_alone == "n" ]; then
set_variable "receptor";
set_variable "ligand";
fi
set_variable_default "skip" "1";
set_variable_default "min" "n";
set_variable_default "use_topology" "n";
#set_variable_default "NO_topol_ff" "n";
NO_topol_ff="n"
if [ $NO_topol_ff == "y" ]; then
cas=$(echo n); ffield="n"; use_nonstd_ff="n"; use_topology="n";
echo -e "\nYou are not providing neither forcefield nor topology to GMXPBSA.\nWith this option you can not perform alanine scanning." | tee -a REPORTFILE0
if [ $min == "y" ]; then echo -e "WARNING! With this option you can not perform energy minimization. Setting \"min\" to \"n\".\n" | tee -a REPORTFILE0; fi
min="n";
else
if [ $use_topology == "y" ]; then
if [ $protein_alone == "n" ]; then
read_topology "itp_receptor";
set_variable "itp_ligand";
set_variable_default "water_mol" "0";
else
read_topology2 "itp_protein" "itp_protein_check";
fi
cas=$(echo n); ffield="n"; use_nonstd_ff="n"; Ltopology_Pff="n";
echo -e "\nYou are using the option \"use_topology\".\n" | tee -a REPORTFILE0
else
set_variable_default "Ltopology_Pff" "n";
if [ $Ltopology_Pff == "y" ]; then
set_variable_default "use_nonstd_ff" "n";
if [ $use_nonstd_ff == "n" ]; then
set_variable "ffield";
echo -e "\nYou are using the option \"Ltopology_Pff\", using custom topology (itp file) for the ligand and a std forcefield for the protein.\n" | tee -a REPORTFILE0
else
ffield="1";
echo -e "\nYou are using the option \"Ltopology_Pff\", using custom topology (itp file) for the ligand and a non-std forcefield for the protein.\n" | tee -a REPORTFILE0
fi
set_variable "itp_ligand";
set_variable_multiple_default "Histidine" "";
else
set_variable_default "use_nonstd_ff" "n";
if [ $use_nonstd_ff == "n" ]; then
set_variable "ffield";
echo -e "\nYou are using a standard forcefield.\n" | tee -a REPORTFILE0
else
ffield="1";
echo -e "\nYou are using the option \"use_nonstd_ff\".\n" | tee -a REPORTFILE0
fi
fi
set_variable_default "cas" "n";
fi
fi
set_variable_default "multichain" "n";
#multichain=n
# Gromacs variables
# double precision?
#set_variable_default "double_p" "n";
set_variable_default2 "gmx_suffix" "";
set_variable_default2 "gmx_prefix" "";
set_variable_default "read_vdw_radii" "n";
#################################
#if [ $double_p == "y" ]
#then
pdb2gmx=${gmx_prefix}pdb2gmx${gmx_suffix}; trjconv=${gmx_prefix}trjconv${gmx_suffix}; mdrun=${gmx_prefix}mdrun${gmx_suffix}; grompp=${gmx_prefix}grompp${gmx_suffix}; editconf=${gmx_prefix}editconf${gmx_suffix}; tpbconv=${gmx_prefix}tpbconv${gmx_suffix}; gmx=${gmx_prefix}gmx${gmx_suffix}
#else
# pdb2gmx=pdb2gmx; trjconv=trjconv; mdrun=mdrun; grompp=grompp; editconf=editconf; tpbconv=tpbconv;
#fi
# pdb2gmx trjconv mdrun grompp editconf tpbconv
############################################
# what is Gromacs path? (Gpath)
nf=$(which $editconf 2>/dev/null | awk -F / '{print NF-1 }')
if [ $nf ]; then
gmx_path=$(which $editconf | cut -d / -f -$nf);
else
nf=$(which $gmx 2>/dev/null | awk -F / '{print NF-1 }')
if [ $nf ]; then
gmx_path=$(which $editconf | cut -d / -f -$nf);
fi
fi
set_variable_default "Gpath" "$gmx_path";
# is Gromacs installed?
if [ -z $Gpath ]; then
echo -e "\n"$(date +%H:%M:%S)" \n ERROR: I could not find Gromacs Path. Exiting... \n" >> REPORTFILE0
echo "Exiting -- please read the REPORTFILE0"
exit
else
control0=`find $Gpath -maxdepth 1 -name $gmx 2>/dev/null | rev| cut -d / -f 1`
if [ -z $control0 ]; then
control1=`find $Gpath -maxdepth 1 -name $editconf 2>/dev/null | rev| cut -d / -f 1`
if [ -z $control1 ]; then
echo "The variable Gpath is not set correctly. Please double-check it. Exiting..."; exit;
else
control1=`find $Gpath -maxdepth 1 -name $editconf 2>/dev/null | rev| cut -d / -f 1 | rev | awk '{if ($1~"editconf") {print "ok"} else {print "no"} }'`
if [ $control1 == "no" ]; then
echo "The variable Gpath is not set correctly. Please double-check it. Exiting..."; exit;
else
Gversion="4";
fi
fi
else
control0=`find $Gpath -maxdepth 1 -name $gmx 2>/dev/null | rev| cut -d / -f 1 | rev | awk '{if ($1~"gmx") {print "ok"} else {print "no"} }'`
if [ $control0 == "no" ]; then
echo "The variable Gpath is not set correctly. Please double-check it. Exiting..."; exit;
else
Gversion="5";
fi
fi
fi
# what Gromacs version is installed? (GVersion)
if [ $Gversion -eq 4 ]; then
$Gpath\/$editconf -h 2> out 1> /dev/null
GVersion=$(grep VERSION out | awk '{print $3}' | sort -u)
else
$Gpath\/$gmx -h 2> out 1> /dev/null
GVersion=$(grep VERSION out | awk '{print $NF}'| sort -u)
pdb2gmx="${gmx} pdb2gmx"; trjconv="${gmx} trjconv"; mdrun="${gmx} mdrun"; grompp="${gmx} grompp"; editconf="${gmx} editconf"; tpbconv="${gmx} convert-tpr";
fi
echo -e "\nUsing GROMACS version $GVersion"
rm -f out
# APBS Variables
set_variable_default "coulomb" "gmx";
if [ $coulomb == "coul" ]; then
nf=$(which coulomb 2>/dev/null | awk -F / '{print NF-1 }')
if [ $nf ]; then coul_path=$(which coulomb| cut -d / -f -$nf); fi
set_variable_default "Cpath" "$coul_path";
if [ -z $Cpath ]; then
echo -e "\n"$(date +%H:%M:%S)" \n ERROR: I could not find coulomb Path. Exiting... \n" >> REPORTFILE0
echo "Exiting -- please read the REPORTFILE0"
exit
else
control=`find $Cpath -maxdepth 1 -name coulomb 2>/dev/null | rev| cut -d / -f 1`
if [ -z $control ]; then
echo "The variable Cpath is not set correctly. Please double-check it. Exiting..."; exit;
else
control=`find $Cpath -maxdepth 1 -name coulomb 2>/dev/null | rev| cut -d / -f 1 | rev | awk '{if ($1=="coulomb") {print "ok"} else {print "no"} }'`
if [ $control == "no" ]; then echo "The variable Cpath is not set correctly. Please double-check it. Exiting..."; exit; fi
fi
fi
fi
nf=$(which apbs 2>/dev/null | awk -F / '{print NF-1 }')
if [ $nf ]; then apbs_path=$(which apbs| cut -d / -f -$nf); fi
set_variable_default "Apath" "$apbs_path";
if [ -z $Apath ]; then
echo -e "\n"$(date +%H:%M:%S)" \n ERROR: I could not find apbs Path. Exiting... \n" >> REPORTFILE0
echo "Exiting -- please read the REPORTFILE0"
exit
else
control=`find $Apath -maxdepth 1 -name apbs 2>/dev/null | rev| cut -d / -f 1`
if [ -z $control ]; then
echo "The variable Apath is not set correctly. Please double-check it. Exiting..."; exit;
else
control=`find $Apath -maxdepth 1 -name apbs 2>/dev/null | rev| cut -d / -f 1 | rev | awk '{if ($1=="apbs") {print "ok"} else {print "no"} }'`
if [ $control == "no" ]; then echo "The variable Apath is not set correctly. Please double-check it. Exiting..."; exit; fi
fi
fi
echo -e "\nSetting the APBS variables\n"
set_variable_default "precF" "0";
set_variable_default "extraspace" "5";
set_variable_default "coarsefactor" "1.7";
set_variable_default "grid_spacing" "0.5";
set_variable_default "linearized" "y";
set_variable_default "temp" "293";
set_variable_default "bcfl" "mdh";
set_variable_default "pdie" "2";
set_variable_default "sdie" "80";
set_variable_default "chgm" "spl2";
set_variable_default "srfm" "smol";
set_variable_default "srad" "1.4";
set_variable_default "swin" "0.3";
set_variable_default "sdens" "10.0";
set_variable_default "calcforce" "no";
set_variable_default "ion_ch_pos" "1";
set_variable_default "ion_rad_pos" "2.000";
set_variable_default "ion_conc_pos" "0.1500";
set_variable_default "ion_ch_neg" "-1";
set_variable_default "ion_rad_neg" "2.000";
set_variable_default "ion_conc_neg" "0.1500";
set_variable_default "Hsrfm" "sacc";
set_variable_default "Hpress" "0.000";
set_variable_default "Hgamma" "0.0227";
#set_variable_default "Hbconc" "0.000";
set_variable_default "Hdpos" "0.20";
set_variable_default "Hcalcforce" "total";
set_variable_default "Hxgrid" "0.1";
set_variable_default "Hygrid" "0.1";
set_variable_default "Hzgrid" "0.1";
calcenergy="total"
Hbconc="0.00"
# PBS queque system variables
echo -e "\nSetting the PBS queque variables\n"
set_variable_default "cluster" "y";
set_variable_default "mnp" "1";
if [ $cluster == "y" ]
then
set_variable "Q";
set_variable_default2 "budget_name" "";
set_variable_default2 "walltime" "";
#set_variable_default "nodes" "1";
#set_variable_default "mem" "5GB";
set_variable_default "option_clu" "select=$mnp:ncpus=1:mem=5GB ";
set_variable_default2 "option_clu2" "";
fi
# output variables
set_variable_default "pdf" "n";
#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@#
# (3) initialization of the procedure #
#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@#
if [ $multitrj == "y" ]; then
FolderFile=$root_multitrj
else
FolderFile=$root
fi
RUN=RUN${run}_$root
check_run "$RUN"
PRINT_WELCOME >> REPORTFILE0
for FoLdeR in $FolderFile; do
#entering in each folder...
cd $FoLdeR
rm -f \#* *~
# check the existence of the trajectory, topology and index files
check $name_xtc.xtc ../REPORTFILE0; check $name_tpr.tpr ../REPORTFILE0; check index.ndx ../REPORTFILE0;
if [ $use_topology = "y" ]; then
# the topology files for the receptor and the ligand are created and their existence is checked
check topol.top ../REPORTFILE0;
if [ $protein_alone == "n" ]; then
check "$itp_ligand" ../REPORTFILE0;
topology "$itp_receptor" "$itp_ligand" "$receptor" "$ligand" "comp" "${water_mol}"
check topol_comp.top ../REPORTFILE0; check topol_$receptor.top ../REPORTFILE0; check topol_$ligand.top ../REPORTFILE0;
else
if [ $itp_protein_check == "NO" ]; then
cp topol.top topol_comp.top
else
topology2 "$itp_protein" "comp"
check topol_comp.top ../REPORTFILE0;
fi
fi
else
if [ $Ltopology_Pff == "y" ]; then
check "$itp_ligand" ../REPORTFILE0;
#altro? creo qui topologia o dopo?
fi
if [ $use_nonstd_ff == "y" ]; then
check residuetypes.dat ../REPORTFILE0
check "*.ff" ../REPORTFILE0
else
check_NOdir "*.ff"
fi
fi
#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@#
# (4) generation of complex, receptor and ligand centered PDB files #
#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@#
# Here it generates the centered complex PDB files...
echo -e " \n"$(date +%H:%M:%S)" Generating the centered PDB structures in "$FoLdeR"..." | tee -a ../REPORTFILE0
if [ $protein_alone == "n" ]; then
echo "$complex"| $Gpath\/$trjconv -f $name_xtc.xtc -o ${name_xtc}_out.xtc -s $name_tpr.tpr -pbc whole -n index.ndx >>STD_ERR0 2>&1
new_xtc=${name_xtc}_out
else
new_xtc=${name_xtc}
fi
echo "$complex" "$complex" "$complex" | $Gpath\/$trjconv -f ${new_xtc}.xtc -o _comp.pdb -s $name_tpr.tpr -fit rot+trans -n index.ndx -sep -center -skip $skip >>STD_ERR0 2>&1
if [ "$min" = "y" ]; then
echo "$complex" "$complex" "$complex" | $Gpath\/$trjconv -f ${new_xtc}.xtc -o _comp.gro -s $name_tpr.tpr -fit rot+trans -n index.ndx -sep -center -skip $skip >>STD_ERR0 2>&1
fi
if [ $protein_alone == "n" ]; then
rm -f ${new_xtc}.xtc
fi
check2 _comp0.pdb ../REPORTFILE0
# ... and here it generates the receptor and ligand PDB files
if [ $protein_alone == "n" ]; then
let "fin=$(ls _comp*.pdb | wc | awk '{print $1}')"
let "fin=$fin-1"
for (( counter=0; counter<=$fin; counter++ )) ; do
fakeprot=$(echo $receptor$counter)
fakeliga=$(echo $ligand$counter)
echo "$receptor" | $Gpath\/$editconf -f _comp$counter.pdb -o _$fakeprot.pdb -n index.ndx >>STD_ERR0 2>&1
echo "$ligand" | $Gpath\/$editconf -f _comp$counter.pdb -o _$fakeliga.pdb -n index.ndx >>STD_ERR0 2>&1
# Update "$counter"
done
check2 _$receptor\0.pdb ../REPORTFILE0
check2 _$ligand\0.pdb ../REPORTFILE0
fi
rm -f STD_ERR0
cd ..
done
mkdir $RUN
cp INPUT.dat $RUN/run${run}_parameters.in
mv REPORTFILE0 $RUN
for FoLdeR in $FolderFile; do
mkdir $RUN/$FoLdeR
cd $FoLdeR
for file in _*.pdb
do
mv $file ../$RUN/$FoLdeR
done
cp index.ndx ../$RUN/$FoLdeR
if [ $NO_topol_ff == "y" ]; then
cp ${name_tpr}.tpr ../$RUN/$FoLdeR
else
if [ $cas == "n" ] && [ $min == "n" ]; then
cp ${name_tpr}.tpr ../$RUN/$FoLdeR
fi
fi
if [ "$min" == "y" ]; then
for file in _comp*.gro
do
mv $file ../$RUN/$FoLdeR
done
fi
if [ $use_nonstd_ff == "y" ]; then
cp -r *.ff ../$RUN/$FoLdeR
cp residuetypes.dat ../$RUN/$FoLdeR
fi
if [ $use_topology == "y" ]; then
cp *.top ../$RUN/$FoLdeR
cp *.itp ../$RUN/$FoLdeR
rm -f topol_comp.top topol_$receptor.top topol_$ligand.top
fi
if [ $Ltopology_Pff == "y" ]; then
cp *.itp ../$RUN/$FoLdeR
fi
cd ..
done
#find box-minimization dimension reading the pdb files..
if [ "$min" == "y" ]; then
for FoLdeR in $FolderFile; do
cd $RUN/$FoLdeR
let "fin2=$(ls _comp*.gro | wc | awk '{print $1}')"
let "fin2=$fin2-1"
find_box "$fin2" "bX" "bY" "bZ"
rm -f _comp*.gro
cd ../..
done
fi
#@@@@@@@@ò@@@@@@@@@@@@@@@@@@@@@@@@@@#
# CAS: Mutants' folders generation #
#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@#
cd $RUN
if [ "$cas" = "y" ]; then
echo -e "\n"$(date +%H:%M:%S)" These calculations will be performed with the CAS approach!\nGenerating the Mutants' folders...\n" | tee -a REPORTFILE0;
# The file deleteSC.pl is generated...
PRINT_DELETESC > deleteSC.pl
chmod 700 deleteSC.pl
# read the mutations to perform from the input file.
# There are "N_Mut_folder" folders on which perform the mutations. On the folder j, named "FOLDER[$j]" (with j belonging to [1,...,N_Mut_folder]),
# are performed "count_FOLDER[$j]" mutations
N_MUTATION_TOT=`grep "^MUTATION" ../INPUT.dat | wc -l`
N_Mut_folder=0
if [ $N_MUTATION_TOT -eq 0 ]; then echo -e "\n\nWARNING!!!! No mutation can be read!! \n\n" | tee -a REPORTFILE0 WARNINGS_gmxpbsa0.dat; fi
# calculate N_Mut_folder and count_$root
for ((i=0;i<$N_MUTATION_TOT;i++))
do
dir[$i]=`grep "^MUTATION" ../INPUT.dat|head -n $(($i+1)) |tail -n 1| awk '{print $2}'`
control=0
for ((j=0;j<$N_Mut_folder;j++))
do
ref=${FOLDER[$j]}
if [ "${dir[$i]}" == "$ref" ]
then
control=$(($control+1))
jREF=$j
fi
done
if [ $control -eq 0 ]
then
FOLDER[$N_Mut_folder]=${dir[$i]}
count_FOLDER[$N_Mut_folder]=1
N_Mut_folder=$(($N_Mut_folder+1))
else
count_FOLDER[$jREF]=$((${count_FOLDER[$jREF]}+1))
fi
done
for ((i=0;i<$N_Mut_folder ;i++))
do
# calculate Ngroups for each Folder
Ngroups=0
for ((j=0;j<${count_FOLDER[$i]} ;j++))
do
gr[$j]=`grep "^MUTATION[[:blank:]]*${FOLDER[$i]}[[:blank:]]" ../INPUT.dat|head -n $(($j+1)) |tail -n 1| awk '{print $6}'`
control=0
for ((k=0;k<${Ngroups};k++))
do
ref=${Group_name[$k]}
if [ "${gr[$j]}" == "$ref" ]
then
control=$(($control+1))
kREF=$k
fi
done
if [ $control -eq 0 ]
then
Group_name[${Ngroups}]=${gr[$j]}
Nmut[${Ngroups}]=1
Ngroups=$((${Ngroups}+1))
else
Nmut[$kREF]=$((${Nmut[$kREF]}+1))
fi
done
# Some controls..
# control 1. Does "FOLDER[$i]" correspond to a existing folder?
if ! [ -r ${FOLDER[$i]} ]
then
echo -e "\n\""${FOLDER[$i]}"\"\tis not a directory!! In the section CAS of your INPUT.dat file you asked to perform a mutation on ${FOLDER[$i]}, please check your \"INPUT.dat\" file.\nExiting......\n" | tee -a REPORTFILE0
cd ..
# rm -rf $RUN
exit
fi
# control 2. Does the directory "FOLDER[$i]_Mutation_Group_name" already exist? If yes..please displace or remove this directory.
for (( k=0; k<$Ngroups; k++ ))
do
if [ -r ${FOLDER[$i]}_Mutation_${Group_name[$k]} ]
then
echo -e "\n"$(date +%H:%M:%S)"\nThe directories ${FOLDER[$i]}_Mutation_${Group_name[$k]} already exist!\nPlease remove or displace these directories.\nExiting.." | tee -a REPORTFILE0;
echo "Exiting -- please read the REPORTFILE0"
exit
fi
mkdir ${FOLDER[$i]}_Mutation_${Group_name[$k]}
done
#read 'RESname', 'RESid' and 'prot_lig' from the file INPUT.dat
for (( k=0; k<$Ngroups; k++ ))
do
for (( l=0; l<${Nmut[$k]}; l++ ))
do
a=0;
for ((z=0;z<k;z++)); do a=$(($a+${Nmut[$(($z))]})); done
a=$(($a+$l))
RESnumber[$a]=`egrep "^MUTATION[[:blank:]]*${FOLDER[$i]}[[:blank:]]" ../INPUT.dat| awk '{if ($6==group) print $0}' group=${Group_name[$k]}| head -n $(($l+1))|tail -n 1 | awk '{if($1=="MUTATION") print $3}'`
REStype[$a]=`egrep "^MUTATION[[:blank:]]*${FOLDER[$i]}[[:blank:]]" ../INPUT.dat | awk '{if ($6==group) print $0}' group=${Group_name[$k]}| head -n $(($l+1))|tail -n 1 | awk '{if($1=="MUTATION") print $4}'`
prot_lig[$a]=`egrep "^MUTATION[[:blank:]]*${FOLDER[$i]}[[:blank:]]" ../INPUT.dat | awk '{if ($6==group) print $0}' group=${Group_name[$k]}| head -n $(($l+1))|tail -n 1 | awk '{if($1=="MUTATION") print $5}'`
# control 5. If I use "Ltopology_Pff" option I can not perform alanine mutation on the ligand...check!
if [ $Ltopology_Pff == "y" ]; then
if [ ! ${prot_lig[$a]} == "receptor" ]; then
echo "You are trying to perform an alanine mutation on the ligand in ${FOLDER[$i]}. With the option \"Ltopology_Pff\" you can perform mutation only on the receptor! Exiting.." | tee -a REPORTFILE0 WARNINGS_gmxpbsa0.dat;
exit;
fi
fi
# control 3. is REStype = "ALA", "GLY" or "PRO"? --> WARNING
if [ "${REStype[$a]}" == "ALA" ]; then
echo "You are trying to perform an alanine mutation on alanine in ${FOLDER[$i]}. Exiting.." | tee -a REPORTFILE0 WARNINGS_gmxpbsa0.dat; exit; fi
if [ "${REStype[$a]}" == "PRO" ]; then
echo "You are trying to perform an alanine mutation on proline in ${FOLDER[$i]}. Exiting.." | tee -a REPORTFILE0 WARNINGS_gmxpbsa0.dat; exit; fi
if [ "${REStype[$a]}" == "GLY" ]; then
echo "You are trying to perform an alanine mutation on glycine in ${FOLDER[$i]}. Exiting.." | tee -a REPORTFILE0 WARNINGS_gmxpbsa0.dat; exit; fi
# control 4. Does 'RESname', 'RESid' and 'prot_lig' match each other?
if [ $protein_alone == "n" ]; then
if [ ${prot_lig[$a]} == "receptor" ]; then
match=`awk 'BEGIN{tot=0};
{
if( ($6==RESnumber && $4==REStype) || ($5~RESnumber && $4==REStype) ) tot=tot+1;
};
END{print tot}' RESnumber=${RESnumber[$a]} REStype=${REStype[$a]} ${FOLDER[$i]}/_$receptor\0.pdb`;
else
match=`awk 'BEGIN{tot=0};
{
if( ($6==RESnumber && $4==REStype) || ($5~RESnumber && $4==REStype) ) tot=tot+1;
};
END{print tot}' RESnumber=${RESnumber[$a]} REStype=${REStype[$a]} ${FOLDER[$i]}/_$ligand\0.pdb`;
fi
else
match=`awk 'BEGIN{tot=0};
{
if( ($6==RESnumber && $4==REStype) || ($5~RESnumber && $4==REStype) ) tot=tot+1;
};
END{print tot}' RESnumber=${RESnumber[$a]} REStype=${REStype[$a]} ${FOLDER[$i]}/_comp0.pdb`;
fi
if [ $match -eq 0 ]
then
echo -e "WARNING!!! The RESnumber " ${RESnumber[$a]} " and the REStype " ${REStype[$a]} " do not match in the " ${prot_lig[$a]} " of the directory " ${FOLDER[$i]} "\nExiting.." | tee -a REPORTFILE0 WARNINGS_gmxpbsa0.dat;
exit;
fi
done
done
# Finally delete the sidechain of the required residues
cd ${FOLDER[$i]};
if [ $protein_alone == "n" ]; then
# declare -A first
#find the order: in complex file is receptor after/before ligand?
complex_line=`grep -n '^\[ '${complex}' \]' index.ndx | cut -d: -f1`
complex_line=$((${complex_line} + 1));
first_c=`head -n ${complex_line} index.ndx | tail -n 1 | awk '{print $1}'`
ligand_line=`grep -n '^\[ '${ligand}' \]' index.ndx | cut -d: -f1`
ligand_line=$((${ligand_line} + 1));
first_l=`head -n ${ligand_line} index.ndx | tail -n 1 | awk '{print $1}'`
# for indexk in $complex $receptor $ligand; do
# index_line=`grep -n '^\[ '${indexk}' \]' index.ndx | cut -d: -f1`
# index_line=$(($index_line + 1));
# first[$indexk]=`head -n ${index_line} index.ndx | tail -n 1 | awk '{print $1}'`
# done
if [ ${first_c} -eq ${first_l} ]; then
rec_position=after
limit=`wc -l _$ligand\0.pdb | awk '{print $1}'`
else
rec_position=before
limit=`wc -l _$receptor\0.pdb | awk '{print $1}'`
fi
else
rec_position=n
limit=`wc -l _comp\0.pdb | awk '{print $1}'`
fi
for ((k=0;k<$Ngroups ;k++))
do
for (( l=0; l<${Nmut[$k]}; l++ ))
do
a=0;
for ((z=0;z<k;z++)); do a=$(($a+${Nmut[$(($z))]})); done;
a=$(($a+$l));
if [ $l -eq 0 ]; then
Nfile=`ls _comp*.pdb | wc -l`
for (( b=0; b<$Nfile ; b++ )); do
# cp _comp${b}.pdb _comp${b}.pdb@iteration$l
# cp _${receptor}${b}.pdb _${receptor}${b}.pdb@iteration$l
# cp _${ligand}${b}.pdb _${ligand}${b}.pdb@iteration$l
cp _comp${b}.pdb _comp${b}@iteration$l.pdb
cp _${receptor}${b}.pdb _${receptor}${b}@iteration$l.pdb
cp _${ligand}${b}.pdb _${ligand}${b}@iteration$l.pdb
done
fi
if [ $l -gt 0 ]; then
rm -f *@iteration$(($l-1)).pdb
fi
for (( b=0; b<$Nfile ; b++ )); do
#complex
fileC=`echo _comp${b}@iteration$l.pdb`
out=`echo _comp${b}@iteration$(($l+1)).pdb`
OUTPUT=./$out
perl ../deleteSC.pl $fileC ${REStype[$a]} ${RESnumber[$a]} ${prot_lig[$a]} ALA $OUTPUT $limit $rec_position
if [ $protein_alone == "n" ]; then
#receptor
fileR=`echo _${receptor}${b}@iteration${l}.pdb`
out=`echo _${receptor}${b}@iteration$(($l+1)).pdb`
OUTPUT=./$out
if [ ${prot_lig[$a]} == "receptor" ]
then
perl ../deleteSC.pl $fileR ${REStype[$a]} ${RESnumber[$a]} ${prot_lig[$a]} ALA $OUTPUT $limit n
else
grep "ATOM" $fileR > $OUTPUT
fi
fileCnew=`echo _comp${b}@iteration$(($l+1)).pdb`
fileRnew=`echo _${receptor}${b}@iteration$(($l+1)).pdb`
###################################################################
if [ $Ltopology_Pff == "y" ]; then
#generate file gro with the HB of mutated Alanine
echo "$ffield" | $Gpath\/$pdb2gmx -f $fileRnew -p tmp.top -i tmp.itp -o tmp.gro -water tip3p -ignh >>STD_ERR0 2>&1
#find HB lines and x-y-z coordinate for each HB
mutation=`echo ${RESnumber[$a]}ALA`
HB[1]=`more tmp.gro | awk '{if($1==NNa){if($2~/HB1/){print $4, $5, $6}} }' NNa=$mutation`
HB[2]=`more tmp.gro | awk '{if($1==NNa){if($2~/HB2/){print $4, $5, $6}} }' NNa=$mutation`
HB[3]=`more tmp.gro | awk '{if($1==NNa){if($2~/HB3/){print $4, $5, $6}} }' NNa=$mutation`
xhb1=`echo ${HB[1]} | awk '{printf "%-2.3f", $1*10}'`
yhb1=`echo ${HB[1]} | awk '{printf "%-2.3f", $2*10}'`
zhb1=`echo ${HB[1]} | awk '{printf "%-2.3f", $3*10}'`
xhb2=`echo ${HB[2]} | awk '{printf "%-2.3f", $1*10}'`
yhb2=`echo ${HB[2]} | awk '{printf "%-2.3f", $2*10}'`
zhb2=`echo ${HB[2]} | awk '{printf "%-2.3f", $3*10}'`
xhb3=`echo ${HB[3]} | awk '{printf "%-2.3f", $1*10}'`
yhb3=`echo ${HB[3]} | awk '{printf "%-2.3f", $2*10}'`
zhb3=`echo ${HB[3]} | awk '{printf "%-2.3f", $3*10}'`
rm -f tmp*
#find ALA CB postion in receptor/complex pdb (depends on pdb format)
for fileF in $fileRnew $fileCnew; do
R1="";R2="";
R1=`more $fileF | awk '{if($4=="ALA" && $6==RN && $3=="CB"){print NR}}' RN="${RESnumber[$a]}"`
R2=`more $fileF | awk '{if($4=="ALA" && $5~RN && $3=="CB"){print NR}}' RN=${RESnumber[$a]}`
Rtot=`more $fileF | wc -l`
if [ $R1 ]; then
xold=`more $fileF | awk '{if(NR==R1) print $7}' R1=$R1`
yold=`more $fileF | awk '{if(NR==R1) print $8}' R1=$R1`
zold=`more $fileF | awk '{if(NR==R1) print $9}' R1=$R1`
lll=$R1
else
if [ $R2 ]; then
xold=`more $fileF | awk '{if(NR==R1) print $6}' R1=$R2`
yold=`more $fileF | awk '{if(NR==R1) print $7}' R1=$R2`
zold=`more $fileF | awk '{if(NR==R1) print $8}' R1=$R2`
lll=$R2
fi
fi
Natm=`more $fileF | awk '{if(NR==R1) print $2}' R1=$lll`
more $fileF | sed -n '1',$lll'p' > ${fileF}2
more $fileF | sed -n $lll'p' >> ${fileF}2
more $fileF | sed -n $lll'p' >> ${fileF}2
more $fileF | sed -n $lll'p' >> ${fileF}2
more $fileF | sed -n $(($lll+1)),$Rtot'p' >> ${fileF}2
sed -i -e $(($lll+1))'s/CB /HB1/' -e $(($lll+1))'s/'$Natm'/'$(($Natm+1))'/' -e $(($lll+1))'s/'$xold'/'$xhb1'/' -e $(($lll+1))'s/'$yold'/'$yhb1'/' -e $(($lll+1))'s/'$zold'/'$zhb1'/' ${fileF}2
sed -i -e $(($lll+2))'s/CB /HB2/' -e $(($lll+2))'s/'$Natm'/'$(($Natm+2))'/' -e $(($lll+2))'s/'$xold'/'$xhb2'/' -e $(($lll+2))'s/'$yold'/'$yhb2'/' -e $(($lll+2))'s/'$zold'/'$zhb2'/' ${fileF}2
sed -i -e $(($lll+3))'s/CB /HB3/' -e $(($lll+3))'s/'$Natm'/'$(($Natm+3))'/' -e $(($lll+3))'s/'$xold'/'$xhb3'/' -e $(($lll+3))'s/'$yold'/'$yhb3'/' -e $(($lll+3))'s/'$zold'/'$zhb3'/' ${fileF}2
#replace correct file
rm -f $fileF
mv ${fileF}2 $fileF
done
fi
###################################################################
#ligand
fileL=`echo _${ligand}${b}@iteration$l.pdb`
out=`echo _${ligand}${b}@iteration$(($l+1)).pdb`
OUTPUT=./$out
if [ ${prot_lig[$a]} == "lig" ]
then
perl ../deleteSC.pl $fileL ${REStype[$a]} ${RESnumber[$a]} ${prot_lig[$a]} ALA $OUTPUT $limit n
else
grep "ATOM" $fileL > $OUTPUT
fi
fi
if [ $l -eq $((${Nmut[$k]}-1)) ]; then
cp _comp${b}@iteration$(($l+1)).pdb ../${FOLDER[$i]}_Mutation_${Group_name[$k]}/_comp${b}.pdb
cp _${receptor}${b}@iteration$(($l+1)).pdb ../${FOLDER[$i]}_Mutation_${Group_name[$k]}/_${receptor}${b}.pdb
cp _${ligand}${b}@iteration$(($l+1)).pdb ../${FOLDER[$i]}_Mutation_${Group_name[$k]}/_${ligand}${b}.pdb
fi
done
done
rm -f *@iteration*
if [ $use_nonstd_ff == "y" ]; then
cp -r *.ff ../${FOLDER[$i]}_Mutation_${Group_name[$k]}/
cp residuetypes.dat ../${FOLDER[$i]}_Mutation_${Group_name[$k]}/
fi
if [ "$min" = "y" ]; then cp box_dimension.dat ../${FOLDER[$i]}_Mutation_${Group_name[$k]}/box_dimension.dat; fi
if [ $Ltopology_Pff == "y" ]; then
cp *.itp ../${FOLDER[$i]}_Mutation_${Group_name[$k]}/
cp index.ndx ../${FOLDER[$i]}_Mutation_${Group_name[$k]}/
fi
done
cd ..
#PRINT SUMMARY
echo -e "From the WT-folder ${FOLDER[$i]} the following MUTANTS-folders have been created:" | tee -a REPORTFILE0
for ((k=0;k<$Ngroups ;k++)); do
echo -e "\t${FOLDER[$i]}_Mutation_${Group_name[$k]} where the residues mutated are:\t" | tee -a REPORTFILE0
for (( l=0; l<${Nmut[$k]}; l++ ))
do
a=0;
for ((z=0;z<k;z++)); do a=$(($a+${Nmut[$(($z))]})); done;
a=$(($a+$l));
echo -e "\t\t" ${REStype[$a]}${RESnumber[$a]}ALA "\t" ${prot_lig[$a]} | tee -a REPORTFILE0
done
done
echo -e "" | tee -a REPORTFILE0
done
rm -f deleteSC.pl
fi
#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@#
# (5) complex, receptor and ligand PDB EM #
#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@#
# The file Mm.mdp is generated
# if the user prefers to perform a thorough minimization, the box sizes of the structures are checked and stored in the b[XYZ] variables
if [ $multitrj == "y" ]; then
FolderFile2=$(for ((i=0;i<$N_start_dir; i++)); do ls -1| grep "^${start_dir[$i]}"; done | sed s/" "/"\n"/g | sort -u)
else
FolderFile2=$(ls -1 | grep "^$root")
fi
for FoLdeR in $FolderFile2; do
#entering in each folder...
cd $FoLdeR
rm -f \#* *~
let "fin=$(ls _comp*.pdb | wc | awk '{print $1}')"
let "fin=$fin-1"
# if [ $multichain == "y" ] && [ $use_nonstd_ff == "y" ]; then
if [ $multichain == "y" ]; then
echo -e "\n"$(date +%H:%M:%S)" Modifying the PDB files in order to use multiple chains in "$FoLdeR"...\n" | tee -a ../REPORTFILE0
for file in _*.pdb; do
mv $file a$file
nOC2=`grep "OC2" a${file} | wc -l`;
for (( i = 1; i < $nOC2; i++ )); do
ln=`grep -n "OC2" a$file | head -n $i | tail -n 1 | cut -d : -f1`
more a$file | awk '{if (NR == ln) {printf "TER\n"$0"\n"} else {print $0} }' ln=$(($ln+1)) > $file
mv $file a$file
done
mv a$file $file
done
fi
if [ -f Mm.mdp ]; then rm Mm.mdp; fi
if [ $NO_topol_ff == "n" ]; then touch Mm.mdp; fi
if [ $protein_alone == "y" ]; then
receptor="";
ligand="";
fi
if [ $Ltopology_Pff == "y" ]; then
name=`echo ${receptor}0`
#Att: to avoid confusion HISTIDINE must be called "HIE", "HID" or "HIP". If "HIS" is found in "_${name}.pdb" they are replaced by the correct name.
# PROBLEMA: per amber funziona. con charmm si chiamano HSE, HSD, HSP... non si può fare
IsHis=`echo $Histidine | cut -d " " -f1`
if [ -z $IsHis ]; then
echo "$ffield" | $Gpath\/$pdb2gmx -f _${name}.pdb -p topol_${receptor}.top -i posre_${receptor}.itp -o _${name}.gro -water tip3p -ignh >>STD_ERR0 2>&1
else
echo -e "$ffield\n$Histidine" | $Gpath\/$pdb2gmx -f _${name}.pdb -p topol_${receptor}.top -i posre_${receptor}.itp -o _${name}.gro -water tip3p -ignh -his >>STD_ERR0 2>&1
fi
rm -f _${name}.gro
lineB=`grep -n '\[ moleculetype \]' topol_${receptor}.top | cut -d : -f1`
lineE=`grep -n '^#ifdef POSRES$' topol_${receptor}.top | head -2 | tail -1 | cut -d : -f1`; lineE=$(($lineE+3));
lineTOT=`wc -l topol_${receptor}.top | awk '{print $1}'`
more topol_${receptor}.top | sed -n $lineB,$lineE'p' > ${receptor}.itp
mv topol_${receptor}.top tmp.top
more tmp.top | sed -n '1,'$(($lineB-1))'p' > topol.top
sed -i '/^$/d' topol.top
echo -e "#include \"${itp_ligand}\"" >> topol.top
echo -e "#include \"${receptor}.itp\"\n" >> topol.top
more tmp.top | sed -n $(($lineE+1)),$lineTOT'p' >> topol.top
# add ligand-line under section [ molecule ]
nr_lig=$( echo $(( $(grep -n "moleculetype" ${itp_ligand} | cut -d: -f1 ) + 2 )));
keywordLig=$( echo $(sed -n $nr_lig'p' ${itp_ligand} | awk '{print $1}') );
echo -e "$keywordLig\t1" >> topol.top
#use function topology (as in the case use_topology=y)
topology "${receptor}.itp" "$itp_ligand" "$receptor" "$ligand" "comp" "${water_mol}"
check topol_comp.top ../REPORTFILE0; check topol_$receptor.top ../REPORTFILE0; check topol_$ligand.top ../REPORTFILE0;
# set use_topology=y
use_topology="y";
fi
if [ "$min" = "y" ]; then
bX=`awk '{if(NR==1) print $1}' box_dimension.dat`
bY=`awk '{if(NR==1) print $2}' box_dimension.dat`
bZ=`awk '{if(NR==1) print $3}' box_dimension.dat`
PRINT_MINfile_y;
echo -e " \n\n"$(date +%H:%M:%S)" Started performing the energy minimization of the PDB files in "$FoLdeR"..." | tee -a ../REPORTFILE0
# The EM step is performed for each complex, receptor and ligand structure
for (( counter=0; counter<=$fin; counter++ )); do
for molec in comp $receptor $ligand; do
EnergyMin_y "$molec" "$counter" "$Gpath" "$ffield" "$bX" "$bY" "$bZ" "$use_topology" "$editconf" "$pdb2gmx" "$grompp" "$mdrun"
done
done
else
echo -e " \n\n"$(date +%H:%M:%S)" Started the recovery of the Coulomb/VdW energy contributions from the PDB files in "$FoLdeR"..." | tee -a ../REPORTFILE0
if [ $NO_topol_ff == "y" ]; then
echo "$complex" | $Gpath\/$tpbconv -s ${name_tpr}.tpr -n index.ndx -o comp.tpr >>STD_ERR0 2>&1
if [ $protein_alone == "n" ]; then
echo "$ligand" | $Gpath\/$tpbconv -s ${name_tpr}.tpr -n index.ndx -o ${ligand}.tpr >>STD_ERR0 2>&1
echo "$receptor" | $Gpath\/$tpbconv -s ${name_tpr}.tpr -n index.ndx -o ${receptor}.tpr >>STD_ERR0 2>&1
fi
for (( counter=0; counter<=$fin; counter++ )); do
for molec in comp $receptor $ligand; do
EnergyMin_n_NOcas "$molec" "$counter" "$Gpath" "$mdrun"
done
done
#rm -f comp.tpr ${ligand}.tpr ${receptor}.tpr
else
PRINT_MINfile_n;
# The step is performed for each complex, receptor and ligand structure
use_tpbcon=n
#if [ $cas == "n" ] && [ $min == "n" ]; then
# use_tpbcon=y;
# echo "$complex" | $Gpath\/$tpbconv -s ${name_tpr}.tpr -n index.ndx -o comp.tpr >>STD_ERR0 2>&1
# echo "$ligand" | $Gpath\/$tpbconv -s ${name_tpr}.tpr -n index.ndx -o ${ligand}.tpr >>STD_ERR0 2>&1
# echo "$receptor" | $Gpath\/$tpbconv -s ${name_tpr}.tpr -n index.ndx -o ${receptor}.tpr >>STD_ERR0 2>&1
# fi
for (( counter=0; counter<=$fin; counter++ )); do
for molec in comp $receptor $ligand; do
EnergyMin_n "$molec" "$counter" "$Gpath" "$ffield" "$use_topology" "$use_tpbcon" "$editconf" "$pdb2gmx" "$grompp" "$mdrun"
done
done
#if [ $use_tpbcon == "y" ]; then rm -f comp.tpr ${ligand}.tpr ${receptor}.tpr;fi
fi
fi
# The topology files generated during EM are deleted
if [ $NO_topol_ff == "n" ]; then
rm -f topol_comp*.top topol_$ligand*.top topol_$receptor* posre*
fi
#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@#
# (6) generation of the PQR files #
#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@#
echo -e $(date +%H:%M:%S)" Started generating the PQR files from the corresponding "$FoLdeR" PDB files..." | tee -a ../REPORTFILE0
if [ $NO_topol_ff == "y" ]; then
for molec in comp $receptor $ligand; do
# generate pqr template
#if [ $molec == "comp" ]; then group=complex; else group=$molec; fi
#echo "$group" | $Gpath\/$editconf -f ${name_tpr}.tpr -n index.ndx -mead ${molec}.pqr >>STD_ERR0 2>&1 && check2 ${molec}.pqr ../REPORTFILE0
check2 ${molec}.tpr ../REPORTFILE0 && $Gpath\/$editconf -f ${molec}.tpr -mead ${molec}.pqr >>STD_ERR0 2>&1 && check2 ${molec}.pqr ../REPORTFILE0
#generate common files