深度分析

氨基酸三维曲率计算公式

2022-09-23  本文已影响0人  晓柒NLP与药物设计

已知氨基酸X,Y,Z坐标

1. 利用切线,做小量近似,展开足够阶数

在三维坐标系中,对于两切线近似组成的平面,切线的方向向量为(1,\frac{dy}{dx},\frac{dz}{dx})

\cos \Delta \theta=\left(1, \frac{d y}{d x}, \frac{d z}{d x}\right)\left(1, \frac{d y}{d x}+\Delta\left(\frac{d y}{d x}\right), \frac{d z}{d x}+\Delta\left(\frac{d z}{d x}\right)\right) / \left (\bigg |\left(1, \frac{d y}{d x}, \frac{d z}{d x}\right)\bigg |\left|\left(1, \frac{d y}{d x}+\Delta\left(\frac{d y}{d x}\right), \frac{d z}{d x}+\Delta\left(\frac{d z}{d x}\right)\right)\right|\right)

设:
\begin{array}{l} \cos \Delta \theta=1-\Delta \theta^{2} / 2 \\ \Delta s=\sqrt{\Delta x^{2}+\Delta y^{2}+\Delta z^{2}} \end{array}
上式就等于:
\begin{array}{l} \left(1+\frac{d y}{d x}\left(\frac{d y}{d x}+\Delta\left(\frac{d y}{d x}\right)\right)+\frac{d z}{d x}\left(\frac{d z}{d x}+\Delta\left(\frac{d z}{d x}\right)\right)\right) /\left(\sqrt{1+\left(\frac{d y}{d x}\right)^{2}+\left(\frac{d z}{d x}\right)^{2}} \sqrt{1+\left(\frac{d y}{d x}+\Delta \frac{d y}{d x}\right)^{2}+\left(\frac{d z}{d x}+\Delta \frac{d z}{d x}\right)^{2}}\right) \end{array}
小量展开:

\begin{array}{l} 1+\frac{d y}{d x}\left(\frac{d y}{d x}+\Delta\left(\frac{d y}{d x}\right)\right)+\frac{d z}{d x}\left(\frac{d z}{d x}+\Delta\left(\frac{d z}{d x}\right)\right)=1+\left(\frac{d y}{d x}\right)^{2}+\left(\frac{d z}{d x}\right)^{2}+\frac{1}{2} \Delta\left(\left(\frac{d y}{d x}\right)^{2}+\left(\frac{d z}{d x}\right)^{2}\right)\\ \sqrt{1+\left(\frac{d y}{d x}+\Delta \frac{d y}{d x}\right)^{2}+\left(\frac{d z}{d x}+\Delta \frac{d z}{d x}\right)^{2}}=\sqrt{1+\left(\frac{d y}{d x}\right)^{2}+\left(\frac{d z}{d x}\right)^{2}+\Delta\left(\left(\frac{d y}{d x}\right)^{2}+\left(\frac{d z}{d x}\right)^{2}\right)+\left(\left(\Delta \frac{d y}{d x}\right)^{2}+\left(\Delta \frac{d z}{d x}\right)^{2}\right)} \end{array}

其中:
1 / \sqrt{1+\left(\frac{d y}{d x}+\Delta \frac{d y}{d x}\right)^{2}+\left(\frac{d z}{d x}+\Delta \frac{d z}{d x}\right)^{2}} =\frac{1}{\sqrt{1+\left(\frac{d y}{d x}\right)^{2}+\left(\frac{d z}{d x}\right)^{2}}}\left\{1-\frac{1}{2} \frac{\bigg [\left.\Delta\left(\left(\frac{d y}{d x}\right)^{2}+\left(\frac{d z}{d x}\right)^{2}\right)+\left(\left(\Delta \frac{d y}{d x}\right)^{2}+\left(\Delta \frac{d z}{d x}\right)^{2}\right)\right]}{1+\left(\frac{d y}{d x}\right)^{2}+\left(\frac{d z}{d x}\right)^{2}}+ \frac{3}{8}\left(\frac{\left.\left(\Delta\left(\left(\frac{d y}{d x}\right)^{2}+\left(\frac{d z}{d x}\right)^{2}\right.\right)\right)}{1+\left(\frac{d y}{d x}\right)^{2}+\left(\frac{d z}{d x}\right)^{2}}\right)^{2}\right\}

