<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.10.0">Jekyll</generator><link href="https://jinleiphys.github.io/feed.xml" rel="self" type="application/atom+xml" /><link href="https://jinleiphys.github.io/" rel="alternate" type="text/html" /><updated>2026-06-25T18:20:48-07:00</updated><id>https://jinleiphys.github.io/feed.xml</id><title type="html">Jin Lei’s personal page</title><subtitle>personal description</subtitle><author><name>Jin Lei</name><email>jinl@tongji.edu.cn</email></author><entry><title type="html">搭建个人wiki百科</title><link href="https://jinleiphys.github.io/posts/2020/07/wiki/" rel="alternate" type="text/html" title="搭建个人wiki百科" /><published>2020-07-08T00:00:00-07:00</published><updated>2020-07-08T00:00:00-07:00</updated><id>https://jinleiphys.github.io/posts/2020/07/wiki</id><content type="html" xml:base="https://jinleiphys.github.io/posts/2020/07/wiki/"><![CDATA[<p>在日程的工作中，我对wiki百科的依赖性非常大，尤其是要查某些物理概念的定义的时候。但是过段时间回国后可能就面临着告别wiki的尴尬局面。 因此我想着能不能把wiki百科整个下载下来，放在自己的服务器上面运行。因为wiki本身是开源的，所以可行性非常的高。 通过查找我发现，整个wiki英文版的备份也是能够下载到的。</p>

<p>首先下载wiki的源程序，通过git下载方便随时更新wiki的最新版</p>

<p>git clone https://phabricator.wikimedia.org/source/mediawiki.git</p>

<p>同样wiki的设置需要以下的环境pache + MySQL + PHP，把wiki的源程序软链接到/var/www/html/文件下即在网页中流量。打开网页，根据提示设置各个参数即可。</p>

<p>设置好之后我们得到一个空的wiki百科，没有任何内容，那么下一步就是下载英文wiki百科的备份，并载入这个空的wiki百科中。</p>

<p>下载XML格式的wiki备份，https://dumps.wikimedia.org/enwiki/ , 可以看到最新的wiki整个备份压缩后是17.2GB，解压后大概80GB。</p>

<p>那么下一步就是把解压后的wiki备份文件载入我刚才搭建好的wiki中， 在mediawiki/maintenance/文件夹下运行</p>

<p>sudo php importDump.php –conf ../LocalSettings.php /media/jin/code/wikidata/enwiki-20200701-pages-articles-multistream.xml –username-prefix=””</p>

<p>/media/jin/code/wikidata/enwiki-20200701-pages-articles-multistream.xml 是解压好的wiki备份文件所在的位置</p>

<p>这个过程及其的漫长…………..</p>

<p>结束之后，需要更新wiki百科的网页，运行</p>

<p>php rebuildrecentchanges.php</p>

<p>php initSiteStats.php</p>

<p>最后给出个没有导入完全的wiki测试地址，有效期大约1天。。。</p>]]></content><author><name>Jin Lei</name><email>jinl@tongji.edu.cn</email></author><category term="树莓派" /><summary type="html"><![CDATA[在日程的工作中，我对wiki百科的依赖性非常大，尤其是要查某些物理概念的定义的时候。但是过段时间回国后可能就面临着告别wiki的尴尬局面。 因此我想着能不能把wiki百科整个下载下来，放在自己的服务器上面运行。因为wiki本身是开源的，所以可行性非常的高。 通过查找我发现，整个wiki英文版的备份也是能够下载到的。]]></summary></entry><entry><title type="html">使用树莓派搭建个人网盘owncloud</title><link href="https://jinleiphys.github.io/posts/2020/07/pi/" rel="alternate" type="text/html" title="使用树莓派搭建个人网盘owncloud" /><published>2020-07-07T00:00:00-07:00</published><updated>2020-07-07T00:00:00-07:00</updated><id>https://jinleiphys.github.io/posts/2020/07/owncloud</id><content type="html" xml:base="https://jinleiphys.github.io/posts/2020/07/pi/"><![CDATA[<p>由于快要回国的原因，基本上要告别了我最爱的dropbox网盘，但是国内又没有好的替代产品。特别是某度网盘服务奇差，速度极慢。基于以上的原因我打算自己搭建一个个人网盘系统。</p>

<p>服务器：树莓派 4</p>

<p>操作系统：Raspberry Pi OS</p>

<p>使用树莓派的原因是省电，而且它本身只有卡片大小，携带方便。树莓派的设置非常方便，在没有外接显示器的情况下，我们可以通过ssh链接。初始化的时候，需要在操作系统盘写入空白ssh文件以激活ssh服务。 树莓派系统默认的用户名：pi 密码：raspberry</p>

<p>对于个人网盘的搭建，我选择owncloud, 它本身是开源的，可以在github上下载到源代码，而且对各个平台的支持非常全面，安卓手机，苹果手机，linux，mac等都有客户端支持。</p>

<p>owncloud的设置需要以下的环境Apache + MySQL + PHP</p>

<p>Apache是最常用的网页服务器软件， 在树莓派上安装Apache2，只需要运行</p>

<p>sudo apt install apache2 -y</p>

<p>默认的网页储存在/var/www/html 文件夹下，在浏览器上输入树莓派的ip地址就可以看到这个默认的网页，比如 （http://192.168.1.126）</p>

<p>安装php需要运行</p>

<p>sudo apt install php -y</p>

<p>安装MySQL (MariaDB Server)</p>

<p>sudo apt install mariadb-server php-mysql -y</p>

<p>重启Apache服务</p>

<p>sudo service apache2 restart</p>

<p>下载ownclound源程序并软链接到/var/www/html文件夹下</p>

<p>ln -s /media/usb1/code/owncloud/core owncloud</p>

<p>在浏览器中打开 http://192.168.1.126/owncloud/index.php 进行配置</p>

<p>由于我家里的电脑没有公网IP,因此需要进行内网穿透，在这里选取ngrok工具。</p>

<p>免费版本的ngrok没办法后台运行，为了解决这个问题，可以使用screen这个命令</p>

<p>首先安装screen</p>

<p> apt-get install screen</p>

<p>之后运行</p>

<p>  screen -S 任意名字（例如：keepngork）</p>

<p>然后运行ngrok启动命令</p>

<p>最后按快捷键</p>

<p> ctrl+A+D</p>

<p>最后贴出一个测试的网址，由于使用的是免费的ngrok,所以不知道链接什么时候会失效，链接在阅读原文可以找到</p>

<p>用户名：test
密码：test</p>]]></content><author><name>Jin Lei</name><email>jinl@tongji.edu.cn</email></author><category term="树莓派" /><summary type="html"><![CDATA[由于快要回国的原因，基本上要告别了我最爱的dropbox网盘，但是国内又没有好的替代产品。特别是某度网盘服务奇差，速度极慢。基于以上的原因我打算自己搭建一个个人网盘系统。]]></summary></entry><entry><title type="html">nonlocal potential的解法</title><link href="https://jinleiphys.github.io/posts/2020/06/nonlocalpot/" rel="alternate" type="text/html" title="nonlocal potential的解法" /><published>2020-06-13T00:00:00-07:00</published><updated>2020-06-13T00:00:00-07:00</updated><id>https://jinleiphys.github.io/posts/2020/06/nonlocalpot</id><content type="html" xml:base="https://jinleiphys.github.io/posts/2020/06/nonlocalpot/"><![CDATA[<p>最近做的项目中需要解一个包含nonlocal potential的薛定谔方程。 但是在通过使用R-matrix方法求解方程的时候发现得到的结果与把该nonlocal potential傅里叶变换到动量空间下求解的结果不一致。这个问题困扰了长达一个月的时间，通过查找文献我发现了一个比较有趣的现象，不同的文章对包含nonlocal potential的薛定谔方程定义都不一样。 比如， 在文章ANNALS OF PHYSICS 59, 219-247 (1970)中，方程被定义为</p>

<p><a href="https://www.codecogs.com/eqnedit.php?latex=\left[\frac{d^{2}}{d&space;r^{2}}&plus;k^{2}-\frac{l(l&plus;1)}{r^{2}}\right]&space;\psi_{l}(k,&space;r)=\int_{0}^{\infty}&space;V\left(r,&space;r^{\prime}\right)&space;\psi_{2}\left(k,&space;r^{\prime}\right)&space;d&space;r^{\prime}" target="_blank"><img src="https://latex.codecogs.com/gif.latex?\left[\frac{d^{2}}{d&space;r^{2}}&plus;k^{2}-\frac{l(l&plus;1)}{r^{2}}\right]&space;\psi_{l}(k,&space;r)=\int_{0}^{\infty}&space;V\left(r,&space;r^{\prime}\right)&space;\psi_{2}\left(k,&space;r^{\prime}\right)&space;d&space;r^{\prime}" title="\left[\frac{d^{2}}{d r^{2}}+k^{2}-\frac{l(l+1)}{r^{2}}\right] \psi_{l}(k, r)=\int_{0}^{\infty} V\left(r, r^{\prime}\right) \psi_{2}\left(k, r^{\prime}\right) d r^{\prime}" /></a></p>

<p>在文章 PHYSICAL REVIEW C 98, 044621 (2018)中，方程被定义为</p>

