Bohrium
robot
新建

空间站广场

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

我的工作空间

任务
节点
文件
数据集
镜像
项目
数据库
公开
OpenLAM Structure Optimization Tool
OpenLAM
OpenLAM
Peng
发布于 2024-06-04
推荐镜像 :lam-crystal-philately:openlam
推荐机型 :c12_m92_1 * NVIDIA V100
lam-crystal-model(v3)

Installation

First, download the OpenLAM structure optimization tool project to your local machine.

代码
文本
[1]
!git clone https://github.com/deepmodeling/openlam
Cloning into 'openlam'...
remote: Enumerating objects: 66, done.
remote: Counting objects: 100% (66/66), done.
remote: Compressing objects: 100% (45/45), done.
remote: Total 66 (delta 28), reused 49 (delta 17), pack-reused 0
Receiving objects: 100% (66/66), 26.82 KiB | 5.36 MiB/s, done.
Resolving deltas: 100% (28/28), done.
代码
文本

Installation of the project.

代码
文本
[2]
!pip install ./openlam
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Processing /openlam
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
  Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: pydflow>=1.7.23 in /opt/mamba/envs/matbench/lib/python3.11/site-packages (from lam-crystal-philately==0.1.dev12+gbabbdec) (1.8.73)
Requirement already satisfied: ase==3.22.1 in /opt/mamba/envs/matbench/lib/python3.11/site-packages (from lam-crystal-philately==0.1.dev12+gbabbdec) (3.22.1)
Requirement already satisfied: numpy==1.26.4 in /opt/mamba/envs/matbench/lib/python3.11/site-packages (from lam-crystal-philately==0.1.dev12+gbabbdec) (1.26.4)
Requirement already satisfied: tqdm==4.66.2 in /opt/mamba/envs/matbench/lib/python3.11/site-packages (from lam-crystal-philately==0.1.dev12+gbabbdec) (4.66.2)
Requirement already satisfied: pymatgen==2024.3.1 in /opt/mamba/envs/matbench/lib/python3.11/site-packages (from lam-crystal-philately==0.1.dev12+gbabbdec) (2024.3.1)
Requirement already satisfied: matplotlib>=3.1.0 in /opt/mamba/envs/matbench/lib/python3.11/site-packages (from ase==3.22.1->lam-crystal-philately==0.1.dev12+gbabbdec) (3.8.3)
Requirement already satisfied: scipy>=1.1.0 in /opt/mamba/envs/matbench/lib/python3.11/site-packages (from ase==3.22.1->lam-crystal-philately==0.1.dev12+gbabbdec) (1.12.0)
Requirement already satisfied: monty>=2024.2.2 in /opt/mamba/envs/matbench/lib/python3.11/site-packages (from pymatgen==2024.3.1->lam-crystal-philately==0.1.dev12+gbabbdec) (2024.2.26)
Requirement already satisfied: networkx>=2.2 in /opt/mamba/envs/matbench/lib/python3.11/site-packages (from pymatgen==2024.3.1->lam-crystal-philately==0.1.dev12+gbabbdec) (3.2.1)
Requirement already satisfied: palettable>=3.1.1 in /opt/mamba/envs/matbench/lib/python3.11/site-packages (from pymatgen==2024.3.1->lam-crystal-philately==0.1.dev12+gbabbdec) (3.3.3)
Requirement already satisfied: pandas in /opt/mamba/envs/matbench/lib/python3.11/site-packages (from pymatgen==2024.3.1->lam-crystal-philately==0.1.dev12+gbabbdec) (2.2.1)
Requirement already satisfied: plotly>=4.5.0 in /opt/mamba/envs/matbench/lib/python3.11/site-packages (from pymatgen==2024.3.1->lam-crystal-philately==0.1.dev12+gbabbdec) (5.20.0)
Requirement already satisfied: pybtex in /opt/mamba/envs/matbench/lib/python3.11/site-packages (from pymatgen==2024.3.1->lam-crystal-philately==0.1.dev12+gbabbdec) (0.24.0)
Requirement already satisfied: requests in /opt/mamba/envs/matbench/lib/python3.11/site-packages (from pymatgen==2024.3.1->lam-crystal-philately==0.1.dev12+gbabbdec) (2.31.0)
Requirement already satisfied: ruamel.yaml>=0.17.0 in /opt/mamba/envs/matbench/lib/python3.11/site-packages (from pymatgen==2024.3.1->lam-crystal-philately==0.1.dev12+gbabbdec) (0.18.6)
Requirement already satisfied: spglib>=2.0.2 in /opt/mamba/envs/matbench/lib/python3.11/site-packages (from pymatgen==2024.3.1->lam-crystal-philately==0.1.dev12+gbabbdec) (2.3.1)
Requirement already satisfied: sympy in /opt/mamba/envs/matbench/lib/python3.11/site-packages (from pymatgen==2024.3.1->lam-crystal-philately==0.1.dev12+gbabbdec) (1.12)
Requirement already satisfied: tabulate in /opt/mamba/envs/matbench/lib/python3.11/site-packages (from pymatgen==2024.3.1->lam-crystal-philately==0.1.dev12+gbabbdec) (0.9.0)
Requirement already satisfied: uncertainties>=3.1.4 in /opt/mamba/envs/matbench/lib/python3.11/site-packages (from pymatgen==2024.3.1->lam-crystal-philately==0.1.dev12+gbabbdec) (3.1.7)
Requirement already satisfied: joblib in /opt/mamba/envs/matbench/lib/python3.11/site-packages (from pymatgen==2024.3.1->lam-crystal-philately==0.1.dev12+gbabbdec) (1.3.2)
Requirement already satisfied: six in /opt/mamba/envs/matbench/lib/python3.11/site-packages (from pydflow>=1.7.23->lam-crystal-philately==0.1.dev12+gbabbdec) (1.16.0)
Requirement already satisfied: python-dateutil in /opt/mamba/envs/matbench/lib/python3.11/site-packages (from pydflow>=1.7.23->lam-crystal-philately==0.1.dev12+gbabbdec) (2.9.0.post0)
Requirement already satisfied: urllib3 in /opt/mamba/envs/matbench/lib/python3.11/site-packages (from pydflow>=1.7.23->lam-crystal-philately==0.1.dev12+gbabbdec) (2.2.1)
Requirement already satisfied: certifi in /opt/mamba/envs/matbench/lib/python3.11/site-packages (from pydflow>=1.7.23->lam-crystal-philately==0.1.dev12+gbabbdec) (2024.2.2)
Requirement already satisfied: argo-workflows==5.0.0 in /opt/mamba/envs/matbench/lib/python3.11/site-packages (from pydflow>=1.7.23->lam-crystal-philately==0.1.dev12+gbabbdec) (5.0.0)
Requirement already satisfied: jsonpickle in /opt/mamba/envs/matbench/lib/python3.11/site-packages (from pydflow>=1.7.23->lam-crystal-philately==0.1.dev12+gbabbdec) (3.0.4)
Requirement already satisfied: minio in /opt/mamba/envs/matbench/lib/python3.11/site-packages (from pydflow>=1.7.23->lam-crystal-philately==0.1.dev12+gbabbdec) (7.2.7)
Requirement already satisfied: kubernetes in /opt/mamba/envs/matbench/lib/python3.11/site-packages (from pydflow>=1.7.23->lam-crystal-philately==0.1.dev12+gbabbdec) (29.0.0)
Requirement already satisfied: pyyaml in /opt/mamba/envs/matbench/lib/python3.11/site-packages (from pydflow>=1.7.23->lam-crystal-philately==0.1.dev12+gbabbdec) (6.0.1)
Requirement already satisfied: cloudpickle==2.2.0 in /opt/mamba/envs/matbench/lib/python3.11/site-packages (from pydflow>=1.7.23->lam-crystal-philately==0.1.dev12+gbabbdec) (2.2.0)
Requirement already satisfied: psutil in /opt/mamba/envs/matbench/lib/python3.11/site-packages (from pydflow>=1.7.23->lam-crystal-philately==0.1.dev12+gbabbdec) (5.9.8)
Requirement already satisfied: contourpy>=1.0.1 in /opt/mamba/envs/matbench/lib/python3.11/site-packages (from matplotlib>=3.1.0->ase==3.22.1->lam-crystal-philately==0.1.dev12+gbabbdec) (1.2.0)
Requirement already satisfied: cycler>=0.10 in /opt/mamba/envs/matbench/lib/python3.11/site-packages (from matplotlib>=3.1.0->ase==3.22.1->lam-crystal-philately==0.1.dev12+gbabbdec) (0.12.1)
Requirement already satisfied: fonttools>=4.22.0 in /opt/mamba/envs/matbench/lib/python3.11/site-packages (from matplotlib>=3.1.0->ase==3.22.1->lam-crystal-philately==0.1.dev12+gbabbdec) (4.50.0)
Requirement already satisfied: kiwisolver>=1.3.1 in /opt/mamba/envs/matbench/lib/python3.11/site-packages (from matplotlib>=3.1.0->ase==3.22.1->lam-crystal-philately==0.1.dev12+gbabbdec) (1.4.5)
Requirement already satisfied: packaging>=20.0 in /opt/mamba/envs/matbench/lib/python3.11/site-packages (from matplotlib>=3.1.0->ase==3.22.1->lam-crystal-philately==0.1.dev12+gbabbdec) (24.0)
Requirement already satisfied: pillow>=8 in /opt/mamba/envs/matbench/lib/python3.11/site-packages (from matplotlib>=3.1.0->ase==3.22.1->lam-crystal-philately==0.1.dev12+gbabbdec) (10.2.0)
Requirement already satisfied: pyparsing>=2.3.1 in /opt/mamba/envs/matbench/lib/python3.11/site-packages (from matplotlib>=3.1.0->ase==3.22.1->lam-crystal-philately==0.1.dev12+gbabbdec) (3.1.2)
Requirement already satisfied: tenacity>=6.2.0 in /opt/mamba/envs/matbench/lib/python3.11/site-packages (from plotly>=4.5.0->pymatgen==2024.3.1->lam-crystal-philately==0.1.dev12+gbabbdec) (8.2.3)
Requirement already satisfied: ruamel.yaml.clib>=0.2.7 in /opt/mamba/envs/matbench/lib/python3.11/site-packages (from ruamel.yaml>=0.17.0->pymatgen==2024.3.1->lam-crystal-philately==0.1.dev12+gbabbdec) (0.2.8)
Requirement already satisfied: future in /opt/mamba/envs/matbench/lib/python3.11/site-packages (from uncertainties>=3.1.4->pymatgen==2024.3.1->lam-crystal-philately==0.1.dev12+gbabbdec) (1.0.0)
Requirement already satisfied: google-auth>=1.0.1 in /opt/mamba/envs/matbench/lib/python3.11/site-packages (from kubernetes->pydflow>=1.7.23->lam-crystal-philately==0.1.dev12+gbabbdec) (2.29.0)
Requirement already satisfied: websocket-client!=0.40.0,!=0.41.*,!=0.42.*,>=0.32.0 in /opt/mamba/envs/matbench/lib/python3.11/site-packages (from kubernetes->pydflow>=1.7.23->lam-crystal-philately==0.1.dev12+gbabbdec) (1.8.0)
Requirement already satisfied: requests-oauthlib in /opt/mamba/envs/matbench/lib/python3.11/site-packages (from kubernetes->pydflow>=1.7.23->lam-crystal-philately==0.1.dev12+gbabbdec) (2.0.0)
Requirement already satisfied: oauthlib>=3.2.2 in /opt/mamba/envs/matbench/lib/python3.11/site-packages (from kubernetes->pydflow>=1.7.23->lam-crystal-philately==0.1.dev12+gbabbdec) (3.2.2)
Requirement already satisfied: argon2-cffi in /opt/mamba/envs/matbench/lib/python3.11/site-packages (from minio->pydflow>=1.7.23->lam-crystal-philately==0.1.dev12+gbabbdec) (23.1.0)
Requirement already satisfied: pycryptodome in /opt/mamba/envs/matbench/lib/python3.11/site-packages (from minio->pydflow>=1.7.23->lam-crystal-philately==0.1.dev12+gbabbdec) (3.20.0)
Requirement already satisfied: typing-extensions in /opt/mamba/envs/matbench/lib/python3.11/site-packages (from minio->pydflow>=1.7.23->lam-crystal-philately==0.1.dev12+gbabbdec) (4.10.0)
Requirement already satisfied: pytz>=2020.1 in /opt/mamba/envs/matbench/lib/python3.11/site-packages (from pandas->pymatgen==2024.3.1->lam-crystal-philately==0.1.dev12+gbabbdec) (2024.1)
Requirement already satisfied: tzdata>=2022.7 in /opt/mamba/envs/matbench/lib/python3.11/site-packages (from pandas->pymatgen==2024.3.1->lam-crystal-philately==0.1.dev12+gbabbdec) (2024.1)
Requirement already satisfied: latexcodec>=1.0.4 in /opt/mamba/envs/matbench/lib/python3.11/site-packages (from pybtex->pymatgen==2024.3.1->lam-crystal-philately==0.1.dev12+gbabbdec) (3.0.0)
Requirement already satisfied: charset-normalizer<4,>=2 in /opt/mamba/envs/matbench/lib/python3.11/site-packages (from requests->pymatgen==2024.3.1->lam-crystal-philately==0.1.dev12+gbabbdec) (3.3.2)
Requirement already satisfied: idna<4,>=2.5 in /opt/mamba/envs/matbench/lib/python3.11/site-packages (from requests->pymatgen==2024.3.1->lam-crystal-philately==0.1.dev12+gbabbdec) (3.6)
Requirement already satisfied: mpmath>=0.19 in /opt/mamba/envs/matbench/lib/python3.11/site-packages (from sympy->pymatgen==2024.3.1->lam-crystal-philately==0.1.dev12+gbabbdec) (1.3.0)
Requirement already satisfied: cachetools<6.0,>=2.0.0 in /opt/mamba/envs/matbench/lib/python3.11/site-packages (from google-auth>=1.0.1->kubernetes->pydflow>=1.7.23->lam-crystal-philately==0.1.dev12+gbabbdec) (5.3.3)
Requirement already satisfied: pyasn1-modules>=0.2.1 in /opt/mamba/envs/matbench/lib/python3.11/site-packages (from google-auth>=1.0.1->kubernetes->pydflow>=1.7.23->lam-crystal-philately==0.1.dev12+gbabbdec) (0.4.0)
Requirement already satisfied: rsa<5,>=3.1.4 in /opt/mamba/envs/matbench/lib/python3.11/site-packages (from google-auth>=1.0.1->kubernetes->pydflow>=1.7.23->lam-crystal-philately==0.1.dev12+gbabbdec) (4.9)
Requirement already satisfied: argon2-cffi-bindings in /opt/mamba/envs/matbench/lib/python3.11/site-packages (from argon2-cffi->minio->pydflow>=1.7.23->lam-crystal-philately==0.1.dev12+gbabbdec) (21.2.0)
Requirement already satisfied: pyasn1<0.7.0,>=0.4.6 in /opt/mamba/envs/matbench/lib/python3.11/site-packages (from pyasn1-modules>=0.2.1->google-auth>=1.0.1->kubernetes->pydflow>=1.7.23->lam-crystal-philately==0.1.dev12+gbabbdec) (0.6.0)
Requirement already satisfied: cffi>=1.0.1 in /opt/mamba/envs/matbench/lib/python3.11/site-packages (from argon2-cffi-bindings->argon2-cffi->minio->pydflow>=1.7.23->lam-crystal-philately==0.1.dev12+gbabbdec) (1.16.0)
Requirement already satisfied: pycparser in /opt/mamba/envs/matbench/lib/python3.11/site-packages (from cffi>=1.0.1->argon2-cffi-bindings->argon2-cffi->minio->pydflow>=1.7.23->lam-crystal-philately==0.1.dev12+gbabbdec) (2.21)
Building wheels for collected packages: lam-crystal-philately
  Building wheel for lam-crystal-philately (pyproject.toml) ... done
  Created wheel for lam-crystal-philately: filename=lam_crystal_philately-0.1.dev12+gbabbdec-py3-none-any.whl size=31171 sha256=8d2114da987c4dee054a8f8d752feca83457546a63118a2a6722a5ee8614fd0a
  Stored in directory: /tmp/pip-ephem-wheel-cache-avxt1x14/wheels/61/47/de/ef330879f8aedf68b464ac99bcc69a236487ada5c119f4671e
Successfully built lam-crystal-philately
Installing collected packages: lam-crystal-philately
  Attempting uninstall: lam-crystal-philately
    Found existing installation: lam-crystal-philately 0.1.dev9+g384656b.d20240604
    Uninstalling lam-crystal-philately-0.1.dev9+g384656b.d20240604:
      Successfully uninstalled lam-crystal-philately-0.1.dev9+g384656b.d20240604
Successfully installed lam-crystal-philately-0.1.dev12+gbabbdec
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
代码
文本

The DP model already exists in the dataset of this notebook, symlink it to the current directory.

代码
文本
[3]
!ln -s /bohr/lam-crystal-model-01oe/v3/dp0529.pth dp.pth
代码
文本

Local Structure Optimization

Directly use the command line tool to optimize the sample structures lo cally.

By default, after optimizing the structure, it will check the convergence of the optimized structure (can be skipped using the parameter --skip-check-convergence), and whether it is duplicated in the OpenLAM database (can be s kipped using the parameter --skip-check-duplicate). The checked structures will be saved as cif format files.

To check if the structure is duplicated in the OpenLAM database, the environment variable BOHRIUM_ACCESS_KEY needs to be configured, which can be generated through the https://bohrium.dp.tech/settings/user page.

代码
文本
[20]
%env BOHRIUM_ACCESS_KEY=xxx
env: BOHRIUM_ACCESS_KEY=xxx
代码
文本
[6]
!lam-opt relax -i openlam/examples/data -m dp.pth -o results.json --skip-check-convergence
To get the best performance, it is recommended to adjust the number of threads by setting the environment variables OMP_NUM_THREADS, DP_INTRA_OP_PARALLELISM_THREADS, and DP_INTER_OP_PARALLELISM_THREADS. See https://deepmd.rtfd.io/parallelism/ for more information.