并且:
\begin{array}{l} \begin{array}{l} 1-\Delta \theta^{2} / 2 \\ =\left[1+\frac{1}{2} \frac{\Delta\left(\left(\frac{d y}{d x}\right)^{2}+\left(\frac{d z}{d x}\right)^{2}\right)}{1+\left(\frac{d y}{d x}\right)^{2}+\left(\frac{d z}{d x}\right)^{2}}\right] \end{array}\\ \left\{1-\frac{1}{2} \frac{\left[\Delta\left(\left(\frac{d y}{d x}\right)^{2}+\left(\frac{d z}{d x}\right)^{2}\right)+\left(\left(\Delta \frac{d y}{d x}\right)^{2}+\left(\Delta \frac{d z}{d x}\right)^{2}\right)\right]}{1+\left(\frac{d y}{d x}\right)^{2}+\left(\frac{d z}{d x}\right)^{2}}+\frac{3}{8} \frac{\left(\Delta\left(\left(\frac{d y}{d x}\right)^{2}+\left(\frac{d z}{d x}\right)^{2}\right)\right)^{2}}{\left(1+\left(\frac{d y}{d x}\right)^{2}+\left(\frac{d z}{d x}\right)^{2}\right)^{2}}\right\}\\ =1-\frac{1}{4}\left(\frac{\left.\Delta\left(\left(\frac{d y}{d x}\right)^{2}+\left(\frac{d z}{d x}\right)^{2}\right)\right)^{2}}{1+\left(\frac{d y}{d x}\right)^{2}+\left(\frac{d z}{d x}\right)^{2}}\right)^{-\frac{1}{2}} \frac{\left(\Delta \frac{d y}{d x}\right)^{2}+\left(\Delta \frac{d z}{d x}\right)^{2}}{1+\left(\frac{d y}{d x}\right)^{2}+\left(\frac{d z}{d x}\right)^{2}}+\frac{3}{8} \frac{\left(\Delta\left(\left(\frac{d y}{d x}\right)^{2}+\left(\frac{d z}{d x}\right)^{2}\right)\right)^{2}}{\left(1+\left(\frac{d y}{d x}\right)^{2}+\left(\frac{d z}{d x}\right)^{2}\right)^{2}}\\ =1-\frac{1}{2} \frac{\left(\Delta \frac{d y}{d x}\right)^{2}+\left(\Delta \frac{d z}{d x}\right)^{2}}{1+\left(\frac{d y}{d x}\right)^{2}+\left(\frac{d z}{d x}\right)^{2}}+\frac{1}{8} \frac{\left(\Delta\left(\left(\frac{d y}{d x}\right)^{2}+\left(\frac{d z}{d x}\right)^{2}\right)\right)^{2}}{\left(1+\left(\frac{d y}{d x}\right)^{2}+\left(\frac{d z}{d x}\right)^{2}\right)^{2}} \end{array}
故:
\begin{array}{l} \Delta \theta^{2}=\frac{\left(\Delta \frac{d y}{d x}\right)^{2}+\left(\Delta \frac{d z}{d x}\right)^{2}}{1+\left(\frac{d y}{d x}\right)^{2}+\left(\frac{d z}{d x}\right)^{2}}-\frac{1}{4} \frac{\left(\Delta\left(\left(\frac{d y}{d x}\right)^{2}+\left(\frac{d z}{d x}\right)^{2}\right)\right)^{2}}{\left(1+\left(\frac{d y}{d x}\right)^{2}+\left(\frac{d z}{d x}\right)^{2}\right)^{2}}\\ =\frac{\left(\left(\Delta \frac{d y}{d x}\right)^{2}+\left(\Delta \frac{d z}{d x}\right)^{2}\right)\left(1+\left(\frac{d y}{d x}\right)^{2}+\left(\frac{d z}{d x}\right)^{2}\right)-\frac{1}{4}\left(\Delta\left(\left(\frac{d y}{d x}\right)^{2}+\left(\frac{d z}{d x}\right)^{2}\right)\right)^{2}}{\left(1+\left(\frac{d y}{d x}\right)^{2}+\left(\frac{d z}{d x}\right)^{2}\right)^{2}}\\ =\frac{\left(\left(\Delta \frac{d y}{d x}\right)^{2}+\left(\Delta \frac{d z}{d x}\right)^{2}\right)+\left(\left(\Delta \frac{d y}{d x}\right)^{2}+\left(\Delta \frac{d z}{d x}\right)^{2}\right)\left(\left(\frac{d y}{d x}\right)^{2}+\left(\frac{d z}{d x}\right)^{2}\right)-\left(\frac{d y}{d x} \Delta \frac{d y}{d x}+\frac{d z}{d x} \Delta \frac{d z}{d x}\right)^{2}}{\left(1+\left(\frac{d y}{d x}\right)^{2}+\left(\frac{d z}{d x}\right)^{2}\right)^{2}}\\ =\frac{\left(\Delta \frac{d y}{d x}\right)^{2}+\left(\Delta \frac{d z}{d x}\right)^{2}+\left(\Delta \frac{d y}{d x}\right)^{2}\left(\frac{d z}{d x}\right)^{2}+\left(\Delta \frac{d z}{d x}\right)^{2}\left(\frac{d y}{d x}\right)^{2}-2\left(\frac{d y}{d x} \Delta \frac{d y}{d x}\right)\left(\frac{d z}{d x} \Delta \frac{d z}{d x}\right)}{\left(1+\left(\frac{d y}{d x}\right)^{2}+\left(\frac{d z}{d x}\right)^{2}\right)^{2}}\\ =\frac{\left(\Delta \frac{d y}{d x}\right)^{2}+\left(\Delta \frac{d z}{d x}\right)^{2}+\left(\left(\Delta \frac{d y}{d x}\right)\left(\frac{d z}{d x}\right)-\left(\Delta \frac{d z}{d x}\right)\left(\frac{d y}{d x}\right)\right)^{2}}{\left(1+\left(\frac{d y}{d x}\right)^{2}+\left(\frac{d z}{d x}\right)^{2}\right)^{2}} \end{array}

