Modules

yambopy

Create, read and write yambo input files Read, modify and write yambo databases Analyse results from yambo calculations

Modules:
io
  • YamboIn: read, write and manipulate yambo input files
  • YamboOut: read yambo output files and save in .json
dbs
  • YamboSaveDB: read information in the ns.db1
  • YamboLatticeDB: read lattice parameters, symmetries and k-points from ns.db1
  • YamboDipolesDB: dipole matrix elements from ndb.dip*
  • YamboStaticScreeningDB: static dielectric screening from ndb.em1s*
  • YamboElectronsDB: read the electronic states from ns.db1
  • YamboQPDB: read the quasiparticle energies db ndb.QP
  • YamboGreenDB: read the green’s functions calculated using yambo
bse
  • YamboExcitonWaveFunctionXSF: read the excitonic
  • YamboExcitonWeight: read the excitonic weights from the ypp output file
  • YamboBSEAbsorptionSpectra: generate a .json file with the bse absorption calculation (including information about the excitons)
analyse:
  • YamboAnalyser: read .json files generated with yamboout and plot them together
  • recipes: user contributed scripts
class yambopy.YamboAnalyser(folder='.')[source]

Class to open multiple .json files, organize them and plot the data together. Useful to perform convergence tests

io

class yambopy.YamboIn(args='', folder='.', vim=True, filename='yambo.in')[source]

Class to read, write, create and manipulate yambo input files with python.

Examples of use:

Initialize an empty input file:

y = YamboIn(filename='somefile.in')
print y

Call yambo to initialize the input file with variables according to the runlevel, parse the input file and store the variables:

y = YamboIn('yambo -o c',folder='ip')
print y

If the argument args was used then the filename should be left as yambo.in because that’s the default input filename that yambo will create.

Call ypp to initialize the input file:

y = YamboIn('yyp -e w'args=,filename='ypp.in')
print y

Arguments:

args: if specified yambopy will run yambo, read the generated input file and initialize the class with those variables.

folder: the folder where the SAVE directory is located

vim: if yambo is compiled using vim as an editor this variable should be set as True because then yambopy will close vim. In newer versions an argument for yambo ‘-Q’ tells it to not call vim

filename: the name of the input file to be read

class yambopy.YamboOut(folder, save_folder='.')[source]

Class to read yambo output files and pack them in a .json file

Arguments:

folder: The relative path of the folder where yambo dumped its input files

save_folder: The path were the SAVE folder is localized

dbs

class yambopy.YamboSaveDB(save='SAVE', filename='ns.db1')[source]

Reads the information from the SAVE database in Yambo

Arguments:

save: Path with the save folder (default:SAVE) filename: name of the filename of the ns.db1 database created with yambo (default:ns.db1)

Properties:

atomic_numbers : atomic number of the species eigenvalues : eigenvalues of the electrons in eV nkpoints : number of kpoints
class yambopy.YamboLatticeDB(save='SAVE', filename='ns.db1', expand=True)[source]

Class to read the lattice information from the netcdf file

class yambopy.YamboDipolesDB(lattice, save='SAVE', filename='ndb.dip_iR_and_P', dip_type='iR', field_dir=[1, 0, 0], field_dir3=[0, 0, 1])[source]

Class to read the dipoles databases from the ndb.dip* files

Can be used to for exapmle plot the imaginary part of the dielectric function which corresponds to the optical absorption

class yambopy.YamboQPDB(filename='ndb.QP', folder='.')[source]

Class to read yambo ndb.QP files

These files describe the quasiparticle states calculated from yambo Includes the quasi-particl energies, the lifetimes and the Z factors

class yambopy.YamboGreenDB(filename='ndb.G', folder='.')[source]

Read the green’s functions calculated using yambo These green’s functions describe the spectral function of the quasiparticles. The quasi-particles can be from electron-phonon or GW calculations

class yambopy.YamboElectronsDB(lattice, save='SAVE', filename='ns.db1')[source]

Class to read information about the electrons from the ns.db1 produced by yambo

Arguments:

lattice: instance of YamboLatticeDB or YamboSaveDB

filename: netcdf database to read from (default:ns.db1)

class yambopy.YamboStaticScreeningDB(save='.', filename='ndb.em1s', db1='ns.db1')[source]

Class to handle static screening databases from Yambo

This reads the databases ndb.em1s* There \(v\chi(\omega=0)\) is stored.