Start to relax structures.

Relaxing: 0it [00:00, ?it/s]      Step     Time          Energy         fmax
BFGS:    0 11:59:39       -3.432330        1.4856
BFGS:    1 11:59:42       -3.462572        1.2149
BFGS:    2 11:59:52       -3.474138        1.2986
BFGS:    3 11:59:56       -3.499632        0.2218
BFGS:    4 11:59:56       -3.500611        0.0249
BFGS:    5 11:59:56       -3.500631        0.0114
BFGS:    6 11:59:56       -3.500635        0.0110
BFGS:    7 11:59:56       -3.500739        0.0496
BFGS:    8 11:59:57       -3.500918        0.0937
BFGS:    9 11:59:57       -3.501440        0.1756
BFGS:   10 11:59:57       -3.502467        0.2799
BFGS:   11 11:59:57       -3.504224        0.3837
BFGS:   12 11:59:57       -3.540719        0.7027
BFGS:   13 11:59:57       -3.545436        0.2616
BFGS:   14 11:59:57       -3.546308        0.1420
BFGS:   15 11:59:57       -3.546664        0.0037
BFGS:   16 11:59:57       -3.546664        0.0000
Relaxing: 1it [00:22, 22.67s/it]      Step     Time          Energy         fmax
BFGS:    0 11:59:57       -5.405985        0.7214
BFGS:    1 12:00:07       -5.421183        0.7691
BFGS:    2 12:00:07       -5.421177        2.1633
BFGS:    3 12:00:07       -5.503029        0.4127
BFGS:    4 12:00:07       -5.515699        0.5083
BFGS:    5 12:00:07       -5.550243        0.5736
BFGS:    6 12:00:07       -5.302219        3.1964
BFGS:    7 12:00:08       -5.563675        0.8995
BFGS:    8 12:00:08       -5.438606        0.7443
BFGS:    9 12:00:08       -5.545653        0.3734
BFGS:   10 12:00:08       -5.563606        1.3026
BFGS:   11 12:00:08       -5.564468        0.3407
BFGS:   12 12:00:08       -5.577429        0.3208
BFGS:   13 12:00:08       -5.247499        2.8527
BFGS:   14 12:00:08       -5.588167        0.5249
BFGS:   15 12:00:08       -5.569788        0.3426
BFGS:   16 12:00:08       -5.586407        0.2904
BFGS:   17 12:00:08       -5.291737        2.2892
BFGS:   18 12:00:08       -5.568543        1.3995
BFGS:   19 12:00:09       -5.467279        0.7000
BFGS:   20 12:00:09       -5.541057        0.4039
BFGS:   21 12:00:09       -5.550354        1.7077
BFGS:   22 12:00:09       -5.561118        0.3295
BFGS:   23 12:00:09       -5.571989        0.3297
BFGS:   24 12:00:09       -5.325982        1.6277
BFGS:   25 12:00:09       -5.590947        0.4720
BFGS:   26 12:00:09       -5.559236        0.3329
BFGS:   27 12:00:09       -5.581635        0.3157
BFGS:   28 12:00:09       -5.310092        2.1232
BFGS:   29 12:00:09       -5.582313        0.9937
BFGS:   30 12:00:09       -5.460432        0.7097
BFGS:   31 12:00:10       -5.551491        0.3550
BFGS:   32 12:00:10       -5.578869        1.1455
BFGS:   33 12:00:10       -5.568943        0.3095
BFGS:   34 12:00:10       -5.579210        0.3042
BFGS:   35 12:00:10       -5.317244        1.7866
BFGS:   36 12:00:10       -5.587033        0.7966
BFGS:   37 12:00:10       -5.461176        0.7112
BFGS:   38 12:00:10       -5.559699        0.3170
BFGS:   39 12:00:10       -5.592966        0.3663
BFGS:   40 12:00:10       -5.583208        0.2907
BFGS:   41 12:00:11       -5.592933        0.1862
BFGS:   42 12:00:11       -5.545587        1.7609
BFGS:   43 12:00:11       -5.594824        0.1668
BFGS:   44 12:00:11       -5.595295        0.1689
BFGS:   45 12:00:11       -5.595634        0.1508
BFGS:   46 12:00:11       -5.595848        0.1382
BFGS:   47 12:00:11       -5.596218        0.0995
BFGS:   48 12:00:11       -5.596359        0.0997
BFGS:   49 12:00:11       -5.596817        0.1094
BFGS:   50 12:00:11       -5.597326        0.1168
BFGS:   51 12:00:11       -5.598318        0.1175
BFGS:   52 12:00:12       -5.552859        0.4600
BFGS:   53 12:00:12       -5.574159        0.7846
BFGS:   54 12:00:12       -5.588147        0.5505
BFGS:   55 12:00:12       -5.595027        0.2559
BFGS:   56 12:00:12       -5.602665        0.1604
BFGS:   57 12:00:12       -5.604079        0.0749
BFGS:   58 12:00:12       -5.604216        0.1023
BFGS:   59 12:00:12       -5.604481        0.0826
BFGS:   60 12:00:12       -5.605446        0.0526
BFGS:   61 12:00:12       -5.606199        0.0744
BFGS:   62 12:00:13       -5.605357        0.4217
BFGS:   63 12:00:13       -5.607068        0.0346
BFGS:   64 12:00:13       -5.607500        0.0342
BFGS:   65 12:00:13       -5.581688        1.1910
BFGS:   66 12:00:13       -5.607893        0.0296
BFGS:   67 12:00:13       -5.608146        0.0301
BFGS:   68 12:00:13       -5.608311        0.1705
BFGS:   69 12:00:13       -5.608587        0.0554
BFGS:   70 12:00:13       -5.608691        0.0569
BFGS:   71 12:00:13       -5.609182        0.0947
BFGS:   72 12:00:13       -5.609566        0.0651
BFGS:   73 12:00:14       -5.600396        0.7815
BFGS:   74 12:00:14       -5.612574        0.1182
BFGS:   75 12:00:14       -5.614660        0.0937
BFGS:   76 12:00:14       -5.620260        0.0549
BFGS:   77 12:00:14       -5.619484        0.1918
BFGS:   78 12:00:14       -5.620855        0.0646
BFGS:   79 12:00:14       -5.620925        0.0391
BFGS:   80 12:00:14       -5.620993        0.0274
BFGS:   81 12:00:14       -5.621018        0.0179
BFGS:   82 12:00:14       -5.621036        0.0132
BFGS:   83 12:00:14       -5.621049        0.0236
BFGS:   84 12:00:15       -5.621061        0.0309
BFGS:   85 12:00:15       -5.621082        0.0386
BFGS:   86 12:00:15       -5.621136        0.0500
BFGS:   87 12:00:15       -5.621274        0.0678
BFGS:   88 12:00:15       -5.621747        0.0900
BFGS:   89 12:00:15       -5.626878        0.1020
BFGS:   90 12:00:15       -5.626784        0.2829
BFGS:   91 12:00:15       -5.630610        0.1543
BFGS:   92 12:00:15       -5.631596        0.0634
BFGS:   93 12:00:15       -5.631780        0.0422
BFGS:   94 12:00:16       -5.631856        0.0149
BFGS:   95 12:00:16       -5.631868        0.0015
BFGS:   96 12:00:16       -5.631869        0.0004
BFGS:   97 12:00:16       -5.631869        0.0001
Relaxing: 2it [00:41, 20.62s/it]

