Skip to content

ASE 3.26 stress output is not compatible with charge-NEP

I am trying to relax a structure using a trained charge-NEP potential and the GPUNEP calculator. The structure should be close to the ground state, and I am able to extract the energy as a single-point calculation, but when using relax_structure() the calculation ends with an error. On a different system the calculation completes but never converges.

I am using Calorine 3.2 and GPUMD 4.3.

The error message is:

Traceback (most recent call last):
  File "/home/idacsk/projects/ferroelectric-oxides/domain_walls/formation_energies/bulk_CNEP/test_files/relax_2.py", line 20, in <module>
    relax_structure(structure, fmax = f_max, steps = nsteps)
  File "/home/idacsk/Venv/my_chalmers/lib/python3.12/site-packages/calorine/tools/structures.py", line 56, in relax_structure
    dyn.run(fmax=fmax, steps=steps)
  File "/home/idacsk/Venv/my_chalmers/lib/python3.12/site-packages/ase/optimize/optimize.py", line 417, in run
    return Dynamics.run(self, steps=steps)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/idacsk/Venv/my_chalmers/lib/python3.12/site-packages/ase/optimize/optimize.py", line 286, in run
    for converged in Dynamics.irun(self, steps=steps):
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/idacsk/Venv/my_chalmers/lib/python3.12/site-packages/ase/optimize/optimize.py", line 233, in irun
    gradient = self.optimizable.get_gradient()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/idacsk/Venv/my_chalmers/lib/python3.12/site-packages/ase/filters.py", line 32, in get_gradient
    return self.filterobj.get_forces().ravel()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/idacsk/Venv/my_chalmers/lib/python3.12/site-packages/ase/filters.py", line 618, in get_forces
    stress = self.atoms.get_stress(**kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/idacsk/Venv/my_chalmers/lib/python3.12/site-packages/ase/atoms.py", line 918, in get_stress
    stress = self._calc.get_stress(self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/idacsk/Venv/my_chalmers/lib/python3.12/site-packages/ase/calculators/abc.py", line 35, in get_stress
    return self.get_property('stress', atoms)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/idacsk/Venv/my_chalmers/lib/python3.12/site-packages/ase/calculators/calculator.py", line 519, in get_property
    self.calculate(atoms, [name], system_changes)
  File "/home/idacsk/Venv/my_chalmers/lib/python3.12/site-packages/ase/calculators/calculator.py", line 1161, in calculate
    self.write_input(self.atoms, properties, system_changes)
  File "/home/idacsk/Venv/my_chalmers/lib/python3.12/site-packages/calorine/calculators/gpunep.py", line 229, in write_input
    write_xyz(filename=os.path.join(self._directory, 'model.xyz'),
  File "/home/idacsk/Venv/my_chalmers/lib/python3.12/site-packages/calorine/gpumd/io.py", line 336, in write_xyz
    write(filename=filename, images=_structure, write_info=True, format='extxyz')
  File "/home/idacsk/Venv/my_chalmers/lib/python3.12/site-packages/ase/io/formats.py", line 686, in write
    return _write(filename, fd, format, io, images,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/idacsk/Venv/my_chalmers/lib/python3.12/site-packages/ase/parallel.py", line 261, in new_func
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/home/idacsk/Venv/my_chalmers/lib/python3.12/site-packages/ase/io/formats.py", line 722, in _write
    return io.write(fd, images, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/idacsk/Venv/my_chalmers/lib/python3.12/site-packages/ase/io/formats.py", line 183, in _write_wrapper
    return function(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/idacsk/Venv/my_chalmers/lib/python3.12/site-packages/ase/utils/__init__.py", line 599, in iofunc
    obj = func(fd, *args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/idacsk/Venv/my_chalmers/lib/python3.12/site-packages/ase/io/extxyz.py", line 926, in write_xyz
    comm, ncols, dtype, fmt = output_column_format(atoms,
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/idacsk/Venv/my_chalmers/lib/python3.12/site-packages/ase/io/extxyz.py", line 764, in output_column_format
    dtype = array.dtype
            ^^^^^^^^^^^
AttributeError: 'list' object has no attribute 'dtype'

I have also compiled a folder with a relaxation script, the nep.txt and the POSCAR. Recreating this calculation with a regular NEP potential and CPUNEP, it runs without any issue.

files.zip

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information