To calculate epsilon (static dielectric function) we do:

\[\epsilon^{-1} = 1-v\chi\]

bse

class yambopy.YamboBSEAbsorptionSpectra(job_string, path='.')[source]

Create a file with information about the excitons from Yambo files

class yambopy.YamboExcitonWeight(filename, save='SAVE', path='.')[source]

Class to read the excitonic weight writen by ypp

class yambopy.YamboExcitonWaveFunctionXSF[source]

Class to read excitonic wavefunctions from yambo in the 3D xsf format

qepy

Scripts to manipulate Quantum Espresso input files

Also able to read output files in xml format (datafile.xml or datafile-schema.xml)

class qepy.PwIn(filename=None)[source]

Class to generate an manipulate Quantum Espresso input files Can be initialized either reading from a file or starting from a new file.

Examples of use:

To read a local file with name “mos2.in”

qe = PwIn('mos2.scf')
print qe

To start a file from scratch

qe = PwIn('mos2.scf')
qe.atoms = [['N',[ 0.0, 0.0,0.0]],
            ['B',[1./3,2./3,0.0]]]
qe.atypes = {'B': [10.811, "B.pbe-mt_fhi.UPF"],
             'N': [14.0067,"N.pbe-mt_fhi.UPF"]}

qe.control['prefix'] = "'%s'"%prefix
qe.control['verbosity'] = "'high'"
qe.control['wf_collect'] = '.true.'
qe.control['pseudo_dir'] = "'../pseudos/'"
qe.system['celldm(1)'] = 4.7
qe.system['celldm(3)'] = layer_separation/qe.system['celldm(1)']
qe.system['ecutwfc'] = 60
qe.system['occupations'] = "'fixed'"
qe.system['nat'] = 2
qe.system['ntyp'] = 2
qe.system['ibrav'] = 4
qe.kpoints = [6, 6, 1]
qe.electrons['conv_thr'] = 1e-8

print qe

Special care should be taken with string variables e.g. “‘high’”

class qepy.PwXML(prefix, path='.')[source]

Class to read data from a Quantum espresso XML file

class qepy.PhIn[source]

A class to generate an manipulate quantum espresso input files for ph.x

class qepy.DynmatIn[source]

Generate an manipulate quantum espresso input files for matdyn.x

class qepy.ProjwfcIn(prefix, DeltaE=0.05, folder='.')[source]

A class to generate and manipulate projwfc input files.

class qepy.ProjwfcXML(prefix, output_filename='projwfc.log', path='.')[source]

Class to read data from a Quantum espresso projwfc XML file.

This file contains the projection of the Kohn-Sham stated in the atomic orbitals read from the pseudopotential

schedulerpy

Schedulerpy is a simple set of python modules to run commands on different environments (clusters, local computers, etc..)

Currently available schedulers are:

  • bash: Execute the job in the bash
  • oar : Use the OAR scheduler
  • pbs : Use the PBS scheduler
class schedulerpy.Scheduler(name=None, nodes=None, cores=None, walltime='1:00:00', **kwargs)[source]

Generic scheduler class

Initialize the class, by default we look for a config file in ~/.yambopy/config.json

This file has the following information:

{
    "default": "oar <or> bash <or> pbs",
    "oar <or> bash <or> pbs":
    {
        "mpirun": "<mpirun command>",
        "modules": {"<module tag>":"<module name>"},
        "pre_run": ["line1 to execute before the run",
                    "line2 to execute before the run"],
        "pos_run": "file:<file_in_config_folder>",
        "<tag>":"<value>"
    }
}

The “default” tag chooses the scheduler to use when no scheduler is specified by the user.

“<tag>” and “<value>” in are additional variables that are handled differently for each scheduler. They are stored as arguments in the variable kwargs.

class schedulerpy.Bash(name=None, nodes=None, cores=None, walltime='1:00:00', **kwargs)[source]

Class to submit jobs using BASH

class schedulerpy.Pbs(name=None, nodes=None, cores=None, walltime='1:00:00', **kwargs)[source]

Class to submit jobs through the PBS scheduler.

_vardict states the default assignement of the nodes and cores variables from the schduler class to the variables needed in this class

class schedulerpy.Oar(name=None, nodes=None, cores=None, walltime='1:00:00', **kwargs)[source]

Class to submit jobs through the OAR scheduler

_vardict states the default assignement of the nodes and cores variables from the schduler class to the variables needed in this class