Hi,
I am using ase to create selactive dynamics (FixedLine class). Below is my full code:
import os
import ase.io as aio
from ase.build import add_adsorbate, graphene, sort
from ase.calculators.vasp import Vasp
from ase.constraints import FixedLine
command = 'mpirun -np {:2d} $HOME/bin/vasp_gam'.format(8)
os.environ['VASP_PP_PATH'] = os.path.expanduser('~/Software/POTCAR')
system = aio.read("Fe1.cif")
c = FixedLine(indices=[atom.index for atom in system], direction=[0, 0, 1])
system.set_constraint(c)
print(system)
calc = Vasp(directory="/tmp", command=command)
calc.set(ibrion=2,
nsw=3,
nelm=5,
ediffg=-0.01,
nelmdl=4,
lreal="Auto",
ncore=4,
lorbit=11,
lwave=False,
lcharge=False)
system.calc = calc
print(system.get_potential_energy())
But this is giving error:
python trial.py
Atoms(symbols='Fe4', pbc=True, cell=[3.65555117, 3.65555117, 3.65555117], spacegroup_kinds=..., constraint=FixedLine(indices=[0 1 2 3], [0.0, 0.0, 1.0]))
Traceback (most recent call last):
File "/home/rudra/Projects/Porphyrine/trial.py", line 29, in <module>
print(system.get_potential_energy())
~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
File "/home/rudra/.local/lib/python3.13/site-packages/ase/atoms.py", line 770, in get_potential_energy
energy = self._calc.get_potential_energy(self)
File "/home/rudra/.local/lib/python3.13/site-packages/ase/calculators/abc.py", line 24, in get_potential_energy
return self.get_property(name, atoms)
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
File "/home/rudra/.local/lib/python3.13/site-packages/ase/calculators/calculator.py", line 538, in get_property
self.calculate(atoms, [name], system_changes)
~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/rudra/.local/lib/python3.13/site-packages/ase/calculators/vasp/vasp.py", line 346, in calculate
self.read_results()
~~~~~~~~~~~~~~~~~^^
File "/home/rudra/.local/lib/python3.13/site-packages/ase/calculators/vasp/vasp.py", line 564, in read_results
calc_xml = self._read_xml()
File "/home/rudra/.local/lib/python3.13/site-packages/ase/calculators/vasp/vasp.py", line 711, in _read_xml
_xml_atoms = read(file, index=-1, format='vasp-xml')
File "/home/rudra/.local/lib/python3.13/site-packages/ase/io/formats.py", line 809, in read
return next(_iread(filename, slice(index, None), format, io,
parallel=parallel, **kwargs))
File "/home/rudra/.local/lib/python3.13/site-packages/ase/parallel.py", line 302, in new_generator
for result in generator(*args, **kwargs):
~~~~~~~~~^^^^^^^^^^^^^^^^^
File "/home/rudra/.local/lib/python3.13/site-packages/ase/io/formats.py", line 875, in _iread
for dct in io.read(fd, *args, **kwargs):
~~~~~~~^^^^^^^^^^^^^^^^^^^^^
File "/home/rudra/.local/lib/python3.13/site-packages/ase/io/vasp.py", line 485, in read_vasp_xml
constraints.append(FixScaled(cell_init, i, flags))
~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^
File "/home/rudra/.local/lib/python3.13/site-packages/ase/constraints.py", line 887, in __init__
super().__init__(indices=a)
~~~~~~~~~~~~~~~~^^^^^^^^^^^
File "/home/rudra/.local/lib/python3.13/site-packages/ase/constraints.py", line 137, in __init__
raise ValueError('indices has wrong amount of dimensions. '
f'Got {np.ndim(indices)}, expected ndim <= 1')
ValueError: indices has wrong amount of dimensions. Got 2, expected ndim <= 1
I am using ase-3.23.1b1
with Python 3.13.0
Any clue to solve this?