Saved to df.

代码
文本

The result file contains the optimized structure and energy.

代码
文本
[9]
!cat results.json
{"final_structure":{"MP_mp-1006815":{"@module":"pymatgen.core.structure","@class":"Structure","charge":0,"lattice":{"matrix":[[7.230147594,-0.6129705837,-0.2359834023],[-4.1459218943,7.1809473651,0.4719668046],[-0.4390057784,0.760380313,14.2020498528]],"pbc":[true,true,true],"a":7.2599211658,"b":8.3052649614,"c":14.2291645685,"alpha":83.2045861827,"beta":93.8807974416,"gamma":124.8894017167,"volume":698.8008411647},"properties":{},"sites":[{"species":[{"element":"Cs","occu":1}],"abc":[-0.0,-0.0,0.0],"xyz":[0.0,-0.0,0.0],"properties":{},"label":"Cs"},{"species":[{"element":"H","occu":1}],"abc":[-0.0,0.1209169629,0.7997949989],"xyz":[-0.8524269099,1.4764467177,11.4157972395],"properties":{},"label":"H"},{"species":[{"element":"H","occu":1}],"abc":[0.0,0.8790830371,0.2002050011],"xyz":[-3.7325007628,6.4648809604,3.258219418],"properties":{},"label":"H"}]},"MP_mp-1093779":{"@module":"pymatgen.core.structure","@class":"Structure","charge":0,"lattice":{"matrix":[[16.0670444689,-0.0,-0.0],[-0.0,14.2111,-0.0],[-0.0,-0.0,20.0251]],"pbc":[true,true,true],"a":16.0670444689,"b":14.2111,"c":20.0251,"alpha":90.0000000001,"beta":90.0,"gamma":90.0,"volume":4572.3386054619},"properties":{},"sites":[{"species":[{"element":"K","occu":1}],"abc":[0.0,0.0,0.0],"xyz":[0.0,0.0,0.0],"properties":{},"label":"K"},{"species":[{"element":"Na","occu":1}],"abc":[0.1905935253,0.5,0.5],"xyz":[3.0622746457,7.10555,10.01255],"properties":{},"label":"Na"},{"species":[{"element":"Na","occu":1}],"abc":[0.8094064747,0.5,0.5],"xyz":[13.0047698232,7.10555,10.01255],"properties":{},"label":"Na"},{"species":[{"element":"Tl","occu":1}],"abc":[0.0,0.5,0.5],"xyz":[0.0,7.10555,10.01255],"properties":{},"label":"Tl"}]}},"final_energy":{"MP_mp-1006815":-5.6318688293,"MP_mp-1093779":-3.5466640916}}
代码
文本

