Skip to content

Bug in load_phonopy function in Phonons.py – incorrect handling of dynamical matrices #113

Description

@FlemkMeserath

Hi,

I noticed that the load_phonopy function in Phonons.py does not properly load and save the dynamical matrices.

Specifically, I identified three issues:

The FORCE_CONSTANTS file loaded via cellconstructor does not correctly assign the force constants to the respective atoms.

The standard force constants in phonopy are stored in eV/Ų, but cellconstructor expects them in Ry/Bohr², leading to unit inconsistencies.

The alat parameter is not properly initialized, resulting in incorrect vector scaling.

I’ve implemented a possible fix addressing all three points:

Adjusted the code to correctly map the full force constants as output by phonopy.

Applied proper unit conversion to Ry/Bohr².

Correctly initialized the alat parameter.

I’ve attached a modified version of the load_phonopy function for your review if you deem appropriate.

vasp_load.txt

Activity

  1. mesonepigreco commented on Jul 19, 2025

    @mesonepigreco
    Collaborator

    Yes you are right. THe phonopy loader is broken.
    I deactivated it for now. However, there is a way to read phonopy dynamical matrices within sscha (and also save), as explained in #87

    Thank you very much for your fix. Does this correctly load the dynamical matrix? Be careful, as we noticed that sometimes, even if the phonon energies are the same, you see weird stuff when you plot the phonon bands via interpolation.

  2. FlemkMeserath commented on Jul 19, 2025

    @FlemkMeserath
    Author

    Thank you for the suggestion, I will give it a look.

    The fix seems to work properly under the conditions that in phonopy the flag FULL_FORCE_CONSTANTS = .TRUE. and that the force constants are saved in eV/Angstrom^2

    I have tried to load the phonopy force constants with the suggested fixed method and then save them in QE format.
    The eigenvalues and eigenvectors seem to have a good agreement between vasp and QE. Also the band interpolated matrices obtained through phonopy seem congruent with those obtained just using QE, exception made for differences driven by the phonopy finite displacements / QE DFPT different approaches.

  3. SergeevGregory commented on Jul 20, 2025

    @SergeevGregory

    Dear mesonepigreco and FlemkMeserath,

    I’ve studied #87 and the documentation, but I’m struggling to write a working code for loading Phonopy’s force_constants.hdf5 file to CC.Phonons.Phonons. Could you provide a minimal working example?

  4. caolz commented on Aug 11, 2025

    @caolz

    I'm trying to convert VASP force constants from phonopy to QE dynamical matrix format, but I'm encountering several issues. I have studied #87 and the documentation, but I still cannot get it working properly. Could you provide a working example for converting phonopy force constants to QE format?

  5. added this to the 1.7 milestone on Jul 20, 2026
  6. mesonepigreco commented on Jul 20, 2026

    @mesonepigreco
    Collaborator

    This should be fixed by PR #121 which has just been merged. In the next Cellconstructor version 1.7, phonopy integration should automatically work correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions