aiidaplugins Modules
addiaplugins.io Module
- hzdplugins.aiidaplugins.serverio.qeCleanAllRemoteFolder(uuid_list, is_wfc, is_save)[source]
qeCleanAllRemoteFolderWithWfcWe would like to clean all the remote folder in the results.- Parameters
uuid_list (python list object) – you can add a list of nodes that you want to clear the remote folder. e.g. [2020, 2030, 2040] etc. The function will only deal with the list object, other types of inputs are ignored. But if args is not set, then the function will deal with all the nodes in the results dictionary.
is_wfc (python boolean object) – (optional, default = False) True if we want to delete all the wavefunction files
is_save (python boolean object) – (optional, default = False )True if we want to delete all contents in
aiida.savefolder
- hzdplugins.aiidaplugins.serverio.qeCleanOneRemoteFolder(uuid, is_wfc=False, is_save=False)[source]
qeCleanOneRemoteFolderNoWfcThis method is used for clean the content on remote folder generated by Quantum Espresso. Since QE will generate a lot of files (e.g. ‘mix’, ‘hub’, ‘wfc’, ‘restart’, etc), so the storage on our supercomputer will be overloaded soon, that’s not a good thing.- Parameters
uuid (python string object) – the uuid value of certain node (CalcJob)
is_wfc (python boolean object) – (optional, default = False) True if we want to delete all the wavefunction files
is_save (python boolean object) – (optional, default = False )True if we want to delete all contents in
aiida.savefolder
- hzdplugins.aiidaplugins.serverio.qeRetriveAllFiles(uuid, localpath)[source]
qeRetriveAllFilescan help us retrieve all the files from remote_folder_path- Parameters
uuid (python string object) – The uuid of the computational node
localpath (python string object) – The absolute path of local folder, which we want to store our information in.
- Returns
There is no return.
- hzdplugins.aiidaplugins.serverio.setCmdOnRemoteComputer(cmd, uuid)[source]
setCmdOnRemoteComputercan run command on remote computer from jupyterlab, which is really convenient, and also the command is programmable.- Parameters
cmd (python string object) – represents the command that needs to be run on the remote server.
uuid (python string object) – represents the uuid of the job. Our cmd will be operated in uuid work directory.
- Returns
r (int): if 0, means success
stdout (list): the return list of the cmd
stderr (str): the return message of error, if succeeds, then this is empty
addiaplugins.info Module
- hzdplugins.aiidaplugins.info.checkDistance(cell, atom1, atom2, bond_length)[source]
check_distancefunction can help us determine whether the two atoms in the slab structure are close enough (distance < bond_length) or not. In here we should notice that all slab structures have periodic boundary condition (PBC), which means that not only we need to consider the position of atom2, we also need to consider 6 different atom positions that is in translational symmetry with atom2.- Parameters
cell (python list object) – A 3x3 array. The cell parameters of the slab, which can be easily accessed by
structure.cellatom1 (ase.Atom object) – atom1
atom2 (ase.Atom object) – atom2
bond_length (python float object) – The threshold of the bond length that we are interested in, can be set by the user.
- Returns
If true, then function will return [True, distance, add_string]
If false, then function will return [False, -1, ‘’]
- hzdplugins.aiidaplugins.info.checkTotalSpin(symbol, electron_configuration)[source]
Get the spin of certain configurations.
- hzdplugins.aiidaplugins.info.getChargeAndMagneticMoments(uuid, traj_index=- 1)[source]
get_ChargeAndMagneticMomentsfunction will output the charge and the magnetic moments for each atom if we have spin-polarized simulation.- Parameters
uuid (python string object) – The uuid of the computational node.
traj_index – The index of the structure. -1 means the end structure, but sometimes we need to use -2 because the last structure was created by SCF calculation, and for vc-relax simulation, the last step can sometimes be questionable.
- Returns
A table that shows the charge and atomic_magnetic_moments for each species (labeled as
[number][ atomic_species], e.g. 1Ni)
- hzdplugins.aiidaplugins.info.getDos(uuid)[source]
getDoscan return the DOS of the system- Parameters
uuid (python string object) – The uuid of the projwfc calc node
- Returns
energy (python list object): list of energy
dos (python list object): dos of energy
- hzdplugins.aiidaplugins.info.getGCN(structure, bond_length, atom_list, cn_max)[source]
This function is used to calculate the GCN (generalized coordination number of certain atom) of certain site.
- Parameters
structure (aiida.orm.StructureData) – Structure of the slab
bond_length (python real object) – the maximum bond_length that we need to investigate
atom_list (python list object) – a list of atoms which constructs a unique site (could be ensemble)
cn_max (python integer) – the maximum coordination number of certain atom in the structure
atom_name (python string object) – the name of the atom (useful in dealing with the dictionary)
- hzdplugins.aiidaplugins.info.getLastForce(uuid)[source]
getLastForcewill return the value of the last total force and the stdout ofgrep 'Total force' aiida.out- Parameters
uuid (python string object) – The uuid of the simulation
- Returns
The last force of the simulation
The stdout of the cmd
- hzdplugins.aiidaplugins.info.getLastScf(uuid)[source]
getLastScfwill return the value of the last scf accuracy and the stdout ofgrep 'scf accuracy' aiida.out- Parameters
uuid (python string object) – The uuid of the simulation
- Returns
The last force of the simulation
The stdout of the cmd
- hzdplugins.aiidaplugins.info.getOptimizedStructure(data_xml)[source]
Get the last structure (atomic positions and cell) from the xml data (parsed as dictionary)
- Parameters
data_xml – The python dictionary parsed from the xml file generated by pw.x
- Returns
There are two returns, the first is the cell of the optimized structure, the second is the atomic positions.
- hzdplugins.aiidaplugins.info.getPdos(uuid, index, is_spin, set_angular_momentum=[0, 1, 2])[source]
getPdoswill give you the PDOS that you want, in order to do the analysis later.- Parameters
uuid (python string object) – The uuid of the computational node.
index (python list object) – Shows the atoms that we want to investigate.
is_spin (python boolean object) – If is_spin is True, then we need to look for spin-up and spin-down, but if is_spin is false, then we only need to care about the orbital, not the spin.
set_angular_momentum (python list object) – A list. [0, 1, 2] means [‘s’, ‘p’, ‘d’] orbitals, and if we are considering f-electrons, then we need to add ‘3’ to this list.
- Returns
A list and A dictionary. A list is the energy list, which is modified by the Fermi energy. The second return is a dictionary. First key is the index of atom in the cell, second key is the angular_momentum, third key is the magnetic number, and in there is the pdos of certain magnetic number, for each angular_momentum, we will have a ‘tot’ element which shows the combination of all the magnetic number.
The structure can be represented as:
res = { 1: { 's': { 's': 'tot': }, 'p': { 'px':, 'py', 'pz' 'tot': } ... } }
- hzdplugins.aiidaplugins.info.getStructure(structure)[source]
getStructurecan give you the structure by using ase_gui.- Parameters
structure (aiida.orm.StructureData) – The uuid of the node.
- Returns
A ase-gui figure represents the structure, which you can view; An ase structure file which you can manipulate later.
- hzdplugins.aiidaplugins.info.getStructureAnalysis(structure, bond_length=2.5, atom_index=[], is_Metal=False)[source]
get_StructureAnalysisis a function that can analyze the local structure of each atom in the structure.- Parameters
structure (aiida.orm.StructureData) – The structure that we want to investigate
bond_length (python float object) – The maximum bond length that we consider as a “neighbour”, 2.5 is sufficiently large enough, but if can be adjusted by the user.
atom_index (python list object) – A list that tell the code which atom that we want to investigate, put the atom_id of the atom in the list.
is_Metal (python boolean object) – A boolean variable. If you are only interested in the metal elements, then you put that to True, else False.
- Returns
A dictionary that shows the distance of the central atom with its surrouding atoms. Since metals are important, so we mainly focus on Metal atoms. Later maybe I can add a boolean parameters to let the user choose.
- hzdplugins.aiidaplugins.info.getTotalForces(uuid)[source]
get_TotalForcesfunction will output the total force for each atomic step.- Parameters
uuid (python string object) – The uuid of the computational node.
- Returns
A matplotlib figure that shows the convergence, and also the last 5 steps of total_forces.
- hzdplugins.aiidaplugins.info.getXMLFromPW(xml_file)[source]
Get the dictionary from the xml output.
- Parameters
xml_file – The location of the .xml file that we need
- Returns
return the python dictionary that contains all the information
addiaplugins.submit Module
- hzdplugins.aiidaplugins.submit.nebOriginalSubmit(results, uuid, codename, add_parameters, del_parameters, metadata)[source]
- hzdplugins.aiidaplugins.submit.phOriginalSubmit(uuid, codename, natlist, qpoints=[[0.0, 0.0, 0.0]], add_parameters={}, del_parameters={}, metadata={}, cluster_options={})[source]
phOriginalSubmitcan submit a ph.x simulation to get the PDOS. It must follow a scf simulation.- Parameters
uuid (python string object) – (mandatory) The uuid of previous calculation. We will start our calculation from there. Because uuid is the unique identification number for each CalcJobNode
codename (python string object) – (mandatory) Represent the code for pw.x that you want to use. If you want to use the same as previous calculation, then you need to use Str(‘’)
natlist (python list object) – (mandatory) Assign the atoms which we want to do the vibrational frequency analysis.
qpoints (python list object) – (optional, default = [[0.0, 0.0, 0.0]] It is like k-points, but useful when calculating vibrational frequencies.
add_parameters (python dictionary object) –
(optional, default = {}) The desired parameters that you want to state, it can be incomplete, because inside the function there is a default setting for parameters which can be used in most cases, but if you have specific need, you can put that in parameters, the format is similar as pw.x input file.
e.g.
{'PROJWFC':{}}del_parameters (python dictionary object) –
(optional, default = {}) The tags that we would like to delete, for example if we do not want to use spin-polarized simulation, then ‘nspin’ needs to be deleted. Same structure as add_parameters.
e.g.
{'PROJWFC': [key1, key2, key3]}metadata (python dictionary object) – (optional, default = {}) The dictionary that contains information about metadata. For example: label and description. label and description are mendatory.
cluster_options (python dictionary object) – (optional, default = {}) The detailed option for the cluster. Different cluster may have different settings. Only the following 3 keys can have effects: (1) resources (2) account (3) queue_name
- Returns
uuid of the CalcJobNode object of the newest calculation.
- hzdplugins.aiidaplugins.submit.ppOriginalSubmit(results, uuid, codename, add_parameters, del_parameters, metadata)[source]
- hzdplugins.aiidaplugins.submit.projwfcOriginalSubmit(uuid, codename, metadata, add_parameters={}, del_parameters={}, cluster_options={})[source]
projwfcOriginalSubmitcan submit a projwfc simulation to get the PDOS. It must follow a nscf simulation- Parameters
uuid (python string object) – (mandatory) The uuid of previous calculation. We will start our calculation from there. Because uuid is the unique identification number for each CalcJobNode
codename (python string object) – (mandatory) Represent the code for pw.x that you want to use. If you want to use the same as previous calculation, then you need to use Str(‘’)
add_parameters (python dictionary object) –
(optional, default = {}) The desired parameters that you want to state, it can be incomplete, because inside the function there is a default setting for parameters which can be used in most cases, but if you have specific need, you can put that in parameters, the format is similar as pw.x input file.
e.g.
{'PROJWFC':{}}del_parameters (python dictionary object) –
(optional, default = {}) The tags that we would like to delete, for example if we do not want to use spin-polarized simulation, then ‘nspin’ needs to be deleted. Same structure as add_parameters.
e.g.
{'PROJWFC': [key1, key2, key3]}metadata (python dictionary object) – (optional, default = {}) The dictionary that contains information about metadata. For example: label and description. label and description are mendatory.
cluster_options (python dictionary object) – (optional, default = {}) The detailed option for the cluster. Different cluster may have different settings. Only the following 3 keys can have effects: (1) resources (2) account (3) queue_name
- Returns
uuid of the CalcJobNode object of the newest calculation.
- hzdplugins.aiidaplugins.submit.qePwContinueSubmit(uuid, pseudo_family, pseudo_dict={}, codename='', parent_folder=True, add_parameters={}, del_parameters={}, kpoints=[], cluster_options={}, metadata={}, settings_dict={})[source]
qePwContinueSubmit will continue a simulation with similar or modified input parameters. All the parameters are listed in the kwargs.
- Parameters
uuid (python string object) –
(mandatory) The uuid of previous calculation. We will start our calculation from there. Because uuid is the unique identification number for each CalcJobNode
Notice: The uuid must be in the results dictionary, if not the program will shout KeyError. And if you are testing, you could use assignValue to quickly create a dictionary that contains the uuid that you want to continue.
pseudo_family (python string object) – (mandatory) The pseudopotential family that you want to use. Make sure that you already have that configured, otherwise an error will occur. This is mendatory.
pseudo_dict (python dictionary object) – (optional, default = {}) Which contains the pseudopotential files that we want to use in the simulation.
codename (python string object) – (optional, default = ‘’) Represent the code for pw.x that you want to use. If you want to use the same as previous calculation, then you need to use Str(‘’)
parent_folder (python boolean object) – (optional, default = True) If parent_folder is True, then the calculation will start with the output files from previous calculations.
add_parameters (python dictionary object) –
(optional, default = {}) The desired parameters that you want to state, it can be incomplete, because inside the function there is a default setting for parameters which can be used in most cases, but if you have specific need, you can put that in parameters, the format is similar as pw.x input file.
If you want to assign DFT+U and spin-polarization, you need to specify it on your own.
e.g.
{'CONTROL':{}, 'SYSTEM':{}}Notice: more options in qePwOriginalSubmit function. In qePwContinueSubmit, we assume that the user wants to restart from previous converged wave functions and charge density, so we set [‘CONTROL’][‘restart_mode’]=’restart’, [‘ELECTRON’][ ‘startingwfc’]=’file and [‘ELECTRON’][‘startingpot’]=’file’.
del_parameters (python dictionary object) –
(optional, default = {})The tags that we would like to delete, for example if we do not want to use spin-polarized simulation, then ‘nspin’ needs to be deleted. Same structure as add_parameters.
e.g.
{'CONTROL': [key1, key2, key3], 'SYSTEM': [key1, key2, key3]}kpoints (python list object) – (optional, default = []), if you want to keep the k-points for previous calculation, just use an empty list
[]. The kpoints that you want to use, if the kpoints has only 1 list, then it is the kpoint mesh, but if two lists are detected, then the first will be k-point mesh, the second one will be the origin of k-point mesh.e.g. [[3, 3, 1]] or [[3, 3, 1],[0.5, 0.5, 0.5]]cluster_options (python dictionary object) – (optional, default = {}) The detailed option for the cluster. Different cluster may have different settings. Only the following 3 keys can have effects: (1) resources (2) account (3) queue_name. If value is
{}, then it means we will use previous settingsmetadata (python dictionary object) – (optional, default = {}) The dictionary that contains information about metadata. For example: label and description.label and description are mendatory. If value is
{}, then it means we will use previous settings.settings_dict (python dictionary object) – (optional, default = {}) which contains the additional information for the pw.x calculation. e.g. Fixed atom, retrieving more files, parser options, etc. And the command-line options. If value is
{}, then it means we will use previous settings.
- Returns
uuid of the CalcJobNode of the newest calculation.
- hzdplugins.aiidaplugins.submit.qePwOriginalSubmit(codename, structure, kpoints, pseudo_family, metadata, pseudo_dict={}, add_parameters={}, del_parameters={}, cluster_options={}, settings_dict={})[source]
qePwOriginalSubmitwill submit an original computational task to the desired computer by using certain code.- Parameters
codename (python string object) – (mandatory) A string represents the code for pw.x that you want to use.
structure (aiida.orm.StructureData object) – (mandatory) The structure of your system.
add_parameters (python dictionary) –
(optional, default = {}) The desired parameters that you want to state, it can be incomplete, because inside the function there is a default setting for parameters which can be used in most cases, but if you have specific need, you can put that in parameters, the format is similar as pw.x input file.
If you want to assign DFT+U and spin-polarization, you need to specify it on your own.
In Aiida, there is a very efficient way to specify the
hubbard_u,starting_magnetizationandstarting_ns_eigenvalue. I give some examples in below:# hubbard_u 'SYSTEM': { 'hubbard_u': { 'Fe': 5.0, 'Fe3': 5.0 # if you have different spins of same atom, then you should use newStructure function to create the structure }, 'starting_magnetization': { 'Fe': 0.1, 'Fe3': 0.1, }, 'starting_ns_eigenvalue': [ [1, 1, 'Fe', 1.0] # represent: starting_ns_eigenvalue(1, 1, 1)=1.0 # others are the same, if you want to assign to Fe3, just replace Fe with Fe3. ] }
del_parameters (python dictionary object) –
(optional, default = {}) The tags that we would like to delete, for example if we do not want to use spin-polarized simulation, then ‘nspin’ needs to be deleted. Same structure as add_parameters.
e.g.
{'CONTROL': [key1, key2, key3], 'SYSTEM': [key1, key2, key3]}kpoints (python list object) – (mandatory) The kpoints that you want to use, if the kpoints has only 1 list, then it is the kpoint mesh, but if two lists are detected, then the first will be k-point mesh, the second one will be the origin of k-point mesh.e.g. [[3, 3, 1]] or [[3, 3, 1],[0.5, 0.5, 0.5]]
pseudo_family (python string object.) – (mandatory) The pseudopotential family that you want to use. Make sure that you already have that configured, otherwise an error will occur.
pseudo_dict (python dictionary object.) –
(optional, default = {}) which contains the pseudopotential files that we want to use in the simulation. In here it is very important to note that the path of the pseudopotential file has to be in the absolute path.
e.g.
pseudo_dict = { 'Fe': UpfData(absolute_path), 'Fe3': UpfData(absolute_path) }
cluster_options (python dictionary object) – (optional, default = {}) The detailed option for the cluster. Different cluster may have different settings. Only the following 3 keys can have effects: (1) resources (2) account (3) queue_name
metadata (python dictionary object) –
(mandatory) The dictionary that contains information about metadata. For example: label and description. label and description are mendatory.
e.g.
{'label':{}, 'description':{}}settings_dict (python dictionary object) – (optional, default = {}) which contains the additional information for the pw.x calculation. e.g. Fixed atom, retrieving more files, parser options, etc. And the command-line options.
- Returns
uuid of the new CalcJobNode
addiaplugins.inputgenerator Module
- class hzdplugins.aiidaplugins.inputgenerator.PwBaseWorkChainInputGenerator(pw, kpoints, clean_workdir=True)[source]
Bases:
objectThe
PwBaseWorkChainInputGeneratorclass is used to construct the input file for PwBaseWorkChain.Initialization function for
PwBaseWorkChainInputGeneratorclass.- Parameters
pw (PwCalculationInputGenerator object) – The input of PwCalculation
kpoints (aiida.orm.KpointsData) – The kpoints for the simulation
clean_workdir (python boolean object) – If true, then we want to delete all the files in the work directory
- class hzdplugins.aiidaplugins.inputgenerator.PwCalculationInputGenerator(code, structure, pseudos, parameters, settings, metadata, kpoints)[source]
Bases:
objectThe
PwCalculationInputGeneratorclass is used to construct the input file for PwCalculation.Initialization function for
PwCalculationInputGeneratorclass.- Parameters
code (aiida.orm.StructureData object) – The code we want to use for the pw.x calculation.
structure – The structure we want to calculate
pseudos (python dictionary object) –
The pseudopotential we want to use
e.g. An example for pseudos
pseudos = { 'Pt': UpfData(absolute_path_of_pseudopotential_for_Pt) 'O': UpfData(absolute_path_of_pseudopotential_for_O) }
parameters (aiida.orm.Dict object) – The parameters for the pw.x calculation
settings (aiida.orm.Dict object) – The computational settings for the pw.x calculation
metadata (python dictionary object) –
The metadata for the pw.x calculation
e.g. An example for metadata
metadata = { 'label': 'The label of your system, easy for query later', 'description': 'A description of your calculation', 'options': { 'resources': {'num_machines': x}, 'max_wallclock_seconds': 86400, 'account': 'xxxxx', 'scheduler_stderr': 'stderr', 'scheduler_stdout': 'stdout', 'queue_name': 'xxxxxx' } }
kpoints (aiida.orm.KpointsData) – kpoints for the simulation
- class hzdplugins.aiidaplugins.inputgenerator.PwRelaxWorkChainInputGenerator(base, base_final_scf, structure, relaxation_scheme, relax_type, meta_convergence=True, max_meta_convergence_iterations=5, volume_convergence=0.01, clean_workdir=True)[source]
Bases:
objectThe
PwRelaxWorkChainInputGeneratorclass is used to construct the input file for PwBaseWorkChain.Initialization function for
PwRelaxWorkChainInputGeneratorclass.- Parameters
base (PwBaseWorkChainInputGenerator object) – Input for the PwBaseWorkChain
base_final_scf (PwBaseWorkChainInputGenerator object) – Input for the last scf simulation
structure (aiida.orm.StructureData object) – The structure we want to relax
relax_type (python string object) –
How do we want to relax the structure. Default value can be summaried in below:
relax_type_dict = { 'none': 'Nothing can move --> SCF simulation', 'atoms: 'Only atomic positions can be relaxed, cell is fixed.', ('relax') 'volume': 'Only volume can change, cell shape and atoms are fixed', 'shape': 'Only shape is optimized, volume and atomic positions are fixed', 'cell': 'Only cell is optimized (both shape and volume), atoms are fixed', 'atoms_volume': 'Relax atomic positions and volume', 'atoms_shape': 'Relax atomic positions and shape', 'atoms_cell': 'Relax both atomic positions and cell' ('vc-relax') }
meta_convergence (python boolean object) – Don’t know why this exists
max_meta_convergence_iterations (python int object) – pass
volume_convergence (python float object) – pass
clean_workdir (python boolean object) – pass
addiaplugins.utilities Module
- hzdplugins.aiidaplugins.utilities.dictToPwInput(dict_input, location, atomic_species_list)[source]
To convert the dictionary to the input file for pw.x
- Parameters
dict_input (Python dictionary) – contains all the information about the structure
location (Python string) – contains the location of the output file
atomic_species_list (Python dictionary) – contains the order of the atomic species, very useful for the hubbard_u, etc.
- Returns
a file named in location
- hzdplugins.aiidaplugins.utilities.getSubmitFile(filename, computer, typeCalculation, inpDict)[source]
This function can help us generate the submitting file for the supercomputer.
- Parameters
location (Python string) – the filename of the submitting script
computer (Pythong string) – the name of the computer that we want to run on, the options are: [‘rwth-claix’, ‘juwels-mac’, ‘jureca-dc-mac’, ‘jureca-booster-mac’] (currently)
typeCalculation (Python string (e.g. ['qe'] or others)) – the type of the simulation that we want to conduct
inpDict (Python dictionary) –
The dictionary that contains all the information that we need for constructing the input file. All the keywords are: [‘job_name’, ‘scheduler_stdout’, ‘scheduler_stderr’,
’queue_name’, ‘account’, ‘resources’, ‘max_wallclock_seconds’, ‘modules’, ‘cmd’, ‘ntasks_per_node’]
- Returns
a file named filename, no other return
- hzdplugins.aiidaplugins.utilities.listToStr(l, separator)[source]
- Parameters
l (Python list) – the list that we want to print
separator (Python string) – the separator that we want to add, e.g. ‘ ‘ (space), etc.
- hzdplugins.aiidaplugins.utilities.pwInputToDict(loc_file, atomic_species_list)[source]
Create the input dictionary from the INP_PWSCF
- Parameters
loc_file (Python string) – The location of the input file for pw.x
atomic_species_list (Python dictionary) – contains the order of the atomic species, very useful for the hubbard_u, etc.
- Returns
a python dictionary that contains all the relevant information