I am attempting to connect LAMMPS to the ASE Python module using the LAMMPSRun
calculator. While everything seems to be set up correctly, ASE is unable to retrieve thermodynamic data from the LAMMPS log file.
I am using Windows 11, LAMMPS (2 Aug 2023 - Update 4), and the ReaxFF potential for atomic interactions.
When I run my Python script, it creates a tempDir
folder containing several files, including in_lammps*
, ffield
, control
, data_lammps*
, log_lammps*
, and trj_lammps*.bin
.
ERROR
Traceback (most recent call last):
File "D:\hobby\python\ASE\globalOptimization\lmpCalculator.py", line 29, in <module>
print("Energy ", atoms.get_potential_energy())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\hobby\python\ASE\globalOptimization\venv\Lib\site-packages\ase\atoms.py", line 755, in get_potential_energy
energy = self._calc.get_potential_energy(self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\hobby\python\ASE\globalOptimization\venv\Lib\site-packages\ase\calculators\abc.py", line 24, in get_potential_energy
return self.get_property(name, atoms)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\hobby\python\ASE\globalOptimization\venv\Lib\site-packages\ase\calculators\calculator.py", line 538, in get_property
self.calculate(atoms, [name], system_changes)
File "D:\hobby\python\ASE\globalOptimization\venv\Lib\site-packages\ase\calculators\lammpsrun.py", line 250, in calculate
self.run()
File "D:\hobby\python\ASE\globalOptimization\venv\Lib\site-packages\ase\calculators\lammpsrun.py", line 419, in run
raise RuntimeError("Failed to retrieve any thermo_style-output")
RuntimeError: Failed to retrieve any thermo_style-output
PYTHON SCRIPT
import os
os.environ["ASE_LAMMPSRUN_COMMAND"] = r"C:\Program Files\LAMMPS 64-bit 2Aug2023\bin\lmp.exe"
print("ASE_LAMMPSRUN_COMMAND:", os.environ.get("ASE_LAMMPSRUN_COMMAND"))
from ase.io.lammpsdata import read_lammps_data
from ase.calculators.lammpsrun import LAMMPS
parameters = {
'atom_style': 'charge',
'units': 'real',
'pair_style': 'reax/c control checkqeq yes safezone 4.8 mincap 200',
'pair_coeff': ['* * ffield Ni'],
'fix': ['fix_qeq_reax all qeq/reax 1 0.0 10.0 1.0e-6 reax/c'],
}
files = ['ffield', 'control']
atoms=read_lammps_data("ni210.dat", sort_by_id=True, units="real", atom_style="charge")
calc=LAMMPS(
files=files,
**parameters,
keep_tmp_files=True,
tmp_dir="tempDir",
)
atoms.calc=calc
print("Energy ", atoms.get_potential_energy())
MY FOLDERS AND FILES
in_lammps - input file created by ASE*
clear
variable dump_file string "D:\hobby\python\ASE\globalOptimization\tempDir\trj_lammps000001htmwusct.bin"
variable data_file string "D:\hobby\python\ASE\globalOptimization\tempDir\data_lammps0000017hpp8og_"
atom_style charge
units real
boundary p p p
box tilt large
atom_modify sort 0 0.0
read_data D:\hobby\python\ASE\globalOptimization\tempDir\data_lammps0000017hpp8og_
### interactions
pair_style reax/c control checkqeq yes safezone 4.8 mincap 200
pair_coeff * * ffield Ni
mass 1 58.693400
### run
fix fix_nve all nve
fix fix_qeq_reax all qeq/reax 1 0.0 10.0 1.0e-6 reax/c
dump dump_all all custom 1 D:\hobby\python\ASE\globalOptimization\tempDir\trj_lammps000001htmwusct.bin id type x y z vx vy vz fx fy fz
thermo_style custom step temp press cpu pxx pyy pzz pxy pxz pyz ke pe etotal vol lx ly lz atoms
thermo_modify flush yes format float %23.16g
thermo 1
run 0
print "__end_of_ase_invoked_calculation__"
log /dev/stdout
Any suggestions on how to resolve this issue would be greatly appreciated.