When setting the Hubbard projectors for HubbardStructureData instance, one needs to first create a copy of the HubbardStructureData.Hubbard() object, set the projectors in this copy, then set the value of the HubbardStructureData.Hubbard to the modified object, which works correctly and is described in the tutorial:
hubbard = hubbard_structure.hubbard
hubbard.projectors = 'atomic' # default is 'ortho-atomic'
hubbard.formulation = 'dudarev' # already the default
hubbard_structure.hubbard = hubbard
print(HubbardUtils(hubbard_structure).get_hubbard_card())
However, quite unintuitively, it does not work to set the projectors directly like
hubbard_structure.hubbard.projectors = 'atomic'
after which the hubbard_structure.hubbard.projectors stay 'ortho-atomic', they haven't changed to 'atomic'.
This can cause confusion and bugs when the user believes he has set the projectors to the new value, while they didn't change.
When setting the Hubbard projectors for
HubbardStructureDatainstance, one needs to first create a copy of theHubbardStructureData.Hubbard()object, set the projectors in this copy, then set the value of theHubbardStructureData.Hubbardto the modified object, which works correctly and is described in the tutorial:However, quite unintuitively, it does not work to set the projectors directly like
after which the
hubbard_structure.hubbard.projectorsstay 'ortho-atomic', they haven't changed to 'atomic'.This can cause confusion and bugs when the user believes he has set the projectors to the new value, while they didn't change.