##########################################
# README for the automatedMBPT.aiida file.
##########################################

We provide an automatedMBPT.aiida zip file which contains the export of the AiiDA database for the YamboConvergence and YamboWannier90 calculations. You can export all the nodes into your own AiiDA database (>v1.5) by typing:

```
verdi import automatedMBPT.aiida
```

# GW convergences:

You can find a group for each sysytem, by typing "verdi group list -A": 

YamboConvergence/Si2
YamboConvergence/C2
YamboConvergence/2D-hBN
YamboConvergence/MoS2
YamboConvergence/ZnO
YamboConvergence/rutile_TiO2
YamboConvergence/bulk_hBN

In addition, a Dict node with the "type_dict" extra equal to "instructions", in which you can find the uuid 
of the YamboConvergence node.

To access the instruction Dict, it is possible to use the QueryBuilder:

```
from aiida import orm

qb = orm.QueryBuilder()

    
qb.append(
    Group, 
    filters={'label':{'like':group_name}}, 
    tag ='g',
) 
        
qb.append(
    orm.Dict, 
    filters={
        'extras.type_dict':'instructions',},
        with_group='g',
        tag = 'structure_imported',
)
```


## Access the convergence history for a system:

You can access all the convergence history by means of the pandas library:

import pandas as pd

YamboConvergence_node = load_node(<YamboConvergence node uuid>)
    
    df = pd.DataFrame(YamboConvergence_node.outputs.history.get_dict()) 

The final converged YamboWorkflow can be accessed by: 
    
    final_workflow_uuid = df[df['useful'] == True]['uuid'].values[0]
    
Calculations can be accessed by their corresponding YamboWorkflow caller, whose uuid is store in df['uuid'] column of the df DataFrame. This is valid for all systems except 2D-hBN and rutile-TiO2, which are simulated using an older version of the convergence workflow. 

If the minimum gap is recomputed (indirect gap), the corresponding YamboWorkflow is provided in the database, with the extra "final_gap" = True. Gap can then be accessed via:

```
load_node(<Yamboworkflow_uuid>).outputs.output_ywfl_parameters.get_dict()
```

##########

# Automated G0W0 band interpolations by means of Wannierization:

You can also find the groups:

automatic_G0W0_Wannierization/Si2
automatic_G0W0_Wannierization/Cu

where you can find the two YamboWannier90 workchains used to compute the automated interpolated band structures of silicon and copper, and the corresponding PwBaseWorkchain used to compute the QE band structure on the same path. To plot all the bands:

```
aiida-yambo-wannier90 plot bands <PwBaseWorkchain> <YamboWannier90 workchain>
```