# How to import and query the AiiDA nodes of this Materials Cloud record

If you don't have AiiDA installed yet, we suggest to use a python virtualenvironment and the new 
"verdi presto" feature (to create an AiiDA profile with zero effort and no services):

>>> conda create -n myvenv python=3.11 ase pymatgen
>>> conda activate myvenv
>>> pip install aiida-core==2.6.2
>>> pip install aiida-quantumespresso==4.6.0 # needed for HubbardStructureData
>>> verdi presto

To import the data into your AiiDA profile, just run:

>> verdi archive import automated_muons.aiida -G automated_muons 

To query a specific subgroup, for example the one for the LaCoPO, just open a terminal, invoke "verdi shell" and run:

```python
from aiida import orm

qb = orm.QueryBuilder()
qb.append(orm.Group,
          filters={'label': 'muons/LaCoPO/FindMuon'},
          tag="group"
          )
qb.append(orm.Node, 
          with_group="group",
          project='*'
          )

find_muon_workchains = qb.all(flat=True)
first_find_muon_workchains = find_muon_workchains[0]
```

Then you can inspect the workchains and their results. For a list 
of all the subgroup contained in this record, please look at the last section of this file.

## Plotting the results

See the README.txt file. Some of the data used for plotting are not computed within AiiDA, and are contained in the 
"raw_data" folder of each material.

## List of all the groups contained in the archive

### LaCoPO
- FindMuonWorkChain: muons/LaCoPO/FindMuon; NB: part of the results (the supercell with and without the muon) were computed by hands and loaded from the "raw_data/force_difference_data" subfolder. 
  The data contained in the IsolatedImpurityWorkChain (subworkflow of FindMuonWorkChain) are computed also doing a pre-relaxation of the unit cell, but the results on the supercell size are the same. 

### La2NiO4
- FindMuonWorkChain: muons/La2NiO4/FindMuon

### LiF 
- IsolatedImpurityWorkChain: muons/LiF/Supercell/Convergence; NB: part of the results (the supercell without the muon) were computed by hands and loaded from the "raw_data/force_difference_data" subfolder.

### CaF2
- charged FindMuonWorkChain: muons/CaF2/FindMuon/charged
- neutral FindMuonWorkChain: muons/CaF2/FindMuon/neutral

### Kagomes
- FindMuonWorkChain RbV3Sb5: muons/RbV3Sb5/FindMuon
- FindMuonWorkChain KV3Sb5: muons/KV3Sb5/FindMuon
- FindMuonWorkChain CsV3Sb5: muons/CsV3Sb5/FindMuon

### Fe
- PpCalculations tet: muons/Fe/tet/Ppcalculations (tet means the muon in the tetrahedral interstitial site)
- PpCalculations oct: muons/Fe/oct/Ppcalculations (oct means the muon in the octahedral interstitial site)

### CuO
- PpCalculations for different Hubbard U values: muons/CuO/Hubbard_values/Ppcalculations
- FindMuonWorkChain: muons/CuO/FindMuon/Hubbard