<p><a href="https://www.codecogs.com/eqnedit.php?latex=\left(T_{l_{p}}-E\right)&space;\chi_{p}^{l_{p}}(r)=\int_{0}^{\infty}&space;\chi_{p}^{l_{p}}\left(r^{\prime}\right)&space;U_{\mathrm{Ap}}\left(r,&space;r^{\prime}\right)&space;r^{\prime&space;2}&space;d&space;r^{\prime}" target="_blank"><img src="https://latex.codecogs.com/gif.latex?\left(T_{l_{p}}-E\right)&space;\chi_{p}^{l_{p}}(r)=\int_{0}^{\infty}&space;\chi_{p}^{l_{p}}\left(r^{\prime}\right)&space;U_{\mathrm{Ap}}\left(r,&space;r^{\prime}\right)&space;r^{\prime&space;2}&space;d&space;r^{\prime}" title="\left(T_{l_{p}}-E\right) \chi_{p}^{l_{p}}(r)=\int_{0}^{\infty} \chi_{p}^{l_{p}}\left(r^{\prime}\right) U_{\mathrm{Ap}}\left(r, r^{\prime}\right) r^{\prime 2} d r^{\prime}" /></a></p>

<p>然而在文章Computer Physics Communications 254, 107340(2020)中，方程被定义为</p>

<p><a href="https://www.codecogs.com/eqnedit.php?latex=-\frac{\hbar^{2}}{2&space;\mu}\left[\frac{d^{2}}{d&space;r^{2}}-\frac{l(l&plus;1)}{r^{2}}\right]&space;f_{l&space;j}(k,&space;r)&plus;V_{C}(r)&space;f_{l&space;j}(k,&space;r)&plus;r&space;\int_{0}^{\infty}&space;\nu_{l&space;j}\left(r,&space;r^{\prime}&space;;&space;E\right)&space;f_{l&space;j}\left(k,&space;r^{\prime}\right)&space;r^{\prime}&space;\mathrm{d}&space;r^{\prime}=E&space;f_{l&space;j}(k,&space;r)" target="_blank"><img src="https://latex.codecogs.com/gif.latex?-\frac{\hbar^{2}}{2&space;\mu}\left[\frac{d^{2}}{d&space;r^{2}}-\frac{l(l&plus;1)}{r^{2}}\right]&space;f_{l&space;j}(k,&space;r)&plus;V_{C}(r)&space;f_{l&space;j}(k,&space;r)&plus;r&space;\int_{0}^{\infty}&space;\nu_{l&space;j}\left(r,&space;r^{\prime}&space;;&space;E\right)&space;f_{l&space;j}\left(k,&space;r^{\prime}\right)&space;r^{\prime}&space;\mathrm{d}&space;r^{\prime}=E&space;f_{l&space;j}(k,&space;r)" title="-\frac{\hbar^{2}}{2 \mu}\left[\frac{d^{2}}{d r^{2}}-\frac{l(l+1)}{r^{2}}\right] f_{l j}(k, r)+V_{C}(r) f_{l j}(k, r)+r \int_{0}^{\infty} \nu_{l j}\left(r, r^{\prime} ; E\right) f_{l j}\left(k, r^{\prime}\right) r^{\prime} \mathrm{d} r^{\prime}=E f_{l j}(k, r)" /></a></p>

<p>可以看到上述几个文献中，给出的nonlocal方程在积分项上有分歧。</p>

<p>为了检验上述的几个方程，我们首先来看一下nonlocal potential的单位为何。原则上nonlocal potential应该与local potential的单位一致，对于local potential</p>

<p><a href="https://www.codecogs.com/eqnedit.php?latex=V(r,r')=V(r)&space;\frac{\delta(r-r'))}{rr'}" target="_blank"><img src="https://latex.codecogs.com/gif.latex?V(r,r')=V(r)&space;\frac{\delta(r-r'))}{rr'}" title="V(r,r')=V(r) \frac{\delta(r-r'))}{rr'}" /></a></p>

<p>它的单位为 MeV fm^{-3}， 也就是说通过积分运算之后nonlocal potential的单位应该与动能的单位一致，即MeV， 也就是说积分项本身要因为的单位为fm^3。 按照这个定义，我们可以排除第一个方程。 对于第二个和第三个方程哪个是正确的，我们先不讨论。 我们先回到R-matrix方法中。对于Lagrange函数的定义</p>

<p><a href="https://www.codecogs.com/eqnedit.php?latex=\varphi_{i}(r)=(-1)^{N&plus;i}&space;\frac{r}{a&space;x_{i}}&space;\sqrt{a&space;x_{i}\left(1-x_{i}\right)&space;\frac{P_{N}(2&space;r&space;/&space;a-1)}{r-a&space;x_{i}}}" target="_blank"><img src="https://latex.codecogs.com/gif.latex?\varphi_{i}(r)=(-1)^{N&plus;i}&space;\frac{r}{a&space;x_{i}}&space;\sqrt{a&space;x_{i}\left(1-x_{i}\right)&space;\frac{P_{N}(2&space;r&space;/&space;a-1)}{r-a&space;x_{i}}}" title="\varphi_{i}(r)=(-1)^{N+i} \frac{r}{a x_{i}} \sqrt{a x_{i}\left(1-x_{i}\right) \frac{P_{N}(2 r / a-1)}{r-a x_{i}}}" /></a></p>

<p>以及</p>

<p><a href="https://www.codecogs.com/eqnedit.php?latex=\left\langle\varphi_{i}&space;|&space;\varphi_{j}\right\rangle=\int_{0}^{a}&space;\varphi_{i}(r)&space;\varphi_{j}(r)&space;\mathrm{d}&space;r&space;\approx&space;\delta_{i&space;j}" target="_blank"><img src="https://latex.codecogs.com/gif.latex?\left\langle\varphi_{i}&space;|&space;\varphi_{j}\right\rangle=\int_{0}^{a}&space;\varphi_{i}(r)&space;\varphi_{j}(r)&space;\mathrm{d}&space;r&space;\approx&space;\delta_{i&space;j}" title="\left\langle\varphi_{i} | \varphi_{j}\right\rangle=\int_{0}^{a} \varphi_{i}(r) \varphi_{j}(r) \mathrm{d} r \approx \delta_{i j}" /></a></p>

<p>在Pierre最初的文章中，nonlocal potential被定义为</p>

<p><a href="https://www.codecogs.com/eqnedit.php?latex=\begin{aligned}&space;\left\langle\varphi_{i}\left|U_{\ell}\right|&space;\varphi_{j}\right\rangle&space;&amp;=\int_{0}^{a}&space;\varphi_{i}(r)&space;U_{\ell}\left(r,&space;r^{\prime}\right)&space;\varphi_{j}\left(r^{\prime}\right)&space;d&space;r&space;d&space;r^{\prime}&space;\\&space;&amp;&space;\approx&space;a&space;\sqrt{\lambda_{i}&space;\lambda_{j}}&space;U_{\ell}\left(a&space;x_{i},&space;a&space;x_{j}\right)&space;\end{aligned}" target="_blank"><img src="https://latex.codecogs.com/gif.latex?\begin{aligned}&space;\left\langle\varphi_{i}\left|U_{\ell}\right|&space;\varphi_{j}\right\rangle&space;&amp;=\int_{0}^{a}&space;\varphi_{i}(r)&space;U_{\ell}\left(r,&space;r^{\prime}\right)&space;\varphi_{j}\left(r^{\prime}\right)&space;d&space;r&space;d&space;r^{\prime}&space;\\&space;&amp;&space;\approx&space;a&space;\sqrt{\lambda_{i}&space;\lambda_{j}}&space;U_{\ell}\left(a&space;x_{i},&space;a&space;x_{j}\right)&space;\end{aligned}" title="\begin{aligned} \left\langle\varphi_{i}\left|U_{\ell}\right| \varphi_{j}\right\rangle &amp;=\int_{0}^{a} \varphi_{i}(r) U_{\ell}\left(r, r^{\prime}\right) \varphi_{j}\left(r^{\prime}\right) d r d r^{\prime} \\ &amp; \approx a \sqrt{\lambda_{i} \lambda_{j}} U_{\ell}\left(a x_{i}, a x_{j}\right) \end{aligned}" /></a></p>

<p><strong>但是</strong>，对于Lagrange函数的正交性我们看到这里定义的是一个一维的情况，而并非三维的情况。为了保证三维情况下，径向波函数的正交归一性， Lagrange函数可以被重新定义为</p>

<p><a href="https://www.codecogs.com/eqnedit.php?latex=\varphi_{i}(r)=\frac{1}{r}(-1)^{N&plus;i}&space;\frac{r}{a&space;x_{i}}&space;\sqrt{a&space;x_{i}\left(1-x_{i}\right)}&space;\frac{P_{N}(2&space;r&space;/&space;a-1)}{r-a&space;x_{i}}" target="_blank"><img src="https://latex.codecogs.com/gif.latex?\varphi_{i}(r)=\frac{1}{r}(-1)^{N&plus;i}&space;\frac{r}{a&space;x_{i}}&space;\sqrt{a&space;x_{i}\left(1-x_{i}\right)}&space;\frac{P_{N}(2&space;r&space;/&space;a-1)}{r-a&space;x_{i}}" title="\varphi_{i}(r)=\frac{1}{r}(-1)^{N+i} \frac{r}{a x_{i}} \sqrt{a x_{i}\left(1-x_{i}\right)} \frac{P_{N}(2 r / a-1)}{r-a x_{i}}" /></a></p>