The relaxed folder contains validated cif files.

代码
文本
[7]
!ls relaxed
final-CsH2.cif	final-KNa2Tl.cif
代码
文本

Submit to Structure Optimization Workflow

First, create a workflow configuration file. After optimizing the structure, the convergence of the optimized structure will be checked by default (can be skipped by setting the parameter "check_convergence": false in inputs), as well as whether it is a duplicate in the OpenLAM database (can be skipped by setting the parameter "check_duplicate": false in inputs). The checked structures will be saved as CIF files. To check for duplicates in the OpenLAM database, the environment variable BOHRIUM_ACCESS_KEY needs to be configured. You can generate an access key on the https://bohrium.dp.tech/settings/user page.

代码
文本
[ ]
%env BOHRIUM_ACCESS_KEY=xxx
代码
文本
[16]
%%file input.json
{
"relax": {
"inputs": {
"check_convergence": false
},
"image": "registry.dp.tech/dptech/prod-26832/lam-crystal-philately:dp-mptraj-ase-utype",
"executor": {
"image_pull_policy": "IfNotPresent",
"machine_dict": {
"batch_type": "Bohrium",
"context_type": "Bohrium",
"remote_profile": {
"input_data": {
"job_type": "container",
"platform": "ali",
"scass_type": "1 * NVIDIA T4_16g",
"maxRescheduleTimes": 10
}
}
},
"retry_on_submission_error": 10
}
}
}
Overwriting input.json
代码
文本

