Add support for reading displacement and force matrices from .npy files

This commit adds support for directly reading displacement and force data from .npy matrix files, in addition to the existing file-based workflows, and relaxes the ASE dependency constraint. This functionality is specifically used to support the atomate2–pheasy workflow used to generate the 2nd-order harmonic phonon database, where displacement and force data are already available in matrix form.

Key changes:

  • Introduced optional input arguments:

    • DISP_MATRIX_FILE
    • FORCE_MATRIX_FILE
  • Added new CLI flags in basic_io.py:

    • --disp_matrix_file
    • --force_matrix_file
  • Implemented:

    • read_displacements_from_matrix()
    • load_interatomic_forces_from_matrix()
  • Updated workflow logic in constructors.py:

    • If DISP_MATRIX_FILE is provided, displacement configurations are read directly from the NumPy matrix instead of reconstructed from structure files.
    • If FORCE_MATRIX_FILE is provided, forces are loaded directly from the NumPy matrix instead of parsed from DFT outputs.
  • Preserved backward compatibility:

    • Existing DISP_FILE and default workflows remain unchanged.
    • New functionality is only triggered when matrix files are explicitly provided.

Dependency update:

  • Relaxed ASE version constraint from ==3.22.1 to >=3.22.1 to improve its compatibilty with atomate2 software.

Merge request reports

Loading