Bohrium
robot
新建

空间站广场

论文
Notebooks
比赛
课程
Apps
我的主页
我的Notebooks
我的论文库
我的足迹

我的工作空间

任务
节点
文件
数据集
镜像
项目
数据库
公开
基于热力学积分(TI)的自由能计算
notebook
分子动力学
科学计算
DeePMD
Molecular Dynamics
bohrium
NBHub
Tutorial
LAMMPS
力场
notebook分子动力学科学计算DeePMDMolecular DynamicsbohriumNBHub TutorialLAMMPS力场
yfb222333@gmail.com
发布于 2023-12-22
推荐镜像 :Basic Image:ubuntu22.04-mojo0.3-notebook
推荐机型 :c2_m4_cpu
赞 1
基于热力学积分的自由能计算
自由能计算
分子动力学模拟
热力学积分

基于热力学积分的自由能计算

这篇notebook将带介绍一下计算自由能的一个经典方法——热力学积分方法(Thermodynamics Integration方法): 并提供一个谐振子模型,计算谐振子变化到指定势函数时的自由能的变化。

bohrium上,已经有比较多notebook阐述了自由能计算方方面面,下面是节选的一些:

自由能计算

分子动力学模拟

代码
文本

热力学积分

这一原理和形式足够清晰。 但具体到计算时,需要额外考虑的需要有:数值积分计算,对误差(热力学误差,积分误差)估计,合理积分路径。

考虑两个有着不同哈密顿量的系统, 我们想要计算这两个系统之间得自由能差,考虑一系列中间状态,其哈密顿量。随着 逐渐变化到 ,系统由 变化到 .

这两个系统之间的自由能差 满足,

=

=

=

=

=

=

其中 为不同 下,系统的配分函数。尖括号对代表系综平均。

不同 对应系统不同的势函数。 跑MD,实际上就是在这个势函数下,采样我们关心的物理量。 也就是用MD轨迹上的点,代表系综平均值。

具体计算时,想要求得自由能差值,需要知道,中间这一系列状态的这一物理量的MD模拟的系综平均值,取路径上一系列积分节点,求数值积分即可。

一个简单的做法是让H(\lambda) 成为 的线性组合,即

也可以有一些更复杂的路线了。比如引入一些中间状态。

这样这个 就有相对简单的形式,在MD模拟过程中,可以简单、直接地算出来

MD软件实现时,运动轨迹的每一帧,得到每个原子位置后,再多算两个两个势函数下系统的能量,并作差。

因此,自由能差的计算成为 \lambda 空间的积分。用最简单的积分法,梯形积分,它变成

当然也可以由其他形式的更准确的数值积分方法。 比如经典Runge-Kutta积分方法。

起始点一般可以选用爱因斯坦固体和理想气体,这两个状态自由能我们是可以解析求解。这样我们就可以得到目标系统自由能的具体数值。