可得:
\begin{array}{l} \Delta \frac{d y}{d x} / \Delta t=\frac{y^{\prime \prime} x^{\prime}-x^{\prime \prime} y^{\prime}}{x^{\prime 2}}\\ \end{array}

\begin{array}{l} \frac{\Delta \theta}{\Delta s}=\sqrt{\frac{\left(\Delta \frac{d y}{d x}\right)^{2}+\left(\Delta \frac{d z}{d x}\right)^{2}+\left(\left(\Delta \frac{d y}{d x}\right)\left(\frac{d z}{d x}\right)-\left(\Delta \frac{d z}{d x}\right)\left(\frac{d y}{d x}\right)\right)^{2}}{\left(1+\left(\frac{d y}{d x}\right)^{2}+\left(\frac{d z}{d x}\right)^{2}\right)^{2}} / \sqrt{\Delta x^{2}+\Delta y^{2}+\Delta z^{2}}} \\ =\sqrt{\left(\frac{y^{\prime \prime} x^{\prime}-x^{\prime \prime} y^{\prime}}{x^{\prime 2}}\right)^{2}+\left(\frac{z^{\prime \prime} x^{\prime}-x^{\prime \prime} z^{\prime}}{x^{\prime 2}}\right)^{2}+\left(\left(\frac{y^{\prime \prime} x^{\prime}-x^{\prime \prime} y^{\prime}}{x^{\prime 2}}\right)\left(\frac{z^{\prime}}{x^{\prime}}\right)-\left(\frac{z^{\prime \prime} x^{\prime}-x^{\prime \prime} z^{\prime}}{x^{\prime 2}}\right)\left(\frac{y^{\prime}}{x^{\prime}}\right)\right)^{2}} /\left(\left(1+\left(\frac{y^{\prime}}{x^{\prime}}\right)^{2}+\left(\frac{z^{\prime}}{x^{\prime}}\right)^{2}\right)^{2}*\Delta s\right)\\ =\sqrt{\left(y^{\prime \prime} x^{\prime}-x^{\prime \prime} y^{\prime}\right)^{2}+\left(z^{\prime \prime} x^{\prime}-x^{\prime \prime} z^{\prime}\right)^{2}+\left(\left(y^{\prime \prime} x^{\prime}-x^{\prime \prime} y^{\prime}\right)\left(\frac{z^{\prime}}{x^{\prime}}\right)-\left(z^{\prime \prime} x^{\prime}-x^{\prime \prime} z^{\prime}\right)\left(\frac{y^{\prime}}{x^{\prime}}\right)\right)^{2}} /\left(x^{\prime 2}+y^{\prime 2}+z^{\prime 2}\right)^{3 / 2} \\ =\sqrt{\left(y^{\prime \prime} x^{\prime}-x^{\prime \prime} y^{\prime}\right)^{2}+\left(z^{\prime \prime} x^{\prime}-x^{\prime \prime} z^{\prime}\right)^{2}+\left(y^{\prime \prime} z^{\prime}-z^{\prime \prime} y^{\prime}\right)^{2}} /\left(x^{\prime 2}+y^{\prime 2}+z^{\prime 2}\right)^{3 / 2} \end{array}