Divide the structure in the project sample into 2 folders, and we will optimize them with 2 parallel tasks.

代码
文本
[9]
!mkdir -p part0 part1
!cp openlam/examples/data/MP_mp-1006815.cif part0
!cp openlam/examples/data/MP_mp-1093779.cif part1
代码
文本

Set up workflow environment variables.

代码
文本
[21]
%env DFLOW_HOST=https://workflows.deepmodeling.com
%env DFLOW_K8S_API_SERVER=https://workflows.deepmodeling.com
%env DFLOW_S3_REPO_KEY=oss-bohrium
%env DFLOW_S3_STORAGE_CLIENT=dflow.plugins.bohrium.TiefblueClient
%env BOHRIUM_USERNAME=xxx
%env BOHRIUM_PASSWORD=xxx
%env BOHRIUM_PROJECT_ID=xxx
env: DFLOW_HOST=https://workflows.deepmodeling.com
env: DFLOW_K8S_API_SERVER=https://workflows.deepmodeling.com
env: DFLOW_S3_REPO_KEY=oss-bohrium
env: DFLOW_S3_STORAGE_CLIENT=dflow.plugins.bohrium.TiefblueClient
env: BOHRIUM_USERNAME=xxx
env: BOHRIUM_PASSWORD=xxx
env: BOHRIUM_PROJECT_ID=xxx
代码
文本

