Debian Codegraph @

contrib/iapbs/modules/Amber/patches/amber9_mm_pbsa.patch

raw
1 diff -ur mm_pbsa.orig/mm_pbsa_calceneent.pm mm_pbsa/mm_pbsa_calceneent.pm
2 --- mm_pbsa.orig/mm_pbsa_calceneent.pm 2007-09-14 18:36:19.000000000 -0700
3 +++ mm_pbsa/mm_pbsa_calceneent.pm 2007-09-26 13:56:27.000000000 -0700
4 @@ -57,8 +57,12 @@
5 print OUT "MM\n" if($r_gen->{"MM"});
6 print OUT "GB\n" if($r_gen->{"GB"});
7 print OUT "PB\n" if($r_gen->{"PB"});
8 - print OUT "MS\n" if($r_gen->{"GB"} || $r_gen->{"PB"} || $r_gen->{"MS"}); # Implicit use of sander/pbsa SAS
9 - print OUT "NM\n" if($r_gen->{"NM"}); # calc if not MS set
10 + print OUT "MS\n" if($r_gen->{"GB"} ||
11 + ($r_gen->{"PB"} && ($r_del->{"PROC"} != 3)) ||
12 + $r_gen->{"MS"}); # Implicit use of sander/pbsa SAS
13 + # calc if not MS set
14 + # disabled for iAPBS (PROC=3)
15 + print OUT "NM\n" if($r_gen->{"NM"});
16
17 # Parmtop file
18 my $npar;
19 @@ -129,6 +133,11 @@
20 my $pbsaout = "pbsa" . $suf . "." . $number . ".out";
21 &calc_pbsa(*OUT,"pbsa.in",$pbsaout,$ncrdfile,$npar,$r_gen,$r_pro);
22 }
23 + elsif($r_del->{"PROC"} == 3){
24 + my $pbsaout = "iapbs" . $suf . "." . $number . ".out";
25 + #my $pbsain = "iapbs" . $suf . ".in";
26 + &calc_iapbs(*OUT,"iapbs.in",$pbsaout,$ncrdfile,$npar,$r_gen,$r_pro,$suf);
27 + }
28 }
29
30 # Calc MS
31 @@ -264,6 +273,68 @@
32 unlink $pbsaout;
33 }
34
35 +sub calc_iapbs(){
36 +################
37 +
38 + # Parameters: $OUT, $pbsain, $pbsaout, $ncrdfile, $npar, $r_gen, $r_pro
39 +
40 + my $OUT = shift;
41 + my $pbsain = shift;
42 + my $pbsaout = shift;
43 + my $ncrdfile = shift;
44 + my $npar = shift;
45 + my $r_gen = shift;
46 + my $r_pro = shift;
47 + my $suf = shift;
48 +
49 + print " Calc Amber/iAPBS\n";
50 +
51 + my $command = $r_pro->{"IAPBS"} . " -O" .
52 + " -i " . $pbsain .
53 + " -o " . $pbsaout .
54 + " -c " . $ncrdfile .
55 + " -p " . $npar;
56 +
57 +
58 + my $pqrfname = "";
59 + $pqrfname = "com.pqr" if ($suf eq "_com");
60 + $pqrfname = "rec.pqr" if ($suf eq "_rec");
61 + $pqrfname = "lig.pqr" if ($suf eq "_lig");
62 +
63 + my $lncommand = "ln -s " . $pqrfname . " ./pqr";
64 + system($lncommand) && die ("Linking pqr file $pqrfname failed!\n");
65 + system($command) && die(" $command not successful\n");
66 + system("rm -f ./pqr");
67 +
68 + # Write MM results
69 + open(IN,"$pbsaout") || die(" $pbsaout not opened\n");
70 + my $finalflg = 0;
71 + my $line;
72 + while(defined($line = <IN>)){
73 + if($line =~ /FINAL RESULTS/){
74 + $finalflg = 1;
75 + }
76 + elsif($finalflg > 0){
77 + if ($line =~ /VDWAALS.+EEL.+EPB. += +(-?\d+\.\d+)/){
78 + #print OUT $line;
79 + # Convert to kT, because back-conversion to kcal/mol is done in
80 + # mm_pbsa_statistics, subroutine treat_special
81 + # (to be compatible with delphi calculation)
82 + my $kcal2kt = 1000.0 * 4.184 / (300.0 * 8.314);
83 + my $rfe = $1 * $kcal2kt;
84 + printf OUT "%s %15.6f\n", "corrected reaction field energy:", $rfe;
85 + }
86 + elsif($line =~ /ENPOLAR +=/ && $r_gen->{"PB"} > 0 && $r_gen->{"MS"} == 0){
87 + print OUT $line;
88 + }
89 + }
90 + }
91 + close(IN);
92 +
93 + # Clean up MM
94 + unlink $pbsaout;
95 +}
96 +
97 sub calc_delphi(){
98 ##################
99
100 diff -ur mm_pbsa.orig/mm_pbsa_createinput.pm mm_pbsa/mm_pbsa_createinput.pm
101 --- mm_pbsa.orig/mm_pbsa_createinput.pm 2007-09-14 18:36:19.000000000 -0700
102 +++ mm_pbsa/mm_pbsa_createinput.pm 2007-09-26 13:55:26.000000000 -0700
103 @@ -51,6 +51,9 @@
104 elsif($r_del->{"PROC"} == 2){
105 &create_pbsa_input($r_gen, $r_san, $r_del);
106 }
107 + elsif($r_del->{"PROC"} == 3){
108 + &create_iapbs_input($r_gen, $r_san, $r_del);
109 + }
110 }
111
112 if($r_gen->{"GC"} || $r_gen->{"AS"}){
113 @@ -372,7 +375,7 @@
114
115 close(OUT);
116 }
117 - }
118 + }
119 return;
120 }
121
122 @@ -441,6 +444,83 @@
123 return;
124 }
125
126 +sub create_iapbs_input() {
127 +#########################
128 + # Parameters: \%GEN,\%SAN,\%DEL
129 + my $r_gen = shift;
130 + my $r_san = shift;
131 + my $r_del = shift;
132 +
133 + print " iAPBS input\n";
134 +
135 + my ($igb, $dielc, $epsin, $epsout, $istrng, $radiopt, $sprob,
136 + $space, $maxitn, $npopt, $cavity_surften, $cavity_offset,
137 + $srad, $bcfl, $srfm, $chgm, $swin);
138 + # Do iAPBS calculation
139 + $igb = 6;
140 + $dielc = $r_san->{"DIELC"};
141 + $epsin = $r_del->{"INDI"};
142 + $epsout = $r_del->{"EXDI"};
143 + my $pbions = "";
144 + if(exists $r_del->{"ISTRNG"} && $r_del->{"ISTRNG"} > 0.0){
145 + my $ionc = $r_del->{"ISTRNG"};
146 + $pbions = " nion = 2, \n";
147 + $pbions .= " ionq = 1.0, -1.0,\n";
148 + $pbions .= " ionrr = 2.0, 2.0,\n";
149 + $pbions .= " ionc = $ionc, $ionc,\n";
150 + } else {
151 + $pbions = " nion = 0,\n";
152 + }
153 + $radiopt = $r_del->{"RADIOPT"};
154 + $sprob = $r_del->{"PRBRAD"};
155 + $space = 1.0 / $r_del->{"SCALE"}->[0];
156 + $srad = $r_del->{"SRAD"};
157 + $bcfl = $r_del->{"BCFL"};
158 + $srfm = $r_del->{"SRFM"};
159 + $chgm = $r_del->{"CHGM"};
160 + $swin = $r_del->{"SWIN"};
161 + # ($dimex, $dimey, $dimez) = split(/,/,$r_del->{"DIME"});
162 + # ($fglenx, $fgleny, $fglenz) = split(/,/,$r_del->{"FGLEN"});
163 + # ($cglenx, $cgleny, $cglenz) = split(/,/,$r_del->{"CGLEN"});
164 +
165 + my $name = "iapbs.in";
166 + open(OUT,">$name") || die(" $name not opened\n");
167 + print OUT "File generated by mm_pbsa.pl. Using iAPBS\n";
168 + print OUT " &cntrl\n";
169 + print OUT " ntf = 1, ntb = 0,\n";
170 + print OUT " igb = ${igb}, dielc = ${dielc},\n";
171 + print OUT " cut = 999.0, nsnb = 99999,\n";
172 + print OUT " scnb = 2.0, scee = 1.2,\n";
173 + print OUT " imin = 1, maxcyc = 0, ntmin = 2,\n";
174 + print OUT " &end\n";
175 + # Here, only REFE == 0 calculations are allowed, whereby the reference state
176 + # is assumed to be INDI/INDI.
177 + # Hence, only one pbsa calc with EXDI/INDI is performed,
178 + # and the result taken is the reaction field energy
179 + # (given as "ELE" in the pbsa output).
180 + # Consider scaling of coulombic interactions as well (by DIELC) if using INDI != 1.
181 + # If SALT > 0.0, only one calculation is done here (compared to delphi).
182 + # For NLPB, see work of Tsui & Case, J. Phys. Chem. B 2001, 105, 11314
183 + # and salt_contrib and process_phi scripts in delphi directory.
184 + # Here, a PBTEMP of 300K is used to compute the Boltzmann factor for the salt effect.
185 + # If a different temperature is specified here, also correct the factor for
186 + # kcal/mol -> kT conversion in the subroutine calc_pbsa.
187 +
188 + print OUT " &apbs\n";
189 + print OUT " apbs_print=0, apbs_debug=0, calc_type = 0,\n";
190 + print OUT " grid = ${space}, ${space}, ${space},\n";
191 + print OUT " radiopt = ${radiopt}, pqr='pqr', \n";
192 + print OUT " sdie = ${epsout}, pdie = ${epsin}, srad=${srad}, \n";
193 + print OUT " cmeth=1, bcfl=${bcfl}, srfm=${srfm}, chgm=${chgm},\n";
194 + print OUT $pbions;
195 + print OUT " swin=${swin}, calcforce=0, calcnpenergy=1 \n";
196 + print OUT " &end\n";
197 +
198 + close(OUT);
199 + return;
200 +}
201 +
202 +
203 sub create_makecrd_input(){
204 ###########################
205
206 diff -ur mm_pbsa.orig/mm_pbsa_readinput.pm mm_pbsa/mm_pbsa_readinput.pm
207 --- mm_pbsa.orig/mm_pbsa_readinput.pm 2007-09-14 18:36:19.000000000 -0700
208 +++ mm_pbsa/mm_pbsa_readinput.pm 2007-09-26 14:15:39.000000000 -0700
209 @@ -470,8 +470,18 @@
210 die(" PB calculation with REFE > 0 doesn't work with PROC equals 2\n");
211 }
212 }
213 + elsif($r_del->{"PROC"} == 3){
214 + # Test iapbs parameters
215 + &test_par(\@RL_PAR,[$r_del]);
216 + &test_fil(\@RL_FIL,[$r_del,$r_pro]);
217 +
218 + # No focussing calc for REFE > 0
219 + #if($r_del->{"REFE"} > 0){
220 + #die(" PB calculation with REFE > 0 doesn't work with PROC equals 2\n");
221 + #}
222 + }
223 else{
224 - die(" PROC parameter in PB section must be 1 or 2\n");
225 + die(" PROC parameter in PB section must be 1, 2 or 3\n");
226 }
227
228 # Test if DIELC and INDI agree (if REFE > 0, no test is performed)
229 diff -ur mm_pbsa.orig/mm_pbsa_statistics.pm mm_pbsa/mm_pbsa_statistics.pm
230 --- mm_pbsa.orig/mm_pbsa_statistics.pm 2007-09-14 18:36:19.000000000 -0700
231 +++ mm_pbsa/mm_pbsa_statistics.pm 2007-09-18 12:04:03.000000000 -0700
232 @@ -131,6 +131,7 @@
233 "PB" => [1,0,'corrected reaction field energy: +(-?\d+\.\d+)'],
234 "PBDIS" => [1,0,'EDISPER = +(-?\d+\.\d+)'],
235 "PBCAV" => [1,0,'ECAVITY = +(\d+\.\d+)'],
236 + "PBNONPOL" => [1,0,'ENPOLAR = +(\d+\.\d+)'],
237 "PBSUR" => [3,5],
238 "PBCAL" => [3,6],
239 "PBSOL" => [2,7,'+PB_PBCAL+PB_PBSUR+PB_PBDIS'],
240 @@ -1337,13 +1338,32 @@
241 }
242 }
243 elsif($calc eq "PB" && $var eq "PBSUR"){
244 + # Convert PB from kT to kcal/mol
245 + my $kt2kcal = $R * $TEMP / 4.184 / 1000.0;
246 # Calc nonpolar contribution for PB
247 $DATA->[$i]->{$calc}->{$var} = [];
248 my $j;
249 - for($j = 0; $j < scalar(@{$DATA->[$i]->{"PB"}->{"PBCAV"}}); $j++){
250 - push @{$DATA->[$i]->{$calc}->{$var}}, $gammaP * $DATA->[$i]->{"PB"}->{"PBCAV"}->[$j] + $betaP;
251 - }
252 - }
253 + if (defined ($DATA->[$i]->{"PB"}->{"PBNONPOL"}->[0])){
254 + for($j = 0; $j < scalar(@{$DATA->[$i]->{"PB"}->{"PBNONPOL"}}); $j++){
255 + push @{$DATA->[$i]->{$calc}->{$var}}, $DATA->[$i]->{"PB"}->{"PBNONPOL"}->[$j];
256 + # PBCAV and PBDIS are missing when doing iAPBS calculation
257 + # zero them out so the rest of the script can proceed
258 + $DATA->[$i]->{"PB"}->{"PBCAV"}->[$j] = 0.;
259 + $DATA->[$i]->{"PB"}->{"PBDIS"}->[$j] = 0.;
260 + print "rok INSIDE\n";
261 + #print "$DATA->[$i]->{$calc}->{$var}->[$j] \n";
262 + }
263 + }
264 + else {
265 + for($j = 0; $j < scalar(@{$DATA->[$i]->{"PB"}->{"PBCAV"}}); $j++){
266 + push @{$DATA->[$i]->{$calc}->{$var}}, $gammaP * $DATA->[$i]->{"PB"}->{"PBCAV"}->[$j] + $betaP;
267 + # zero out PBNONPOL
268 + $DATA->[$i]->{"PB"}->{"PBNONPOL"}->[$j] = 0.;
269 + print "rok OUTSIDE\n";
270 + }
271 + }
272 + }
273 +
274 # elsif($calc eq "GB" && $var eq "GBSUR"){
275 # # Calc nonpolar contribution for GB
276 # $DATA->[$i]->{$calc}->{$var} = [];
277 diff -ur mm_pbsa.orig/mm_pbsa_util.pm mm_pbsa/mm_pbsa_util.pm
278 --- mm_pbsa.orig/mm_pbsa_util.pm 2007-09-14 18:36:19.000000000 -0700
279 +++ mm_pbsa/mm_pbsa_util.pm 2007-09-26 14:35:01.000000000 -0700
280 @@ -42,6 +42,7 @@
281
282 $r_pro->{"SANDER"} = "$amberexe" . "/" . "sander";
283 $r_pro->{"PBSA"} = "$amberexe" . "/" . "pbsa";
284 + $r_pro->{"IAPBS"} = "$amberexe" . "/" . "sander.APBS";
285 $r_pro->{"NMODE"} = "$amberexe" . "/" . "nmode";
286 $r_pro->{"AMBPDB"} = "$amberexe" . "/" . "ambpdb";
287 $r_pro->{"MS"} = "$amberexe" . "/" . "molsurf";
288 @@ -67,6 +68,9 @@
289 elsif($r_del->{"PROC"} == 2){
290 unlink "pbsa.in" if(-e "pbsa.in");
291 }
292 + elsif($r_del->{"PROC"} == 3){
293 + unlink "iapbs.in" if(-e "iapbs.in");
294 + }
295 }
296 unlink "make_crd.in" if(-e "make_crd.in");
297 unlink "sander_com.in" if(-e "sander_com.in");