<p>因为对于nonlocal potential项来说</p>

<p><a href="https://www.codecogs.com/eqnedit.php?latex=\begin{aligned}&space;\left\langle\varphi_{i}\left|U_{\ell}\right|&space;\varphi_{j}\right\rangle&space;&amp;=\int_{0}^{a}&space;r^2&space;r'^2&space;\varphi_{i}(r)&space;U_{\ell}\left(r,&space;r^{\prime}\right)&space;\varphi_{j}\left(r^{\prime}\right)&space;d&space;r&space;d&space;r^{\prime}&space;\\&space;&amp;&space;\approx&space;a^3x_ix_j&space;\sqrt{\lambda_{i}&space;\lambda_{j}}&space;U_{\ell}\left(a&space;x_{i},&space;a&space;x_{j}\right)&space;\end{aligned}" target="_blank"><img src="https://latex.codecogs.com/gif.latex?\begin{aligned}&space;\left\langle\varphi_{i}\left|U_{\ell}\right|&space;\varphi_{j}\right\rangle&space;&amp;=\int_{0}^{a}&space;r^2&space;r'^2&space;\varphi_{i}(r)&space;U_{\ell}\left(r,&space;r^{\prime}\right)&space;\varphi_{j}\left(r^{\prime}\right)&space;d&space;r&space;d&space;r^{\prime}&space;\\&space;&amp;&space;\approx&space;a^3x_ix_j&space;\sqrt{\lambda_{i}&space;\lambda_{j}}&space;U_{\ell}\left(a&space;x_{i},&space;a&space;x_{j}\right)&space;\end{aligned}" title="\begin{aligned} \left\langle\varphi_{i}\left|U_{\ell}\right| \varphi_{j}\right\rangle &amp;=\int_{0}^{a} r^2 r'^2 \varphi_{i}(r) U_{\ell}\left(r, r^{\prime}\right) \varphi_{j}\left(r^{\prime}\right) d r d r^{\prime} \\ &amp; \approx a^3x_ix_j \sqrt{\lambda_{i} \lambda_{j}} U_{\ell}\left(a x_{i}, a x_{j}\right) \end{aligned}" /></a></p>

<p>为了验证这个nonlocal项的正确性，我们先把nonlocal potential傅里叶变换到动量空间下求解，对于动量空间下potential是nonlocal，不管坐标空间的potential是local还是nonlocal。因此方便验证坐标空间下的求解是不是正确的，</p>

<p><img src="https://jinleiphys.github.io/files/nonlocal_wf.jpg" alt="" /></p>

<p>如上图所示，黑色的线是动量空间下求解的波函数，红色的线是用pierre文章中给出的公式，蓝色的虚线是改正后的nonlocal项。可以看见改正后的项与动量空间下的求解完全一致。</p>

<p>那么现在我们看一下F. PEREY and B. BUCK文章(Nuclear Physics 32 (1962) 353–380)中对nonlocal项的定于与求解为何呢？在其文章中</p>

<p><a href="https://www.codecogs.com/eqnedit.php?latex=g_{l}\left(r,&space;r^{\prime}\right)=2&space;\pi&space;r&space;r^{\prime}&space;U\left[\frac{1}{2}\left(r&plus;r^{\prime}\right)\right]&space;\int_{-1}^{&plus;1}&space;\frac{\exp&space;\left[-\left(\frac{\mathbf{r}-\mathbf{r}^{\prime}}{\beta}\right)^{2}\right]}{\pi^{\frac{3}{2}}&space;\beta^{3}}&space;P_{l}(\cos&space;\chi)&space;\mathrm{d}(\cos&space;\chi)" target="_blank"><img src="https://latex.codecogs.com/gif.latex?g_{l}\left(r,&space;r^{\prime}\right)=2&space;\pi&space;r&space;r^{\prime}&space;U\left[\frac{1}{2}\left(r&plus;r^{\prime}\right)\right]&space;\int_{-1}^{&plus;1}&space;\frac{\exp&space;\left[-\left(\frac{\mathbf{r}-\mathbf{r}^{\prime}}{\beta}\right)^{2}\right]}{\pi^{\frac{3}{2}}&space;\beta^{3}}&space;P_{l}(\cos&space;\chi)&space;\mathrm{d}(\cos&space;\chi)" title="g_{l}\left(r, r^{\prime}\right)=2 \pi r r^{\prime} U\left[\frac{1}{2}\left(r+r^{\prime}\right)\right] \int_{-1}^{+1} \frac{\exp \left[-\left(\frac{\mathbf{r}-\mathbf{r}^{\prime}}{\beta}\right)^{2}\right]}{\pi^{\frac{3}{2}} \beta^{3}} P_{l}(\cos \chi) \mathrm{d}(\cos \chi)" /></a></p>

<p>与Computer Physics Communications 254, 107340(2020)中的定义是一致的，也与改正后的Lagrange-Rmatrix一致</p>]]></content><author><name>Jin Lei</name><email>jinl@tongji.edu.cn</email></author><category term="物理笔记" /><summary type="html"><![CDATA[最近做的项目中需要解一个包含nonlocal potential的薛定谔方程。 但是在通过使用R-matrix方法求解方程的时候发现得到的结果与把该nonlocal potential傅里叶变换到动量空间下求解的结果不一致。这个问题困扰了长达一个月的时间，通过查找文献我发现了一个比较有趣的现象，不同的文章对包含nonlocal potential的薛定谔方程定义都不一样。 比如， 在文章ANNALS OF PHYSICS 59, 219-247 (1970)中，方程被定义为]]></summary></entry><entry><title type="html">几个帮助英文学术写作的小工具</title><link href="https://jinleiphys.github.io/posts/2020/04/english/" rel="alternate" type="text/html" title="几个帮助英文学术写作的小工具" /><published>2020-04-04T00:00:00-07:00</published><updated>2020-04-04T00:00:00-07:00</updated><id>https://jinleiphys.github.io/posts/2020/04/english</id><content type="html" xml:base="https://jinleiphys.github.io/posts/2020/04/english/"><![CDATA[<p>作为英文写作困难户的我，前段时间刷抖音，刷到一个神奇的英文写作工具介绍的短视频。我立刻觉得这是上天赐给我的解药，可以大大的缓解我写作的尴尬。</p>

<ul>
  <li>第一个工具是<a href="https://linggle.com">linggle</a>， 这是一个在线的平台，可以帮助查找英文短语的搭配。</li>
</ul>

<p><img src="https://jinleiphys.github.io/files/linggle1.jpeg" alt="" /></p>

<p>上图介绍了在linggle搜索短语搭配的几种方式。前段时间一直困惑in addition和in additional两种短语那个正确，多数人和我说没有in additional，于是尝试在上面搜索了一下</p>

<p><img src="https://jinleiphys.github.io/files/linggle2.jpeg" alt="" /></p>

<p>结果显示用法还是有的，不过要放在特定的语境里</p>

<ul>
  <li>
    <p>第二个工具是<a href="https://collocaid.uk/prototype/editor/public/home">collocaid</a>，这个工具和第一个工作很像，也是找到短语的固定搭配，但是个人感觉这个网站的实用性远远不如上面的那个网站。</p>
  </li>
  <li>
    <p>第三个工具是<a href="https://www.grammarly.com">grammarly</a>， 这是一个在线查找语法错误的平台。强烈推荐这个工具，我经常被合作者抱怨我写的内容有大量的语法错误，有了这个工具的帮助， 我希望能在正确的路上缓慢前行。</p>
  </li>
  <li>
    <p>第四个工具是<a href="https://jinleiphys.github.io/files/Academiv-Phrase-Bank.pdf">Manchester Academic Phrasebank</a>。这是一个非常实用的固定搭配数据库，我相信每个需要写论文的人都可以找这个数据库中找到合适的。比如下面的这组用法</p>
  </li>
</ul>

<p><img src="https://jinleiphys.github.io/files/1586035566777.jpg" alt="" /></p>]]></content><author><name>Jin Lei</name><email>jinl@tongji.edu.cn</email></author><category term="学术写作" /><summary type="html"><![CDATA[作为英文写作困难户的我，前段时间刷抖音，刷到一个神奇的英文写作工具介绍的短视频。我立刻觉得这是上天赐给我的解药，可以大大的缓解我写作的尴尬。]]></summary></entry><entry><title type="html">WKB近似</title><link href="https://jinleiphys.github.io/posts/2020/03/wkb/" rel="alternate" type="text/html" title="WKB近似" /><published>2020-03-30T00:00:00-07:00</published><updated>2020-03-30T00:00:00-07:00</updated><id>https://jinleiphys.github.io/posts/2020/03/wkb</id><content type="html" xml:base="https://jinleiphys.github.io/posts/2020/03/wkb/"><![CDATA[<p>来到Pisa之后主要的一个研究课题就是寻找半经典理论和量子理论的连接。主要的原因是我现在的老板Angela和她当年的博士导师发展了一套半经典的理论Bonaccorso-Brink理论来描述敲出(stripping)反应， 而我在博士期间使用了IAV模型即一种量子模型来解决同样的敲出反应。 那么来到这边之后主要的目的就是看看这两个模型有没有相连的地方。</p>

<p>Bonaccorso-Brink是一种转移到连续态的反应模型， 它本身是从Hasan和Brink转移到束缚态理论（<a href="https://jinleiphys.github.io/files/hasan1978.pdf">J. Phys. G 4 (1978) 1573</a>）的一种推广。在转移到束缚态理论中有两个重要的近似。 第一个就是球谐函数的渐进形式，之前已经讨论过了，这种近似的准确度非常的低；第二个就是WKB近似， 也是这里要讨论的内容。</p>

<p>在Brink一系列的半经典理论中的一个出发点就是WKB的分波展开，即<a href="https://jinleiphys.github.io/files/landowne1976.pdf">Nucl. Phys. A 259 (1976) 99-121</a>这篇文章中的Eq.(3.1)。</p>

<p>那么在这里主要验证一下，这个WKB近似和直接求解薛定谔方程有何区别， 这里我们主要考虑连续态波函数的情况。 首先我们考虑势能为零的情况，量子理论中我们知道这个是平面波的情况。Eq.(3.1) 变为</p>

<p><a href="https://www.codecogs.com/eqnedit.php?latex=\chi_0=\sin&space;\left(&space;k&space;{r}&plus;\frac{1}{4}&space;\pi\right)" target="_blank"><img src="https://latex.codecogs.com/gif.latex?\chi_0=\sin&space;\left(&space;k&space;{r}&plus;\frac{1}{4}&space;\pi\right)" title="\chi_0=\sin \left( k {r}+\frac{1}{4} \pi\right)" /></a></p>

<p>但是在量子理论中我们知道s-wave的平面波为spherical Bessel function</p>

<p><a href="https://www.codecogs.com/eqnedit.php?latex=j_{0}(x)=\sin&space;x" target="_blank"><img src="https://latex.codecogs.com/gif.latex?j_{0}(x)=\sin&space;x" title="j_{0}(x)=\sin x" /></a></p>

<p>可以看到中间差了1/4 pi这个系数</p>

<p>那么现在考虑只有p-wave的平面波，通过数值求解我们得到下面的结果
<img src="https://jinleiphys.github.io/files/planewave_wkb_1.png" alt="alt text" /></p>

<p>可以看到WKB近似与精确解相比有一个微小的相移(phase shift)。老板跟我说在半经典理论中，centrifugal barrier通常取以下的近似值(文献来源尚无考证)</p>

<p><a href="https://www.codecogs.com/eqnedit.php?latex=\frac{&space;l(l&plus;1)}{&space;r^{2}}&space;\to&space;\frac{\left(l&plus;\frac{1}{2}\right)^{2}}{&space;r^{2}}" target="_blank"><img src="https://latex.codecogs.com/gif.latex?\frac{&space;l(l&plus;1)}{&space;r^{2}}&space;\to&space;\frac{\left(l&plus;\frac{1}{2}\right)^{2}}{&space;r^{2}}" title="\frac{ l(l+1)}{ r^{2}} \to \frac{\left(l+\frac{1}{2}\right)^{2}}{ r^{2}}" /></a></p>

<p>把这个新的centrifugal barrier代入WKB计算，可以得到
<img src="https://jinleiphys.github.io/files/planewave_wkb_2.png" alt="alt text" /></p>

<p>可以看到除了经典的拐点之外，WKB的近似结果还是比较令人满意的。在测试中我测试过l=40的情况，结论是一致的,WKB是一个比较成功的近视。</p>

<p>那么下面我们做进一步的测试， 如果只加入库伦相互作用力会是什么样，我们假设z1=1, z2=1, Elab=160 MeV。数值计算结果如下</p>

<p><img src="https://jinleiphys.github.io/files/planewave_wkb_3.png" alt="alt text" /></p>

<p>可以看到在这里我们的结论基本与平面波一致，即除了s-wave以外的分波WKB与精确解基本一致。同样我们也测试到了l=40的情况。</p>

<p>那么接下来，我们测试一下一个real absorption势的情况，定义这个势具有以下的参数</p>

<p>&amp;POTENTIAL ptype=1 a1=0 a2=208 rc=1.3
            uv=77.3 av=0.77 rv=1.15 /</p>

<p>数值计算结果如下</p>

<p><img src="https://jinleiphys.github.io/files/planewave_wkb_4.png" alt="alt text" /></p>

<p>在这里，我们可以得到两个信息，</p>

<p>（1） WKB解与精确解在波函数幅度上存在一定的差别，这个差别除了s-wave之外是一致的；</p>

<p>（2）在小分波的时候，WKB与精确解的phase是一致的，但是当分波变大的时候明显存在相移，而且相移随着分波越大越明显。</p>

<p>上面的第一点可以从<a href="https://jinleiphys.github.io/files/landowne1976.pdf">Nucl. Phys. A 259 (1976) 99-121</a>的原文中得到解释，在Eq(2.6)中他们假设</p>

<p><a href="https://www.codecogs.com/eqnedit.php?latex=\chi_{l}(k,&space;r)=\sin&space;\left(k&space;r-\frac{1}{2}&space;\pi-\eta&space;\ln&space;(2&space;k&space;r)&plus;\sigma_{l}&plus;\delta_{l}\right)" target="_blank"><img src="https://latex.codecogs.com/gif.latex?\chi_{l}(k,&space;r)=\sin&space;\left(k&space;r-\frac{1}{2}&space;\pi-\eta&space;\ln&space;(2&space;k&space;r)&plus;\sigma_{l}&plus;\delta_{l}\right)" title="\chi_{l}(k, r)=\sin \left(k r-\frac{1}{2} \pi-\eta \ln (2 k r)+\sigma_{l}+\delta_{l}\right)" /></a></p>

<p>然而实际情况并非如此，波函数只是正比于上述的表达式。 那么第(2)条，我们如何来解释呢？</p>

<p>在和老板聊了之后发现，造成这样的原因就是势阱深度数值太大，uv=77.3 MeV，这个数值与Elab=160 MeV相差不多， 所以WKB在这里失效。。然并卵，按照这个逻辑， 那么WKB就不能应用到核反应才对， 因为大多数的情况势阱深度数值都很大！ 这个根本就说不通</p>]]></content><author><name>Jin Lei</name><email>jinl@tongji.edu.cn</email></author><category term="物理笔记" /><category term="半经典方法" /><summary type="html"><![CDATA[来到Pisa之后主要的一个研究课题就是寻找半经典理论和量子理论的连接。主要的原因是我现在的老板Angela和她当年的博士导师发展了一套半经典的理论Bonaccorso-Brink理论来描述敲出(stripping)反应， 而我在博士期间使用了IAV模型即一种量子模型来解决同样的敲出反应。 那么来到这边之后主要的目的就是看看这两个模型有没有相连的地方。]]></summary></entry><entry><title type="html">晕核散射的弥散度</title><link href="https://jinleiphys.github.io/posts/2020/03/diffuseness/" rel="alternate" type="text/html" title="晕核散射的弥散度" /><published>2020-03-16T00:00:00-07:00</published><updated>2020-03-16T00:00:00-07:00</updated><id>https://jinleiphys.github.io/posts/2020/03/diffuseness</id><content type="html" xml:base="https://jinleiphys.github.io/posts/2020/03/diffuseness/"><![CDATA[<p>前段时间，老板一直跟我吹嘘说她的半经典模型有多么的好用，在二十年前她用半经典模型预言了晕核散射的弥散度(diffuseness)(<a href="https://jinleiphys.github.io/files/Optical_potentials_of_halo_and_weakly_bound_nuclei.pdf">Nuclear Physics A 706 (2002) 322–334</a>)，这个结果在10年前的实验中得到了证明(<a href="https://jinleiphys.github.io/files/PhysRevLett105.022701.pdf">Phys. Rev. Lett. 105, 022701</a>)。</p>

<p>今天花了点时间看了一下，她的这篇文章。 这篇文章主要的内容是她把她和她博士导师发展那套半经典散射模型应用到了晕核参与的核反应中。在半经典模型，即eikonal模型中，散射的相移因子和光学势的虚部直接相关。 通过研究相移因子在核反应中的变化从而研究散射过程中截面和光学势虚部的依赖关系。</p>

<p>在这篇文章中， 她假设晕核核反应的光学势虚部由两部分组成，即体项（Volume）和表面项（surface）。这个附加的表面项体现了晕核束缚态波函数在坐标空间下长程的性质。通过她的模型分析，最终得到的结论是表面项的弥散度与晕核的束缚能直接相关,即</p>

<p><a href="https://www.codecogs.com/eqnedit.php?latex=a_s=\frac{\hbar}{2\sqrt{-2\mu&space;\varepsilon&space;_i}}" target="_blank"><img src="https://latex.codecogs.com/gif.latex?a_s=\frac{\hbar}{2\sqrt{-2\mu&space;\varepsilon&space;_i}}" title="a_s=\frac{\hbar}{2\sqrt{-2\mu \varepsilon _i}}" /></a></p>

<p>把上述公式代入晕核11Be参与的核反应中，我们得到</p>

