Automated high-throughput Wannierisation

79 views
Skip to first unread message

Zhigang Hu

unread,
Apr 26, 2021, 2:18:50 AM4/26/21
to aiidausers
Dear aiida users

I want to do some high-throughput researches based on the record: Valerio Vitale, Giovanni Pizzi, Antimo Marrazzo, Jonathan R. Yates, Nicola Marzari, Arash A. Mostofi, Automated high-throughput Wannierisation, Materials Cloud Archive 2020.60 (2020), doi: 10.24435/materialscloud:dd-nz.  The virtual machine wannierising_machine_19.07 provided is not capable of dealing with a real high-throughput calculation (involving hundreds or thousands of materials). So I install the recent version of aiida on a remote HPC following the tutorial

> conda create -n aiida -c conda-forge aiida-core aiida-core.services

I have installed softwares and relative aiida-plugins (quantumespresso.pw, etc)  and setuped the computer and codes.  However,  I have no idea how to modify the run_automated_wannier.py provided in wannierising_machine_19.07 for set options for the slurm. This is the code in run_automated_wannier.py
------------------------------------------------------------------------------------------
scf_settings =  ParameterData(dict={'cmdline':['-nk',str(num_pools)]})
        scf_options  = ParameterData(dict={
                            'resources': {
                                        'num_machines': 1,
                                        'tot_num_mpiprocs': tot_num_mpiprocs,
                                        },
                            'max_wallclock_seconds': max_sec_scf,#'queue_name':'debug',
                                })
        nscf_options  = ParameterData(dict={
                            'resources': {
                                        'num_machines': 1,
                                        'tot_num_mpiprocs': tot_num_mpiprocs,
                                        },
                            'max_wallclock_seconds': max_sec_nscf,#'queue_name':'debug',
                                })
        pw2wannier90_options  = ParameterData(dict={
                            'resources': {
                                        'num_machines': 1,
                                        'tot_num_mpiprocs':tot_num_mpiprocs_matrices,
                                        },
                            'max_wallclock_seconds': max_sec_pw2wannier90,#'queue_name':'debug',
                                })
----------------------------------------------------------------------------------------

And  the typical submit script in the HPC is
----------------------------------------------------------------------------------------
#!/bin/bash
#SBATCH -o job.%j.out
#SBATCH --partition=C032M0128G
#SBATCH --qos=low
#SBATCH -J myFirstMPIJob
#SBATCH --nodes=2
#SBATCH --ntasks-per-node=32

# load MPI
module load intel/2018.1

# execuate
mpirun -n 64  execuate_code_path > log
--------------------------------------------------------------------------------------

run_automated_wannier.py is attached.

Best,
Zhigang Hu
run_automated_wannier.py

zhubon...@gmail.com

unread,
Apr 26, 2021, 4:29:38 AM4/26/21
to aiida...@googlegroups.com

Hi Zhigang,

 

The code you attached suggests that it is from a pre-1.0 version of AiiDA. The equivalent of the below for aiida-core >=1.0 is to replace the `ParameterData` with `Dict`.

However, the most important thing is that the underlying plugin must also be migrated to AiiDA 1.0 – if you have installed the correct versions then they should work fine.

The workflows provided themselves may also need some migration, although it should be very minimal.

 

Best wishes,

Bonan

--
AiiDA is supported by the NCCR MARVEL (http://nccr-marvel.ch/), funded by the Swiss National Science Foundation, and by the European H2020 MaX Centre of Excellence (http://www.max-centre.eu/).
 
Before posting your first question, please see the posting guidelines at http://www.aiida.net/?page_id=356 .
---
You received this message because you are subscribed to the Google Groups "aiidausers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to aiidausers+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/aiidausers/ed9cee44-c562-48db-a6d6-dc03fda6c8d5n%40googlegroups.com.

Giovanni Pizzi

unread,
Apr 26, 2021, 5:39:57 AM4/26/21
to AiiDA users mailing list
Dear all,
Indeed, the code in the archive entry mentioned below is for a AiiDA 0.x version, with the goal of allowing to reproduce the results with the same versions used in the paper.

Thanks to the work of Junfeng Qiao (for the workflows) and Norma Rivano, Dominik Gresch and others (for the Wannier90 plugin), those have been migrated to AiiDA 1.x.
The new ones have been published and demonstrated last year in the virtual Wannier90 tutorial (March 2020).

To use it, I suggest to follow the tutorial itself: 
which also contains ~18 examples that can be easily resubmitted.

Best,
Giovanni

Zhigang Hu

unread,
May 1, 2021, 2:16:09 PM5/1/21
to aiidausers
The calculation demo_wannier_calcjob.py can be submitted to HPC and give wannierisation results as expected, which suggestes the setups of computer and codes are correct.

When I run launch_auto-wannier_workflow.py, there is the warning about seekpath_structure_analysis
----------------------------------------------------------
/gpfs/share/home/1501110145/software/miniconda3/envs/aiida/lib/python3.8/site-packages/aiida_quantumespresso/workflows/functions/seekpath_structure_analysis.py:7: FutureWarning: This module is deprecated and will be removed soon.
Please use instead the new module:
from aiida_quantumespresso.calculations.functions.seekpath_structure_analysis import seekpath_structure_analysis
Or use the entry point with the factory: CalculationFactory('quantumespresso.seekpath_structure_analysis')
----------------------------------------------------------

then I check the process with the command: verdi process report. The error occurs as 
---------------------------------------------------------
2021-05-01 10:10:27 [9  | REPORT]: [98|Wannier90BandsWorkChain|setup_protocol]: running the workchain with the "testing" protocol
2021-05-01 10:10:27 [10 | REPORT]: [98|Wannier90BandsWorkChain|setup]: workchain controls found in inputs: valence + conduction bands
2021-05-01 10:10:27 [11 | REPORT]: [98|Wannier90BandsWorkChain|run_seekpath]: running seekpath to get primitive structure for: AsGa
2021-05-01 10:10:27 [12 | REPORT]: [98|Wannier90BandsWorkChain|on_except]: Traceback (most recent call last):
 File "/gpfs/share/home/1501110145/software/miniconda3/envs/aiida/lib/python3.8/site-packages/plumpy/process_states.py", line 230, in execute
    result = self.run_fn(*self.args, **self.kwargs)
  File "/gpfs/share/home/1501110145/software/miniconda3/envs/aiida/lib/python3.8/site-packages/aiida/engine/processes/workchains/workchain.py", line 214, in _do_step
    finished, stepper_result = self._stepper.step()
  File "/gpfs/share/home/1501110145/software/miniconda3/envs/aiida/lib/python3.8/site-packages/plumpy/workchains.py", line 299, in step
    finished, result = self._child_stepper.step()
  File "/gpfs/share/home/1501110145/software/miniconda3/envs/aiida/lib/python3.8/site-packages/plumpy/workchains.py", line 250, in step
    return True, self._fn(self._workchain)
  File "/gpfs/share/home/1501110145/software/miniconda3/envs/aiida/lib/python3.8/site-packages/aiida_wannier90_workflows/workflows/bands.py", line 232, in run_seekpath
    result = seekpath_structure_analysis(
  File "/gpfs/share/home/1501110145/software/miniconda3/envs/aiida/lib/python3.8/site-packages/aiida/engine/processes/functions.py", line 179, in decorated_function
    result, _ = run_get_node(*args, **kwargs)
  File "/gpfs/share/home/1501110145/software/miniconda3/envs/aiida/lib/python3.8/site-packages/aiida/engine/processes/functions.py", line 121, in run_get_node
    inputs = process_class.create_inputs(*args, **kwargs)
  File "/gpfs/share/home/1501110145/software/miniconda3/envs/aiida/lib/python3.8/site-packages/aiida/engine/processes/functions.py", line 305, in create_inputs
    cls.validate_inputs(*args, **kwargs)
  File "/gpfs/share/home/1501110145/software/miniconda3/envs/aiida/lib/python3.8/site-packages/aiida/engine/processes/functions.py", line 300, in validate_inputs
    raise TypeError(f'{name}() takes {nparameters} positional arguments but {nargs} were given')
TypeError: seekpath_structure_analysis() takes 1 positional arguments but 2 were given
-----------------------------------------------------------------------------------

It seems that seekpath_structure_analysis()  in /gpfs/share/home/1501110145/software/miniconda3/envs/aiida/lib/python3.8/site-packages/aiida_wannier90_workflows/workflows/bands.py  has wrong arguments. The bands.py file is from https://github.com/aiidateam/aiida-wannier90-workflows.

So, it is possible to solve this problem by editing launch_auto-wannier_workflow.py? or one has to go to the source code bands.py to rewrite def run_seekpath(self):  starting from line 217 in bands.py?

Another question is that there are very limited adjustable parameters in launch_auto-wannier_workflow.py. It is possible to add more parameters? like spin polarized calculation, SOC and etc

Best,
Zhigang Hu
bands.py
launch_auto-wannier_workflow.py

Junfeng Qiao

unread,
May 3, 2021, 4:44:45 AM5/3/21
to aiidausers
Hi Zhigang,

I guess you are using aiida-wannier90-workflows version 1.0.1? The error is caused by a change in aiida-quantumespresso after the workflows' release. You could first clone the repo by `git clone g...@github.com:aiidateam/aiida-wannier90-workflows.git`, checkout the `master` branch, do a `pip install .`, and launch the workflow.
I will release a new version soon and ensure the workflow is compatible with the newest aiida. 

Best,
Junfeng QIAO
Doctoral Assistant
EPFL THEOS
Switzerland

Zhigang Hu

unread,
May 3, 2021, 11:55:02 AM5/3/21
to aiidausers
Hi Junfeng,

I intall the workflows according to your suggestions
> git clone g...@github.com:aiidateam/aiida-wannier90-workflows.git
> cd aiida-wannier90-workflows/
> pip install .

But the version installed is still 1.01
--------------------------------------------
Installing collected packages: aiida-wannier90-workflows
  Attempting uninstall: aiida-wannier90-workflows
    Found existing installation: aiida-wannier90-workflows 1.0.1
    Uninstalling aiida-wannier90-workflows-1.0.1:
      Successfully uninstalled aiida-wannier90-workflows-1.0.1
Successfully installed aiida-wannier90-workflows-1.0.1
---------------------------------------------

Sorry for this foolish question, but I just can't have the correct version installed. 

Junfeng Qiao

unread,
May 3, 2021, 3:26:54 PM5/3/21
to Zhigang Hu, aiidausers
Hi Zhigang,

If the aiida-wannier90-workflows is installed by `pip install .` on the master
branch, then this is not a problem, just try launching the workflow on a
crystal structure and see if it works or not.

Best,
Junfeng
> >> site-packages/aiida_wannier90_workflows/workflows/bands.py has wrong
> >> arguments. The bands.py file is from
> >> https://github.com/aiidateam/aiida-wannier90-workflows.
> >>
> >> So, it is possible to solve this problem by editing
> >> launch_auto-wannier_workflow.py? or one has to go to the source code
> >> bands.py to rewrite *def run_seekpath(self): *starting from line 217 in
> >> bands.py?
> >>
> >> Another question is that there are very limited adjustable parameters in
> >> launch_auto-wannier_workflow.py. It is possible to add more parameters?
> >> like spin polarized calculation, SOC and etc
> >>
> >> Best,
> >> Zhigang Hu
> >>
> >> On Monday, April 26, 2021 at 5:39:57 PM UTC+8 Giovanni Pizzi wrote:
> >>> Dear all,
> >>> Indeed, the code in the archive entry mentioned below is for a AiiDA 0.x
> >>> version, with the goal of allowing to reproduce the results with the
> >>> same
> >>> versions used in the paper.
> >>>
> >>> Thanks to the work of Junfeng Qiao (for the workflows) and Norma Rivano,
> >>> Dominik Gresch and others (for the Wannier90 plugin), those have been
> >>> migrated to AiiDA 1.x.
> >>> The new ones have been published and demonstrated last year in the
> >>> virtual Wannier90 tutorial (March 2020).
> >>>
> >>> To use it, I suggest to follow the tutorial itself:
> >>>
> >>> https://aiida-tutorials.readthedocs.io/en/latest/pages/2020_Oxford/secti
> >>> ons/automated_wannierisation.html which also contains ~18 examples that
> >>> can be easily resubmitted.
> >>> The updated code is here:
> >>> https://github.com/aiidateam/aiida-wannier90-workflows
> >>>
> >>> Best,
> >>> Giovanni
> >>>
> >>>
> >>>
> >>> On 26 Apr 2021, at 10:29, zhubon...@gmail.com wrote:
> >>>
> >>> Hi Zhigang,
> >>>
> >>> The code you attached suggests that it is from a pre-1.0 version of
> >>> AiiDA. The equivalent of the below for aiida-core >=1.0 is to replace
> >>> the
> >>> `ParameterData` with `Dict`.
> >>> However, the most important thing is that the underlying plugin must
> >>> also be migrated to AiiDA 1.0 – if you have installed the correct
> >>> versions
> >>> then they should work fine.
> >>> The workflows provided themselves may also need some migration, although
> >>> it should be very minimal.
> >>>
> >>> Best wishes,
> >>> Bonan
> >>>
> >>> *From:* aiida...@googlegroups.com <aiida...@googlegroups.com> *On
> >>> Behalf Of *Zhigang Hu
> >>> *Sent:* 25 April 2021 18:02
> >>> *To:* aiidausers <aiida...@googlegroups.com>
> >>> *Subject:* [aiidausers] Automated high-throughput Wannierisation
> >>>
> >>> Dear aiida users
> >>>
> >>> I want to do some high-throughput researches based on the record:
> >>> Valerio Vitale, Giovanni Pizzi, Antimo Marrazzo, Jonathan R. Yates,
> >>> Nicola
> >>> Marzari, Arash A. Mostofi, *Automated high-throughput Wannierisation*,
> >>> Materials Cloud Archive *2020.60* (2020), doi:
> >>> 10.24435/materialscloud:dd-nz
> >>> <https://doi.org/10.24435/materialscloud:dd-nz>. The virtual
> >>> machine wannierising_machine_19.07 provided is not capable of dealing
> >>> with
> >>> a real high-throughput calculation (involving hundreds or thousands of
> >>> materials). So I install the recent version of aiida on a remote HPC
> >>> following the tutorial
> >>> <https://aiida.readthedocs.io/projects/aiida-core/en/latest/intro/instal
> >>> l_conda.html>>>>
> >>> > conda create -n aiida -c conda-forge aiida-core aiida-core.services
> >>>
> >>> I have installed softwares and relative aiida-plugins (
> >>> quantumespresso.pw, etc) and setuped the computer and codes.
> >>> However, I have no idea how to modify the run_automated_wannier.py
> >>> provided in wannierising_machine_19.07 for set options for the slurm.
> >>> This
> >>> is the code in run_automated_wannier.py
> >>>
> >>> ------------------------------------------------------------------------
> >>> ------------------ scf_settings =
> >>> ---------------- #!/bin/bash
> >>> #SBATCH -o job.%j.out
> >>> #SBATCH --partition=C032M0128G
> >>> #SBATCH --qos=low
> >>> #SBATCH -J myFirstMPIJob
> >>> #SBATCH --nodes=2
> >>> #SBATCH --ntasks-per-node=32
> >>>
> >>> # load MPI
> >>> module load intel/2018.1
> >>>
> >>> # execuate
> >>> mpirun -n 64 execuate_code_path > log
> >>>
> >>> ------------------------------------------------------------------------
> >>> --------------
> >>>
> >>> run_automated_wannier.py is attached.
> >>>
> >>> Best,
> >>> Zhigang Hu
> >>>
> >>>
> >>> To view this discussion on the web visit
> >>> https://groups.google.com/d/msgid/aiidausers/002e01d73a76%244a032130%24d
> >>> e096390%24%40gmail.com
> >>> <https://groups.google.com/d/msgid/aiidausers/002e01d73a76%244a032130%2
> >>> 4de096390%24%40gmail.com?utm_medium=email&utm_source=footer> .


Zhigang Hu

unread,
Jun 1, 2021, 11:28:41 AM6/1/21
to aiidausers
Hi Junfeng, Giovanni

During this period of time I am using the Quantum Mobile. The conflict of seekpath_structure_analysis seems to exist in aiida versions later than  1.1.1
Installing aiida-wannier90-workflows from the master branch returns the same error as directly installing the aiida plugin aiida-wannier90-workflows
I find that Quantum Mobile  v20.03.1with aiida version 1.1.1 can solve the problem perfectly. 

 Thanks for previous advices  from Giovanni on retrieving raw hr.dat in pre-1.0 version of AiiDA. 
--------------------------------------
group = Group.get(label='xxx')
all_w90_calculations = {w90calc.inputs.structure.get_formula(): w90calc for w90calc in group.nodes}
w90calc_xsf_file = all_w90_calculations['xsf_file']
retrieved_files = w90calc_ xsf_file.outputs.retrieved
 with open('aiida_hr-xsf_file.dat', 'wb') as fhandle:
    fhandle.write(retrieved_files.get_object_content('aiida_hr.dat', 'rb'))
---------------------------------------
As the version now changes to 1.1.1, w90calc_CaO.outputs.retrieved is not invalid anymore. How to revise the script accordingly to obtain the output file?

Any help will be appreciated.

Zhigang Hu 

Junfeng Qiao

unread,
Jun 2, 2021, 11:37:44 AM6/2/21
to aiidausers
Hi Zhigang,

Sorry I don't quite understand your question, from your code snippet:
```
group = Group.get(label='xxx')
all_w90_calculations = {w90calc.inputs.structure.get_formula(): w90calc for w90calc in group.nodes}
w90calc_xsf_file = all_w90_calculations['xsf_file']
retrieved_files = w90calc_ xsf_file.outputs.retrieved
 with open('aiida_hr-xsf_file.dat', 'wb') as fhandle:
    fhandle.write(retrieved_files.get_object_content('aiida_hr.dat', 'rb'))
``` 

there is no `w90calc_CaO`? Maybe you are referring to the `w90calc_ xsf_file`? Actually, your `all_w90_calculations` is a dictionary with crystal structure formula as the keys, I think there can't be a crystal structure having the formula 'xsf_file' so there should be a KeyError in the line `w90calc_xsf_file = all_w90_calculations['xsf_file']`, the code fails here so you cannot access the `.outputs.retrieved` property of `w90calc_ xsf_file`.

If your `w90calc_CaO` is of type `Wannier90Calculation`,  the `.outputs.retrieved` should be there, irrelevant to your aiida version update. 

Best,
Junfeng

Zhigang Hu

unread,
Jun 3, 2021, 11:28:37 AM6/3/21
to aiidausers
Hi Junfeng,

I shall make my question clearer. Apologize for that. 
There is a loop for all structure files, I use 'xsf_file' to avoid the use of specific structure formula, like 'CaO' as you mentioned. The full script reads

---------------------------------------------------------------
group = Group.get(label='autowannier_workflow_withconduction_mlwf')
all_w90_calculations = {w90calc.inputs.structure.get_formula(): w90calc for w90calc in group.nodes}
for i in all_w90_calculations:
    w90calc = all_w90_calculations[i]
    print("{} calculation UUID: {}".format(i,w90calc.uuid))
    retrieved_files = w90calc.outputs.retrieved
    print(retrieved_files.list_object_names())
    with open('{}_{}_hr.dat'.format(w90calc.label,i), 'wb') as fhandle:
        fhandle.write(retrieved_files.get_object_content('aiida_hr.dat', 'rb'))
    with open('{}_{}_wsvec.dat'.format(w90calc.label,i), 'wb') as fhandle:
        fhandle.write(retrieved_files.get_object_content('aiida_wsvec.dat', 'rb'))
-------------------------------------------------------------------

I test the extracting script in verdi shell, it returns the error

In [5]: w90calc.outputs.retrieved                                                              
---------------------------------------------------------------------------
NotExistent                               Traceback (most recent call last)
<ipython-input-5-9acd200207df> in <module>
----> 1 w90calc.outputs.retrieved

~/codes/aiida-core/aiida/orm/utils/managers.py in __getattr__(self, name)
     80         """
     81         try:
---> 82             return self._get_node_by_link_label(label=name)
     83         except KeyError:
     84             raise AttributeError("Node '{}' does not have an input with link '{}'".format(self._node.pk, name))

~/codes/aiida-core/aiida/orm/utils/managers.py in _get_node_by_link_label(self, label)
     61         if self._incoming:
     62             return self._node.get_incoming(link_type=self._link_type).get_node_by_label(label)
---> 63         return self._node.get_outgoing(link_type=self._link_type).get_node_by_label(label)
     64 
     65     def __dir__(self):

~/codes/aiida-core/aiida/orm/utils/links.py in get_node_by_label(self, label)
    300 
    301         if matching_entry is None:
--> 302             raise exceptions.NotExistent('no neighbor with the label {} found'.format(label))
    303 
    304         return matching_entry

NotExistent: no neighbor with the label retrieved found
-----------------------------------------------------------------------------------------------------

The auto-wannier script is attached, which is just run_automated_wannier.py in aiida-wannier90-workflows with minor modifications.

autowannier.py

Junfeng Qiao

unread,
Jun 3, 2021, 11:54:10 AM6/3/21
to aiidausers
Hi Zhigang,

Thanks for providing more details of your issue.
In your code `w90calc = all_w90_calculations[i]`, the `w90calc` is of type `Wannier90BandsWorkChain`, to access the Hamiltonian you can replace your code `retrieved_files = w90calc.outputs.retrieved` by `retrieved_files = w90calc.outputs.wannier90_retrieved`.

Best,
Junfeng

Zhigang Hu

unread,
Jun 4, 2021, 12:07:47 PM6/4/21
to aiidausers
Hi Junfeng,

The substitution of `retrieved_files = w90calc.outputs.wannier90_retrieved` works well.
By the way, I find some inappropriate option setting in band.py.  When the atom number of the structure is large (more than 20), the memory for pw2wan subprocess will be very heavy, such that there is not always enough space in remote computer if you use , for example more than 10 cores. Therefore In get_pw2wannier90_inputs  of band.py, it is not optimal to use
------------------------
inputs.metadata.options = self.get_default_options(with_mpi=True)
------------------------
Reply all
Reply to author
Forward
0 new messages