2. 利用方向向量

d s=\sqrt{d x^{2}+d y^{2}+d z^{2}}, s^{\prime}=\sqrt{x^{\prime 2}+y^{\prime 2}+z^{\prime 2}}, \frac{1}{R}=\frac{d \theta}{d s}=\frac{\theta^{\prime}}{s^{\prime}}

\begin{array}{l} \vec{a}=\left(\frac{d x}{d s}, \frac{d y}{d s}, \frac{d z}{d s}\right)=\left(\frac{x^{\prime}}{s^{\prime}}, \frac{y^{\prime}}{s^{\prime}}, \frac{z^{\prime}}{s^{\prime}}\right),|\vec{a}|=1,|d \vec{a}|=d \theta, \\ |d \vec{a}|=\left|d\left(\frac{d x}{d s}, \frac{d y}{d s}, \frac{d z}{d s}\right)\right|=\left|\left(d \frac{d x}{d s}, d \frac{d y}{d s}, d \frac{d z}{d s}\right)\right|=\sqrt{\left(d \frac{x^{\prime}}{s^{\prime}}\right)^{2}+\left(d \frac{y^{\prime}}{s^{\prime}}\right)^{2}+\left(d \frac{z^{\prime}}{s^{\prime}}\right)^{2}}, \\ \theta^{\prime}=\sqrt{\left(\frac{x^{\prime}}{s^{\prime}}\right)^{\prime 2}+\left(\frac{y^{\prime}}{s^{\prime}}\right)^{\prime 2}+\left(\frac{z^{\prime}}{s^{\prime}}\right)^{\prime 2}}, \\ \end{array}

