Open Luc1anoo opened 2 weeks ago
@1041176461 could you have a look?
@Luc1anoo Have you tried the latest ASE-ABACUS interface ?
We update the ase-abacus version to ase-3.23.1b1, please check the newest commit.
I check read
function for reading 'running_cell-relax.log' output by ABACUS v3.6.5 , it runs successfully.
We update the ase-abacus version to ase-3.23.1b1, please check the newest commit. I check
read
function for reading 'running_cell-relax.log' output by ABACUS v3.6.5 , it runs successfully.
I updated the ase-abacus version. This time the read
function worked well. However, the calculator
seemed to fail with the following error:
(base) root@bohrium-17819-1150041:/personal/TEST/2/relax# python3 relax.py
/abacus-develop/tests/PP_ORB
/abacus-develop/tests/PP_ORB
Traceback (most recent call last):
File "/personal/TEST/2/relax/relax.py", line 59, in <module>
dyn.run(fmax=0.05)
File "/opt/mamba/lib/python3.10/site-packages/ase/optimize/optimize.py", line 430, in run
return Dynamics.run(self, steps=steps)
File "/opt/mamba/lib/python3.10/site-packages/ase/optimize/optimize.py", line 275, in run
for converged in Dynamics.irun(self, steps=steps):
File "/opt/mamba/lib/python3.10/site-packages/ase/optimize/optimize.py", line 225, in irun
self.optimizable.get_forces()
File "/opt/mamba/lib/python3.10/site-packages/ase/optimize/optimize.py", line 34, in get_forces
return self.atoms.get_forces()
File "/opt/mamba/lib/python3.10/site-packages/ase/atoms.py", line 818, in get_forces
forces = self._calc.get_forces(self)
File "/opt/mamba/lib/python3.10/site-packages/ase/calculators/abc.py", line 30, in get_forces
return self.get_property('forces', atoms)
File "/opt/mamba/lib/python3.10/site-packages/ase/calculators/calculator.py", line 538, in get_property
self.calculate(atoms, [name], system_changes)
File "/opt/mamba/lib/python3.10/site-packages/ase/calculators/genericfileio.py", line 321, in calculate
self.write_inputfiles(atoms, properties)
File "/opt/mamba/lib/python3.10/site-packages/ase/calculators/genericfileio.py", line 312, in write_inputfiles
self.template.write_input(
TypeError: AbacusTemplate.write_input() got an unexpected keyword argument 'profile'
The snippet of my script relax.py
is as follows with other parts remaining unchanged:
abacus = '/usr/local/bin/abacus'
profile = AbacusProfile('mpirun -n 2 abacus')
stru.calc = Abacus(profile=profile, directory=out_dir, **parameters)
@1041176461 I've repeated the same error above, the problem seems to be in write_input
function. Also, I have no idea about the change of usage of AbacusProfile
until I saw this issue. May you give a look and give us the right way to use ase-abacus interface after bug fixed ?
I fixed it in the commit https://gitlab.com/1041176461/ase-abacus/-/commit/80e300311f90e939f606068995d6ae61d13f645b, please test it again @QuantumMisaka @Luc1anoo
@1041176461 There are still other problems:
Traceback (most recent call last):
File "/lustre/home/2201110432/WORK/FeCHO-SCAN/Fe5C2-CO-react/clean/new-orb/PBE/vib/vib_analysis.py", line 10, in <module>
from ase.calculators.abacus import Abacus, AbacusProfile
File "/lustre/home/2201110432/apps/miniconda3/envs/ase/lib/python3.10/site-packages/ase/calculators/abacus.py", line 16
from ase.io.abacus import write_abacus, copy_basis, copy_offsite_basis, copy_pp, write_input, write_kpt,
^
SyntaxError: trailing comma not allowed without surrounding parentheses
So the comma need to be fixed.
We fixed the bug @QuantumMisaka metioned above and error for basis
and pp
environment varible settings. I modify your script @Luc1anoo and add some comments, please test it again based on this one.
import os
from pathlib import Path
import numpy as np
from ase.calculators.abacus import Abacus, AbacusProfile
from ase.collections import g2
from ase.io import Trajectory, read, write
from ase.optimize import QuasiNewton
from ase.visualize import view
# get Ethanol model
atoms = g2['CH3CH2OH']
# translation
translation_vector = np.array([5,5,5])
atoms.positions += translation_vector
atoms.center(vacuum=5)
# 不需要来回转换文件,直接使用atoms即可
out_dir = "OUT"
properties = ["energy", "forces", "stress"]
# pseudo_dir和basis_dir可自动从ABACUS_PP_PATH和ABACUS_ORBITAL_PATH获取
# 已支持默认pp和basis,详情见issue:https://gitlab.com/1041176461/ase-abacus/-/issues/30
kpts = [1, 1, 1]
# INPUT setting
parameters = {
'suffix': 'Ethanol',
'calculation': 'scf',
'basis_type': 'lcao',
'ks_solver': 'genelpa',
'nspin' : 1,
'xc': 'pbe',
'ecutwfc': 50,
'scf_thr': 1e-7,
'kpts': kpts,
'smearing_method': 'gauss',
'smearing_sigma': 0.0037,
'cal_force': 1,
'cal_stress': 1,
'out_stru': 1,
'out_chg': 0,
}
# attch calculator to the model
# 当前版本使用command=字符串
profile = AbacusProfile(command='mpirun -n 1 abacus')
atoms.calc = Abacus(profile=profile, directory=out_dir, **parameters)
#relax
dyn = QuasiNewton(atoms, trajectory='Ethanol.traj')
dyn.run(fmax=0.05)
print('Energy:', atoms.get_potential_energy())
The ATST-Tools https://github.com/QuantumMisaka/ATST-Tools have been updated to 1.4.3 version, which march the newest version of ase-abacus interface
@1041176461 Can one use the default PP and ORB while specifying pseudo_dir
and orbital_dir
at the same time ? In my test this way seems to fail. like:
lib_dir = "/lustre/home/2201110432/example/abacus"
pseudo_dir = f"{lib_dir}/PP"
basis_dir = f"{lib_dir}/ORB"
# default pp and basis is supported by ase-abacus interface
# pp = {
# 'C':'C_ONCV_PBE-1.0.upf',
# 'H':'H_ONCV_PBE-1.0.upf',
# 'Pt':'Pt_ONCV_PBE-1.0.upf',
# }
# basis = {
# 'C': 'C_gga_7au_100Ry_2s2p1d.orb',
# 'H': 'H_gga_6au_100Ry_2s1p.orb',
# 'Pt': 'Pt_gga_7au_100Ry_4s2p2d1f.orb'
# ,}
kpts = [2, 1, 2]
parameters = {
'calculation': 'scf',
'nspin': 2,
'xc': 'pbe',
'ecutwfc': 100,
'dft_functional': 'pbe',
'ks_solver': 'genelpa',
'symmetry': 0,
'vdw_method': 'd3_bj',
'smearing_method': 'gaussian',
'smearing_sigma': 0.001,
'basis_type': 'lcao',
'mixing_type': 'broyden',
'scf_thr': 1e-6,
'scf_nmax': 100,
'kpts': kpts,
'pseudo_dir': pseudo_dir,
'basis_dir': basis_dir,
'cal_force': 1,
'cal_stress': 1,
'init_wfc': 'atomic',
'init_chg': 'atomic',
'out_stru': 1,
'out_chg': 0,
'out_mul': 0,
'out_wfc_lcao': 0,
'out_bandgap': 0,
'efield_flag': 1,
'dip_cor_flag': 1,
'efield_dir': 1,
}
# 'pp': pp,
# 'basis': basis,
And by this way ase-abacus will not copy PP and ORB to running directory
@QuantumMisaka In this case, pseudo_dir
and basis_dir
will be output into INPUT file. Here are the corresponding codes
If you have any good suggestions, please submit a new MR to the Gitlab repo.
We update the ase-abacus version to ase-3.23.1b1, please check the newest commit. I check
read
function for reading 'running_cell-relax.log' output by ABACUS v3.6.5 , it runs successfully.
By the way, the initial error caused by read
function still exists with the ABAUCS version of 3.6.3 (3.6.5 is well).
If v3.6.0 and v3.6.5 run successfully, I think there is a problem with the formatting of ABACUS v3.6.3
Describe the bug
I'm performing the computation of structure relaxation of Ethanol by ASE-ABACUS and ABACUS. I use the following script
model.py
andrelax.py
to create model of Ethanol and do the relaxation computation. The computation can be done successfully with ABACUS version of 3.6.0, but will throw the following error when running therelax.py
after changing the ABACUS version to 3.6.3. It seems something wrong with reading the structure of Ethanol.Expected behavior
No response
To Reproduce
model.py
:relax.py
:Environment
version: ASE-ABACUS: ase-3.23.0b1 ABACUS: 3.6.0, 3.6.3
Additional Context
No response
Task list for Issue attackers (only for developers)