Closed PNOGillespie closed 8 months ago
Hi @superstar54, I have added some tests for get_xspectra_structures
and also refined some of the logic for assigning magnetic states, since I noticed that the original method would not give the absorbing atom the correct starting_magnetization
if the Kind
that it inherited from had a starting_magnetization
of zero. I also fixed a few mistakes that I noticed when I testing it again.
Hi @superstar54. I noted (and fixed) a bug that I spotted with the function which will be relevant for cases where different Kind
names applied to the structure would break the symmetry (e.g. in the case of antiferromagnetic systems). This should now be ready for final review.
If you could give the PR another review (or ping someone with write access) that would be much appreciated.
Hi @superstar54. I reviewed the source code to see if I could de-convolute and consolidate some of the process logic. I have managed to reduce the number of if
statements somewhat in a few different ways, but modularisation won't simplify things here since there are very few cases where code is really re-used.
In regards to your suggestion here:
think there is no need to create a new
clearned_symmetry_dataset
here.
The CalcFunction
needs to know which Kind
should be present at each site, so both "cleaned" and "non-cleaned" datasets are needed in order to map the correct Kind
to each chosen absorbing atom while also determining the symmetry properties correctly (i.e. where we assume that all Kind
s of the same element are the same). This information is then needed by XspectraCrystalWorkChain
in order to correctly set the magnetic moment (particularly for an anti-ferromagnetic system).
I reduced the number of if use_element_types
statements by taking your suggestion and then generating the arrays needed to determine which Kind
s correspond to which site on-the-fly, since the alternative is to constantly check if use_element_types == True
.
All this behaviour should be covered by the tests, since there are test cases for c-Si using [Si, Si]
and [Si0, Si1]
Let me know what you think of the changes.
Hi @superstar54, I've changed it to now generate a single dataset and extract the data from there instead of repeating the same function call.
Let me know if you need anything else
Overview
In this PR, we update the various
WorkChains
andCalcFunctions
relevant for calculations with XSpectra to work with the newHubbardStructureData
data type and to handle system with magnetic data reliably, thus making calculations of systems with known magnetic and Hubbard parameter configurations possible with eachWorkChain
.Changes
get_xspectra_structures
:CalcFunction
. If a supercell is created from the input structure, then the parameters are scaled to the new supercell usingHubbardUtils.get_hubbard_for_supercell()
.CalcFunction
where the information on equivalent atomic sites was taken from the standardized structure even if the input structure was not standardized.Bool
inputuse_element_types
which instructs theCalcFunction
to treatKind
s of the same element as the same for the purposes of symmetry analysis even if theirkind_name
s differ.XspectraCrystalWorkChain
:WorkChain
to setstandardize_structure = False
if the input structure isHubbardStructureData
in order to preserve the Hubbard data during structure creation.starting_magnetization
of the absorbing atom in each subsequentXspectraCoreWorkChain
based on the magnetic moment given for theKind
that it replaces. Note that this only works ifstarting_magnetization
is provided as adict
instead of separate entries ofstarting_magnetization(n)
.XspectraCoreWorkChain
:WorkChain
so that it applies the GIPAW pseudopotential provided for the calculation to allKinds
corresponding to the absorbing element even if multiple of such exist.