<p><a href="https://www.codecogs.com/eqnedit.php?latex=a_s=\frac{197.3269718}{2\sqrt{2.*0.5*10*931.4932/11.}}\approx&space;3.39~\textrm{fm}" target="_blank"><img src="https://latex.codecogs.com/gif.latex?a_s=\frac{197.3269718}{2\sqrt{2.*0.5*10*931.4932/11.}}\approx&space;3.39~\textrm{fm}" title="a_s=\frac{197.3269718}{2\sqrt{2.*0.5*10*931.4932/11.}}\approx 3.39~\textrm{fm}" /></a></p>

<p>这个数值在误差范围内完全与后面PRL文章中的结果一致。</p>]]></content><author><name>Jin Lei</name><email>jinl@tongji.edu.cn</email></author><category term="物理笔记" /><category term="半经典方法" /><summary type="html"><![CDATA[前段时间，老板一直跟我吹嘘说她的半经典模型有多么的好用，在二十年前她用半经典模型预言了晕核散射的弥散度(diffuseness)(Nuclear Physics A 706 (2002) 322–334)，这个结果在10年前的实验中得到了证明(Phys. Rev. Lett. 105, 022701)。]]></summary></entry><entry><title type="html">散射波函数的分波展开</title><link href="https://jinleiphys.github.io/posts/2020/03/partial/" rel="alternate" type="text/html" title="散射波函数的分波展开" /><published>2020-03-10T00:00:00-07:00</published><updated>2020-03-10T00:00:00-07:00</updated><id>https://jinleiphys.github.io/posts/2020/03/partial</id><content type="html" xml:base="https://jinleiphys.github.io/posts/2020/03/partial/"><![CDATA[<p>今天读文献的时候对散射波函数分波展开式的表述有些困惑，特别是(-)* state与(+) state关系时。现在把具体的展开式写在这里，以便下次困惑的时查阅</p>

<p>对于(+) state，</p>

<p><a href="https://www.codecogs.com/eqnedit.php?latex=\chi^{(&plus;)}(\vec{k},&space;\vec{r})=\frac{4&space;\pi}{k&space;r}&space;\sum&space;i^{l}&space;f_{l}(k,&space;r)&space;e^{i&space;\sigma_{l}}&space;Y_{l}^{m&space;*}(\hat{k})&space;Y_{l}^{m}(\hat{r})" target="_blank"><img src="https://latex.codecogs.com/gif.latex?\chi^{(&plus;)}(\vec{k},&space;\vec{r})=\frac{4&space;\pi}{k&space;r}&space;\sum&space;i^{l}&space;f_{l}(k,&space;r)&space;e^{i&space;\sigma_{l}}&space;Y_{l}^{m&space;*}(\hat{k})&space;Y_{l}^{m}(\hat{r})" title="x^{(+)}(\vec{k}, \vec{r})=\frac{4 \pi}{k r} \sum i^{l} f_{l}(k, r) e^{i \sigma_{l}} Y_{l}^{m *}(\hat{k}) Y_{l}^{m}(\hat{r})" /></a></p>

<p>对于(-)* state</p>

<p><a href="https://www.codecogs.com/eqnedit.php?latex=\chi^{(-)&space;*}(\vec{k},&space;\vec{r})=\frac{4&space;\pi}{k&space;r}&space;\sum&space;{i}^{-l}&space;f_{l}(k,&space;r)e^{i&space;\sigma_{l}}&space;Y_{l}^{m&space;*}(\hat{r})&space;Y_{l}^{m}(\hat{k})" target="_blank"><img src="https://latex.codecogs.com/gif.latex?\chi^{(-)&space;*}(\vec{k},&space;\vec{r})=\frac{4&space;\pi}{k&space;r}&space;\sum&space;{i}^{-l}&space;f_{l}(k,&space;r)e^{i&space;\sigma_{l}}&space;Y_{l}^{m&space;*}(\hat{r})&space;Y_{l}^{m}(\hat{k})" title="x^{(-) *}(\vec{k}, \vec{r})=\frac{4 \pi}{k r} \sum {i}^{-l} f_{l}(k, r)e^{i \sigma_{l}} Y_{l}^{m *}(\hat{r}) Y_{l}^{m}(\hat{k})" /></a></p>

<p>使用关系式
<a href="https://www.codecogs.com/eqnedit.php?latex=Y_{l}^{m}(\hat{k})=(-)^{l}&space;Y_{l}^{m}(-\hat{k})" target="_blank"><img src="https://latex.codecogs.com/gif.latex?Y_{l}^{m}(\hat{k})=(-)^{l}&space;Y_{l}^{m}(-\hat{k})" title="Y_{l}^{m}(\hat{k})=(-)^{l} Y_{l}^{m}(-\hat{k})" /></a>， 上式变为</p>

<p><a href="https://www.codecogs.com/eqnedit.php?latex=\chi^{(-)*}=\frac{4&space;\pi}{k&space;r}&space;\sum&space;{i}^{-l}&space;f_{l}(k,&space;r)&space;e^{i&space;\sigma_{l}}&space;Y_{l}^{m&space;*}(\hat{r})&space;(-)^{l}&space;Y_{l}^{m}(-\hat{k})" target="_blank"><img src="https://latex.codecogs.com/gif.latex?\chi^{(-)*}(\vec{k},\vec{r})=\frac{4&space;\pi}{k&space;r}&space;\sum&space;{i}^{-l}&space;f_{l}(k,&space;r)&space;e^{i&space;\sigma_{l}}&space;Y_{l}^{m&space;*}(\hat{r})&space;(-)^{l}&space;Y_{l}^{m}(-\hat{k})" title="=\frac{4 \pi}{k r} \sum {i}^{-l} f_{l}(k, r) e^{i \sigma_{l}} Y_{l}^{m *}(\hat{r}) (-)^{l} Y_{l}^{m}(-\hat{k})" /></a></p>

<p>使用关系式<a href="https://www.codecogs.com/eqnedit.php?latex=Y_{l}^{m&space;*}(\theta,&space;\varphi)=(-)^{m}&space;Y_{l}^{-m}(\theta,&space;\varphi)" target="_blank"><img src="https://latex.codecogs.com/gif.latex?Y_{l}^{m&space;*}(\theta,&space;\varphi)=(-)^{m}&space;Y_{l}^{-m}(\theta,&space;\varphi)" title="Y_{l}^{m *}(\theta, \varphi)=(-)^{m} Y_{l}^{-m}(\theta, \varphi)" /></a>， 可以得到</p>

<p><a href="https://www.codecogs.com/eqnedit.php?latex=\begin{align}&space;\chi^{(-)*}(\vec{k},&space;\vec{r})&amp;=\frac{4&space;\pi}{k&space;r}&space;\sum&space;i^{l}&space;f_{l}(k,&space;r)&space;e^{i&space;\sigma_{l}}&space;Y_{l}^{m}\left(\hat{r}\right)&space;Y_{l}^{m^{*}}(-\hat{k})&space;\nonumber\\&space;&amp;=\chi^{(&plus;)}(-\vec{k},&space;\vec{r})&space;\nonumber&space;\end{align}" target="_blank"><img src="https://latex.codecogs.com/gif.latex?\begin{align}&space;\chi^{(-)*}(\vec{k},&space;\vec{r})&amp;=\frac{4&space;\pi}{k&space;r}&space;\sum&space;i^{l}&space;f_{l}(k,&space;r)&space;e^{i&space;\sigma_{l}}&space;Y_{l}^{m}\left(\hat{r}\right)&space;Y_{l}^{m^{*}}(-\hat{k})&space;\nonumber\\&space;&amp;=\chi^{(&plus;)}(-\vec{k},&space;\vec{r})&space;\nonumber&space;\end{align}" title="\begin{align} \chi^{(-)*}(\vec{k}, \vec{r})&amp;=\frac{4 \pi}{k r} \sum i^{l} f_{l}(k, r) e^{i \sigma_{l}} Y_{l}^{m}\left(\hat{r}\right) Y_{l}^{m^{*}}(-\hat{k}) \nonumber\\ &amp;=\chi^{(+)}(-\vec{k}, \vec{r}) \nonumber \end{align}" /></a></p>]]></content><author><name>Jin Lei</name><email>jinl@tongji.edu.cn</email></author><category term="物理笔记" /><summary type="html"><![CDATA[今天读文献的时候对散射波函数分波展开式的表述有些困惑，特别是(-)* state与(+) state关系时。现在把具体的展开式写在这里，以便下次困惑的时查阅]]></summary></entry><entry><title type="html">Inhomogeneous equation解法</title><link href="https://jinleiphys.github.io/posts/2020/03/inhomogeneous/" rel="alternate" type="text/html" title="Inhomogeneous equation解法" /><published>2020-03-09T00:00:00-07:00</published><updated>2020-03-09T00:00:00-07:00</updated><id>https://jinleiphys.github.io/posts/2020/03/inhomogeneous</id><content type="html" xml:base="https://jinleiphys.github.io/posts/2020/03/inhomogeneous/"><![CDATA[<p>今天在写文章的时候，又对解inhomogeneous方程时，source项需不需要乘r这个系数感到困惑。不得不重新推导一遍方程，现在把过程记录在这里，省得以后每一次遇到时都需要推导。</p>

<p>对于具有下面形式的inhomogeneous方程</p>

<p><a href="https://www.codecogs.com/eqnedit.php?latex=[T&plus;U-E]&space;\psi=S" target="_blank"><img src="https://latex.codecogs.com/gif.latex?[T&plus;U-E]&space;\psi=S" title="[T+U-E] \psi=S" /></a></p>

