Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add structures with multiple kinds for AFM calculations #154

Closed
mbercx opened this issue Mar 5, 2021 · 4 comments · Fixed by #157
Closed

Add structures with multiple kinds for AFM calculations #154

mbercx opened this issue Mar 5, 2021 · 4 comments · Fixed by #157

Comments

@mbercx
Copy link
Member

mbercx commented Mar 5, 2021

So far I've been running AFM calculations for QE by first generating a new StructureData with the required kinds and then passing its identifier to the -S option. This is not very user friendly, however. 😅

Instead, it would be easier if we added structure files that immediately have the required kinds after being loaded. @yakutovicha sent me an example yesterday where tags are added to an .xyz file for BCC Fe:

2
Lattice="2.833509 0.0 0.0 0.0 2.833509 0.0 0.0 0.0 2.833509" Properties=species:S:1:pos:R:3:tags:I:1 spacegroup="I m -3 m" unit_cell=conventional pbc="T T T"
Fe       0.00000000       0.00000000       0.00000000        1
Fe       1.41675450       1.41675450       1.41675450        2

However, we might still switch to FCC iron for this structure (see #117). Another example would be the hydrogen molecule:

2
Lattice="15.0 0.0 0.0 0.0 15.0 0.0 0.0 0.0 15.0" Properties=species:S:1:pos:R:3:tags:I:1 pbc="F F F"
H        0.00000000       0.00000000      -0.40000000   1
H        0.00000000       0.00000000       0.40000000   2

When I adjust the common/data/h2.xyz file as above, the DissociationCurveWorkChain launch command work fine for Quantum ESPRESSO. However, running e.g. BigDFT result in error with the following final line:

aiida.common.exceptions.ValidationError: The following kinds are defined, but there are no sites with that kind: ['H2']

So maybe we should have two separate files (e.g. h2.xyz and h2-afm.xyz), and clearly indicate which ones to use for which code in the instructions? Not the cleanest solution, I admit. Alternatively we could look into loading the right structure in StructureDataParamType based on the code and provided magnetizations (which can be derived from the ctx?)? Pinging @sphuber for comments.

@yakutovicha
Copy link
Contributor

@mbercx
Copy link
Member Author

mbercx commented Mar 5, 2021

Sure, that also works for these simple cases :) (note that for complex systems with more than 10 magnetizations for one element this would fail due to the 3 char limit of Quantum ESPRESSO kinds). However, you would be creating a new duplicate StructureData each time the Cp2kRelaxInputGenerator.get_builder() method is called, right?

@sphuber
Copy link
Collaborator

sphuber commented Mar 8, 2021

Indeed, there are the usual two comments to the simple solution referenced:

  1. The provenance of the input structure is lost. If that is "fixed" by turning the function into a calcfunction, now the builder will mutate the database when being run, which is not desirable.
  2. This solution does not account for infinitesimal float differences, i.e., a magnetization of 0.99999, will be considered to be a different kind as 0.99999999999

@mbercx and I have written a calcfunction that takes the latter problem (and a lot more subtle details) but the further we advanced the more we were getting convinced the problem lay elsewhere. Really the CalcJob should probably just allow to specify quantities (such as starting magnetization) per site, instead of per kind.

@mbercx
Copy link
Member Author

mbercx commented Mar 8, 2021

That said, it's probably better to have this simple solution for now than no solution at all? That or we add separate .xyz files with tags for the structures which we discuss in the paper. On that note, I don't seem to be able to obtain the click arguments from the context, i.e. ctx.params only seems to contain the options?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants