File: two-ions-model-example.tex

package info (click to toggle)
apbs 3.4.1-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 199,188 kB
  • sloc: ansic: 284,988; cpp: 60,416; fortran: 44,896; xml: 13,895; sh: 13,838; python: 8,105; yacc: 2,922; makefile: 1,428; f90: 989; objc: 448; lex: 294; awk: 266; sed: 205; java: 134; csh: 79
file content (302 lines) | stat: -rw-r--r-- 9,528 bytes parent folder | download | duplicates (7)
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
%% LyX 1.5.6 created this file.  For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[english,preprint]{revtex4}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage{babel}

\begin{document}

\title{MATLAB example: The two Born-ions model}

\begin{abstract}
Let's consider the two-ions complex model at room temperature (T=298.15
C). Inside the radius (r=1A) the low dielectric coefficient representing
the (solute) molecule is set equal to $\epsilon^{x}=\epsilon^{y}=\epsilon^{z}=2.0$.
The positive ion (with valence equal to $z=+1)$ is located at the
position $(1,1,1)$ in amstrongs and the negative ion (with valence
equal to $z=-1)$ is located at the position $(-1,-1,-1)$. Both ions
are immersed in a solvent medium of dielectric coefficient that mimic
water, e.g., with $\epsilon^{x}=\epsilon^{y}=\epsilon^{z}=78.54$
(solvated state). The bulk ionic strength is set equal to zero. To
solve the PB equation we will use a cubic grid of 65 points and a
box length of 12 A centered at the origin of the reference system
$(0,0,0)$. We will use the linear B-spline to obtain the fractional
charge at the node points. 
\end{abstract}
\maketitle

\part{Using the MATLAB PB SOLVER}


\subsection*{Input files as generated by the APBS and pdb2pqr codes}

The {}``twoions.pqr'' file corresponding to the model described
above reads

\begin{quotation}
ATOM 1 I1 ION 1 1.000 1.000 1.000 1.000 1.000

ATOM 2 I2 ION 1 -1.000 -1.000 -1.000 -1.000 1.000
\end{quotation}
As an example, the {}``twoions.in'' input file used by the APBS
reads

\begin{quotation}
read 

mol pqr twoions.pqr \# Two-ion complex

end

elec name comp\_solv \# Solvated complex

mg-manual

dime 65 65 65 \# Grid dimensions

nlev 4 \# Multigrid levels

glen 12 12 12 \# Grid lengths

gcent mol 1 \# Grid center 

mol 1 

lpbe \# Linearized PB

bcfl mdh \# Full multipole boundary condition

ion 1 0.000 2.0 \# Zero ionic strength

ion -1 0.000 2.0 \# Zero ionic strength

pdie 2.0 \# Solute dielectric

sdie 78.54 \# Solvent dielectric

chgm spl2 \# Cubic spline charge discretization

srfm mol \# Molecular surface

srad 1.4 \# Solvent probe radius

swin 0.3 \# Surface spline window

sdens 10.0 \# Sphere density

temp 298.15 \# Temperature

write pot dx twoions-pot

write charge dx twoions-charge

write dielx dx twoions-dielx

write diely dx twoions-diely

write dielz dx twoions-dielz

write kappa dx twoions-kappa

calcenergy total \# Total energy

calcforce no \# No forces

end

quit
\end{quotation}
For example, if you saved both files 'twoions.pqr'' and 'twoions.in'
in the directory 'C:/Users/me/Documents/APBS\_PB\_solver/', you may
type in your command prompt window

\begin{quotation}
C:/Users/me/Documents/Matlab\_PB\_solver>apbs twoions.in
\end{quotation}
In this way we obtain the input files in dx format required by the
MATLAB version of the APBS to solve the PB equation. Specifically,
we obtain the shifted dielectric coefficients maps twoions-dielx.dx,
twoions-diely.dx, twoions-dielz.dx, and the ion accessibility map
twoions-kappa.dx. We also obtain the charge density twoions-charge.dx
and the electrostatic potential twoions-pot.dx maps which will be
used later for testing purpose.


\subsection*{MATLAB input file}

Now we are ready to write the input file {}``twoions.inm'' as follows

\begin{quotation}
65 65 65

12 12 12

298.15

0.0 78.54

twoions-dielx.dx

twoions-diely.dx

twoions-dielz.dx

twoions-kappa.dx

twoions.pqr

twoions\_model
\end{quotation}
The first line corresponds to the number of grid of points $[N_{x}N_{y}N_{z}]$;
the second line corresponds to the length in Anstrong of the boxsides
$[L_{x}L_{y}L_{z}]$; the next line corresponds to the temperature
in Celsius degree; next line contains the bulk properties (ionic strenght
$I_{s}=\sum c_{i}z_{i}^{2}$ and the solvent dielectric coeffcient
for the solvated states or the molecular dielectric coefficient for
the reference state); next is the name of the dx file containing the
shifted dielectric coefficients along the x direction; next is for
the one corresponding to the y-direction and next the one in the z-direction.
The seventh line corresponds to the name of the ion accessibility
coefficient map. The next one corresponds to the name of the pqr file
generated by the pdb2pqr code and the last line corresponds to the
name of the folder that will be created into the current (working)
folder (for instances 'Matlab\_PB\_solver') where all the Matlab files
of our code are saved. In the folder {}``twoions\_model'' you will
find all the files generated by our Matlab code, namely electrostatic
potential and the charge maps in dx format, and the electrostatic
potential surface $u_{ij(N_{z}+1)/2}$ in both jpg and fig format. 


\subsection*{Before using our Matlab code}

Before running the {}``main.m'' file in the Matlab console you must
create a folder (for instances {}``Matlab\_Input\_Files'') in the
same directory (For instances 'C:/Users/me/Documents/Matlab\_PB\_solver/')
in which all the Matlab files of our code are saved. Then you must
save the input files twoions.inm, twoions-ion.pqr, twoions-dielx.dx,
twoions-diely.dx, twoions-dielz.dx, and twoions-kappa.dx in the folder
{}``Matlab\_Input\_Files''. 

Next, you must edit two lines in the {}``main.m'' file to know:

\begin{itemize}
\item The line number 57 contains the path to the folder {}``Matlab\_Input\_Files''.
In our example you have to set the path as follows
\end{itemize}
\begin{quotation}
MYPATH='C:/Users/me/Documents/Matlab\_PB\_solver/Matlab\_Input\_Files';
\end{quotation}
\begin{itemize}
\item The line number 65 contains the name of the inm input file. In our
example we termed it as {}``twoions.inm'' such that we have to set
the name of the inputfile as follows
\end{itemize}
\begin{quotation}
inputfile='twoions.inm';
\end{quotation}
Now we are ready to run the main.m file. In the command window of
Matlab you may type

\begin{quotation}
>\textcompwordmark{}>run C:/Users/me/Documents/Matlab\_PB\_solver/main
\end{quotation}
You are done. On the same command window you will see information
about the different steps that our code performs to get the required
solution. 


\subsection*{Matlab output files}

In this example you will find a created folder named 'twoions\_model'
in the directory 'C:/Users/me/Documents/Matlab\_PB\_solver/' containing
the following files

\begin{quotation}
twoions\_model\_MATLAB\_charge\_density.dx

twoions\_model\_MATLAB\_potential\_solution.dx

twoions\_model\_MATLAB\_potential\_solution.jpg

twoions\_model\_MATLAB\_potential\_solution.fig
\end{quotation}

\subsection*{Accuracy and efficiency of our Matlab code}

You may change same parameters of our code in order to make it faster
and more efficient. In particular, the default accuracy is set equal
to 10\textasciicircum{}-9. You may change it by editing the main.m
file and change the variable 'accuracy' for the required precision.
You may also change the tolerance in the inexact LU decompostion.
The default value for the variable 'tolerance' is set equal to 0.25. 

\newpage


\part{Testing our code}


\subsection*{Before using our Matlab code}

Before running the {}``comparison.m'' file in the Matlab console
you must create a folder (for instances {}``Potential'') in the
same directory (For instances 'C:/Users/me/Documents/Matlab\_PB\_solver/')
in which all the Matlab files of our code are saved. Then you must
save in that folder the APBS and MATLAB electrostatic potential solutions.
In our example they are APBS-twoions-pot.dx and twoions\_model\_MATLAB\_potential\_solution.dx. 

Next, you must edit three lines in the {}``comparison.m'' file to
know:

\begin{itemize}
\item The line number 19 contains the path to the folder {}``Potential''.
In our example you have to set the path as follows
\end{itemize}
\begin{quotation}
MYPATH='C:/Users/me/Documents/Matlab\_PB\_solver/Potential';
\end{quotation}
\begin{itemize}
\item The line number 27 contains the number of grid points in the format
$[N_{x}N_{y}N_{z}]$. In our example we have to set
\end{itemize}
\begin{quotation}
dime= {[}65 65 65];
\end{quotation}
\begin{itemize}
\item The line number 29 contains the length of the boxside in the format
$[L_{x}L_{y}L_{z}]$ in anstromgs. In our example we have to set
\end{itemize}
\begin{quotation}
glen= {[}12 12 12];
\end{quotation}
Now we are ready to run the comparison.m file. In the command window
of Matlab you may type

\begin{quotation}
>\textcompwordmark{}>run C:/Users/me/Documents/Matlab\_PB\_solver/comparison
\end{quotation}
You are done. On the same command window you will see information
about the different steps that our code performs to get the required
solution. 


\subsection*{Matlab output files}

In this example you will find a created folder named 'COMPARATIVE\_ANALYSIS'
in the directory 'C:/Users/me/Documents/Matlab\_PB\_solver/' containing
the following files

\begin{quotation}
Absolute Error between MATLAB and APBS solutions.dx

Absolute\_error.fig

Absolute\_error.tiff

APBS-twoions-pot\_and\_twoions\_model\_MATLAB\_potential\_solution.fig

APBS-twoions-pot\_and\_twoions\_model\_MATLAB\_potential\_solution.tiff
\end{quotation}

\end{document}