When calculating NPT-MD in ASE, the lattice vectors (atoms.cell) of a target structure must be in triangular matrix form (upper triangular matrix form for versions prior to ASE 3.24). For example, using ase.build.bulk to create the Cu-FCC structure yields an atoms object with the following lattice vectors.
from ase.build import bulk
Cu_fcc_atoms = bulk(name="Cu", crystalstructure="fcc")
Cu_fcc_atoms = Cu_fcc_atoms * (4, 4, 4)
Cu_fcc_atoms.cell[:]array([[0. , 7.22, 7.22],
[7.22, 0. , 7.22],
[7.22, 7.22, 0. ]])If NPT-MD is performed on such atoms objects without transforming the lattice vectors, the following error (NotImplementedError) will occur and the MD calculation will not proceed.
・ For ASE 3.25.0 (Click image to enlarge)
・ For ASE 3.24.0 (Click image to enlarge)
convert_atoms_to_upper
By using the function "convert_atoms_to_upper" in matlantis-futures, one can obtain an atoms object in which the lattice vectors have been converted to upper triangular matrix form.
from matlantis_features.utils.atoms_util import convert_atoms_to_upper
Cu_fcc_atoms = convert_atoms_to_upper(Cu_fcc_atoms)
Cu_fcc_atoms.cell[:]array([[ 8.33693789, 2.94755266, 5.10531096],
[ 0. , 8.84265797, 5.10531096],
[ 0. , 0. , 10.21062192]])By using the atoms object after lattice vector transformation, NPT-MD calculations can be performed in ASE.
Tips (Added 8/5/2025)
If you save the file in CIF format, please note that you will need to convert it again after loading.