Open krefson opened 8 months ago
Hi Keith,
I can take a look at this. I'm not familiar with the current logic to figure it out, but probably should be. I can't promise an exact timescale, but I guess we would like to have it by 2025?
I expect this feature will be very useful for combining force constants with a dipole correction from another (i.e. DFPT-supported!) level of theory.
Within Euphonic the ambiguity is avoided by a simple rule: if the Born charges and dielectric tensor are included, they have been subtracted from the ForceConstants they are attached to.
(Arguably the convention used by Phonopy, Espresso and others of "they have never been subtracted, this only happens on-the-fly" is simpler still, but Euphonic was built on CASTEP-friendly foundations!)
@krefson It seems worth revisiting this now we are in Q4 2024! Do we have some reasonably stable sample files to work with?
I am planning a small change in the CASTEP binary checkpoint file format for the next release (25.1) in the handling of the force constant matrix, and I wanted to ensure that this will not generate problems with Euphonic's CASTEP binary reader.
The change will be do do with the dipole-dipole model Coulomb tail subtraction of the force constant matrix. Currently the stored FCM may or may-not be Coulomb-subtracted depending on wither DFPT or FD/Supercell methods were used. Euphonic has some logic to figure this out, but I haven't completely understood this. I propose to add a new flag to the checkpoint format to explicitly indicate whether this is the case, so a minor change to Euphonic will be needed to read this (*). This will also require a checkpoint version test (>=25.1?read new flag:retain old logic).
The reason for this is that I have implemented reading in of externally computed Born effective charges for calculating the dipole tail, LO/TO splitting correction etc, as requested, so the logic of Coulomb subtraction will be more complicated if used.
(*) As the flag is a Fortran logical some twiddling will be required to reliably convert to a 0/1 boolean - Fortran logicals are a compiler-dependent representation.