仓库源文站点原文


layout: post title: GROMACS表面张力单位,计算及其长程校正 categories:


2014-09-24 13:00:48

单位

表面张力单位常用的有好几个,

换算关系

1 dyn/cm = 10^-3^ Pa-m = 1 mJ/m^2

1 bar-nm = 10^-4^ Pa-m = 10^-4^ N/m = 10^-4^ J/m^2 = 0.1 mN/m = 0.1 mJ/m^2 = 0.1 dyn/cm

<table id='tab-0'><caption>表面张力换算</caption> <tr> <th rowspan="1" colspan="1" style="text-align:center;">Unit</th> <th rowspan="1" colspan="1" style="text-align:center;">Pa-m N/m J/m<sup>2</sup></th> <th rowspan="1" colspan="1" style="text-align:center;">mN/m mJ/m<sup>2</sup> dyn/cm</th> <th rowspan="1" colspan="1" style="text-align:center;">bar-nm</th> <th rowspan="1" colspan="1" style="text-align:center;">kcal/mol-A<sup>2</sup></th> <th rowspan="1" colspan="1" style="text-align:center;">kJ/mol-nm<sup>2</sup></th> </tr> <tr> <td rowspan="1" colspan="1" style="text-align:center;">Pa-m N/m J/m<sup>2</sup></td> <td rowspan="1" colspan="1" style="text-align:center;">1</td> <td rowspan="1" colspan="1" style="text-align:center;">10<sup>3</sup></td> <td rowspan="1" colspan="1" style="text-align:center;">10<sup>4</sup></td> <td rowspan="1" colspan="1" style="text-align:center;">1.43932643164436</td> <td rowspan="1" colspan="1" style="text-align:center;">602.214178999998</td> </tr> <tr> <td rowspan="1" colspan="1" style="text-align:center;">mN/m mJ/m<sup>2</sup> dyn/cm</td> <td rowspan="1" colspan="1" style="text-align:center;">10<sup>-3</sup></td> <td rowspan="1" colspan="1" style="text-align:center;">1</td> <td rowspan="1" colspan="1" style="text-align:center;">10</td> <td rowspan="1" colspan="1" style="text-align:center;">1.43932643164436E3</td> <td rowspan="1" colspan="1" style="text-align:center;">602.214178999998E3</td> </tr> <tr> <td rowspan="1" colspan="1" style="text-align:center;">bar-nm</td> <td rowspan="1" colspan="1" style="text-align:center;">10<sup>-4</sup></td> <td rowspan="1" colspan="1" style="text-align:center;">0.1</td> <td rowspan="1" colspan="1" style="text-align:center;">1</td> <td rowspan="1" colspan="1" style="text-align:center;">1.43932643164436E4</td> <td rowspan="1" colspan="1" style="text-align:center;">602.214178999998E4</td> </tr> <tr> <td rowspan="1" colspan="1" style="text-align:center;">kcal/mol-A<sup>2</sup></td> <td rowspan="1" colspan="1" style="text-align:center;">0.694769426875285</td> <td rowspan="1" colspan="1" style="text-align:center;">0.694769426875285E3</td> <td rowspan="1" colspan="1" style="text-align:center;">0.694769426875285E4</td> <td rowspan="1" colspan="1" style="text-align:center;">1</td> <td rowspan="1" colspan="1" style="text-align:center;">418.4</td> </tr> <tr> <td rowspan="1" colspan="1" style="text-align:center;">kJ/mol-nm<sup>2</sup></td> <td rowspan="1" colspan="1" style="text-align:center;">1.66053878316273E-3</td> <td rowspan="1" colspan="1" style="text-align:center;">1.66053878316273</td> <td rowspan="1" colspan="1" style="text-align:center;">16.6053878316273</td> <td rowspan="1" colspan="1" style="text-align:center;">2.39005736137667E-3</td> <td rowspan="1" colspan="1" style="text-align:center;">1</td> </tr> </table>

计算

GROMACS 中给出的 #SurfTen 为表面张力乘上表面数目, 一般slab构型有两个表面, 所以实际表面张力为

