Debian Codegraph @

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