<p>通常情况下有两种解法，一个是微分解法，另外一种是积分解法。对于微分解法来说，我们一般假设</p>

<p><a href="https://www.codecogs.com/eqnedit.php?latex=\psi=\frac{u}{r}&space;\quad&space;\text&space;{&space;and&space;}&space;\quad&space;S=\frac{\rho}{r}" target="_blank"><img src="https://latex.codecogs.com/gif.latex?\psi=\frac{u}{r}&space;\quad&space;\text&space;{&space;and&space;}&space;\quad&space;S=\frac{\rho}{r}" title="\psi=\frac{u}{r} \quad \text { and } \quad S=\frac{\rho}{r}" /></a></p>

<p>因此上述方程在分波表述下， 可以写为</p>

<p><a href="https://www.codecogs.com/eqnedit.php?latex=\left[-\frac{\hbar^{2}&space;}{2&space;\mu}\left(\frac{d^{2}}{d&space;r^{2}}-\frac{l(l&plus;1)}{r^{2}}\right)&plus;U-E\right]&space;u_{\ell}=\rho_{\ell}" target="_blank"><img src="https://latex.codecogs.com/gif.latex?\left[-\frac{\hbar^{2}&space;}{2&space;\mu}\left(\frac{d^{2}}{d&space;r^{2}}-\frac{l(l&plus;1)}{r^{2}}\right)&plus;U-E\right]&space;u_{\ell}=\rho_{\ell}" title="\left[-\frac{\hbar^{2} }{2 \mu}\left(\frac{d^{2}}{d r^{2}}-\frac{l(l+1)}{r^{2}}\right)+U-E\right] u_{\ell}=\rho_{\ell}" /></a></p>

<p>上面的这个方程可以用Numerov或者R-matrix方法来解。</p>

<p>另外一方面我们还可以通过积分方程来解inhomogeneous equation，</p>

<p><a href="https://www.codecogs.com/eqnedit.php?latex=\psi(r)=-\int&space;r^{\prime&space;2}G\left(r,&space;r^{\prime})&space;S\left(r^{\prime}\right)&space;d&space;r^{\prime}\right." target="_blank"><img src="https://latex.codecogs.com/gif.latex?\psi(r)=-\int&space;r^{\prime&space;2}G\left(r,&space;r^{\prime})&space;S\left(r^{\prime}\right)&space;d&space;r^{\prime}\right." title="\psi(r)=-\int r^{\prime 2}G\left(r, r^{\prime}) S\left(r^{\prime}\right) d r^{\prime}\right." /></a></p>

<p>根据定义我们可以得到下列方程</p>

<p><a href="https://www.codecogs.com/eqnedit.php?latex=\begin{aligned}&space;u_\ell(r)&space;&amp;=r&space;\cdot&space;\int&space;r'^{2}&space;\cdot&space;\frac{2&space;\mu}{\hbar&space;^{2}&space;k}&space;\frac{f_\ell(r)}{r^{\prime}}&space;\frac{h_\ell^&plus;}{r}&space;\frac{\rho_\ell}{r^{\prime}}&space;d&space;r^{\prime}&space;\\&space;&amp;=\frac{2&space;\mu}{\hbar^{2}&space;k}&space;\int&space;f_{\ell}(r&lt;)&space;h_{\ell}^{(&plus;)}(r&gt;)\rho_\ell&space;(r^{\prime})&space;d&space;r^{\prime}&space;\end{aligned}" target="_blank"><img src="https://latex.codecogs.com/gif.latex?\begin{aligned}&space;u_\ell(r)&space;&amp;=r&space;\cdot&space;\int&space;r'^{2}&space;\cdot&space;\frac{2&space;\mu}{\hbar&space;^{2}&space;k}&space;\frac{f_\ell(r)}{r^{\prime}}&space;\frac{h_\ell^&plus;}{r}&space;\frac{\rho_\ell}{r^{\prime}}&space;d&space;r^{\prime}&space;\\&space;&amp;=\frac{2&space;\mu}{\hbar^{2}&space;k}&space;\int&space;f_{\ell}(r&lt;)&space;h_{\ell}^{(&plus;)}(r&gt;)\rho_\ell&space;(r^{\prime})&space;d&space;r^{\prime}&space;\end{aligned}" title="\begin{aligned} u_\ell(r) &amp;=r \cdot \int r'^{2} \cdot \frac{2 \mu}{\hbar ^{2} k} \frac{f_\ell(r)}{r^{\prime}} \frac{h_\ell^+}{r} \frac{\rho_\ell}{r^{\prime}} d r^{\prime} \\ &amp;=\frac{2 \mu}{\hbar^{2} k} \int f_{\ell}(r&lt;) h_{\ell}^{(+)}(r&gt;)\rho_\ell (r^{\prime}) d r^{\prime} \end{aligned}" /></a></p>

<p>主要注意的是在实际物理应用时，我们通常情况下得到的是完整的source项，即S项，需要通过除以r变成\rho项。</p>]]></content><author><name>Jin Lei</name><email>jinl@tongji.edu.cn</email></author><category term="物理笔记" /><summary type="html"><![CDATA[今天在写文章的时候，又对解inhomogeneous方程时，source项需不需要乘r这个系数感到困惑。不得不重新推导一遍方程，现在把过程记录在这里，省得以后每一次遇到时都需要推导。]]></summary></entry><entry><title type="html">使用免费资源进行faceswap换脸</title><link href="https://jinleiphys.github.io/posts/2020/03/faceswap/" rel="alternate" type="text/html" title="使用免费资源进行faceswap换脸" /><published>2020-03-08T00:00:00-08:00</published><updated>2020-03-08T00:00:00-08:00</updated><id>https://jinleiphys.github.io/posts/2020/03/faceswap</id><content type="html" xml:base="https://jinleiphys.github.io/posts/2020/03/faceswap/"><![CDATA[<p>前段时间想学习一下机器学习的相关知识，但是面对枯燥乏味的数学公式，真的很难跟实际应用联系起来。想起来前段时间有个比较火的深度学习的项目faceswap,即一种人脸替换深度学习项目。由于项目本身是开源，并且能够在github下载到，只需在github上搜索deepfakes/faceswap即可。</p>

<p>最开始的时候在自己手上的macbook pro上做模型训练，发现速度真的跟蜗牛爬差不多。因此本着白嫖的心态，在网上搜索免费的GPU资源。发现Google旗下的colab可以获得免费强大的Tesla K80单片，如果每个月交9.9美元的话就可以获得更强大的Tesla P100。</p>

<p><img src="https://github.com/jinleiphys/notes/blob/master/faceswap/gpu.jpeg?raw=true" alt="a" /></p>

<p>但是问题是colab支持的是jupyter nootbooks格式，如果想在colab上做模型训练必须要把faceswap代码转换成jupyter nootbooks吗？难道不可以使用ssh直接连接colab吗？继续搜索发现以下解决方案：</p>

<ul>
  <li>
    <p>首先借助Ngrok，它是一个连接公共网络和本地网络的一个代理软件，需要在它的网站上注册一个账号，并且下载运行它的软件，让这个网站可以通过特定的识别码找到你的本地电脑。当然它也是免费的
<img src="https://github.com/jinleiphys/notes/blob/master/faceswap/ngrok.jpeg?raw=true" alt="alt text" /></p>
  </li>
  <li>
    <p>建立一个新的colab notebook， 点开Edit-&gt;Notebook settings,选中GPU和python3
<img src="https://github.com/jinleiphys/notes/blob/master/faceswap/notebook_setting.jpeg?raw=true" alt="alt text" /></p>
  </li>
  <li>
    <p>复制运行以下代码显示分配到的GPU信息，如下所示我分配到了16G显存的P100</p>
    <blockquote>
      <p>gpu_info = !nvidia-smi <br />
 gpu_info = ‘\n’.join(gpu_info) <br />
 if gpu_info.find(‘failed’) &gt;= 0:  <br />
print(‘Select the Runtime → “Change runtime type” menu to enable a GPU accelerator, ‘) <br />
print(‘and then re-execute this cell.’)<br />
 else:<br />
print(gpu_info)</p>
    </blockquote>
  </li>
</ul>

<p><img src="https://github.com/jinleiphys/notes/blob/master/faceswap/gpu_info.jpeg?raw=true" alt="alt text" /></p>

<ul>
  <li>
    <p>挂载Google drive
 <img src="https://github.com/jinleiphys/notes/blob/master/faceswap/google_drive.jpeg?raw=true" alt="alt text" /></p>
  </li>
  <li>
    <p>复制运行以下代码。根据提示输入相关的信息，建立ssh代理通道</p>
  </li>
</ul>

<blockquote>
  <p>!pip install git+https://github.com/demotomohiro/remocolab.git  <br />
import remocolab  <br />
remocolab.setupSSHD()</p>
</blockquote>

<p><img src="https://github.com/jinleiphys/notes/blob/master/faceswap/colab.jpeg?raw=true" alt="alt text" /></p>

<ul>
  <li>
    <p>根据输出的提示即可使用ssh连接到服务器</p>
  </li>
  <li>
    <p>因为colab分配的服务器，会不定时的刷新重启，因此没有办法在colab本地云盘储存东西，需要通过Google drive挂载，这样其实更加方便使用。 ssh连接到服务器后需要获得超级管理员身份才能进去Google drive的目录，超级管理员密码在上一步有显示，只需输入<em>su</em>, 然后进入Google drive目录<em>/content/drive/My\ Drive/</em></p>
  </li>