Submitting workflow.

代码
文本
[18]
!lam-opt submit input.json -i part0 part1 -m dp.pth

Workflow has been submitted (ID: parallel-relax-ghxnh, UID: d391313a-d9e5-4947-ab11-da0b7c88b13c)
Workflow link: https://workflows.deepmodeling.com/workflows/argo/parallel-relax-ghxnh
代码
文本

Click on the workflow link to view the status of the workflow. After the workflow is completed, download the result.

alt

Download the result.

代码
文本
[19]
!lam-opt download parallel-relax-ghxnh -o outputs
!tree outputs
100%|█████████████████████████████████████████████| 5/5 [00:00<00:00,  7.92it/s]
100%|█████████████████████████████████████████████| 5/5 [00:00<00:00,  7.87it/s]
outputs
├── 0
│   ├── relaxed
│   │   └── final-CsH2.cif
│   └── results.json
└── 1
    ├── relaxed
    │   └── final-KNa2Tl.cif
    └── results.json

4 directories, 4 files
代码
文本

Querying crystal structures from the OpenLAM database

Configure the environment variable BOHRIUM_ACCESS_KEY. You can generate the access key through the page https://bohrium.dp.tech/settings/user .

代码
文本
[13]
%env BOHRIUM_ACCESS_KEY=xxx
env: BOHRIUM_ACCESS_KEY=xxx
代码
文本