$\g = {\text{#SurfTen} \over 2} \; \text{bar-nm} ={\text{#SurfTen} \over 20} \; \text{mJ/m}^2$

长程校正

对LJ势能函数, 其参数为 $\s, \ve$, 截断距离为 $R_c$, 则其表面张力的长程校正为

$$\begin{align} \D \g^{\text{lrc} } &= \iint \r(z) \r(z') \P(\x) dz dz' \ \P(\x) &= \p{zz}(\x)-\p{xx}(\x) \ \x &=|z-z'| \end{align}$$

其中

$$\P(\x) = \begin{cases} 6\p\ve \x^2[ ({\s \over R_c})^{12} - ({\s \over R_c})^6 ] + 3\p\ve R_c^2[ ({\s \over R_c})^6 - {4 \over 5} ({\s \over R_c})^6 ] \; & \x \le R_c \ 3\p\ve \x^2[ {6 \over 5} ({\s \over \x})^{12} - ({\s \over \x})^6] \; & \x > R_c \end{cases}$$

$\r(\xi)$ 为分子z方向的数密度分布.

这一校正项可利用matlab的二重积分函数quad2d计算, 但由于边界的不规整性, 有时不易收敛. 更好的办法是解析求解或分区域数值积分, 但实现麻烦些. 另外, 一般得到的数密度分布为离散值, 而积分需要连续值, 可以先将离散的数密度分布用样条函数进行插值. 插值方法可参考前面的一篇博文样条函数插值拟合.

测试用例

文件Rz.xvg, 单位为nm, 1/nm^3

   0                0
0.12      6.28082e-05
0.24      6.28082e-05
0.36      6.28082e-05
0.48      6.28082e-05
 0.6                0
0.72      6.28082e-05
0.84      6.28082e-05
0.96      6.28082e-05
1.08      6.28082e-05
 1.2      6.28082e-05
1.32      6.28082e-05
1.44      6.28082e-05
1.56                0
1.68      6.28082e-05
 1.8      6.28082e-05
1.92      6.28082e-05
2.04      6.28082e-05
2.16      6.28082e-05
2.28                0
 2.4      6.28082e-05
2.52      6.28082e-05
2.64      6.28082e-05
2.76      6.28082e-05
2.88      6.28082e-05
   3      6.28082e-05
3.12                0
3.24      6.28082e-05
3.36      0.000753698
3.48        0.0243696
 3.6         0.329303
3.72          2.27014
3.84           8.8525
3.96          20.4586
4.08          30.5037
 4.2          33.1148
4.32          33.2954
4.44          33.1513
4.56          33.1253
4.68          32.7827
 4.8          32.9409
4.92          33.0859
5.04          32.8674
5.16          33.0688
5.28          33.0544
 5.4           32.914
5.52           32.956
5.64          33.1135
5.76          33.0222
5.88          32.9612
   6          32.9931
6.12          33.0441
6.24          32.9333
6.36           32.921
6.48          33.0009
 6.6          32.9177
6.72            32.97
6.84          32.9386
6.96          33.1559
7.08           32.909
 7.2          32.8664
7.32          33.0444
7.44          33.2858
7.56          33.3442
7.68          33.0472
 7.8           30.712
7.92          21.4486
8.04          9.26616
8.16          2.51007
8.28         0.383444
 8.4        0.0336024
8.52       0.00138178
8.64      6.28082e-05
8.76      6.28082e-05
8.88      6.28082e-05
   9      6.28082e-05
9.12                0
9.24      6.28082e-05
9.36      6.28082e-05
9.48      6.28082e-05
 9.6      6.28082e-05
9.72      6.28082e-05
9.84                0
9.96      6.28082e-05
10.08      6.28082e-05
10.2      6.28082e-05
10.32      6.28082e-05
10.44                0
10.56      6.28082e-05
10.68      6.28082e-05
10.8      6.28082e-05
10.92      6.28082e-05
11.04      6.28082e-05
11.16                0
11.28      6.28082e-05
11.4      6.28082e-05
11.52      6.28082e-05
11.64      6.28082e-05
11.76      6.28082e-05
11.88      6.28082e-05

得到 $\D \g^{\text{lrc}}=0.0282 \; \text{kcal/mol-}\AA^2 = 19.592 \; \text{mJ/m}^2$

代码

<table class="highlighttable"><th colspan="2" style="text-align:left">matlab</th><tr><td><div class="linenodiv" style="background-color: #f0f0f0; padding-right: 10px"><pre style="line-height: 125%"> 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</pre></div></td><td class="code"><div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%"><span style="color: #AA22FF; font-weight: bold">function</span> <span style="color: #00A000">GammaLRC</span> clc;

<span style="color: #AA22FF; font-weight: bold">global</span> <span style="color: #AA22FF">eps</span> sgm Rc A B D E pp

sgm = <span style="color: #666666">3.15</span>;              <span style="color: #008800; font-style: italic">% angstrom, TIP4P</span>
<span style="color: #AA22FF">eps</span> = <span style="color: #666666">0.185207656385689</span>; <span style="color: #008800; font-style: italic">% kcal/mol = 93.2kb</span>
Rc  = <span style="color: #666666">2.5*</span>sgm;

S = (sgm<span style="color: #666666">/</span>Rc)^<span style="color: #666666">6</span>;
A = <span style="color: #666666">6*</span><span style="color: #AA22FF">pi</span><span style="color: #666666">*</span><span style="color: #AA22FF">eps</span><span style="color: #666666">*</span>S<span style="color: #666666">*</span>(S<span style="color: #666666">-1</span>);
B = <span style="color: #666666">3*</span><span style="color: #AA22FF">pi</span><span style="color: #666666">*</span><span style="color: #AA22FF">eps</span><span style="color: #666666">*</span>Rc^<span style="color: #666666">2*</span>S<span style="color: #666666">*</span>(<span style="color: #666666">1-0.8*</span>S);
D = <span style="color: #666666">3.6*</span><span style="color: #AA22FF">pi</span><span style="color: #666666">*</span><span style="color: #AA22FF">eps</span><span style="color: #666666">*</span>sgm^<span style="color: #666666">12</span>;
E = <span style="color: #666666">-3*</span><span style="color: #AA22FF">pi</span><span style="color: #666666">*</span><span style="color: #AA22FF">eps</span><span style="color: #666666">*</span>sgm^<span style="color: #666666">6</span>;

[Z, R] = textread(<span style="color: #BB4444">&#39;</span>Rz.xvg<span style="color: #666666">&#39;</span>);
Z = Z<span style="color: #666666">*10</span>;
R = R<span style="color: #666666">/1000</span>;

Zmin = min(Z(:));
Zmax = max(Z(:));
pp = csape(Z,R, <span style="color: #BB4444">&#39;</span>second<span style="color: #666666">&#39;</span>,[<span style="color: #666666">0</span>,<span style="color: #666666">0</span>]);

<span style="color: #008800; font-style: italic">% xsp=Zmin:0.01:Zmax;</span> <span style="color: #008800; font-style: italic">% ysp=ppval(pp,xsp);</span> <span style="color: #008800; font-style: italic">% plot(Z,R,'o',xsp,ysp,'-')</span>

Glrc = quad2d(@PI, Zmin,Zmax, Zmin,Zmax, <span style="color: #008800; font-style: italic">...</span>
    <span style="color: #BB4444">&#39;</span>abstol<span style="color: #666666">&#39;</span>,<span style="color: #666666">1e-6</span>, <span style="color: #BB4444">&#39;</span>reltol<span style="color: #666666">&#39;</span>, <span style="color: #666666">1e-9</span>, <span style="color: #BB4444">&#39;</span>maxfunevals<span style="color: #666666">&#39;</span>, <span style="color: #666666">8000</span>, <span style="color: #008800; font-style: italic">...</span>
    <span style="color: #BB4444">&#39;</span>FailurePlot<span style="color: #666666">&#39;</span>,true, <span style="color: #BB4444">&#39;</span>Singular<span style="color: #666666">&#39;</span>,true)

<span style="color: #AA22FF; font-weight: bold">end</span> <span style="color: #008800; font-style: italic">%%</span> <span style="color: #AA22FF; font-weight: bold">function</span><span style="color: #bbbbbb"> </span>dPi =<span style="color: #bbbbbb"> </span><span style="color: #00A000">PI</span>(z1, z2)<span style="color: #bbbbbb"></span> <span style="color: #bbbbbb"> </span><span style="color: #AA22FF; font-weight: bold">global</span> Rc A B D E pp

Rz1 = ppval(pp, z1);
Rz2 = ppval(pp, z2);
ksi = <span style="color: #AA22FF">abs</span>(z1<span style="color: #666666">-</span>z2);

dPi = <span style="color: #AA22FF">zeros</span>(<span style="color: #AA22FF">size</span>(ksi));

idx = (<span style="color: #AA22FF">find</span>(ksi<span style="color: #666666">&lt;</span>=Rc));
dPi(idx) = (A<span style="color: #666666">*</span>ksi(idx)<span style="color: #666666">.^2+</span>B)<span style="color: #666666">.*</span>Rz1(idx)<span style="color: #666666">.*</span>Rz2(idx);

idx = (<span style="color: #AA22FF">find</span>(ksi<span style="color: #666666">&gt;</span>Rc));
dPi(idx) = ( D<span style="color: #666666">*</span>ksi(idx)<span style="color: #666666">.^</span>(<span style="color: #666666">-10</span>)<span style="color: #666666">+</span>E<span style="color: #666666">*</span>ksi(idx)<span style="color: #666666">.^</span>(<span style="color: #666666">-4</span>) )<span style="color: #666666">.*</span>Rz1(idx)<span style="color: #666666">.*</span>Rz2(idx);

<span style="color: #AA22FF; font-weight: bold">end</span> </pre></div> </td></tr></table>

评论