diff --git a/MindSPONGE/README.md b/MindSPONGE/README.md index c2984ef008aaba5c56a24320b70bf18f06d0ae88..2489d86bac5001696054c41ace5402ad5617253d 100644 --- a/MindSPONGE/README.md +++ b/MindSPONGE/README.md @@ -24,6 +24,8 @@ MindSPONGE中包含了多个传统分子模拟案例,更多详情,请点击 未来,MindSPONGE中将包含更多结合AI算法的分子模拟案例,欢迎大家的关注和支持。 +MindSPONGE Architecture + ## 安装教程 ### 确认系统环境信息 diff --git a/MindSPONGE/docs/mindsponge-arch.png b/MindSPONGE/docs/mindsponge-arch.png new file mode 100644 index 0000000000000000000000000000000000000000..dc449f396ee15f113c4daf5d505d1f7318a15a89 Binary files /dev/null and b/MindSPONGE/docs/mindsponge-arch.png differ diff --git a/MindSPONGE/examples/README.md b/MindSPONGE/examples/README.md index 4c0d86f7e60efe3f31f9f2554beadb3fc6ad11cd..22976523374a90dae0a70217d95ccbb460347ec0 100644 --- a/MindSPONGE/examples/README.md +++ b/MindSPONGE/examples/README.md @@ -1,97 +1,14 @@ # MindSPONGE -- [Description](#Description) -- [Dataset](#Dataset) -- [Environment Requirements](#Environment-Requirements) -- [Quick Start](#Quick-Start) -- [Script Description](#Script-Description) - - [Script and Sample Code](#Script-and-Sample-Code) - - [Simulation Process](#Simulation-Process) -- [Result](#Result) +- [简介](#简介) +- [目录](#目录) -## Description +## 简介 -MindSPONGE implemented functions for molecular modeling and many simulation cases in biology,material and drug designing, which are not only simulated in traditional molecular simulation method, but also in AI method. Your contribution and attention are very important to us! +MindSPONGE包含了分子模拟过程中相关的功能函数以及分子模拟案例集合,其中包含了生物、材料、制药领域中的不同的分子体系的模拟。分子建模中,包含了基于传统分子模拟方法的相关案例,也会在后期包含AI+分子模拟的案例,详情请查看[案例](https://gitee.com/jialiangyu/mindscience/blob/dev_yjl/MindSPONGE/examples)。欢迎大家积极参与和关注。 -The following example demonstrates how to perform high-performance molecular dynamics simulations with the built-in MindSPONGE module on a `GPU`. +## 目录 -## Dataset - -There are three inputs in the example, the property file `NVT_290_10ns.in`, the topology file `WATER_ALA.parm7` and the coordinates file `WATER_ALA_350_cool_290.rst7`, respectivelly. They are stored in `data/polypeptide`. - -![ALA Aqueous System](https://images.gitee.com/uploads/images/2021/0323/184453_4bd9b1a6_8142020.png "图片1.png") - -The topology file and coordinates file can be generated by `tleap` in `AmberTools` ([link]()). For more details, please refer to: - -- [MindSPONGE Tutorial](https://gitee.com/mindspore/mindscience/blob/master/MindSPONGE/examples/) - -## Environment Requirements - -- Hardware: `GPU` - - Prepare a hardware environment with `GPU`. -- Framework - - [MindSpore](https://www.mindspore.cn/install/en) -- For more information, visit the resources below: - - [MindSPONGE Tutorials](https://gitee.com/mindspore/mindscience/tree/master/MindSPONGE/mindsponge/examples) - - [MindSpore Python API](https://www.mindspore.cn/docs/api/en/master/index.html) - -## Quick Start - -After installing MindSpore, go to ../examples/polypeptide/src/ folder, run the following command: - -```shell -python main.py --i /path/NVT_290_10ns.in \ - --amber_parm /path/WATER_ALA.parm7 \ - --c /path/WATER_ALA_350_cool_290.rst7 \ - --o /path/ala_NVT_290_10ns.out -``` - -`path` is the path which stores input files. In this case, they are stored in `data/polypeptide`. - -## Script Description - -### Script and Sample Code - -```shell -|-- README.md -|-- README_CN.md -|-- mindsponge_numpy.md -|-- claisen_rearrangement -| |-- data -| |-- src -| |-- main.py -| |-- simulation_cybertron.py -|-- covid -| |-- data -| | |-- deltaace2.parm7 -| | |-- deltaace2.rst7 -| | |-- s1ace2.parm7 -| | |-- s1ace2.rst7 -| |-- scripts -| | |-- run_covid.sh -| |-- src -| |-- main.py -| |-- run_npt.py -|-- polypeptide - |-- README_CN.md - |-- data - | |-- NVT_290_10ns.in - | |-- WATER_ALA.parm7 - | |-- WATER_ALA_350_cool_290.rst7 - |-- scripts - | |-- run.sh - |-- src - |-- main.py -``` - -## Result - -After training, the following results are stored in `ala_NVT_290_10ns.out`: - -```text -_steps_ _TEMP_ _TOT_POT_ENE_ _BOND_ENE_ _ANGLE_ENE_ _DIHEDRAL_ENE_ _14LJ_ENE_ _14CF_ENE_ _LJ_ENE_ _CF_PME_ENE_ - 1 0.788 -5836.521 48.745 0.891 14.904 9.041 194.479 763.169 -6867.750 - ... -``` - -There are sorts of energy in the output, steps (_steps_), temperature (_TEMP_), total energy (_TOT_POT_E_), bond energy (_BOND_ENE_), angle energy (_ANGLE_ENE_), dihedral energy (_DIHEDRAL_ENE_), non-bond energy, includes Coulomb force (_14CF_ENE_) and Lennard-Jones energy (_14LJ_ENE_), Van der Waals energy (_LJ_ENE_) and Coulomb force in PME (_CF_PME_ENE_). +- [案例](https://gitee.com/jialiangyu/mindscience/blob/dev_yjl/MindSPONGE/examples) + - [丙氨酸三肽水溶液体系](https://gitee.com/mindspore/mindscience/tree/master/MindSPONGE/examples/polypeptide) + - [克莱森重排反应](https://gitee.com/mindspore/mindscience/tree/master/MindSPONGE/examples/claisen_rearrangement) diff --git a/MindSPONGE/examples/README_CN.md b/MindSPONGE/examples/README_CN.md deleted file mode 100644 index 370ae60f98964c0ba5d9ed007da2ea4a96784aa4..0000000000000000000000000000000000000000 --- a/MindSPONGE/examples/README_CN.md +++ /dev/null @@ -1,97 +0,0 @@ -# MindSPONGE - -- [简介](#简介) -- [数据](#数据) -- [环境要求](#环境要求) -- [快速入门](#快速入门) -- [脚本介绍](#脚本介绍) - - [脚本和示例代码](#脚本和示例代码) - - [模拟过程](#模拟过程) -- [结果](#结果) - -## 简介 - -MindSPONGE包含了分子模拟过程中相关的功能函数以及分子模拟案例集合,其中包含了生物、材料、制药领域中的不同的分子体系的模拟。分子建模中,包含了基于传统分子模拟方法的相关案例,也会在后期包含AI+分子模拟的案例,详情请查看[案例](https://gitee.com/jialiangyu/mindscience/blob/dev_yjl/MindSPONGE/examples/polypeptide/README_CN.md)。欢迎大家积极参与和关注。 - -下面的案例将展示如何在`GPU`上,使用MindSPONGE快速进行分子模拟。 - -## 数据 - -该案例中使用了三个不同的输入文件,分别是属性文件`NVT_290_10ns.in`,拓扑文件`WATER_ALA.parm7`,以及坐标文件 `WATER_ALA_350_cool_290.rst7`。三个输入文件都在`data/polypeptide`文件夹中。 - -拓扑文件和坐标文件可以由开源工具`AmberTools`中的`tleap`([链接]())生成,更多细节,请查看案例完整教程: - -- [MindSPONGE 教程](https://gitee.com/mindspore/mindscience/blob/master/MindSPONGE/examples/polypeptide/README_CN.md) - -![ALA Aqueous System](https://images.gitee.com/uploads/images/2021/0323/184453_4bd9b1a6_8142020.png "图片1.png") - -## 环境要求 - -- 硬件设备: `GPU` - - MindSPONGE现有案例目前只支持 `GPU`设备. -- 框架 - - [MindSpore](https://www.mindspore.cn/install/en) -- 更多信息,请查看详细介绍: - - [MindSPONGE 教程](https://gitee.com/mindspore/mindscience/blob/master/MindSPONGE/examples/) - - [MindSpore Python API](https://www.mindspore.cn/docs/api/en/master/index.html) - -## 快速入门 - -安装完成MindSpore后, 进入目录../examples/polypeptide/src/运行如下命令: - -```shell -python main.py --i /path/NVT_290_10ns.in \ - --amber_parm /path/WATER_ALA.parm7 \ - --c /path/WATER_ALA_350_cool_290.rst7 \ - --o /path/ala_NVT_290_10ns.out -``` - -`path` 是存储输入文件的具体路径,在本案例中,该路径为`data/polypeptide`。 - -## 脚本介绍 - -### 脚本和示例代码 - -```shell -|-- README.md -|-- README_CN.md -|-- mindsponge_numpy.md -|-- claisen_rearrangement -| |-- data -| |-- src -| |-- main.py -| |-- simulation_cybertron.py -|-- covid -| |-- data -| | |-- deltaace2.parm7 -| | |-- deltaace2.rst7 -| | |-- s1ace2.parm7 -| | |-- s1ace2.rst7 -| |-- scripts -| | |-- run_covid.sh -| |-- src -| |-- main.py -| |-- run_npt.py -|-- polypeptide - |-- README_CN.md - |-- data - | |-- NVT_290_10ns.in - | |-- WATER_ALA.parm7 - | |-- WATER_ALA_350_cool_290.rst7 - |-- scripts - | |-- run.sh - |-- src - |-- main.py -``` - -## 结果 - -模拟结束后,模拟结果会存储在指定的`.out`文件中,在这里为`ala_NVT_290_10ns.out`。其存储的内容为: - -```text -_steps_ _TEMP_ _TOT_POT_ENE_ _BOND_ENE_ _ANGLE_ENE_ _DIHEDRAL_ENE_ _14LJ_ENE_ _14CF_ENE_ _LJ_ENE_ _CF_PME_ENE_ - 1 0.788 -5836.521 48.745 0.891 14.904 9.041 194.479 763.169 -6867.750 - ... -``` - -存储结果记录了模拟过程中输出的各类信息,包含步骤(_steps_),温度(_TEMP_),总能量(_TOT_POT_E_),键长(_BOND_ENE_),键角(_ANGLE_ENE_),二面角相互作用(_DIHEDRAL_ENE_),非键相互作用,其包含静电力及Leonard-Jones相互作用。 diff --git a/MindSPONGE/examples/mindsponge_numpy.md b/MindSPONGE/examples/mindsponge_numpy.md deleted file mode 100644 index fa5d73eea141a31a2d21ef2606200e8804d048b5..0000000000000000000000000000000000000000 --- a/MindSPONGE/examples/mindsponge_numpy.md +++ /dev/null @@ -1,101 +0,0 @@ -# MindSPONGE with numpy support - -`Linux` `GPU` - - - -- [Run MindSPONGE with MindSpore.Numpy](#Run-MindSPONGE-with-MindSpore.Numpy) -- [Under the hood of the Numpy demo](#Under-the-hood-of-the-Numpy-demo) -- [Performance](#Performance) - - - -## Run MindSPONGE with MindSpore.Numpy - -MindSPONGE has been fully supported by MindSpore.Numpy, which runs at similar speed -compared with the Cuda version, which means energy, force and coordinate calculations -are fully supported with Numpy-like syntax, which runs on top of MindSpore primitive -operators. - -For numpy version, run the following command instead: - -```shell -python main_np.py --i /path/NVT_290_10ns.in \ - --amber_parm /path/WATER_ALA.parm7 \ - --c /path/WATER_ALA_350_cool_290.rst7 \ - --o /path/ala_NVT_290_10ns.out -``` - -Detailed implementations: - -```shell -├── scripts - ├── main_np.py # launch Simulation for SPONGE-Numpy - ├── src - ├── simulation_np.py # SPONGE-numpy simulation - ├── functions # SPONGE-numpy modules - ├── angle_energy.py - ├── angle_force_with_atom_energy.py - ├── bond_energy.py - ├── bond_force_with_atom_energy.py - ├── common.py - ├── crd_to_uint_crd.py - ├── dihedral_14_cf_energy.py - ├── dihedral_14_ljcf_force_with_atom_energy.py - ├── dihedral_14_lj_energy.py - ├── dihedral_energy.py - ├── dihedral_force_with_atom_energy.py - ├── __init__.py - ├── lj_energy.py - ├── lj_force_pme_direct_force.py - ├── md_iteration_leap_frog_liujian.py - ├── md_temperature.py - ├── neighbor_list_update.py - ├── pme_common.py - ├── pme_energy.py - ├── pme_excluded_force.py - └── pme_reciprocal_force.py -``` - -For other details, please refer to the [tutorial on case tutorial](https://gitee.com/mindspore/mindscience/blob/master/MindSPONGE/mindsponge/examples/case_polypeptide.md) - -## Under the hood of the numpy demo - -For the Cuda version, every kernel lies inside MindSpore as Cuda kernels. To allow -better transparency for how molecular dynamics algorithm works, Cuda kernels were -refactored as numpy scripts and displayed in src/functions. - -MindSpore Numpy package contains a set of Numpy-like interfaces, which allows developers -to build models on MindSpore with similar syntax of Numpy. MindSpore.Numpy is a layer -of wrapper on MindSpore Primitives (mindspore.ops) which runs on MindSproe Tensors, -therefore it is compatible with other MindSpore features. See -[here](https://www.mindspore.cn/docs/programming_guide/en/master/numpy.html) for -more details. - -By default, the numpy demo runs on top of [Graph Kernel Fusion] -(https://www.mindspore.cn/docs/programming_guide/en/master/enable_graph_kernel_fusion.html) -and [Auto Kernel Generation] (https://gitee.com/mindspore/akg). These features -lead to 50% (or more) performance improvement, compared with no kernel fusion, -and brings the numpy version to comparable performance with the Cuda version. - -To setup for Graph Kernel Fusion, simply add two lines in the launch script -(mindsponge/scripts/main_np.py): - -```python -# Enable Graph Mode, with GPU as backend, and allow Graph Kernel Fusion -context.set_context(mode=context.GRAPH_MODE, device_target="GPU", device_id=args_opt.device_id, enable_graph_kernel=True) -# Make fusion rules for specific operators -context.set_context(graph_kernel_flags="--enable_expand_ops=Gather --enable_cluster_ops=TensorScatterAdd --enable_recompute_fusion=false") -``` - -## Performance - -| Parameter | GPU | -| -------------------------- |---------------------------------- | -| Resource | GPU (Tesla V100 SXM2); memory 16 GB -| Upload date | -| MindSpore version | 1.4 -| Training parameter | step=1000 -| Output | numpy file -| Speed | 5.2 ms/step -| Script | [Link](https://gitee.com/mindspore/mindscience/tree/master/MindSPONGE/mindsponge/scripts) diff --git a/MindSPONGE/mindsponge/md/npt.py b/MindSPONGE/mindsponge/md/npt.py index ee6c8b68b408a7a463ff6ce8db2a0cf0ba51ac86..d0354f2f36c1f1760259cd41884f5d5f345723f5 100644 --- a/MindSPONGE/mindsponge/md/npt.py +++ b/MindSPONGE/mindsponge/md/npt.py @@ -640,15 +640,7 @@ class NPT(nn.Cell): else: dihedral_force = self.zero_main_force - if self.restrain_is_initialized: - _, atom_virial, restrain_frc = self.restrain_force_with_atom_energy_and_virial(self.restrain_list, - self.crd, - self.crd_ref, - self.box_length) - else: - restrain_frc = self.zero_main_force - - force = P.AddN()([lj_force, pme_force, nb14_force, bond_force, angle_force, dihedral_force, restrain_frc]) + force = P.AddN()([lj_force, pme_force, nb14_force, bond_force, angle_force, dihedral_force]) return force, self.atom_virial, self.virial, self.need_pressure def simulation_caculate_energy(self, uint_crd, uint_dr_to_dr_cof): diff --git a/MindSPONGE/mindsponge/md/simulation.py b/MindSPONGE/mindsponge/md/simulation.py index fcb64b3adb3e4152b70e96923406ba106b688f0e..d590209692c1d7210deccd9547439bea4bd197cf 100644 --- a/MindSPONGE/mindsponge/md/simulation.py +++ b/MindSPONGE/mindsponge/md/simulation.py @@ -510,11 +510,6 @@ class Simulation(nn.Cell): self.pn) force = force + dihedral_force - if self.restrain_is_initialized: - _, _, restrain_frc = self.restrain_force_with_atom_energy_and_virial(self.restrain_list, - self.crd, self.crd_ref, - self.box_length) - force = force + restrain_frc return force def simulation_caculate_energy(self, uint_crd, uint_dr_to_dr_cof): diff --git a/MindSPONGE/protein_msa/README_CN.md b/MindSPONGE/protein_msa/README_CN.md index 6a87c1727aa9bcc94b4bd2b9f30144f48e41368e..227ac8c6feb655c025d1fc3582e09db02afd3426 100644 --- a/MindSPONGE/protein_msa/README_CN.md +++ b/MindSPONGE/protein_msa/README_CN.md @@ -4,7 +4,11 @@ 针对蛋白质的[多序列比对](https://en.wikipedia.org/wiki/Multiple_sequence_alignment)(multiple sequence alignment; MSA)是研究蛋白质的结构、功能和进化关系等问题的重要方法。MSA数据中蕴含了构成蛋白质的氨基酸序列中的保守性质(conservation)、协同突变(co-evolution)和功能与物种进化关系(phylogenetics)的相关信息。 -![MSA与蛋白质性质的关联](../docs/MSA_Figure.png) + +

+ +

+
*图片致谢:Sergey Ovchinnikov*
人类已知的存在于自然界中的蛋白质序列数目已经上亿并在快速增长,但仅凭这些蛋白质单序列的数据很难了解蛋白之间的关系。Protein MSA数据库,就是一个对不同蛋白质序列之间的关系进行了标记的大规模“关系型”数据库,被标记为关联的蛋白质序列之间的相似度、进化关系和突变所在位点的分布等信息对蛋白质结构和功能的预测极为重要。例如在AlphaFold2模型[1]中,目标蛋白序列的MSA信息就是预测结构的必要输入信息之一。