ASE on your local PC (Cu-Ag-Au)
2025年6月16日
ここで利用しているファイルはCrySPY_utility/examples/ase_Cu-Ag-Au_EA-vcからダウンロードできる. このチュートリアルでは,計算が軽いASEのPure Python EMT calculatorを用いてローカルPCで動作確認を行う.対象となるシステムは3元系のCu-Ag-Au.
cryspy.in
cryspy.in
の例.
[basic]
algo = EA-vc
calc_code = ASE
nstage = 1
njob = 5
jobcmd = zsh
jobfile = job_cryspy
[structure]
atype = Cu Ag Au
ll_nat = 0 0 0
ul_nat = 8 8 8
[ASE]
ase_python = ase_in.py
[EA]
n_pop = 20
n_crsov = 5
n_perm = 2
n_strain = 2
n_rand = 2
n_add = 3
n_elim = 3
n_subs = 3
target = random
n_elite = 2
n_fittest = 10
slct_func = TNM
t_size = 2
end_point = 0.0 0.0 0.0
maxgen_ea = 0
[option]
algo = EA-vc
を使用.- bash環境では
jobcmd
をbashに変更. - [structure]セクションでは,
ll_nat
で各元素の原子数の最小値,ul_nat
で最大値を指定. n_pop
=n_crsov
+n_perm
+n_strain
+n_rand
+n_add
+n_elim
+n_subs
end_point
にはCu, Ag, Auにおける各単体の1原子当たりのエネルギー(eV/atom)を入力.ASEのPure Python EMT calculatorは単体のエネルギーが0になるので今回は0.0.(CHGNetを使う場合の例はASE-CHGNet(Cu-Au))- [EA]セクションのパラメータについては,CrySPY > 入力ファイル > [EA] sectionおよびCrySPY > 探索アルゴリズム > 組成可変型進化的アルゴリズム(EA-vc)を見ること.
- 自動的にプロットされる凸包グラフのパラメータはチュートリアル > 組成可変型進化的アルゴリズム(EA-VC) > 解析と可視化も参考にすること.
calc_in/
calc_in/以下はチュートリアル > ランダムサーチ(RS) > ASE in your local PCと同様
calc_in/ase_in.py_1
from ase.constraints import FixSymmetry
from ase.filters import FrechetCellFilter
from ase.calculators.emt import EMT
from ase.optimize import BFGS
import numpy as np
from ase.io import read, write
# ---------- input structure
# CrySPY outputs 'POSCAR' as an input file in work/xxxxxx directory
atoms = read('POSCAR', format='vasp')
# ---------- setting and run
atoms.calc = EMT()
atoms.set_constraint([FixSymmetry(atoms)])
cell_filter = FrechetCellFilter(atoms, hydrostatic_strain=False)
opt = BFGS(cell_filter)
opt.run(fmax=0.01, steps=2000)
# ---------- opt. structure and energy
# [rule in ASE interface]
# output file for energy: 'log.tote' in eV/cell
# CrySPY reads the last line of 'log.tote'
# output file for structure: 'CONTCAR' in vasp format
e = cell_filter.atoms.get_total_energy()
with open('log.tote', mode='w') as f:
f.write(str(e))
# ------ write structure
opt_atoms = cell_filter.atoms.copy()
opt_atoms.set_constraint(None) # remove constraint for pymatgen
write('CONTCAR', opt_atoms, format='vasp', direct=True)
calc_in/job_cryspy
#!/bin/sh
# ---------- ASE
python3 ase_in.py > out.log
# ---------- CrySPY
sed -i -e '3 s/^.*$/done/' stat_job