Query crystal structure through Python interface.

代码
文本
[10]
from lam_optimize import CrystalStructure
data = CrystalStructure.query_by_page()
print(data)
{'page': 1, 'pageSize': 10, 'total': 59, 'items': [<lam_optimize.db.CrystalStructure object at 0x7f83f05f35b0>, <lam_optimize.db.CrystalStructure object at 0x7f838fbe39d0>, <lam_optimize.db.CrystalStructure object at 0x7f838fa30130>, <lam_optimize.db.CrystalStructure object at 0x7f838fa30880>, <lam_optimize.db.CrystalStructure object at 0x7f838fa30f70>, <lam_optimize.db.CrystalStructure object at 0x7f838fa31660>, <lam_optimize.db.CrystalStructure object at 0x7f838fa31d50>, <lam_optimize.db.CrystalStructure object at 0x7f838fa32440>, <lam_optimize.db.CrystalStructure object at 0x7f838fa331c0>, <lam_optimize.db.CrystalStructure object at 0x7f838fa546a0>]}
代码
文本

The query_by_page method accepts the following parameters as query conditions

formula: Optional[str] = None
min_energy: Optional[float] = None
max_energy: Optional[float] = None
min_submission_time: Optional[datetime.datetime] = None
max_submission_time: Optional[datetime.datetime] = None
page: int = 1

The data returned contains a list of CrystalStructure objects as items, in addition to the pagination information. Each CrystalStructure object has the following attributes

class CrystalStructure:
    formula: str
    structure: pymatgen.core.Structure
    energy: float
    submission_time: datetime.datetime

The query method is also provided to automatically merge the results from multiple pages.

代码
文本
[12]
structures = CrystalStructure.query(formula="Sr2YSbO6")
print(structures)
[<lam_optimize.db.CrystalStructure object at 0x7f83f0526e30>]
代码
文本

The returned is a list of CrystalStructure objects.

NOTE: Calling non-paginated methods without query conditions is very slow.

代码
文本
OpenLAM
OpenLAM
点个赞吧
推荐阅读
公开
OpenLAM结构优化工具的使用
OpenLAM
OpenLAM
zjgemi
更新于 2024-08-20
1 赞4 转存文件
公开
Train A Con-CDVAE Model With OpenLAM Data
AI4S
AI4S
Peng
更新于 2024-08-12
1 转存文件