可得:
\begin{array}{l} \left(\frac{x^{\prime}}{s^{\prime}}\right)^{\prime}=\frac{x^{\prime \prime} s^{\prime}-x^{\prime} s^{\prime \prime}}{s^{\prime 2}},\\ s^{\prime \prime}=\frac{2 s^{\prime} s^{\prime \prime}}{2 s^{\prime}}=\frac{\left(s^{\prime 2}\right)^{\prime}}{2 s^{\prime}}=\frac{\left(x^{\prime 2}+y^{\prime 2}+z^{\prime 2}\right)^{\prime}}{2 s^{\prime}}=\frac{x^{\prime} x^{\prime \prime}+y^{\prime} y^{\prime \prime}+z^{\prime} z^{\prime \prime}}{s^{\prime}},\\ \theta^{\prime}=\sqrt{\left(\frac{x^{\prime \prime} s^{\prime}-x^{\prime} s^{\prime \prime}}{s^{\prime 2}}\right)^{2}+\left(\frac{y^{\prime \prime} s^{\prime}-y^{\prime} s^{\prime \prime}}{s^{\prime 2}}\right)^{2}+\left(\frac{z^{\prime \prime} s^{\prime}-z^{\prime} s^{\prime \prime}}{s^{\prime 2}}\right)^{2}},\\ =\frac{\sqrt{\left(x^{\prime \prime} s^{\prime}-x^{\prime} s^{\prime \prime}\right)^{2}+\left(y^{\prime \prime} s^{\prime}-y^{\prime} s^{\prime \prime}\right)^{2}+\left(z^{\prime \prime} s^{\prime}-z^{\prime} s^{\prime \prime}\right)^{2}}}{s^{\prime 2}}\\ \left(x^{\prime \prime} s^{\prime 2}-x^{\prime} s^{\prime} s^{\prime \prime}\right)^{2}=s^{\prime 4} x^{\prime \prime 2}+x^{\prime 2}\left(s^{\prime} s^{\prime \prime}\right)^{2}-2 x^{\prime} x^{\prime \prime} s^{\prime 2}\left(s^{\prime} s^{\prime \prime}\right),\\ \theta^{\prime}=\frac{\sqrt{s^{\prime 2}\left(x^{\prime \prime 2}+x^{\prime \prime 2}+x^{\prime 2}\right)+\left(x^{\prime 2}+x^{\prime 2}+x^{\prime 2}\right) s^{\prime 2}-2 x\left(x^{\prime \prime}+x^{\prime} x^{\prime \prime}+x^{\prime} x^{\prime \prime}\right)\left(s^{\prime} s^{\prime \prime}\right)}}{s^{\prime 2}}\\ =\frac{\sqrt{\left.s^{\prime 2}\left(x^{\prime \prime 2}+x^{\prime \prime 2}+x^{\prime \prime 2}\right)+s^{\prime 2} s^{\prime 2}-2 s^{\prime} s^{\prime \prime}\left(s^{\prime} s^{\prime \prime}\right)\right)}}{s^{\prime 2}}\\ =\frac{\sqrt{s^{\prime 2}\left(x^{\prime \prime 2}+x^{\prime 2}+x^{\prime 2}\right)-\left(s^{\prime} s^{\prime \prime}\right)^{2}}}{s^{\prime 2}}\\ =\frac{\sqrt{s^{\prime 2}\left(x^{\prime \prime 2}+x^{\prime 2}+x^{\prime \prime 2}\right)-\left(x^{\prime} x^{\prime \prime}+y^{\prime} y^{\prime \prime}+z^{\prime} z^{\prime \prime}\right)^{2}}}{s^{\prime 2}} \end{array}
即最终结论:
\begin{array}{l} \theta^{\prime}=\frac{\sqrt{\left(x^{\prime \prime} y^{\prime}-y^{\prime \prime} x^{\prime}\right)^{2}+\left(y^{\prime \prime} z^{\prime}-z^{\prime \prime} y^{\prime}\right)+\left(z^{\prime \prime} x^{\prime}-x^{\prime \prime} z^{\prime}\right)^{2}}}{s^{\prime 2}} \\ \frac{1}{R}=\frac{d \theta}{d s}=\frac{\sqrt{\left(x^{\prime \prime} y^{\prime}-y^{\prime \prime} x^{\prime}\right)^{2}+\left(y^{\prime \prime} z^{\prime}-z^{\prime \prime} y^{\prime}\right)+\left(z^{\prime \prime} x^{\prime}-x^{\prime \prime} z^{\prime}\right)^{2}}}{s^{\prime 3}} \end{array}

for i in X_train:
    x = i[:,1].cpu()
    x1 = np.gradient(x)
    x2 = np.gradient(x1)
    y = i[:,2].cpu()
    y1 = np.gradient(y)
    y2 = np.gradient(y1)
    z = i[:,3].cpu()
    z1 = np.gradient(z)
    z2 = np.gradient(z1)
    r2 = np.sqrt((y1*z2-z1*y2)**2+(z1*x2-x1*z2)**2+(x1*y2-x2*y1)**2)/((np.sqrt(x1**2+y1**2+z1**2))**3)
# 直接莽
上一篇下一篇

猜你喜欢

热点阅读