</ul>

<p>接下来就是使用faceswap进行换脸的实际操作部分了：</p>

<ul>
  <li>git clone faceswap的源代码</li>
</ul>

<blockquote>
  <p>git clone https://github.com/deepfakes/faceswap.git</p>
</blockquote>

<ul>
  <li>挂载显卡驱动
    <blockquote>
      <p>export LD_PRELOAD=/usr/lib64-nvidia/libnvidia-ml.so</p>
    </blockquote>
  </li>
  <li>安装faceswap
    <blockquote>
      <p>python3 setup.py</p>
      <ul>
        <li>选择N,N,Y,Y</li>
      </ul>
    </blockquote>
  </li>
  <li>准备好需要换脸的两个人的照片+视频。 运行下面代码可以从视频中提取人脸
    <blockquote>
      <p>python3 faceswap.py extract -i source/yifei/videoplayback.mp4 -o source/yifei/face -D s3fd -A fan -M extended -nm hist -min 20 -l 0.4 -een 1 -sz 256 -si 0 -L INFO</p>
      <ul>
        <li>-i 后面接的是要提取的视频，</li>
        <li>-o后面是提取的脸存储的目录</li>
        <li>这步骤会产生一个videoplayback_alignments.fsa，这个文件储存的是对应视频中人脸的位置，在最后给视频换脸的时候程序需要这个文件来找到视频中需要换的人脸。</li>
      </ul>
    </blockquote>
  </li>
  <li>在提取人脸的时候，程序可能会把不是人脸的东西识别成人脸，因此需要手动将这些删除，faceswap提供了以下的工具，可以将相似的图片排列起来，然后把不是想要换的人脸删除即可
    <blockquote>
      <p>python3 tools.py sort -i source/yifei/face -s face -t -1.0 -fp rename -g hist -b 5 -be GPU -lf sort_log.json -L INFO</p>
      <ul>
        <li>-i后面是要排列图片所在的文件夹</li>
      </ul>
    </blockquote>
  </li>
  <li>在删除不必要的图片后，要运行以下代码更新.fsa文件
    <blockquote>
      <p>python3 tools.py alignments -j remove-faces -a source/yifei/videoplayback_alignments.fsa -fc source/yifei/face -o console -een 1 -sz 256 -L INFO</p>
      <ul>
        <li>-a 后面接的是fsa文件，</li>
        <li>-fc后面接的是人脸文件夹</li>
      </ul>
    </blockquote>
  </li>
  <li>在准备好需要换脸的两个文件夹后，就可以进行模型训练了， 运行以下代码</li>
</ul>

<blockquote>
  <p>python3 faceswap.py train -A source/yifei/face -ala source/yifei/videoplayback_alignments.fsa -B faces/ofelia -m model/yifei -t Villain -bs 32 -it 1000000 -s 100 -ss 25000  -tia source/yifei/face -tib faces/ofelia -to output/yifei -ps 50 -L INFO</p>
  <ul>
    <li>值得注意的是，这个命令是要把B的脸换到A上的训练</li>
    <li>-A 后面接的是A脸的文件夹</li>
    <li>-B 后面接的是B脸的文件夹</li>
    <li>-m 后面接的是训练的模型储存的位置</li>
    <li>-t 后面接的是训练的方法，官网上给出了好几种模型训练方法，从基础的Lightweight到最佳的Villain， 根据我在Tesla P100显卡的实际测试来看，这几个模型的训练时间相差不大，因此可以选择最佳的Villain</li>
    <li>-tia 后面接的是想要查看换脸效果的A脸所在的文件夹</li>
    <li>-tib 后面接的是想要查看换脸效果的B脸所在的文件夹</li>
    <li>-to 后面接的是实时输出换脸效果的照片的文件夹，基本上每隔5分钟，会产生一个对比照片。</li>
    <li>-bs 即Batch Size， 每次训练读取脸的数目</li>
    <li>-it 要进行训练的最大次数</li>
    <li>-s 每XX次训练储存一次模型</li>
    <li>-ss 每XX次训练备份一次模型</li>
  </ul>
</blockquote>

<ul>
  <li>当实时输出换脸效果的照片基本满意的时候，就可以对整个视频进行换脸了
    <blockquote>
      <p>python3 faceswap.py convert -i source/yifei/videoplayback.mp4 -o output -al source/yifei/videoplayback_alignments.fsa -m model/yifei -c color-transfer -M extended -sc none -w ffmpeg -osc 100 -l 0.4 -j 0 -k -L INFO</p>
      <ul>
        <li>-i 后面接的是换脸的视频</li>
        <li>-o 后面接的是换脸结果存放的位置</li>
        <li>-al 后面接的是.fsa文件，即存储的视频中需要换的脸在视频中位置</li>
        <li>-m 后面接的是换脸模型的位置</li>
      </ul>
    </blockquote>
  </li>
</ul>]]></content><author><name>Jin Lei</name><email>jinl@tongji.edu.cn</email></author><category term="程序学习" /><summary type="html"><![CDATA[前段时间想学习一下机器学习的相关知识，但是面对枯燥乏味的数学公式，真的很难跟实际应用联系起来。想起来前段时间有个比较火的深度学习的项目faceswap,即一种人脸替换深度学习项目。由于项目本身是开源，并且能够在github下载到，只需在github上搜索deepfakes/faceswap即可。]]></summary></entry><entry><title type="html">经典散射理论</title><link href="https://jinleiphys.github.io/posts/2020/03/classical/" rel="alternate" type="text/html" title="经典散射理论" /><published>2020-03-06T00:00:00-08:00</published><updated>2020-03-06T00:00:00-08:00</updated><id>https://jinleiphys.github.io/posts/2020/03/classical</id><content type="html" xml:base="https://jinleiphys.github.io/posts/2020/03/classical/"><![CDATA[<p>提到散射理论， 通常会指向三种不同形式的散射，即经典散射，半经典散射以及量子散射理论。这里我们先从经典散射理论说起。</p>

<p>我们考虑一个简单的二维平面内的散射问题。
在质心系下，假设入射粒子流以相同的速度<em>v_in</em>入射。不同的入射粒子通常具有不同的碰撞参数，因此有不同的散射角度<em>\theta</em>。定义<em>dN</em>为单位时间内通过角度区间<em>\theta</em>到<em>\theta+d\theta</em>范围内的粒子数目。这个数目本身并不能很好的描述散射过程，因为它与入射粒子流的密度成正比。 因此我们采用它们之间的比值</p>

<p><a href="https://www.codecogs.com/eqnedit.php?latex=d&space;\sigma=d&space;N&space;/&space;n" target="_blank"><img src="https://latex.codecogs.com/gif.latex?d&space;\sigma=d&space;N&space;/&space;n" title="d \sigma=d N / n" /></a></p>

<p>其中<em>n</em>是单位时间内通过单位面积的粒子数。 可以发现，这个比值具有面积的量纲，通常把它称为<strong>截面</strong></p>

<p><img src="https://github.com/jinleiphys/notes/blob/master/classical_scattering/fig.png?raw=true" alt="alt text" /></p>

<p>接下来我们讨论一下入射粒子的轨迹, 如上图所示，在中心力场下的散射轨迹以入射粒子到散射中心最短距离（<em>OA</em>）为中心线对称的。两条轨迹渐近线与中心对称线的夹角（<em>\phi_0</em>）是相同的。因此散射角<em>\theta</em>等于</p>

<p><a href="https://www.codecogs.com/eqnedit.php?latex=\theta=|\pi-2&space;\phi_0|" target="_blank"><img src="https://latex.codecogs.com/gif.latex?\theta=|\pi-2&space;\phi_0|" title="\theta=|\pi-2 \phi_0|" /></a></p>

<p>另外，入射粒子的散射问题，可以看成是在中心力场<em>U(r)</em>下的散射，在质心系下总能量为</p>

<p><a href="https://www.codecogs.com/eqnedit.php?latex=E=\frac{1}{2}\left(m&space;\dot{r}^{2}&plus;r^{2}&space;\dot{\phi}^{2}\right)&plus;U(r)=\frac{1}{2}&space;m&space;\dot{r}^{2}&plus;\frac{1}{2}&space;P_{L}^{2}&space;/&space;m&space;r^{2}&plus;U(r)" target="_blank"><img src="https://latex.codecogs.com/gif.latex?E=\frac{1}{2}\left(m&space;\dot{r}^{2}&plus;r^{2}&space;\dot{\phi}^{2}\right)&plus;U(r)=\frac{1}{2}&space;m&space;\dot{r}^{2}&plus;\frac{1}{2}&space;P_{L}^{2}&space;/&space;m&space;r^{2}&plus;U(r)" title="E=\frac{1}{2}\left(m \dot{r}^{2}+r^{2} \dot{\phi}^{2}\right)+U(r)=\frac{1}{2} m \dot{r}^{2}+\frac{1}{2} P_{L}^{2} / m r^{2}+U(r)" /></a></p>

<p>其中角动量<em>P_L</em>被定义为</p>

<p><a href="https://www.codecogs.com/eqnedit.php?latex=P_{L}=m&space;r^{2}&space;\dot{\phi}" target="_blank"><img src="https://latex.codecogs.com/gif.latex?P_{L}=m&space;r^{2}&space;\dot{\phi}" title="P_{L}=m r^{2} \dot{\phi}" /></a></p>

<p>因此，我们得到入射粒子的速度为</p>

<p><a href="https://www.codecogs.com/eqnedit.php?latex=\dot{r}=\frac{d&space;r}{d&space;t}=\sqrt{\frac{2}{m}[E-U(r)]-\frac{P_{L}^{2}}{m^{2}&space;r^{2}}}" target="_blank"><img src="https://latex.codecogs.com/gif.latex?\dot{r}=\frac{d&space;r}{d&space;t}=\sqrt{\frac{2}{m}[E-U(r)]-\frac{P_{L}^{2}}{m^{2}&space;r^{2}}}" title="\dot{r}=\frac{d r}{d t}=\sqrt{\frac{2}{m}[E-U(r)]-\frac{P_{L}^{2}}{m^{2} r^{2}}}" /></a></p>

<p>通过角动量的定义，我们可以得到</p>

<p><a href="https://www.codecogs.com/eqnedit.php?latex=d&space;\phi=P_{L}&space;d&space;t&space;/&space;m&space;r^{2}" target="_blank"><img src="https://latex.codecogs.com/gif.latex?d&space;\phi=P_{L}&space;d&space;t&space;/&space;m&space;r^{2}" title="d \phi=P_{L} d t / m r^{2}" /></a></p>

<p>接下来我们把入射粒子速度定义中的<em>dt</em>代入上式中，可以得到</p>

<p><a href="https://www.codecogs.com/eqnedit.php?latex=\phi=\int_{r_{min}}^{\infty}&space;\frac{P_L&space;d&space;r&space;/&space;r^{2}}{\sqrt{2&space;m(E-U(r))-P_{L}^{2}&space;/&space;r^{2}}}" target="_blank"><img src="https://latex.codecogs.com/gif.latex?\phi=\int_{r_{min}}^{\infty}&space;\frac{P_L&space;d&space;r&space;/&space;r^{2}}{\sqrt{2&space;m(E-U(r))-P_{L}^{2}&space;/&space;r^{2}}}" title="\phi=\int_{r_{min}}^{\infty} \frac{P_L d r / r^{2}}{\sqrt{2 m(E-U(r))-P_{L}^{2} / r^{2}}}" /></a></p>

<p>其中<em>r_{min}</em>为入射粒子与靶核的最短距离，也是上式根号内表达式为<em>0</em>时的<em>r</em>值。为了方便后续的讨论，我们使用入射粒子速度<em>v_in</em>和碰撞参数<em>p</em>为变量，入射粒子能量与角动量可以表述为</p>

<p><a href="https://www.codecogs.com/eqnedit.php?latex=E=\frac{1}{2}&space;m&space;v_{i&space;n}^{2},&space;\quad&space;P_{L}=m&space;p&space;v_{i&space;n}" target="_blank"><img src="https://latex.codecogs.com/gif.latex?E=\frac{1}{2}&space;m&space;v_{i&space;n}^{2},&space;\quad&space;P_{L}=m&space;p&space;v_{i&space;n}" title="E=\frac{1}{2} m v_{i n}^{2}, \quad P_{L}=m p v_{i n}" /></a></p>

<p>因此<em>\phi</em>角的公式可以改写为</p>

<p><a href="https://www.codecogs.com/eqnedit.php?latex=\phi=\int_{r_{min}}^{\infty}&space;\frac{\left(p^{2}&space;/&space;r^{2}\right)&space;d&space;r}{\sqrt{1-\left(p^{2}&space;/&space;r^{2}\right)-\left(2&space;U&space;/&space;m&space;v_{i&space;n}^{2}\right)}}" target="_blank"><img src="https://latex.codecogs.com/gif.latex?\phi=\int_{r_{min}}^{\infty}&space;\frac{\left(p^{2}&space;/&space;r^{2}\right)&space;d&space;r}{\sqrt{1-\left(p^{2}&space;/&space;r^{2}\right)-\left(2&space;U&space;/&space;m&space;v_{i&space;n}^{2}\right)}}" title="\phi=\int_{r_{min}}^{\infty} \frac{\left(p^{2} / r^{2}\right) d r}{\sqrt{1-\left(p^{2} / r^{2}\right)-\left(2 U / m v_{i n}^{2}\right)}}" /></a></p>

<p>通过<em>\phi</em>角与<em>\theta</em>角的关系式，我们得到碰撞参数与散射角的关系式。 通过上述表达式可以发现，一个<em>\phi</em>角只对应一个碰撞参数。 因此当碰撞参数处于<em>p(\theta)</em>和<em>p(\theta)+dp(\theta)</em>之间时，散射角度对应的区间为<em>\theta</em>到<em>\theta+d\theta</em>。通过该散射角区域的粒子数可以由半径为<em>p</em>和<em>p+dp</em>之间环形的面积乘以粒子流密度<em>n</em>求得，</p>

<p><a href="https://www.codecogs.com/eqnedit.php?latex=d&space;N=2&space;\pi&space;p&space;d&space;p&space;\cdot&space;n" target="_blank"><img src="https://latex.codecogs.com/gif.latex?d&space;N=2&space;\pi&space;p&space;d&space;p&space;\cdot&space;n" title="d N=2 \pi p d p \cdot n" /></a></p>

<p>因此我们可以得到散射截面为</p>

<p><a href="https://www.codecogs.com/eqnedit.php?latex=d&space;\sigma=2&space;\pi&space;p&space;d&space;p" target="_blank"><img src="https://latex.codecogs.com/gif.latex?d&space;\sigma=2&space;\pi&space;p&space;d&space;p" title="d \sigma=2 \pi p d p" /></a></p>

<p>为了找到散射截面与角度的关系， 上式可以改写成</p>

<p><a href="https://www.codecogs.com/eqnedit.php?latex=d&space;\sigma=2&space;\pi&space;p(\theta)|d&space;p(\theta)&space;/&space;d&space;\theta|&space;d&space;\theta" target="_blank"><img src="https://latex.codecogs.com/gif.latex?d&space;\sigma=2&space;\pi&space;p(\theta)|d&space;p(\theta)&space;/&space;d&space;\theta|&space;d&space;\theta" title="d \sigma=2 \pi p(\theta)|d p(\theta) / d \theta| d \theta" /></a></p>

<p>在三维空间下，我们可以对坐标进行球坐标展开，并假设散射对于<em>phi</em>角是各向同性的，我们通常用立体角代替上式的<em>\theta</em>角，</p>

<p><a href="https://www.codecogs.com/eqnedit.php?latex=d&space;O=\frac{p(\theta)}{\sin&space;\theta}\left|\frac{d&space;p}{d&space;\theta}\right|&space;d&space;\Omega" target="_blank"><img src="https://latex.codecogs.com/gif.latex?d&space;\sigma=\frac{p(\theta)}{\sin&space;\theta}\left|\frac{d&space;p}{d&space;\theta}\right|&space;d&space;\Omega" title="d \sigma=\frac{p(\theta)}{\sin \theta}\left|\frac{d p}{d \theta}\right| d \Omega" /></a></p>

<p>另外对于库伦散射，我们只需要把上面讨论的相互作用势<em>U</em>设为库伦势即可。</p>

<p><strong>经典散射轨迹</strong></p>

<p>我们假设散射发生在二维平面内， 那么经典散射轨迹可以通过求解下式获得</p>

<p><a href="https://www.codecogs.com/eqnedit.php?latex=\begin{aligned}&space;&amp;v_{x}=\frac{d&space;x}{d&space;t}\\&space;&amp;\mu&space;\dot{v}_{x}=-\frac{\partial&space;U(x)}{\partial&space;x}\\&space;&amp;v_{y}=\frac{d&space;y}{d&space;t}&space;\\&space;&amp;\mu&space;\dot{v}_{y}=-\frac{\partial&space;U(y)}{\partial&space;y}&space;\end{aligned}" target="_blank"><img src="https://latex.codecogs.com/gif.latex?\begin{aligned}&space;&amp;v_{x}=\frac{d&space;x}{d&space;t}\\&space;&amp;\mu&space;\dot{v}_{x}=-\frac{\partial&space;U(x)}{\partial&space;x}\\&space;&amp;v_{y}=\frac{d&space;y}{d&space;t}&space;\\&space;&amp;\mu&space;\dot{v}_{y}=-\frac{\partial&space;U(y)}{\partial&space;y}&space;\end{aligned}" title="\begin{aligned} &amp;v_{x}=\frac{d x}{d t}\\ &amp;\mu \dot{v}_{x}=-\frac{\partial U(x)}{\partial x}\\ &amp;v_{y}=\frac{d y}{d t} \\ &amp;\mu \dot{v}_{y}=-\frac{\partial U(y)}{\partial y} \end{aligned}" /></a></p>]]></content><author><name>Jin Lei</name><email>jinl@tongji.edu.cn</email></author><category term="物理笔记" /><summary type="html"><![CDATA[提到散射理论， 通常会指向三种不同形式的散射，即经典散射，半经典散射以及量子散射理论。这里我们先从经典散射理论说起。]]></summary></entry></feed>