Closed DanPorter closed 1 month ago
The fdmnes runfile is generated here: https://github.com/DanPorter/Dans_Diffraction/blob/02100e5d6d549fecdc8e1c7456782e8af83ed74f/Dans_Diffraction/classes_properties.py#L800-L805
The atomic configuration string is generated here: https://github.com/DanPorter/Dans_Diffraction/blob/02100e5d6d549fecdc8e1c7456782e8af83ed74f/Dans_Diffraction/classes_orbitals.py#L488-L499
The correct orbital configuration is generated for the charge here: https://github.com/DanPorter/Dans_Diffraction/blob/02100e5d6d549fecdc8e1c7456782e8af83ed74f/Dans_Diffraction/functions_crystallography.py#L1694-L1710
So, the error must be in the Atom fdmnes string generation: https://github.com/DanPorter/Dans_Diffraction/blob/02100e5d6d549fecdc8e1c7456782e8af83ed74f/Dans_Diffraction/classes_orbitals.py#L398-L407
The fix was to add the missing orbitals by comparing the orbital lists of the charged and neutral atoms: https://github.com/DanPorter/Dans_Diffraction/blob/d6d2cac958d43d2a11bd3a810f8b94e41bd28d33/Dans_Diffraction/classes_orbitals.py#L298-L326
The generated string for FDMNES then automatically spots the empty orbitals and removes electrons correcty:
from Dans_Diffraction.classes_orbitals import Atom
atom = Atom('Hf', 4)
print(atom)
# Atom: 72 Hf4+ 1s2 2s2 2p6 3s2 3p6 3d10 4s2 4p6 4d10 4f12 5s2 5p6 5d0 6s2
print(atom.generate_string_fdmnes())
# 72 4 4 3 12.00 5 2 0.00 6 0 2.00 6 1 4.00 ! Hf4+ 4f12 5d0 6s2 6p4
In the FDMNES gui, generating the input file for a compound such as HfO2, where Hf has a charge of Hf4+, the automatic atomic configuration is wrong, leading to FDMNES not running:
FDMNES error:
The correct atomic configuration for Hf4+ in the FDMNES input file should be: