Modena 2025: Difference between revisions

From The Yambo Project
Jump to navigation Jump to search
 
(41 intermediate revisions by 4 users not shown)
Line 2: Line 2:


== Use CINECA computational resources ==
== Use CINECA computational resources ==
Yambo tutorials will be run on the Leonardo-DCGP. You can find info about Leonardo-DCGP [https://wiki.u-gov.it/confluence/display/SCAIUS/DCGP+Section here].
Yambo tutorials will be run on the Leonardo-DCGP partition. You can find info about Leonardo-DCGP [https://wiki.u-gov.it/confluence/display/SCAIUS/DCGP+Section here].
In order to access computational resources provided by CINECA you need your personal username and password that were sent you by the organizers.
In order to access computational resources provided by CINECA you need your personal username and password that were sent you by the organizers.


=== Connect to the cluster using ssh ===
=== Connect to the cluster using ssh ===


You can access Leonardo-DCGP via <code>ssh</code> protocol in different ways.
You can access Leonardo via <code>ssh</code> protocol in different ways.
 




Line 14: Line 13:


Use the following command replacing your username:
Use the following command replacing your username:
  $ ssh ...
  ssh username@login.leonardo.cineca.it


However, in this way you have to type your password each time you want to connect.
However, in this way you have to type your password each time you want to connect.


'''FROM HERE IS A PLACEHOLDER: NICOLA WILL FILL THIS PART'''


''' - Connect using ssh key '''
''' - Connect using ssh key '''


You can setup a ssh key pair to avoid typing the password each time you want to connect to M100. To do so, go to your <code>.ssh</code> directory (usually located in the <code>home</code> directory):
You can setup a ssh key pair to avoid typing the password each time you want to connect to Leonardo. To do so, run the <code>ssh-keygen</code> command to generate a private/public key pair:
$ cd $HOME/.ssh
  ssh-keygen -t rsa -b 4096 -f ~/.ssh/leonardo_rsa
 
If you don't have this directory, you can create it with <code>mkdir $HOME/.ssh</code>.
 
Once you are in the <code>.ssh</code> directory, run the <code>ssh-keygen</code> command to generate a private/public key pair:
  $ ssh-keygen
  Generating public/private rsa key pair.
  Generating public/private rsa key pair.
  Enter file in which to save the key: m100_id_rsa
  Created directory '/home/username/.ssh'.
  Enter passphrase (empty for no passphrase):  
  Enter passphrase (empty for no passphrase):  
  Enter same passphrase again:  
  Enter same passphrase again:  
  Your identification has been saved in <your_.ssh_dir>/m100_id_rsa
  Your identification has been saved in /home/username/.ssh/leonardo_rsa
  Your public key has been saved in <your_.ssh_dir>/m100_id_rsa.pub
  Your public key has been saved in /home/username/.ssh/leonardo_rsa.pub
  The key fingerprint is:
  The key fingerprint is:
  <...>
  [...]
  The key's randomart image is:
  The key's randomart image is:
  <...>
  [...]
 
Now you need to copy the '''public''' key to Leonardo. You can do that with the following command (for this step you need to type your password):
ssh-copy-id -i ~/.ssh/leonardo_rsa username@login.leonardo.cineca.it


Now you need to copy the '''public''' key to M100. You can do that with the following command (for this step you need to type your password):
<blockquote>
$ ssh-copy-id -i <your_.ssh_dir>/m100_id_rsa.pub <username>@login.m100.cineca.it
Be aware that when running the <code>ssh-copy-id</code> command, after typing "yes" at the prompt, you might see an error message like the one shown below. Don’t worry—just follow the instructions provided in this CINECA [https://wiki.u-gov.it/confluence/display/SCAIUS/FAQ#FAQ-Ikeepreceivingtheerrormessage%22WARNING:REMOTEHOSTIDENTIFICATIONHASCHANGED!%22evenifImodifyknown_hostfile guide to resolve the issue]. Once done, run the <code>ssh-copy-id</code> command again.
</blockquote>
/usr/bin/ssh-copy-id:
ERROR: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
ERROR: @    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!    @
ERROR: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
ERROR: IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
[...]


Once the public key has been copied, you can connect to M100 without having to type the password using the <code>-i</code> option:
Once the public key has been copied, you can connect to Leonardo without having to type the password using the <code>-i</code> option:
  $ ssh -i <your_.ssh_dir>/m100_id_rsa username@login.m100.cineca.it
  ssh -i ~/.ssh/leonardo_rsa username@login.leonardo.cineca.it


To simplify even more, you can paste the following lines in a file named <code>config</code> located inside the <code>.ssh</code> directory adjusting username and path:
To simplify even more, you can paste the following lines in a file named <code>config</code> located inside the <code>.ssh</code> directory adjusting the username:
  Host m100
  Host leonardo
   HostName login.m100.cineca.it
   HostName login.leonardo.cineca.it
   User username
   User username
   IdentityFile <your_.ssh_dir>/m100_id_rsa
   IdentityFile ~/.ssh/leonardo_rsa


With the <code>config</code> file setup you can connect simply with
With the <code>config</code> file setup you can connect simply with
  $ ssh m100
  ssh leonardo


=== General instructions to run tutorials ===
=== General instructions to run tutorials ===


Before proceeding, it is useful to know the different workspaces you have available on M100, which can be accessed using environment variables. The main ones are:
Before proceeding, it is useful to know the different workspaces you have available on Leonardo, which can be accessed using environment variables. The main ones are:
* <code>$HOME</code>: it's the <code>home</code> directory associated to your username;  
* <code>$HOME</code>: it's the <code>home</code> directory associated to your username;  
* <code>$WORK</code>: it's the <code>work</code> directory associated to the account where the computational resources dedicated to this school are allocated;
* <code>$WORK</code>: it's the <code>work</code> directory associated to the account where the computational resources dedicated to this school are allocated;
* <code>$CINECA_SCRATCH</code>: it's the <code>scratch</code> directory associated to your username.
* <code>$SCRATCH</code>: it's the <code>scratch</code> directory associated to your username.
You can find more details about storage and FileSystems [https://wiki.u-gov.it/confluence/display/SCAIUS/UG2.5%3A+Data+storage+and+FileSystems here].
You can find more details about storage and FileSystems [https://wiki.u-gov.it/confluence/display/SCAIUS/4%3A+Data+storage+and+FileSystems here].


Please don't forget to '''run all tutorials in your scratch directory''':
Please don't forget to '''run all tutorials in your scratch directory''':
  $ echo $CINECA_SCRATCH
  echo $SCRATCH
  /leonardo_scratch/large/userexternal/username
  /leonardo_scratch/large/userexternal/username
  $ cd $CINECA_SCRATCH
  cd $SCRATCH


Computational resources on Leonardo are managed by the job scheduling system [https://slurm.schedmd.com/overview.html Slurm]. Most part of Yambo tutorials during this school can be run in serial, except some that need to be executed on multiple processors. Generally, Slurm batch jobs are submitted using a script, but the tutorials here are better understood if run interactively. The two procedures that we will use to submit interactive and non interactive jobs are explained below.
Computational resources on Leonardo are managed by the job scheduling system [https://slurm.schedmd.com/overview.html Slurm]. Most part of Yambo tutorials during this school can be run in serial, except some that need to be executed on multiple processors. Generally, Slurm batch jobs are submitted using a script, but the tutorials here are better understood if run interactively. The two procedures that we will use to submit interactive and non interactive jobs are explained below.




''' - Run a job using a batch script '''


''' - Run a job using a batch script '''
<!--
This procedure is suggested for the tutorials and examples that need to be run in parallel. In these cases you need to submit the job using a batch script <code>job.sh</code>, whose generic structure is the following:
This procedure is suggested for the tutorials and examples that need to be run in parallel. In these cases you need to submit the job using a batch script <code>job.sh</code>, whose generic structure is the following:
$ more job.sh
  #!/bin/bash
  #!/bin/bash
  #SBATCH --account=tra25_yambo          # Charge resources used by this job to specified account
  #SBATCH --account=tra25_yambo          # Charge resources used by this job to specified account
Line 83: Line 84:
  #SBATCH --gres=tmpfs:10g                # List of generic consumable resources
  #SBATCH --gres=tmpfs:10g                # List of generic consumable resources
  #SBATCH --qos=normal                    # Quality of service  
  #SBATCH --qos=normal                    # Quality of service  
  ###SBATCH --reservation=s_tra_yambo     # Reservation specific to this school (TBD)
  #SBATCH --reservation=s_tra_yambo       # Reservation specific to this school
  #           
  #           
  #SBATCH --nodes=<N>                    # Number of nodes to be allocated for the job
  #SBATCH --nodes=<N>                    # Number of nodes to be allocated for the job
Line 95: Line 96:
  module load yambo/5.3.0--intel-oneapi-mpi--2021.12.1--oneapi--2024.1.0
  module load yambo/5.3.0--intel-oneapi-mpi--2021.12.1--oneapi--2024.1.0
  export OMP_NUM_THREADS=${SLURM_CPUS_PER_TASK}
  export OMP_NUM_THREADS=${SLURM_CPUS_PER_TASK}
 
  mpirun -np ${SLURM_NTASKS} \
  mpirun -np ${SLURM_NTASKS} \
         yambo -F <input> -J <output>
         yambo -F <input> -J <output>
-->


This procedure is suggested for the tutorials and examples that need to be run in parallel. In these cases you need to submit the job using a batch script <code>job.sh</code>. Please note that the instructions in the batch script must be compatible with the specific Leonardo-DCGP [https://wiki.u-gov.it/confluence/display/SCAIUS/DCGP+Section#DCGPSection-SLURMpartitions resourses]. The complete list of Slurm options can be found [https://slurm.schedmd.com/sbatch.html here]. However you will find '''ready-to-use''' batch scripts in locations specified during the tutorials.  
Please note that the instructions in the batch script must be compatible with the specific Leonardo-DCGP [https://wiki.u-gov.it/confluence/display/SCAIUS/DCGP+Section#DCGPSection-SLURMpartitions resources]. The complete list of Slurm options can be found [https://slurm.schedmd.com/sbatch.html here]. However you will find '''ready-to-use''' batch scripts in locations specified during the tutorials.  


To submit the job, use the <code>sbatch</code> command:
To submit the job, use the <code>sbatch</code> command:
  $ sbatch job.sh
  sbatch job.sh
  Submitted batch job 15696508
  Submitted batch job 15696508


To check the job status, use the <code>squeue</code> command:
To check the job status, use the <code>squeue</code> command:
  $ squeue --me
  squeue --me
              JOBID PARTITION    NAME    USER ST      TIME  NODES NODELIST(REASON)
            JOBID PARTITION    NAME    USER ST      TIME  NODES NODELIST(REASON)
          15696508 dcgp_usr_  job.sh nspallan R      0:01      1 lrdn4135
        15696508 dcgp_usr_  job.sh username R      0:01      1 lrdn4135


If you need to cancel your job, do:
If you need to cancel your job, do:
  $ scancel <JOBID>  
  scancel <JOBID>  




Line 118: Line 118:
''' - Open an interactive session '''
''' - Open an interactive session '''


This procedure is suggested for most of the tutorials, since the majority of these is meant to be run in serial (relatively to MPI parallelization) from the command line. Use the command below to open an interactive session of 4 hour:
This procedure is suggested for most of the tutorials, since the majority of these is meant to be run in serial (relatively to MPI parallelization) from the command line. Use the command below to open an interactive session of 4 hours:
  $ srun -A tra25_yambo -p dcgp_usr_prod -q normal -N 1 -n 1 -c 4 -t 04:00:00 --gres=tmpfs:10g --pty /bin/bash
  srun -A tra25_yambo -p dcgp_usr_prod --reservation=s_tra_yambo -N 1 -n 1 -c 4 -t 04:00:00 --gres=tmpfs:10g --pty /bin/bash
  srun: job 15694182 queued and waiting for resources
  srun: job 15694182 queued and waiting for resources
  srun: job 15694182 has been allocated resources
  srun: job 15694182 has been allocated resources
Line 126: Line 126:


Then, you need to manually load <code>yambo</code> as in the batch script above:
Then, you need to manually load <code>yambo</code> as in the batch script above:
  $ module purge
  module purge
  $ module load profile/candidate
  module load profile/candidate
  $ module use /leonardo/pub/userexternal/nspallan/spack-0.22.2-06/modules
  module use /leonardo/pub/userexternal/nspallan/spack-0.22.2-06/modules
module load yambo/5.3.0--intel-oneapi-mpi--2021.12.1--oneapi--2024.1.0


Finally, set the <code>OMP_NUM_THREADS</code> environment variable to 4 using the appropriate Slurm environment variable:
Finally, set the <code>OMP_NUM_THREADS</code> environment variable to 4 using the appropriate Slurm environment variable:
  $ export OMP_NUM_THREADS=${SLURM_CPUS_PER_TASK}
  export OMP_NUM_THREADS=${SLURM_CPUS_PER_TASK}
 
To close the interactive session when you have finished, log out of the compute node with the <code>exit</code> command, and then cancel the job:
$ exit
$ scancel <JOBID>


To close the interactive session when you have finished, log out of the compute node with the <code>exit</code> command:
exit




''' - Plot results with gnuplot '''
''' - Plot results with gnuplot '''


During the tutorials you will often need to plot the results of the calculations. In order to do so on M100, '''open a new terminal window''' and connect to M100 enabling X11 forwarding with the <code>-X</code> option:
During the tutorials you will often need to plot the results of the calculations. In order to do so on Leonardo, '''open a new terminal window''' and connect to Leonardo enabling X11 forwarding with the <code>-X</code> option:
  $ ssh -X m100
  ssh -X leonardo


Please note that <code>gnuplot</code> can be used in this way only from the login nodes:
Please note that <code>gnuplot</code> can be used in this way only from the login nodes:
Line 150: Line 149:
  Terminal type is now '...'
  Terminal type is now '...'
  gnuplot> plot <...>
  gnuplot> plot <...>


''' - Set up yambopy '''
''' - Set up yambopy '''


In order to run yambopy on m100, you must first setup the conda environment (to be done only once):
In order to run yambopy on Leonardo, you must first activate the python environment:
  $ cd
  module load profile/candidate
$ module load anaconda/2020.11
  source /leonardo_work/tra25_yambo/env_yambopy/bin/activate
  $ conda init bash
$ source .bashrc
 
After this, every time you want to use yambopy you need to load its module and environment:
$ module load anaconda/2020.11
$ conda activate /m100_work/tra23_Yambo/softwares/YAMBO/env_yambopy


== Tutorials ==
== Tutorials ==


Quick recap.
Quick recap.
Before every tutorial, if you run on m100, do the following steps
Before every tutorial, if you run on Leonardo, do the following steps


  ssh m100
  ssh leonardo
  cd $CINECA_SCRATCH
  cd $SCRATCH
  mkdir YAMBO_TUTORIALS '''(Only if you didn't before)'''
  mkdir -p YAMBO_TUTORIALS '''#(Only if you didn't before)'''
  cd YAMBO_TUTORIALS
  cd YAMBO_TUTORIALS


At this point you can download the needed files for the tutorial.
Since the compute nodes are not connected to the external network, the tarballs must be downloaded before starting the interactive session.
After that you can open the interactive session and login into the node
Alternatively, once the interactive session has started, it is possible to access the tarballs by copying them from the following directories:
 
/leonardo_work/tra25_yambo/YAMBO_TUTORIALS
/leonardo_work/tra25_yambo/YAMBOPY_TUTORIALSypp_nl -y ypypp_nl -y ypp_nl -y ypp_nl -y p_nl -y
 
After that you can start the interactive session
 
srun -A tra25_yambo -p dcgp_usr_prod --reservation=s_tra_yambo -N 1 -n 1 -c 4 -t 04:00:00 --gres=tmpfs:10g --pty /bin/bash
[...]
 
set the environment variable for openMP
 
export OMP_NUM_THREADS=${SLURM_CPUS_PER_TASK}


salloc -A tra23_Yambo -p m100_sys_test -q qos_test --reservation=s_tra_yambo --nodes=1 --ntasks-per-node=1 --cpus-per-task=4 -t 04:00:00
and load yambo or yambopy as explained above in the general instructions.
ssh '''PUT HERE THE ASSIGNED NODE NAME AFTER salloc COMMAND'''
module purge
module load hpc-sdk/2022--binary spectrum_mpi/10.4.0--binary
export PATH=/m100_work/tra23_Yambo/softwares/YAMBO/5.2-cpu/bin:$PATH
cd $CINECA_SCRATCH
cd YAMBO_TUTORIALS


=== DAY 1 - Monday, 19 May ===  
=== DAY 1 - Monday, 19 May ===  
Line 189: Line 189:


To get the tutorial files needed for the following tutorials, follow these steps:
To get the tutorial files needed for the following tutorials, follow these steps:
  $ wget https://media.yambo-code.eu/educational/tutorials/files/hBN.tar.gz
  wget https://media.yambo-code.eu/educational/tutorials/files/hBN.tar.gz
  $ wget https://media.yambo-code.eu/educational/tutorials/files/hBN-2D.tar.gz
  wget https://media.yambo-code.eu/educational/tutorials/files/hBN-2D.tar.gz
  $ ls
  ls
  hBN-2D.tar.gz  hBN.tar.gz
  hBN-2D.tar.gz  hBN.tar.gz
  $ tar -xvf hBN-2D.tar.gz
  tar -xvf hBN-2D.tar.gz
  $ tar -xvf hBN.tar.gz
  tar -xvf hBN.tar.gz
  $ ls
  ls
  '''hBN-2D''' '''hBN''' hBN-2D.tar.gz  hBN.tar.gz
  '''hBN-2D''' '''hBN''' hBN-2D.tar.gz  hBN.tar.gz


Now that you have all the files, you may open the interactive job session with <code>salloc</code> as explained above and proceed with the tutorials.
Now that you have all the files, you may open the interactive job session with <code>srun</code> as explained above and proceed with the tutorials.


* [[First steps: walk through from DFT(standalone)|First steps: Initialization and more ]]
* [[First steps: walk through from DFT(standalone)|First steps: Initialization and more ]]
Line 205: Line 205:
At this point, you may learn about the python pre-postprocessing capabilities offered by yambopy, our python interface to yambo and QE. First of all, let's create a dedicated directory, download and extract the related files.
At this point, you may learn about the python pre-postprocessing capabilities offered by yambopy, our python interface to yambo and QE. First of all, let's create a dedicated directory, download and extract the related files.
   
   
  $ cd $CINECA_SCRATCH
  cd $SCRATCH
  $ mkdir YAMBOPY_TUTORIALS
  mkdir -p YAMBOPY_TUTORIALS
  $ cd YAMBOPY_TUTORIALS
  cd YAMBOPY_TUTORIALS
  $ wget https://media.yambo-code.eu/educational/tutorials/files/databases_yambopy.tar
  rsync -avzP /leonardo_work/tra25_yambo/YAMBOPY_TUTORIALS/yambopy_tutorial_Modena_2025.tar.gz .
  $ tar -xvf databases_yambopy.tar
  tar --strip-components=1 -xvzf yambopy_tutorial_Modena_2025.tar.gz
$ cd databases_yambopy


Then, follow '''the first three sections''' of this link, which are related to initialization and linear response.
Then, follow part 1 of the tutorial, which is related to DFT band structures, YAMBO initialization and linear response.
* [[Yambopy tutorial: Yambo databases|Reading databases with yambopy]]
* [[Modena 2025 : Yambopy part 1]]


=== DAY 2 - Tuesday, 20 May ===
=== DAY 2 - Tuesday, 20 May ===
Line 233: Line 232:
If you have gone through the first tutorial, pass now to the second one:
If you have gone through the first tutorial, pass now to the second one:
   
   
  cd $CINECA_SCRATCH
  cd $SCRATCH
  cd YAMBO_TUTORIALS
  cd YAMBO_TUTORIALS
  cd MoS2_HPC_tutorial
  cd MoS2_HPC_tutorial
Line 239: Line 238:
* [[Quasi-particles of a 2D system | Quasi-particles of a 2D system ]]
* [[Quasi-particles of a 2D system | Quasi-particles of a 2D system ]]


To conclude, you can learn an other method to plot the band structure in Yambo
As for yambopy, the tutorial related to GW calculations is contained in the first section of Part 2


* [[Yambopy tutorial: band structures| Yambopy tutorial: band structures]]
* [[Modena 2025 : Yambopy part 2#GW calculations| Modena 2025 : Yambopy part 2 (GW calculations)]]


=== DAY 3 - Wednesday, 21 May ===
=== DAY 3 - Wednesday, 21 May ===
Line 247: Line 246:


To get the tutorial files needed for the following tutorials, follow these steps:
To get the tutorial files needed for the following tutorials, follow these steps:
  $ wget https://media.yambo-code.eu/educational/tutorials/files/hBN.tar.gz # NOTE: YOU SHOULD ALREADY HAVE THIS FROM DAY 1
  wget https://media.yambo-code.eu/educational/tutorials/files/hBN.tar.gz # NOTE: YOU SHOULD ALREADY HAVE THIS FROM DAY 1
  $ wget https://media.yambo-code.eu/educational/tutorials/files/hBN-convergence-kpoints.tar.gz  
  wget https://media.yambo-code.eu/educational/tutorials/files/hBN-convergence-kpoints.tar.gz  
  $ tar -xvf hBN-convergence-kpoints.tar.gz
  tar -xvf hBN-convergence-kpoints.tar.gz
  $ tar -xvf hBN.tar.gz
  tar -xvf hBN.tar.gz


Now, you may open the interactive job session with <code>salloc</code> and proceed with the following tutorials.
Now, you may open the interactive job session with <code>salloc</code> and proceed with the following tutorials.
Line 258: Line 257:
* [[BSE solvers overview|Solve the BSE eigenvalue problem with different numerical methods]]
* [[BSE solvers overview|Solve the BSE eigenvalue problem with different numerical methods]]
* [[How to choose the input parameters|Choose the input parameters for a meaningful converged calculation]]
* [[How to choose the input parameters|Choose the input parameters for a meaningful converged calculation]]
Now, go into the yambopy tutorial directory to learn about python analysis tools for the BSE:
Now, go into the yambopy tutorial directory to learn about python analysis tools for the BSE:
  $ cd $CINECA_SCRATCH
  cd $SCRATCH
  $ cd YAMBOPY_TUTORIALS/databases_yambopy
  cd YAMBOPY_TUTORIALS/databases_yambopy


* [[Yambopy_tutorial:_Yambo_databases#Exciton_intro_1:_read_and_sort_data|Visualization of excitonic properties with yambopy]]
* [[Modena 2025 : Yambopy part 2#Excitons| Modena 2025 : Yambopy part 2 (BSE calculations)]]




Line 269: Line 269:


The files needed for the following tutorials can be downloaded following these steps:
The files needed for the following tutorials can be downloaded following these steps:
  $ wget https://media.yambo-code.eu/educational/tutorials/files/hBN-2D-RT.tar.gz
  wget https://media.yambo-code.eu/educational/tutorials/files/hBN-2D-RT.tar.gz
  $ tar -xvf hBN-2D-RT.tar.gz
  tar -xvf hBN-2D-RT.tar.gz




Line 285: Line 285:
For the tutorials we will use first the <code>hBN-2D-RT</code> folder (k-sampling 10x10x1) and then the <code>hBN-2D</code> folder (k-sampling 6x6x1)
For the tutorials we will use first the <code>hBN-2D-RT</code> folder (k-sampling 10x10x1) and then the <code>hBN-2D</code> folder (k-sampling 6x6x1)
You may already have them in the <code>YAMBO_TUTORIALS</code> folder
You may already have them in the <code>YAMBO_TUTORIALS</code> folder
  $ ls
  ls
  '''hBN-2D''' '''hBN-2D-RT''' hBN-2D.tar.gz  hBN-2D-RT.tar.gz
  '''hBN-2D''' '''hBN-2D-RT''' hBN-2D.tar.gz  hBN-2D-RT.tar.gz


If you need to downoload again the tutorial files, follow these steps:
If you need to downoload again the tutorial files, follow these steps:
  $ wget https://media.yambo-code.eu/educational/tutorials/files/hBN-2D.tar.gz
  wget https://media.yambo-code.eu/educational/tutorials/files/hBN-2D.tar.gz
  $ wget https://media.yambo-code.eu/educational/tutorials/files/hBN-2D-RT.tar.gz
  wget https://media.yambo-code.eu/educational/tutorials/files/hBN-2D-RT.tar.gz
  $ tar -xvf hBN-2D.tar.gz
  tar -xvf hBN-2D.tar.gz
  $ tar -xvf hBN-2D-RT.tar.gz
  tar -xvf hBN-2D-RT.tar.gz
 
 
* [[Dielectric function from Bloch-states dynamics]]
* [[Second-harmonic generation of 2D-hBN]]


* [[Real time approach to non-linear response]] (additional tutorial)
* [[Prerequisites for Real Time propagation with Yambo (5.3)|Perform the setup for a real-time calculation]]
* [[Correlation effects in the non-linear response]] (additional tutorial)
* [[Dielectric function from Bloch-states dynamics (5.3)|Dielectric function from Bloch-states dynamics]]
* [[Second-harmonic generation of 2D-hBN (5.3)|Second-harmonic generation of 2D-hBN]]


=== DAY 5 - Friday, 23 May ===
=== DAY 5 - Friday, 23 May ===

Latest revision as of 19:46, 18 May 2025

A general description of the goal(s) of the school can be found on the Yambo main website

Use CINECA computational resources

Yambo tutorials will be run on the Leonardo-DCGP partition. You can find info about Leonardo-DCGP here. In order to access computational resources provided by CINECA you need your personal username and password that were sent you by the organizers.

Connect to the cluster using ssh

You can access Leonardo via ssh protocol in different ways.


- Connect using username and password

Use the following command replacing your username:

ssh username@login.leonardo.cineca.it

However, in this way you have to type your password each time you want to connect.


- Connect using ssh key

You can setup a ssh key pair to avoid typing the password each time you want to connect to Leonardo. To do so, run the ssh-keygen command to generate a private/public key pair:

ssh-keygen -t rsa -b 4096 -f ~/.ssh/leonardo_rsa
Generating public/private rsa key pair.
Created directory '/home/username/.ssh'.
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /home/username/.ssh/leonardo_rsa
Your public key has been saved in /home/username/.ssh/leonardo_rsa.pub
The key fingerprint is:
[...]
The key's randomart image is:
[...]

Now you need to copy the public key to Leonardo. You can do that with the following command (for this step you need to type your password):

ssh-copy-id -i ~/.ssh/leonardo_rsa username@login.leonardo.cineca.it

Be aware that when running the ssh-copy-id command, after typing "yes" at the prompt, you might see an error message like the one shown below. Don’t worry—just follow the instructions provided in this CINECA guide to resolve the issue. Once done, run the ssh-copy-id command again.

/usr/bin/ssh-copy-id: 
ERROR: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
ERROR: @    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
ERROR: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
ERROR: IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
[...]

Once the public key has been copied, you can connect to Leonardo without having to type the password using the -i option:

ssh -i ~/.ssh/leonardo_rsa username@login.leonardo.cineca.it

To simplify even more, you can paste the following lines in a file named config located inside the .ssh directory adjusting the username:

Host leonardo 
 HostName login.leonardo.cineca.it
 User username
 IdentityFile ~/.ssh/leonardo_rsa

With the config file setup you can connect simply with

ssh leonardo

General instructions to run tutorials

Before proceeding, it is useful to know the different workspaces you have available on Leonardo, which can be accessed using environment variables. The main ones are:

  • $HOME: it's the home directory associated to your username;
  • $WORK: it's the work directory associated to the account where the computational resources dedicated to this school are allocated;
  • $SCRATCH: it's the scratch directory associated to your username.

You can find more details about storage and FileSystems here.

Please don't forget to run all tutorials in your scratch directory:

echo $SCRATCH
/leonardo_scratch/large/userexternal/username
cd $SCRATCH

Computational resources on Leonardo are managed by the job scheduling system Slurm. Most part of Yambo tutorials during this school can be run in serial, except some that need to be executed on multiple processors. Generally, Slurm batch jobs are submitted using a script, but the tutorials here are better understood if run interactively. The two procedures that we will use to submit interactive and non interactive jobs are explained below.


- Run a job using a batch script

This procedure is suggested for the tutorials and examples that need to be run in parallel. In these cases you need to submit the job using a batch script job.sh, whose generic structure is the following:

#!/bin/bash
#SBATCH --account=tra25_yambo           # Charge resources used by this job to specified account
#SBATCH --time=00:10:00                 # Set a limit on the total run time of the job allocation in hh:mm:ss
#SBATCH --job-name=JOB                  # Specify a name for the job allocation
#SBATCH --partition= dcgp_usr_prod      # Request a specific partition for the resource allocation
#SBATCH --gres=tmpfs:10g                # List of generic consumable resources
#SBATCH --qos=normal                    # Quality of service 
#SBATCH --reservation=s_tra_yambo       # Reservation specific to this school
#          
#SBATCH --nodes=<N>                     # Number of nodes to be allocated for the job
#SBATCH --ntasks-per-node=<n>           # Number of MPI tasks invoked per node
#SBATCH --ntasks-per-socket=<n/2>       # Tasks invoked on each socket
#SBATCH --cpus-per-task=<c>             # Number of OMP threads per task

module purge
module load profile/candidate
module use /leonardo/pub/userexternal/nspallan/spack-0.22.2-06/modules
module load yambo/5.3.0--intel-oneapi-mpi--2021.12.1--oneapi--2024.1.0
export OMP_NUM_THREADS=${SLURM_CPUS_PER_TASK}

mpirun -np ${SLURM_NTASKS} \
       yambo -F <input> -J <output>

Please note that the instructions in the batch script must be compatible with the specific Leonardo-DCGP resources. The complete list of Slurm options can be found here. However you will find ready-to-use batch scripts in locations specified during the tutorials.

To submit the job, use the sbatch command:

sbatch job.sh
Submitted batch job 15696508

To check the job status, use the squeue command:

squeue --me
           JOBID PARTITION     NAME     USER ST       TIME  NODES NODELIST(REASON)
        15696508 dcgp_usr_   job.sh username  R       0:01      1 lrdn4135

If you need to cancel your job, do:

scancel <JOBID> 


- Open an interactive session

This procedure is suggested for most of the tutorials, since the majority of these is meant to be run in serial (relatively to MPI parallelization) from the command line. Use the command below to open an interactive session of 4 hours:

srun -A tra25_yambo -p dcgp_usr_prod --reservation=s_tra_yambo -N 1 -n 1 -c 4 -t 04:00:00 --gres=tmpfs:10g --pty /bin/bash
srun: job 15694182 queued and waiting for resources
srun: job 15694182 has been allocated resources

We ask for 4 cpus-per-task (-c) because we can exploit OpenMP parallelization with the available resources.

Then, you need to manually load yambo as in the batch script above:

module purge
module load profile/candidate
module use /leonardo/pub/userexternal/nspallan/spack-0.22.2-06/modules
module load yambo/5.3.0--intel-oneapi-mpi--2021.12.1--oneapi--2024.1.0

Finally, set the OMP_NUM_THREADS environment variable to 4 using the appropriate Slurm environment variable:

export OMP_NUM_THREADS=${SLURM_CPUS_PER_TASK}

To close the interactive session when you have finished, log out of the compute node with the exit command:

exit


- Plot results with gnuplot

During the tutorials you will often need to plot the results of the calculations. In order to do so on Leonardo, open a new terminal window and connect to Leonardo enabling X11 forwarding with the -X option:

ssh -X leonardo

Please note that gnuplot can be used in this way only from the login nodes:

username@login01$ cd <directory_with_data>
username@login01$ gnuplot
...
Terminal type is now '...'
gnuplot> plot <...>


- Set up yambopy

In order to run yambopy on Leonardo, you must first activate the python environment:

module load profile/candidate
source /leonardo_work/tra25_yambo/env_yambopy/bin/activate

Tutorials

Quick recap. Before every tutorial, if you run on Leonardo, do the following steps

ssh leonardo
cd $SCRATCH
mkdir -p YAMBO_TUTORIALS #(Only if you didn't before)
cd YAMBO_TUTORIALS

Since the compute nodes are not connected to the external network, the tarballs must be downloaded before starting the interactive session. Alternatively, once the interactive session has started, it is possible to access the tarballs by copying them from the following directories:

/leonardo_work/tra25_yambo/YAMBO_TUTORIALS
/leonardo_work/tra25_yambo/YAMBOPY_TUTORIALSypp_nl -y ypypp_nl -y ypp_nl -y ypp_nl -y p_nl -y 

After that you can start the interactive session

srun -A tra25_yambo -p dcgp_usr_prod --reservation=s_tra_yambo -N 1 -n 1 -c 4 -t 04:00:00 --gres=tmpfs:10g --pty /bin/bash
[...]

set the environment variable for openMP

export OMP_NUM_THREADS=${SLURM_CPUS_PER_TASK}

and load yambo or yambopy as explained above in the general instructions.

DAY 1 - Monday, 19 May

16:15 - 18:30 From the DFT ground state to the complete setup of a Many Body calculation using Yambo

To get the tutorial files needed for the following tutorials, follow these steps:

wget https://media.yambo-code.eu/educational/tutorials/files/hBN.tar.gz
wget https://media.yambo-code.eu/educational/tutorials/files/hBN-2D.tar.gz
ls
hBN-2D.tar.gz  hBN.tar.gz
tar -xvf hBN-2D.tar.gz
tar -xvf hBN.tar.gz
ls
hBN-2D hBN hBN-2D.tar.gz  hBN.tar.gz

Now that you have all the files, you may open the interactive job session with srun as explained above and proceed with the tutorials.

At this point, you may learn about the python pre-postprocessing capabilities offered by yambopy, our python interface to yambo and QE. First of all, let's create a dedicated directory, download and extract the related files.

cd $SCRATCH
mkdir -p YAMBOPY_TUTORIALS
cd YAMBOPY_TUTORIALS
rsync -avzP /leonardo_work/tra25_yambo/YAMBOPY_TUTORIALS/yambopy_tutorial_Modena_2025.tar.gz .
tar --strip-components=1 -xvzf yambopy_tutorial_Modena_2025.tar.gz

Then, follow part 1 of the tutorial, which is related to DFT band structures, YAMBO initialization and linear response.

DAY 2 - Tuesday, 20 May

14:00 - 16:30 A tour through GW simulation in a complex material (from the blackboard to numerical computation: convergence, algorithms, parallel usage)

To get all the tutorial files needed for the following tutorials, follow these steps:

wget https://media.yambo-code.eu/educational/tutorials/files/hBN.tar.gz
wget https://media.yambo-code.eu/educational/tutorials/files/MoS2_2Dquasiparticle_tutorial.tar.gz
tar -xvf hBN.tar.gz
tar -xvf MoS2_2Dquasiparticle_tutorial.tar.gz
cd hBN

Now you can start the first tutorial:

If you have gone through the first tutorial, pass now to the second one:

cd $SCRATCH
cd YAMBO_TUTORIALS
cd MoS2_HPC_tutorial

As for yambopy, the tutorial related to GW calculations is contained in the first section of Part 2

DAY 3 - Wednesday, 21 May

14:00 - 16:30 Bethe-Salpeter equation (BSE) Fulvio Paleari (CNR-Nano, Italy), Davide Sangalli (CNR-ISM, Italy)

To get the tutorial files needed for the following tutorials, follow these steps:

wget https://media.yambo-code.eu/educational/tutorials/files/hBN.tar.gz # NOTE: YOU SHOULD ALREADY HAVE THIS FROM DAY 1
wget https://media.yambo-code.eu/educational/tutorials/files/hBN-convergence-kpoints.tar.gz 
tar -xvf hBN-convergence-kpoints.tar.gz
tar -xvf hBN.tar.gz

Now, you may open the interactive job session with salloc and proceed with the following tutorials.

Now, go into the yambopy tutorial directory to learn about python analysis tools for the BSE:

cd $SCRATCH
cd YAMBOPY_TUTORIALS/databases_yambopy


17:00 - 18:30 Bethe-Salpeter equation in real time (TD-HSEX) Fulvio Paleari (CNR-Nano, Italy), Davide Sangalli (CNR-ISM, Italy)

The files needed for the following tutorials can be downloaded following these steps:

wget https://media.yambo-code.eu/educational/tutorials/files/hBN-2D-RT.tar.gz
tar -xvf hBN-2D-RT.tar.gz


DAY 4 - Thursday, May 22

14:00 - 16:30 Real-time approach with the time dependent berry phase Myrta Gruning (Queen's University Belfast), Davide Sangalli (CNR-ISM, Italy)


For the tutorials we will use first the hBN-2D-RT folder (k-sampling 10x10x1) and then the hBN-2D folder (k-sampling 6x6x1) You may already have them in the YAMBO_TUTORIALS folder

ls
hBN-2D hBN-2D-RT hBN-2D.tar.gz  hBN-2D-RT.tar.gz

If you need to downoload again the tutorial files, follow these steps:

wget https://media.yambo-code.eu/educational/tutorials/files/hBN-2D.tar.gz
wget https://media.yambo-code.eu/educational/tutorials/files/hBN-2D-RT.tar.gz
tar -xvf hBN-2D.tar.gz
tar -xvf hBN-2D-RT.tar.gz

DAY 5 - Friday, 23 May

Lectures

DAY 1 - Monday, 19 May

  • D. Varsano, [Description and goal of the school].
  • C. Franchini, [First principles and data-driven correlated materials]
  • F. Mohamed, [A tour on Density Functional Theory]
  • E. Cannuccia, [Electronic screening and linear response theory]

DAY 2 - Tuesday, 20 May

  • A. Marini, Introduction to Many-Body Perturbation Theory
  • C. Cardoso, Quasiparticles and the GW Approximation
  • A. Guandalini,G. Sesti, GW in practice: algorithms, approximations and W-averaged GW in metals
  • M. Govoni, GW without empty states and investigation of neutral excitations by embedding full configuration interaction in DFT+GW

DAY 3 - Wednesday, 21 May

  • M. Palummo, Optical absorption and excitons via the Bethe-Salpeter Equation
  • D. Sangalli, Real-time simulations
  • F. Paleari, Introduction to YamboPy (automation and post-processing)

DAY 4 - Thursday, 22 May

  • E. Luppi, An introduction to Non-linear spectroscopy
  • M. Grüning, Non-linear spectroscopy in Yambo
  • F. Affinito, Frontiers in High-Performance Computing