代码
文本
双击即可修改
代码
文本
双击即可修改
代码
文本
[57]
!pip install numba
!pip install seaborn
!pip install scipy
Requirement already satisfied: numba in /opt/conda/lib/python3.8/site-packages (0.58.1)
Requirement already satisfied: llvmlite<0.42,>=0.41.0dev0 in /opt/conda/lib/python3.8/site-packages (from numba) (0.41.1)
Requirement already satisfied: numpy<1.27,>=1.22 in /opt/conda/lib/python3.8/site-packages (from numba) (1.24.4)
Requirement already satisfied: importlib-metadata in /opt/conda/lib/python3.8/site-packages (from numba) (6.8.0)
Requirement already satisfied: zipp>=0.5 in /opt/conda/lib/python3.8/site-packages (from importlib-metadata->numba) (3.17.0)
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
Requirement already satisfied: seaborn in /opt/conda/lib/python3.8/site-packages (0.13.0)
Requirement already satisfied: numpy!=1.24.0,>=1.20 in /opt/conda/lib/python3.8/site-packages (from seaborn) (1.24.4)
Requirement already satisfied: pandas>=1.2 in /opt/conda/lib/python3.8/site-packages (from seaborn) (2.0.3)
Requirement already satisfied: matplotlib!=3.6.1,>=3.3 in /opt/conda/lib/python3.8/site-packages (from seaborn) (3.7.3)
Requirement already satisfied: contourpy>=1.0.1 in /opt/conda/lib/python3.8/site-packages (from matplotlib!=3.6.1,>=3.3->seaborn) (1.1.1)
Requirement already satisfied: cycler>=0.10 in /opt/conda/lib/python3.8/site-packages (from matplotlib!=3.6.1,>=3.3->seaborn) (0.11.0)
Requirement already satisfied: fonttools>=4.22.0 in /opt/conda/lib/python3.8/site-packages (from matplotlib!=3.6.1,>=3.3->seaborn) (4.42.1)
Requirement already satisfied: kiwisolver>=1.0.1 in /opt/conda/lib/python3.8/site-packages (from matplotlib!=3.6.1,>=3.3->seaborn) (1.4.5)
Requirement already satisfied: packaging>=20.0 in /opt/conda/lib/python3.8/site-packages (from matplotlib!=3.6.1,>=3.3->seaborn) (23.0)
Requirement already satisfied: pillow>=6.2.0 in /opt/conda/lib/python3.8/site-packages (from matplotlib!=3.6.1,>=3.3->seaborn) (10.0.1)
Requirement already satisfied: pyparsing>=2.3.1 in /opt/conda/lib/python3.8/site-packages (from matplotlib!=3.6.1,>=3.3->seaborn) (3.1.1)
Requirement already satisfied: python-dateutil>=2.7 in /opt/conda/lib/python3.8/site-packages (from matplotlib!=3.6.1,>=3.3->seaborn) (2.8.2)
Requirement already satisfied: importlib-resources>=3.2.0 in /opt/conda/lib/python3.8/site-packages (from matplotlib!=3.6.1,>=3.3->seaborn) (6.1.0)
Requirement already satisfied: pytz>=2020.1 in /opt/conda/lib/python3.8/site-packages (from pandas>=1.2->seaborn) (2023.3.post1)
Requirement already satisfied: tzdata>=2022.1 in /opt/conda/lib/python3.8/site-packages (from pandas>=1.2->seaborn) (2023.3)
Requirement already satisfied: zipp>=3.1.0 in /opt/conda/lib/python3.8/site-packages (from importlib-resources>=3.2.0->matplotlib!=3.6.1,>=3.3->seaborn) (3.17.0)
Requirement already satisfied: six>=1.5 in /opt/conda/lib/python3.8/site-packages (from python-dateutil>=2.7->matplotlib!=3.6.1,>=3.3->seaborn) (1.16.0)
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
Collecting scipy
  Downloading scipy-1.10.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (34.5 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 34.5/34.5 MB 5.3 MB/s eta 0:00:0000:0100:01
Requirement already satisfied: numpy<1.27.0,>=1.19.5 in /opt/conda/lib/python3.8/site-packages (from scipy) (1.24.4)
Installing collected packages: scipy
Successfully installed scipy-1.10.1
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
代码
文本
notebook
分子动力学
科学计算
DeePMD
Molecular Dynamics
bohrium
NBHub
Tutorial
LAMMPS
力场
notebook分子动力学科学计算DeePMDMolecular DynamicsbohriumNBHub TutorialLAMMPS力场
已赞1
本文被以下合集收录
FEP
zhangjiaxian@iccas.ac.cn
更新于 2024-03-30
2 篇0 人关注
推荐阅读
公开
快速开始ABACUS | 计算锂(Li)元素单质及其化合物的晶体结构
Li元素
Li元素
donglikun@dp.tech
更新于 2024-07-16
公开
快速开始ABACUS | 计算铑(Rh)元素单质的晶体结构
中文notebookpythonABACUS分子动力学Tutorial
中文notebookpythonABACUS分子动力学Tutorial
donglikun@dp.tech
更新于 2024-07-16