siman package

Submodules

siman.3d_plot module

siman.SSHTools module

class siman.SSHTools.SSHTools[source]

Bases: object

fexists(filename)[source]
get(source, dest)[source]
host = ''
pkey = ''
pkeypath = ''
port = 22
put(source, dest)[source]
run(command, noerror=False, printout=False)[source]
setup(user='', host='', pkey='', port=22)[source]
sget(source, dest, keeplocal=False)[source]
user = ''

siman.analysis module

siman.analysis.ads_en(cl_slab_ads, cl_slab, ads_at='O')[source]
siman.analysis.around_alkali(st, nn, alkali_ion_number)[source]
siman.analysis.assign_oxi_states(formula, charge=0)[source]

Assign oxidation states for the given chemical formula

INPUT:
  • charge (float) - total electric charge of the compound
RETURN:
  • Pymatgen Composition() object with assigned oxidation states
siman.analysis.calc_oxidation_states(cl=None, st=None, silent=1)[source]
siman.analysis.calc_redox(cl1, cl2, energy_ref=None, value=0, temp=None, silent=0, mode=None, scale=1, config_entropy=None, x_vac1=None, x_vac2=None)[source]

Calculated average redox potential and change of volume cl1 (Calculation) - structure with higher concentration cl2 (Calculation) - structure with lower concentration energy_ref (float) - energy in eV per one alkali ion in anode; default value is for Li; -1.31 eV for Na, -1.02 eV for K

temp(float) - potential at temperature, self.F is expected from phonopy calculations

mode (str) - special
electrostatic_only - use Ewald summation to obtain electrostatic energy ewald_vasp

scale - experimental

config_entropy - cacluculate configuration entropy change and add to redox potential
x_vac - vacancy concentration - should be provided

return dic {‘redox_pot’, ‘vol_red’, …}

siman.analysis.chgsum(cll, el, site, silent=1)[source]

calculate sum of Bader charges for particular atoms

siman.analysis.determine_barrier(positions=None, energies=None)[source]

The sign of barrier determined by the curvuture at saddle point. Minimum at saddle point corresponds to negative barrier The saddle point is determined as maximum deviation from energy in initial position

siman.analysis.find_polaron(st, i_alk_ion, out_prec=1, nstd=1.5)[source]

Find TM atoms with outlying magnetic moments, which is a good indication of being a small polaron

Can be problems with charged-ordered materials

INPUT:

i_alk_ion - number of ion from 0 to calculate distances to detected polarons out_prec (int) - precision of magmom output

nstd - number of standart deviations to detect polaron

RETURN:
pol (dict of int) - numbers of atoms, where polarons are detected for each TM element magmom_tm (list of float) - just magmom for TM
TODO:
  1. Add analysis of bond lengths to distinguish small polarons
    Janh-Teller
  2. Add treatment of charged-ordered
siman.analysis.fit_a(conv, n, description_for_archive, analysis_type, show, push2archive)[source]

Fit equation of state for bulk systems.

The following equation is used:

sjeos (default)
    A third order inverse polynomial fit 10.1103/PhysRevB.67.026103

                    2      3        -1/3
E(V) = c + c t + c t  + c t ,  t = V
        0   1     2      3

taylor
    A third order Taylor series expansion about the minimum volume

murnaghan
    PRB 28, 5480 (1983)

birch
    Intermetallic compounds: Principles and Practice,
    Vol I: Principles. pages 195-210

birchmurnaghan
    PRB 70, 224107

pouriertarantola
    PRB 70, 224107

vinet
    PRB 70, 224107

antonschmidt
    Intermetallics 11, 23-32 (2003)

p3
    A third order polynomial fit

 Use::

    eos = EquationOfState(volumes, energies, eos='sjeos')
    v0, e0, B = eos.fit()
    eos.plot()
siman.analysis.form_en(sources, products, norm_el=None)[source]

Calculate formation energy of reaction.

sources, products - list of tuples (x, cl), where x is multiplier and cl is calculation norm_el - which element to use for normalization

‘all’ - normalize by total number of atoms ‘el’ - normalize by this element int - divide by this number
siman.analysis.gb_en_ideal(cl_gb, cl_bulk, n_gbs=2)[source]

Calculate grain boundary energy of a pure material GB is assumed to be normal to R3! The stoichiometry should be the same!

INPUT:

  • cl_gb (Calculation class object) - slab or cell with grain boundary
  • cl_bulk (Calculation class object) - bulk cell
  • n_gbs (int) - number of grain boundaries in the system (Default - 2)
RETURN:
e_gb (float) - grain boundary energy in J/m2

AUTHOR: Boev A.

siman.analysis.interface_en(cl, cl1, cl2, mul1=1, mul2=1, silent=0, n_intefaces=1)[source]

Calculate surface energy cl - slab or cell with interface cl1 - slab or cell with phase 1, usually substrate cl2 - slab or cell with phase 2, usually film mul1, mul2, - multiply cells

n_intefaces - number of similar interfaces in the system

Interface is assumed to be normal to R3!

siman.analysis.matrix_diff(cl1, cl2, energy_ref=0)[source]
siman.analysis.neb_analysis(cl, show, up=None, push2archive=None, old_behaviour=None, results_dic=None, fitplot_args=None, style_dic=None, params=None)[source]

Analyse traectories and polarons

params
mep_shift_vector
siman.analysis.polaron_analysis(cl, readfiles)[source]

Plot MEP for polaron migration

siman.analysis.set_oxidation_states_guess(st)[source]
siman.analysis.suf_en(cl1, cl2, silent=0, chem_pot=None, return_diff_energy=False, ev_a=0, normal=2, normalize_by=None)[source]

Calculate surface energy cl1 - supercell with surface cl2 - comensurate bulk supercell the area is determined from r[0] and r[1];- i.e they lie in surface chem_pot (dic) - dictionary of chemical potentials for nonstoichiometric slabs

normal - normal to the surface 0 - along a, 1 - along b, 2 - along c normalize_by - name of element to normalize number of atoms in bulk and slab, if None, transition elements are used

return_diff_energy (bool) - in addtion to gamma return difference of energies

siman.analysis.suf_en_polar_layered(formula, cl_surf, dmu_a=0, dmu_b=0, dmu_c=0, printlog=True)[source]
siman.analysis.voltage_profile(objs, xs=None, invert=1, xlabel='x in K$_{1-x}$TiPO$_4$F', ylabel='Voltage, V', ax=None, first=1, last=1, fmt='k-', label=None, color=None, filename='voltage_curve', xlim=None, ylim=None, last_point=1, exclude=None, formula=None, fit_power=4)[source]

objs - dict of objects with concentration of alkali (invert = 1) or vacancies (invert = 0) as a key xs - choose specific concentrations invert - 0 or 1 for concentration axis, see above ax - matplotlib object, if more profiles on one plot are needed

exclude - list of objects to skip

formula - chemical formula used to calculate capacity in mAh/g

fit_power - power of fit polynomial

siman.analysis.wulff(st, miller_list=None, e_surf_list=None, show=0)[source]

siman.bands module

siman.bands.plot_bands(vasprun_dos, vasprun_bands, kpoints, element, ylim=(None, None), folder='', renew_folder=True, vb_top=0, cb_bottom=1, vbm_pos=0, cbm_pos=0)[source]

This function is used to build plot of the electronic band structure along with the density of states (DOS) plot. It has feature to provide contributions from different elements to both band structure and DOS. In addition, the band gap (in eV) is automatically calculated.

INPUT:
  • vasprun_dos (str) - path to the vasprun file of the DOS calculation
  • vasprun_band (str) - path to the vasprun file of the band structure calculation
  • kpoints (str) - path to the KPOINTS file of the band structure calculation
  • element (str) - label of the chemical element, for which the contribution
    to the band structure and DOS
  • ylim (tuple of floats) - energy range of the band structure and DOS plots, units are eV
  • folder (str) - directory where all the results will be built
  • renew_folder (bool) - if True then the folder will be renewed with removing old one
  • vb_top (int) - number of the last occupied band (valence band) (count starts from ‘1’)
  • vbm_pos (int) - supposed number of the k-point in the IBZKPT file, at which the valence band maximum (VBM) is located (count starts from ‘0’)
  • cb_bottom (int) - number of the first unoccupied band (conduction band) (count starts from ‘1’)
  • cbm_pos (int) - supposed number of the k-point in the IBZKPT file, at which the conduction band minimum (CBM) is located (count starts from ‘0’)
RETURN:
None
SOURCE:
Credit https://github.com/gVallverdu/bandstructureplots
TODO:
Some improvements
siman.bands.plot_bands_old(vasprun_dos, vasprun_bands, kpoints, element, ylim=(None, None))[source]

This function is used to build plot of the electronic band structure along with the density of states (DOS) plot. It has feature to provide contributions from different elements to both band structure and DOS

INPUT:
  • vasprun_dos (str) - path to the vasprun file of the DOS calculation
  • vasprun_band (str) - path to the vasprun file of the band structure calculation
  • kpoints (str) - path to the KPOINTS file of the band structure calculation
  • element (str) - label of the chemical element, for which the contribution
    to the band structure and DOS
  • ylim (tuple of floats) - energy range of the band structure and DOS plots, units are eV
RETURN:
None
SOURCE:
Credit https://github.com/gVallverdu/bandstructureplots
TODO:
Some improvements
siman.bands.read_kpoint_labels(filename)[source]

Read commented kpoint labels from VASP KPOINTS file

INPUT:
  • filename (str) - path to the KPOINTS file
RETURN:
None
SOURCE:
None
TODO:
Some improvements
siman.bands.rgbline(ax, k, e, red, green, blue, alpha=0.2)[source]

This function is used to provide colour for the line of the band structure plot depending on the contribution of different orbitals of the specific element. It is used in the ‘plot_bands’ function.

INPUT:
  • ax (matplotlib plot object) - object of the band structure plot
  • k (list of ints) - list of numbers of k-points in the reciprocal space
  • e (list of floats) - list of energies corresponding to the k-points from the parameter ‘k’
  • red (<class ‘numpy.ndarray’>) - contribution from s orbitals
  • green (<class ‘numpy.ndarray’>) - contribution from p orbitals
  • blue (<class ‘numpy.ndarray’>) - contribution from d orbitals
  • alpha (float) -
RETURN:
None
SOURCE:
http://nbviewer.ipython.org/urls/raw.github.com/dpsanders/matplotlib-examples/master/colorline.ipynb
TODO:
Some improvements

siman.calc_manage module

siman.calc_manage.add(it, setlist, verlist, calc=None, varset=None, up='up2', inherit_option=None, id_from=None, inherit_args=None, confdic=None, i_atom_to_remove=None, coord='direct', savefile='oc', show='', comment='', input_geo_format=None, input_kpoints=None, ifolder=None, input_geo_file=None, input_st=None, corenum=None, calc_method=None, u_ramping_region=None, it_folder=None, mat_proj_cell='', mat_proj_id=None, cee_args=None, ise_new=None, it_suffix=None, scale_region=None, n_scale_images=7, n_neb_images=None, occ_atom_coressp=None, ortho=None, mul_matrix=None, ngkpt=None, cluster=None, cluster_home=None, override=None, ssh_object=None, run=False, check_job=1, params=None, mpi=False, copy_to_server=True)

Main subroutine for creation of calculations, saving them to database and sending to server.

Input:

  • it - arbitary name for your crystal structure

  • setlist (list of str or str) - names of sets with vasp parameters from varset dictionary

  • verlist - list of versions of new calculations

  • calc, varset - database dictionaries; could be provided; if not then are taken from header

  • input_geo_format - format of files in input geo folder

    ‘abinit’ - the version is determined from the value inside the file ‘vasp’, ‘cif’ - the version is determined from the name of file; the names should be like POSCAR-1 for vasp files and 1.name.cif for cif ‘mat_proj’ - take structure from materialsproject.org; use it_folder, len(verlist) = 1

  • up - string, possible values are: ‘up1’, ‘up2’, ‘no_base’; if empty then test run is performed without saving and sending

    ‘up1’ - needed for normal creation of calculation and copy to server all files ‘no_base’: only relevant for typconv is the same as “up1”, but the base set is ommited ‘up2’ - update only unfinished calculations ‘up3’ - run only if id does not exist

  • coord - type of cooridnates written in POSCAR:

    ‘direct’ ‘cart’

  • savefile - controls which files are saved during VASP run on server; check

    ‘ocvdawx’ ‘o’ - OUTCAR ‘i’ - INCAR ‘v’ - CHG ‘c’ - CHGCAR ‘p’ - PARCHG ‘l’ - LOCPOT ‘d’ - DOSCAR ‘a’ - AECCAR0, AECCAR2 ‘x’ - vasprun.xml ‘t’ - XDATCAR ‘z’ - OSZICAR ‘w’ - WAVECAR

  • ifolder - explicit path to folder where to search for input geo file.

  • input_geo_file - explicit file name of input file

  • input_st - see in add_calculation()

  • it_folder - section folder (sfolder) used in struct_des; here needed with input_geo_format = mat_proj

  • show - only for read_results() ?.

  • comment - arbitrary comment for history.

#inherit flags: inherit_args (dict) - to pass parameters to inherit_icalc; confdic (dicts) - additional configuration parameters to inherit_icalc in dict, used for antisites - inherit_option (str):

  • ‘continue’ - copy last contcar to poscar, outcar to prev.outcar and run again; on the next launch prev.outcar
    will be rewritten, please improve the code to save all previous outcars
  • ‘inherit_xred’ - if verlist is provided, xred are copied from previous version to the next
  • all options available for inherit_icalc() subroutine (now only ‘full’ is tested)
  • id_from - see inherit_icalc()

  • ise_new (str) - name of new set for inherited calculation (‘uniform_scale’)

  • it_suffix (str) - additional suffix to modify the it part of name

  • occ_atom_coressp (dict) see inherit_icalc()

  • ortho, mul_matrix - transfered to inherit_icalc

  • ngkpt (list) - the list of k-points provided explicitly added to struct_des

  • corenum - number of cores used for calculation; overwrites header.corenum

  • calc_method - provides additional functionality:

    • ‘u_ramping’ - realizes U ramping approach #Phys Rev B 82, 195128
    • ‘afm_ordering’ -
    • ‘uniform_scale’ - creates uniformly scaled copies of the provided calculations
    • ‘c_scale’ - scale across c axis
    • ‘scale’ - arbitrary scale according to mul_matrix

    using scale_region and n_scale_images (see scale_cell_uniformly()) The copies are available as versions from 1 to n_scale_images and suffix .su, .sc, or .sm appended to it name Copies to cluster fit utility that finds volume corresp. to energy minimum, creates 100.POSCAR and continues run - ‘monte’ - Monte-Carlo functionality

    • ‘polaron’ - polaron hopping, only input_st is supported
      • put here all parameters
    • ‘atat’ - create all input for ATAT
      params[‘atat’]
      • ‘active_atoms’ - now dictionary of elements, which can be substituted by what e.g. {‘Li’:’Vac’}

      please improve that Li0 can be used, to consider only symmetrically non-equivalent position for this element - ‘exclude_atoms_n’ - exclude specific atoms from cluster expansion - ‘subatom’ - a string for choosing different POTCAR, e.g. ‘s/K/K_pv/g’

  • u_ramping_region - used with ‘u_ramping’=tuple(u_start, u_end, u_step)

  • cluster_home - override value of header.CLUSTERS

cee_args - arguments for taking files from cee database; see get_structure_from_cee_database

  • cee_file (str) - name of file to be taken from cee database
  • section (str) - CEStorage, Catalysts, ets
  • run (bool) - complete the run file copy to server and run

  • params (dic) - dictionary of additional parameters, please move here numerous arguments

    • ‘occmatrix’ - explicit path to occmatrix file

    • ‘update_set_dic’ (dict) - additional parameters to override the existing set

    • ‘monte’ - dictionary with parameters for Monte-Carlo regime

      • ‘xvoid’ - xcart coordinates of voids
      • ‘thickness’ - thickness of slice where Monte-Carlo changes are allowed (from top surface)
      • ‘mcsteps’ - number of Monte-Carlo steps
      • ‘temp’ - temperature (K) for Metropolis Algorithm
      • ‘normal’ - vector normal to surface; check if works correctly
    • ‘charge’ - charge of the system, +1 - electrons are removed, -1 - electrons are added

    • ‘polaron’
      • ‘polaron_status’ (str) ‘new’ (default) or ‘existing’
    • ‘res_params’ - dictionary with parameters transfered to res_loop()

    • ‘nodes’ - number of nodes for sqedule system, currently works only for PBS

    • ‘init_neb_geo_fld’ - path to folder with geo files for NEB in VASP format

Comments:

!Check To create folders and add calculations add_flag should have value ‘add’

TODO: Now number of images is taken from self.set.vasp_params[‘IMAGES’]; In the case of generalization to other codes, set.nimages should be added and used

Make class for cluster to save all information about cluster in one object, like schedule_system, cluster address, corenum and so on

read structure in add_loop, to add calculation provied only structure, mat_proj_st_id pass in structure

  • occmatrix in params better to rename to occfile or something like this,
  • first run function which read input structure in multiple ways and return structure object. All subsequent code works with object.

no duplication of different input is realized in different places

siman.calc_manage.add_calculation(structure_name, inputset, version, first_version, last_version, input_folder, blockdir, calc, varset, up='no', inherit_option=None, prevcalcver=None, coord='direct', savefile=None, input_geo_format='abinit', input_geo_file=None, input_kpoints=None, calc_method=None, u_ramping_region=None, mat_proj_st_id=None, output_files_names=None, run=None, input_st=None, check_job=1, params=None, mpi=False, corenum=None)[source]

schedule_system - type of job scheduling system:’PBS’, ‘SGE’, ‘SLURM’, ‘none’

prevcalcver - version of previous calculation in verlist

output_files_names - the list is updated on every call

if inherit_option == ‘continue’ the previous completed calculation is saved in cl.prev list

input_st (Structure) - Structure object can be provided instead of input_folder and input_geo_file, has highest priority

TODO: make init of seqset inside calculate_nbands(), actualize_set, check_kpoints

siman.calc_manage.add_des(struct_des, it, it_folder, des='Lazy author has not provided description for me :( ', override=False)[source]

Add description to the struct_des dictionary;

INPUT:

  • struct_des (dict) - dict from project database
  • it (str) - name of calculation
  • it_folder (str) - path and name of folder used for calculation in current project both on local and remote machines
  • des (str) - description of calculation
  • override (bool) - allows to override existing field

RETURN:

None
siman.calc_manage.add_loop(it, setlist, verlist, calc=None, varset=None, up='up2', inherit_option=None, id_from=None, inherit_args=None, confdic=None, i_atom_to_remove=None, coord='direct', savefile='oc', show='', comment='', input_geo_format=None, input_kpoints=None, ifolder=None, input_geo_file=None, input_st=None, corenum=None, calc_method=None, u_ramping_region=None, it_folder=None, mat_proj_cell='', mat_proj_id=None, cee_args=None, ise_new=None, it_suffix=None, scale_region=None, n_scale_images=7, n_neb_images=None, occ_atom_coressp=None, ortho=None, mul_matrix=None, ngkpt=None, cluster=None, cluster_home=None, override=None, ssh_object=None, run=False, check_job=1, params=None, mpi=False, copy_to_server=True)[source]

Main subroutine for creation of calculations, saving them to database and sending to server.

Input:

  • it - arbitary name for your crystal structure

  • setlist (list of str or str) - names of sets with vasp parameters from varset dictionary

  • verlist - list of versions of new calculations

  • calc, varset - database dictionaries; could be provided; if not then are taken from header

  • input_geo_format - format of files in input geo folder

    ‘abinit’ - the version is determined from the value inside the file ‘vasp’, ‘cif’ - the version is determined from the name of file; the names should be like POSCAR-1 for vasp files and 1.name.cif for cif ‘mat_proj’ - take structure from materialsproject.org; use it_folder, len(verlist) = 1

  • up - string, possible values are: ‘up1’, ‘up2’, ‘no_base’; if empty then test run is performed without saving and sending

    ‘up1’ - needed for normal creation of calculation and copy to server all files ‘no_base’: only relevant for typconv is the same as “up1”, but the base set is ommited ‘up2’ - update only unfinished calculations ‘up3’ - run only if id does not exist

  • coord - type of cooridnates written in POSCAR:

    ‘direct’ ‘cart’

  • savefile - controls which files are saved during VASP run on server; check

    ‘ocvdawx’ ‘o’ - OUTCAR ‘i’ - INCAR ‘v’ - CHG ‘c’ - CHGCAR ‘p’ - PARCHG ‘l’ - LOCPOT ‘d’ - DOSCAR ‘a’ - AECCAR0, AECCAR2 ‘x’ - vasprun.xml ‘t’ - XDATCAR ‘z’ - OSZICAR ‘w’ - WAVECAR

  • ifolder - explicit path to folder where to search for input geo file.

  • input_geo_file - explicit file name of input file

  • input_st - see in add_calculation()

  • it_folder - section folder (sfolder) used in struct_des; here needed with input_geo_format = mat_proj

  • show - only for read_results() ?.

  • comment - arbitrary comment for history.

#inherit flags: inherit_args (dict) - to pass parameters to inherit_icalc; confdic (dicts) - additional configuration parameters to inherit_icalc in dict, used for antisites - inherit_option (str):

  • ‘continue’ - copy last contcar to poscar, outcar to prev.outcar and run again; on the next launch prev.outcar
    will be rewritten, please improve the code to save all previous outcars
  • ‘inherit_xred’ - if verlist is provided, xred are copied from previous version to the next
  • all options available for inherit_icalc() subroutine (now only ‘full’ is tested)
  • id_from - see inherit_icalc()

  • ise_new (str) - name of new set for inherited calculation (‘uniform_scale’)

  • it_suffix (str) - additional suffix to modify the it part of name

  • occ_atom_coressp (dict) see inherit_icalc()

  • ortho, mul_matrix - transfered to inherit_icalc

  • ngkpt (list) - the list of k-points provided explicitly added to struct_des

  • corenum - number of cores used for calculation; overwrites header.corenum

  • calc_method - provides additional functionality:

    • ‘u_ramping’ - realizes U ramping approach #Phys Rev B 82, 195128
    • ‘afm_ordering’ -
    • ‘uniform_scale’ - creates uniformly scaled copies of the provided calculations
    • ‘c_scale’ - scale across c axis
    • ‘scale’ - arbitrary scale according to mul_matrix

    using scale_region and n_scale_images (see scale_cell_uniformly()) The copies are available as versions from 1 to n_scale_images and suffix .su, .sc, or .sm appended to it name Copies to cluster fit utility that finds volume corresp. to energy minimum, creates 100.POSCAR and continues run - ‘monte’ - Monte-Carlo functionality

    • ‘polaron’ - polaron hopping, only input_st is supported
      • put here all parameters
    • ‘atat’ - create all input for ATAT
      params[‘atat’]
      • ‘active_atoms’ - now dictionary of elements, which can be substituted by what e.g. {‘Li’:’Vac’}

      please improve that Li0 can be used, to consider only symmetrically non-equivalent position for this element - ‘exclude_atoms_n’ - exclude specific atoms from cluster expansion - ‘subatom’ - a string for choosing different POTCAR, e.g. ‘s/K/K_pv/g’

  • u_ramping_region - used with ‘u_ramping’=tuple(u_start, u_end, u_step)

  • cluster_home - override value of header.CLUSTERS

cee_args - arguments for taking files from cee database; see get_structure_from_cee_database

  • cee_file (str) - name of file to be taken from cee database
  • section (str) - CEStorage, Catalysts, ets
  • run (bool) - complete the run file copy to server and run

  • params (dic) - dictionary of additional parameters, please move here numerous arguments

    • ‘occmatrix’ - explicit path to occmatrix file

    • ‘update_set_dic’ (dict) - additional parameters to override the existing set

    • ‘monte’ - dictionary with parameters for Monte-Carlo regime

      • ‘xvoid’ - xcart coordinates of voids
      • ‘thickness’ - thickness of slice where Monte-Carlo changes are allowed (from top surface)
      • ‘mcsteps’ - number of Monte-Carlo steps
      • ‘temp’ - temperature (K) for Metropolis Algorithm
      • ‘normal’ - vector normal to surface; check if works correctly
    • ‘charge’ - charge of the system, +1 - electrons are removed, -1 - electrons are added

    • ‘polaron’
      • ‘polaron_status’ (str) ‘new’ (default) or ‘existing’
    • ‘res_params’ - dictionary with parameters transfered to res_loop()

    • ‘nodes’ - number of nodes for sqedule system, currently works only for PBS

    • ‘init_neb_geo_fld’ - path to folder with geo files for NEB in VASP format

Comments:

!Check To create folders and add calculations add_flag should have value ‘add’

TODO: Now number of images is taken from self.set.vasp_params[‘IMAGES’]; In the case of generalization to other codes, set.nimages should be added and used

Make class for cluster to save all information about cluster in one object, like schedule_system, cluster address, corenum and so on

read structure in add_loop, to add calculation provied only structure, mat_proj_st_id pass in structure

  • occmatrix in params better to rename to occfile or something like this,
  • first run function which read input structure in multiple ways and return structure object. All subsequent code works with object.

no duplication of different input is realized in different places

siman.calc_manage.choose_cluster(cluster_name, cluster_home, corenum, nodes)[source]

cluster_name should be in header.project_conf.CLUSTERS dict nodes - number of nodes

siman.calc_manage.clean_history_file(history_list)[source]
siman.calc_manage.create_additional(struct_des)[source]

Automatically make objects in struct_des with .f and .fvac index

siman.calc_manage.create_phonopy_conf_file(st, path='', mp=[10, 10, 10], dim=[1, 1, 1], filetype='mesh')[source]

filetype mesh - mesh.conf band - band.conf

siman.calc_manage.for_phonopy(new_id, from_id=None, calctype='read', mp=[10, 10, 10], additional=None)[source]
siman.calc_manage.get_structure_from_cee_database(it, it_folder, ver, section='CEStorage', cee_struct_type='exp', cee_file=None)[source]
cee_struct_type (str) -
‘exp’ - experimental structures ‘’ - all
siman.calc_manage.get_structure_from_matproj(it=None, it_folder=None, ver=None, mat_proj_cell='', mat_proj_id=None)[source]

Take structures from Mat. projects

Find material with ‘it’ stoichiometry (lowest energy) from materialsproject.org, download and create field in struct_des and input POSCAR file INPUT:

  • struct_des-
  • it - materials name, such as ‘LiCoO2’, …. By default the structure with minimum e_above_hull is taken
  • it_folder - section folder in which the Poscar will be placed
  • ver - version of structure defined by user
  • mat_proj_id (str) - the id can be provided explicitly
  • mat_proj_cell (str)-
    • ‘conv’ - conventional

RETURN:

  • ?
  • ?
siman.calc_manage.inherit_icalc(inherit_type, it_new, ver_new, id_base, calc=None, st_base=None, id_from=None, confdic=None, atom_new=None, atom_to_replace=None, id_base_st_type='end', atoms_to_remove=None, del_pos=None, i_atom_to_remove=None, id_from_st_type='end', atom_to_shift=None, shift_vector=None, mult_a=None, mult_b=None, mult_c=None, mult_rprimd=None, it_folder=None, occ_atom_coressp=None, ortho=None, mul_matrix=None, geo_folder='', override=None, use_init=None)[source]

Function for creating new geo files in geo folder based on different types of inheritance Input args:

it_new, ver_new - name of new structure, id_base - new structure will be based on the final structure of this calculation; (can be either Calculation() object or path to geo file) id_from - can be additionally used to adopt for example rprimd from id_from to it_new; (can be either Calculation() object or path to geo file)

st_base - if not None then used instead of id_base; not implemented yet confdic (dict) - to pass more parameters

inherit_type = ‘’:

full - full inheritance of final state full_chg - full + chg file, works only if chg file is on the same cluster ‘full_nomag’ - full except magmom which are set to None r2r3 - use r2 and r3 from id_from r1r2r3 - use r1, r2 and r3 from id_from remove_atoms - removes atoms specified with atoms_to_remove (list of element names or list of atom numbers)

del_pos (int) - choose specific position if several positions exist for the same ion

replace_atoms - atoms of type ‘atom_to_replace’ in ‘id_base’ will be replaced by ‘atom_new’ type. make_vacancy - produce vacancy by removing ‘i_atom_to_remove’ starting from 0 occ - take occ from id_from and create file OCCMATRIX for

OMC [https://github.com/WatsonGroupTCD/Occupation-matrix-control-in-VASP] - occ_atom_coressp (dict) {iatom_calc_from:iatom_calc_base, … } (atomno starting from 0!!!)

supercell - create orthogonal supercel using ortho list [a,b,c] or mul_matrix (3x3) ( higher priority) antisite - create anitsite defect:

curent implimintation takes the first alkali cation and the closest to it transition metal and swap them

confdic

  • st_from
  • cation
  • trans
  • mode

id_base_st_type - use init or end structure of id_base calculation. id_from_st_type - init or end for id_from

atom_to_shift - number of atom to be shifted; starting from 1. shift_vector - vector in decart cooridinates (Angstrom!!) by which the atom will be shifted

  • it_folder - section folder
  • use_init (bool) use init structure if end is empty

Result:

new geo file in the input geo folder

Output:

no

Depends from:

header.struct_des header.calc

Comments:

changes len_units of new to Angstrom!!! !nznucl is not calculated, since only geo is created here! make use of new methods for atom manipulation add to des which type of st is used: ‘end’, ‘init’
siman.calc_manage.inherit_ngkpt(it_to, it_from, inputset)[source]

inherit ngkpt from it_from to it_to

siman.calc_manage.manually_remove_from_struct_des(struct_des, key)[source]
siman.calc_manage.name_mod_supercell(ortho=None, mul_matrix=None)[source]
siman.calc_manage.read_phonopy_dat_file(filename)[source]

read .dat file from phonopy for reading yaml see self.read_phonopy_data() should be probably combined

freq - frequency in THz tot - total energy for freq

siman.calc_manage.read_phonopy_data(filename, key='free_energy', convert=False)[source]

convert (bool) - convert kJ/mol to eV

siman.calc_manage.res(it, setlist, verlist, calc=None, varset=None, analys_type='no', b_id=None, typconv='', up='', imp1=None, imp2=None, matr=None, voronoi=False, r_id=None, readfiles=True, plot=True, show='fomag', comment=None, input_geo_format=None, savefile=None, energy_ref=0, ifolder=None, bulk_mul=1, inherit_option=None, calc_method=None, u_ramping_region=None, input_geo_file=None, corenum=None, run=None, input_st=None, ortho=None, mat_proj_cell=None, ngkpt=None, it_suffix=None, it_folder=None, choose_outcar=None, choose_image=None, cee_args=None, mat_proj_id=None, ise_new=None, push2archive=False, description_for_archive=None, old_behaviour=False, alkali_ion_number=None, cluster=None, ret=None, override=None, check_job=1, fitplot_args=None, style_dic=None, params=None)

Read results INPUT:

‘analys_type’ - (‘gbe’ - calculate gb energy and volume and plot it. b_id should be appropriete cell with

bulk material, ‘e_imp’ (‘e_imp_kp’, ‘e_imp_ecut’) - calculate impurity energy - just difference between cells with impurity and without. ‘fit_ac’ - fit a and c lattice constants using 2-dimensianal spline ‘clusters’ - allows to calculate formation energies of clusters ‘diff’ - difference of energies in meV, and volumes A^3; E(id) - E(b_id) ‘matrix_diff’ - difference normalized by matrix atoms

‘redox_pot’ - calculate redox potential relative to b_id() (deintercalated cathode) and energy_ref ( energy per one ion atom Li, Na in metallic state or in graphite) ‘neb’ - make neb path. The start and final configurations should be versions 1 and 2, the intermidiate images are starting from 3 to 3+nimages

‘xcarts’ )

voronoi - True of False - allows to calculate voronoi volume of impurities and provide them in output. only if lammps is installed b_id - key of base calculation (for example bulk cell), used in several regimes; r_id - key of reference calculation; defines additional calculation (for example atom in vacuum or graphite to calculate formation energies); can contain directly the energy per one atom

up -

if equal to ‘up2’ the files are redownloaded; also can be used to download additional files can be ‘xo’ (deprecated?) - if ‘un’ is found in up then siman will try to read unfinished outcars

readfiles (bool) - True - read from outcar, False - read from database;

The next three used for ‘clusters’ regime: imp1 - key of bulk cell with one imp1 imp2 - key of bulk cell with one imp2 matr - key of bulk cell with pure matrix.

  • show - (str), allows to show additional information:

    • mag - magnetic moments on magnetic atoms maga

      alkali_ion_number (int) - number of atom around which to sort mag moments from 1

    • en - convergence of total energy vs max force

    • mep - neb path

    • fo - max force on each md step

    • polaron - determine polaron positon, write local surroundin

    • mig_path - write migration path xyz

    • pickle - download all pickle and convert to CONTCAR (for Monte-Carlo regime)

    • out - open OUTCAR, sublime text should be installed, not tested on windows

    • op - open containing folder

    • qlog - log

    • term - terminal at folder

    • freq - frequencies

    • conv - convergence

    • sur - surround atoms

    • efav - energy average force

    • est - energy per step

    • time - time per electronic iteration is seconds

    • fit - save figure and show volume scan and fit in case of analys_type = ‘fit_a’

    • fitns - save figure of volume scan and fit in case of analys_type = ‘fit_a’

energy_ref - energy in eV; substracted from energy diffs

bulk_mul - allows to scale energy and volume of bulk cell during calculation of segregation energies

choose_outcar (int, starting from 1)- if calculation have associated outcars, you can check them as well, by default the last one is used during creation of calculation in write_batch_body()

choose_image (int) - relative to NEB, allows to choose specific image for analysis, by default the middle image is used

  • push2archive (bool) - if True produced images are copied to header.project_conf.path_to_images
  • description_for_archive - caption for images

ret (str) - return some more information in results_dic

‘energies’ - just list of full energies

check_job - (bool) check status on server, use 0 if no internet connection

fitplot_args - additional arguments for fit_and_plot function

style_dic - passed to plot_mep()

  • ise_new - dummy

  • inherit_option - dummy

  • savefile - dummy

  • cluster - used to override cluster name

  • override - dummy

  • params - dictionary of additional parameters to control internal, many arguments could me moved here

    ‘mep_shift_vector’ - visualization of mep in xyz format ‘charge’ (int) - charge of cell, +1 removes one electron

RETURN:

(results_dic, result_list) or (result_string, result_list)

result_list - list of results; was used in previous versions, now left for compatibility results_dic - should be used in current version! actually once was used as list, now should be used as dict

TODO:

Make possible update of b_id and r_id with up = ‘up2’ flag; now only id works correctly
siman.calc_manage.res_loop(it, setlist, verlist, calc=None, varset=None, analys_type='no', b_id=None, typconv='', up='', imp1=None, imp2=None, matr=None, voronoi=False, r_id=None, readfiles=True, plot=True, show='fomag', comment=None, input_geo_format=None, savefile=None, energy_ref=0, ifolder=None, bulk_mul=1, inherit_option=None, calc_method=None, u_ramping_region=None, input_geo_file=None, corenum=None, run=None, input_st=None, ortho=None, mat_proj_cell=None, ngkpt=None, it_suffix=None, it_folder=None, choose_outcar=None, choose_image=None, cee_args=None, mat_proj_id=None, ise_new=None, push2archive=False, description_for_archive=None, old_behaviour=False, alkali_ion_number=None, cluster=None, ret=None, override=None, check_job=1, fitplot_args=None, style_dic=None, params=None)[source]

Read results INPUT:

‘analys_type’ - (‘gbe’ - calculate gb energy and volume and plot it. b_id should be appropriete cell with

bulk material, ‘e_imp’ (‘e_imp_kp’, ‘e_imp_ecut’) - calculate impurity energy - just difference between cells with impurity and without. ‘fit_ac’ - fit a and c lattice constants using 2-dimensianal spline ‘clusters’ - allows to calculate formation energies of clusters ‘diff’ - difference of energies in meV, and volumes A^3; E(id) - E(b_id) ‘matrix_diff’ - difference normalized by matrix atoms

‘redox_pot’ - calculate redox potential relative to b_id() (deintercalated cathode) and energy_ref ( energy per one ion atom Li, Na in metallic state or in graphite) ‘neb’ - make neb path. The start and final configurations should be versions 1 and 2, the intermidiate images are starting from 3 to 3+nimages

‘xcarts’ )

voronoi - True of False - allows to calculate voronoi volume of impurities and provide them in output. only if lammps is installed b_id - key of base calculation (for example bulk cell), used in several regimes; r_id - key of reference calculation; defines additional calculation (for example atom in vacuum or graphite to calculate formation energies); can contain directly the energy per one atom

up -

if equal to ‘up2’ the files are redownloaded; also can be used to download additional files can be ‘xo’ (deprecated?) - if ‘un’ is found in up then siman will try to read unfinished outcars

readfiles (bool) - True - read from outcar, False - read from database;

The next three used for ‘clusters’ regime: imp1 - key of bulk cell with one imp1 imp2 - key of bulk cell with one imp2 matr - key of bulk cell with pure matrix.

  • show - (str), allows to show additional information:

    • mag - magnetic moments on magnetic atoms maga

      alkali_ion_number (int) - number of atom around which to sort mag moments from 1

    • en - convergence of total energy vs max force

    • mep - neb path

    • fo - max force on each md step

    • polaron - determine polaron positon, write local surroundin

    • mig_path - write migration path xyz

    • pickle - download all pickle and convert to CONTCAR (for Monte-Carlo regime)

    • out - open OUTCAR, sublime text should be installed, not tested on windows

    • op - open containing folder

    • qlog - log

    • term - terminal at folder

    • freq - frequencies

    • conv - convergence

    • sur - surround atoms

    • efav - energy average force

    • est - energy per step

    • time - time per electronic iteration is seconds

    • fit - save figure and show volume scan and fit in case of analys_type = ‘fit_a’

    • fitns - save figure of volume scan and fit in case of analys_type = ‘fit_a’

energy_ref - energy in eV; substracted from energy diffs

bulk_mul - allows to scale energy and volume of bulk cell during calculation of segregation energies

choose_outcar (int, starting from 1)- if calculation have associated outcars, you can check them as well, by default the last one is used during creation of calculation in write_batch_body()

choose_image (int) - relative to NEB, allows to choose specific image for analysis, by default the middle image is used

  • push2archive (bool) - if True produced images are copied to header.project_conf.path_to_images
  • description_for_archive - caption for images

ret (str) - return some more information in results_dic

‘energies’ - just list of full energies

check_job - (bool) check status on server, use 0 if no internet connection

fitplot_args - additional arguments for fit_and_plot function

style_dic - passed to plot_mep()

  • ise_new - dummy

  • inherit_option - dummy

  • savefile - dummy

  • cluster - used to override cluster name

  • override - dummy

  • params - dictionary of additional parameters to control internal, many arguments could me moved here

    ‘mep_shift_vector’ - visualization of mep in xyz format ‘charge’ (int) - charge of cell, +1 removes one electron

RETURN:

(results_dic, result_list) or (result_string, result_list)

result_list - list of results; was used in previous versions, now left for compatibility results_dic - should be used in current version! actually once was used as list, now should be used as dict

TODO:

Make possible update of b_id and r_id with up = ‘up2’ flag; now only id works correctly
siman.calc_manage.update_des(struct_des, des_list)[source]

Manuall adding of information to struct_des dictionary

INPUT:
  • struct_des (dict) - dict from project database
  • des_list (list of tuples) - list of new calculations to be added to database
RETURN:
  • struct_des (dict)

siman.classes module

class siman.classes.Description(sectionfolder='forgot_folder', description='forgot_description')[source]

Bases: object

Objects of this class include just folder and description of specific calculation. Mostly was needed for manual addition of new calculations self.ngkpt_dict_for_kspacings (dict of lists) - the key is kspacing; the dict contains k-meshes for all calculations based on this geometry structure. can be useful for fine tuning of k-mesh for specific kspacing.

class siman.classes.MP_Compound[source]

Bases: object

This class includes information about chemical compounds from MatProj and next operations (bulk calc, slab construction etc.) db key is ‘pretty_formula.MP’: (‘AgC.MP’)

add_relax(**argv)[source]
calc_bulk(ise, bulk_cl_name=['it', 'ise', '1'], it_folder='bulk/', status='add')[source]
calc_ec_es(ev=0)[source]
calc_suf(**argv)[source]
calc_suf_stoich(**argv)[source]
copy()[source]
e_cohesive_calc(e_box)[source]
e_cohesive_from_MP()[source]
get_st(folder='geo/')[source]

check downloaded POSCAR files in geo/ folder if not POSCAR of some structure - download it from Mat Proj mat_in_list - data dict for any structure from MP, result of get_fata(‘mp-…’)

move_suf_en(**argv)[source]
class siman.classes.cd(newPath)[source]

Bases: object

Context manager for changing the current working directory

class siman.classes.empty_struct[source]

Bases: object

siman.database module

siman.database.add_to_archive_database(cl, subgroup)[source]

cl is Calculation which should be added to database subgroup (str) - subgroup folder

siman.database.get_from_database(x1, x2, mat, inquiry_keys=None, silent=None, ssh_object=None)[source]

inquiry_keys (list) - list of keys that should exist in filenames both for x1 and x2 ssh_object (SSHTools) - ssh object based on paramiko with access details

siman.database.push_figure_to_archive(local_figure_path, caption, figlabel=None, autocompl=True)[source]
siman.database.read_cvs_database(columns)[source]

Allows to read cvs file with experimental results

siman.database.read_database(scratch=False, init_sets=0)[source]

Read database of calculations

INPUT:
scratch - not used init_sets - required to reinit defaults sets in init_default_sets function
RETURN:
calc - dict, contains all calculations of the project conv - dict, convergence sequences varset - dict, parameter sets of the project size_on_start, int - not used now
siman.database.write_database(calc=None, conv=None, varset=None, size_on_start=None)[source]

The function writes main dictionaries to database file calc.s Also creates copy of calc.s

INPUT:
calc - dict, contains all calculations of the project conv - dict, convergence sequences varset - dict, parameter sets of the project size_on_start - not used now
RETURN:
None

siman.default_project_conf module

Default control parameters for siman

siman.default_project_conf.CIF2CELL = True

List of manually added calculations:

siman.default_project_conf.MANUALLY_ADDED = [('Li111', 'Li', '2 Li')]

Naming conventions:

endings: ‘_ml’ - was used to show that this calculation uses manual equilibrium lattice determination and contains several versions of identical structures with different lattice constants. Now not in use, because I always use this method. Usually 16 versions for hcp;

‘_r’ - calculation with structure constructed for fitted lattice constants; Now was replaced with ‘.f’; Usually one version. ‘.ur’ - unrelaxed .r - relaxed atomic positions .o - optimised cell and volume and atomic positions automatically ‘.f’ - fitted ‘.fr’ - means that current calculation based on the structure for which lattice constants were fitted and positions of atoms were relaxed. However see description to know for wich set they were fitted and relaxed. Calculations with ‘.f’ and ‘.fr’ can have different versions which are correspondig to different sets.

.m - only matrix, all impurities were removed and matrix was freezed

letters in name, wich are usually between didgits and element’s names: b - stands for bulk, which denote ideal cells without boundaries. g - cells with grain boundary; v - means that impurity is in the volume of grain; far away from boundaries; i - means that impurity is close to interface plane (grain boundary)

Versions: 20 - usually means that lattice constatns was used from other calculation and this is very good assumtion.

siman.default_project_conf.show_head = None

List of constants determined during installation

siman.dos_functions module

siman.dos_functions.det_gravity(dos, Erange=(-100, 0), key=None)[source]

Determine center of gravity for DOS and return values of energy for d6 orbitals in list INPUT: dos - ase dos type with added d6 - sum of d orbitals over neighbors to impurity atoms Erange - window of energy to determine center of gravity

siman.dos_functions.det_gravity2(energy, dos, Erange=(-100, 0))[source]

Determine center of gravity for DOS and return values of energy for dos INPUT: energy - list of energies dos - list of corresponding dos Erange - window of energy to determine center of gravity

siman.dos_functions.plot_dos(cl1, cl2=None, dostype=None, iatom=None, iatom2=None, orbitals='s', up=None, neighbors=6, show=1, labels=None, path='dos', xlim=(None, None), ylim=(None, None), savefile=True, plot_param={}, suf2='', nsmooth=3, lts2='--', split_type='octa', plot_spin_pol=1, show_gravity=None, efermi_origin=True, efermi_shift=0, invert_spins=0, name_suffix='', image_name=None, color_dict=None)[source]

cl1 (CalculationVasp) - object created by add_loop() dostype (str) - control which dos to plot:

‘total’ - plot total dos ‘diff_total’ - difference of total dos, use cl2 for second calculation ‘partial’ - partial dos
orbitals (list of str) -
any from ‘s, p, d, py, pz, px, dxy, dyz, dz2, dxz, dx2’ where ‘p’ and ‘d’ are sums of projections also to sum around neigbours use p6 and d6 and neighbors parameter p_all - sum over all atoms, p states d_all - sum over all atoms, d states

up - ‘up2’ allows to download the file once again labels - two manual labels for cl1 and cl2 instead of auto

iatom (int) - number of atom starting from 1 to plot DOS; iatom ([float]*3) - cartesian coordinates of point around which atoms will be found show (bool) - whether to show the dos path (str) - path to folder with images

neighbors - number of neighbours around iatom to plot dos on them using p6 or d6; only p6 is implemented to the moment in plot section

xlim, ylim (tuple)- limits for plot

color_dict (dict) - custom dict of colors for orbitals. eg: {‘s’:’g’, ‘p’:}

plot_param - dict of parameters to fit_and_plot
dashes - control of dahsed lines

suf2 - additional suffix for label name_suffix - modify name

image_name - user image name

# nsmooth = 15 # smooth of dos lts2 - style of lines for cl2

split_type -
octa - the names are t2g and eg tetra - the names are t2 and e
plot_spin_pol -
0 - spin-polarized components are summed up
show_gravity (list) - print gravity centers (i, type, range, ); i - 1 or 2 cl
type (str)
‘p6’ - for p orbitals of neighbors ‘p’
efermi_origin
True - e-fermi is zero energy False - e-fermi is left, its value is shown

efermi_shift (float) - additional shift of fermi energy in case if smearing is too large

invert_spins
invert spin up and spin down, now only for partial d and p

#0 s 1 py 2 pz 3 px 4 dxy 5 dyz 6 dz2 7 dxz 8 dx2 #In all cases, the units of the l- and site projected DOS are states/atom/energy.

siman.fit_hex module

siman.fit_hex.fit_hex(shag_a, shag_c, npoint_a, npoint_c, it, ise, verlist, calc, gb_volume=False, type_plot='contourf')[source]

siman.functions module

siman.functions.calc_ac(a1, c1, a2, c2, a_b=0.1, c_b=0.1, type='two_atoms')[source]

Calculate values of hexagonal lattice parameters for cell with two different atoms. The used assumption is: 1. Provided lattice constants are for large enougth cells, in which excess volume (dV) of impurity does not depend on the size of cell. 2. Two atoms do not interact with each other, which allows to use dV(CO) = dV(C) + dV(O)

Two regimes: two_atoms - calculate cell sizes if additional atom was added double_cell - if cell was doubled; only first cell and second_cell are needed

Input: a1, c1 - lattice constants of cell with first impurity atom (first cell) a2, c2 - lattice constants of cell with second impurity atom (second cell) a_b, c_b - lattice constants of cell with pure hexagonal metall

Output: a, c - lattice constants of cell with two atoms

siman.functions.calculate_voronoi(self, state='end')[source]
siman.functions.check_output(filename, check_string, load)[source]

Check if file exist and it is finished by search for check_string

siman.functions.element_name_inv(el)[source]
siman.functions.file_exists_on_server(file, addr)[source]
siman.functions.gb_energy_volume(gb, bulk)[source]
siman.functions.get_from_server(files=None, to=None, to_file=None, addr=None, trygz=True)[source]

Download files using either paramiko (higher priority) or rsync; For paramiko header.ssh_object should be defined

files (list of str) - files on cluster to download to (str) - path to local folder ! to_file (str) - path to local file (if name should be changed); in this case len(files) should be 1

The gz file is also checked

RETURN
result of download

TODO: now for each file new connection is opened, copy them in one connection

siman.functions.headers()[source]
siman.functions.invert(el)
siman.functions.log_history(hstring)[source]
siman.functions.plot_charge_den()[source]

Test function; Was not used

siman.functions.plot_interaction(calclist, calc)[source]

For calculation of interaction parameter alpha; Take in mind that this parameter is obtained under aproximation of redular solution

siman.functions.push_to_server(files=None, to=None, addr=None)[source]

if header.ssh_object then use paramiko to (str) - path to remote folder !

siman.functions.read_charge_den_vasp()[source]

Read CHG vasp file and return ChargeDen object

siman.functions.read_list(token, number_of_elements, ttype, list_of_words)[source]

Input is token to find, number of elements to read, type of elements and list of words, where to search Returns the list of elements for the last match

siman.functions.read_string(token, length, string)[source]
siman.functions.read_vectors(token, number_of_vectors, list_of_words, type_func=None, lists=False)[source]

Returns the list of numpy vectors for the last match

siman.functions.return_atoms_to_cell(st)[source]
siman.functions.rotate()[source]
siman.functions.rotation_matrix(axis, theta)[source]
siman.functions.rotation_matrix_from_vectors(vec1, vec2)[source]

Find the rotation matrix that aligns vec1 to vec2 :param vec1: A 3d “source” vector :param vec2: A 3d “destination” vector :return mat: A transform matrix (3x3) which when applied to vec1, aligns it with vec2.

siman.functions.run_on_server(command, addr=None)[source]
siman.functions.salary_inflation()[source]

Calculate salary growth in Russia taking into account inflation

siman.functions.server_cp(copy_file, to, gz=True, scratch=False, new_filename=None)[source]
siman.functions.smoother(x, n, mul=1, align=1)[source]

mul - additionally multiplies values #align - find first non-zero point and return it to zero #n - smooth value,

if algo = ‘gaus’ than it is sigma use something like 0.8 if algo = ‘my’

n of 10-15 is good
siman.functions.unique_elements(seq, idfun=None)[source]
siman.functions.words(fileobj)[source]

Generator of words. However does not allow to use methods of list for returned

siman.functions.wrapper_cp_on_server(file, to, new_filename=None)[source]

tries iterativly scratch and gz

siman.geo module

siman.geo.best_miller(hkl)[source]
siman.geo.calc_k_point_mesh(rprimd, kspacing, silent=0)[source]

rprimd (list of lists 3x3 of floats) - vectors of cell (Angstroms) kspacing (float) - required spacing between k-points in reciprocal space (A-1); paramter KSPACING in VASP

the provided optimal k-mesh has the smallest sum of squared deviations of kspacings

returns k-point mesh (list of int)

siman.geo.calc_kspacings(ngkpt, rprimd)[source]

Calculate kspacing from ngkpt and rprimd (A) ngkpt (list of int) - k-point mesh

siman.geo.calc_recip_vectors(rprimd)[source]
siman.geo.calc_volume(v1, v2, v3)[source]
siman.geo.create_ads_molecule(st, molecule=['O'], mol_xc=[[0, 0, 0]], conf_i=[0], fix_layers=False, fix_xc_range=None, under_atom=0, find_args={'distance': 0.5, 'positions': ['ontop']})[source]

The function uses special module AdsorbateSiteFinder from pymatgen

https://static-content.springer.com/esm/art%3A10.1038%2Fs41524-017-0017-z/MediaObjects/41524_2017_17_MOESM1_ESM.pdf @article{montoya2017high,

title={A high-throughput framework for determining adsorption energies on solid surfaces}, author={Montoya, Joseph H and Persson, Kristin A}, journal={npj Computational Materials}, volume={3}, number={1}, pages={14}, year={2017}, publisher={Nature Publishing Group}

}

molecule - ‘H’, ‘CO’ … mol_xc - list with xcart of atoms in molecule: [[0,0,0]], [[0,0,0],[0,0,1.23]] return structure with adsorbed molecule on the surface conf_i - [0,1,2] - list of ads configuration numbers

key ‘all’ means all constructed configurations

under_atom return configuration with ads atom strongly under me and neme atoms in surface

siman.geo.create_antisite_defect(st, el1, el2, i_el2_list=None, tol=0.1, max_sep=4, iatom=None, return_with_table=False, disp_AS1=None, mag_AS1=None, disp_AS2=None, AP_on=False, i_AP=None, mag_AP=None, disp_AP=None, confs=None)

Looks for all unique antisite pairs for el1 and el2 takes into account formation of polaron and change of oxidation state

Antisite consisits of three parts:
AS1 - el2_el1 (e.g. Ni_Li) AS2 - el1_el2 (Li_Ni) AP - additional polaron. if AS1 changes its oxidation state (e.g. from +3 to +2 in oxide then additional polaron should compensate this by oxidizing from +3 to +4)
INPUT:

el1 - first element name from periodic table for exchange el2 - second element name from periodic table for exchange i_el2_list - use only this specific atom numbers searching AS (duplicates iatom)

tol - tolerance for determining unique antisite configurations (A) max_sep - maximum separation between antisite components (A) iatom (int) - create antistes using this atom number, from 0 return_with_table (bool) - in addition to structures return table with basic information

disp_AS1 - polaronic displacement around first component (-0.2 for hole, +0.2 for electron)
transition metal is assumed here

mag_AS1 - magnetic moment of TM in AS1

AP_on (bool) - turn on Additional polaron suggestion and creation i_AP - number of AP TM atom. Positions are suggested by code depending on their position relative to AS1 and AS2 mag_AP - magnetic moment of AP_nn atom disp_AP - polaronic displacement around AP

confs (list) - create only this configurations, others are skipped

RETURN:

sts (list) - list of structures if return_with_table:

table (list) - see code

Todo #check that distances through PBC could be two small

siman.geo.create_antisite_defect2(st_base, st_from, cation=None, trans=None, trans_pos=1, mode=None)[source]

exchange cation and transition metal st_base (Structure) - basic structure in which defects are created st_from (Structure) - structure from which the positions of cation are chosen; st_from should be consistent with st_base cation (str) - element, position of which is extracted from st_from and added to st_base

trans (str) - element name transition metal for exchange trans_pos (int) - number of non-equiv position of trans starting from 1

mode -
‘add_alk’ or ‘a1’ - add alkali cation ‘mov_trs’ or ‘a2’ - mov trans to alkali pos ‘add_swp’ or ‘a3’ - add alk and swap with trans
siman.geo.create_antisite_defect3(st, el1, el2, i_el2_list=None, tol=0.1, max_sep=4, iatom=None, return_with_table=False, disp_AS1=None, mag_AS1=None, disp_AS2=None, AP_on=False, i_AP=None, mag_AP=None, disp_AP=None, confs=None)[source]

Looks for all unique antisite pairs for el1 and el2 takes into account formation of polaron and change of oxidation state

Antisite consisits of three parts:
AS1 - el2_el1 (e.g. Ni_Li) AS2 - el1_el2 (Li_Ni) AP - additional polaron. if AS1 changes its oxidation state (e.g. from +3 to +2 in oxide then additional polaron should compensate this by oxidizing from +3 to +4)
INPUT:

el1 - first element name from periodic table for exchange el2 - second element name from periodic table for exchange i_el2_list - use only this specific atom numbers searching AS (duplicates iatom)

tol - tolerance for determining unique antisite configurations (A) max_sep - maximum separation between antisite components (A) iatom (int) - create antistes using this atom number, from 0 return_with_table (bool) - in addition to structures return table with basic information

disp_AS1 - polaronic displacement around first component (-0.2 for hole, +0.2 for electron)
transition metal is assumed here

mag_AS1 - magnetic moment of TM in AS1

AP_on (bool) - turn on Additional polaron suggestion and creation i_AP - number of AP TM atom. Positions are suggested by code depending on their position relative to AS1 and AS2 mag_AP - magnetic moment of AP_nn atom disp_AP - polaronic displacement around AP

confs (list) - create only this configurations, others are skipped

RETURN:

sts (list) - list of structures if return_with_table:

table (list) - see code

Todo #check that distances through PBC could be two small

siman.geo.create_antisite_defect_old(st, cation_positions=None)[source]

exchange cation and transition metal st (Structure)

cation_positions (list of numpy arrays) - reduced coordinates of deintercalated cation positions

siman.geo.create_deintercalated_structure(st, element, del_pos=1)[source]

returns deintercalated structures

del_pos(int) - number of position starting from 1

siman.geo.create_interface_solid(st_host, st_oxide, suf_host, i_suf_host=0, seek_mode=0, seek_range=[0, 2], check_shift=None, hkl_lio=None, i_suf_lio=None, size=[5, 5], ads_pos=None, z_shift=1.5, lio_thick=8)[source]
siman.geo.create_replaced_structure(st, el1, el2, rep_pos=1, only_one=False)[source]

allow to replace symmetry non-equivalent positions structures

rep_pos(int) - number of position starting from 1 only_one - replace only one first atom

siman.geo.create_single_antisite(st, el1, el2, i_el1, i_el2_list=None, tol=0.1, max_sep=4, iatom=None, return_with_table=False, disp_AS1=None, mag_AS1=None, disp_AS2=None, AP_on=False, i_AP=None, mag_AP=None, disp_AP=None, confs=None)[source]

Looks for all unique single antisites for el1 and el2 takes into account formation of polaron and change of oxidation state

confs (dict)
i_el1 - choose specific atom, from 0
siman.geo.create_supercell(st, mul_matrix, test_overlap=False, mp=4, bound=0.01, mul=(1, 1, 1), silent=0)[source]

st (Structure) - mul_matrix (3x3 ndarray of int) - for example created by ortho_ vec()

mul - multiply mul matrix - allows to choose fractions of new vectors

bound (float) - shift (A) allows to correctly account atoms on boundaries mp (int) include additionall atoms before cutting supecell test_overlap (bool) - check if atoms are overlapping - quite slow

siman.geo.create_surface(st, miller_index, min_slab_size=10, min_vacuum_size=10, surface_i=0, oxidation=None)[source]
INPUT:
st (Structure) - Initial input structure. Note that to
ensure that the miller indices correspond to usual crystallographic definitions, you should supply a conventional unit cell structure.
miller_index ([h, k, l]): Miller index of plane parallel to
surface. Note that this is referenced to the input structure. If you need this to be based on the conventional cell, you should supply the conventional structure.
oxidation (dic) - dictionary of effective oxidation states, e. g. {‘Y’:’Y3+’, ‘Ba’:’Ba2+’, ‘Co’:’Co2.25+’, ‘O’:’O2-‘}
allows to calculate dipole moment

surface_i (int) - choose particular surface

min_slab_size (float) - minimum slab size

min_vacuum_size (float) - vacuum thicknes in A

siman.geo.create_surface2(st, miller_index, shift=None, min_slab_size=10, min_vacuum_size=10, surface_i=0, oxidation=None, suf='', primitive=None, symmetrize=False, cut_thickness=None, return_one=False, write_poscar=1, lll_reduce=0, silent=0)[source]
INPUT:
st (Structure) - Initial input structure. Note that to
ensure that the miller indices correspond to usual crystallographic definitions, you should supply a conventional unit cell structure.
pymatgen-related:
miller_index ([h, k, l]): Miller index of plane parallel to
surface. Note that this is referenced to the input structure. If you need this to be based on the conventional cell, you should supply the conventional structure.
oxidation (dic) - dictionary of effective oxidation states, e. g. {‘Y’:’Y3+’, ‘Ba’:’Ba2+’, ‘Co’:’Co2.25+’, ‘O’:’O2-‘}
allows to calculate dipole moment

surface_i (int) - choose particular surface

min_slab_size (float) - minimum slab size

min_vacuum_size (float) - vacuum thicknes in A

symmetrize - try to make both surfaces exact

lll_reduce - try to find smaller basis vectors

my_paramters: shift (float) - shift along z cut_thickness (float) - in A - allow to remove more layers from top return_one (bool) - allows to return only one Structure, otherwise list of pymatgen slabs is returned write_poscar (bool) -self-explained

siman.geo.cubic_supercell(st, ortho_sizes)[source]

wrapper

siman.geo.determine_symmetry_positions(st, element, silent=0, symprec=0.01, angle_tolerance=5.0)[source]

Determine non-equivalent positions for atoms of type element using pymatgen library

INPUT:

  • st (Structure)
  • element (str) - name of element, for example Li
  • silent (bool)
  • symprec (float) - tolerance for symmetry finding
  • angle_tolerance - Angle tolerance for symmetry finding

RETURN:

  • list of lists - atom numbers for each non-equivalent position

AUTHOR:

  1. Aksyonov
siman.geo.find_moving_atom(st1, st2)[source]

find moving atom

The cells should have the same rprimd!

return number of atom which moves between two cell (from zero)

siman.geo.find_mul_mat(rprimd1, rprimd2, silent=0)[source]
siman.geo.find_slab_width(self, vacuum='no')[source]

Calculate width of the sample without vacuum. INPUT:

st - input strucutre vacuum - width of the vacuum or crystal structure. Defaultly, the width of the crystal structure
RETURN:
width of the necessary structure in A
siman.geo.find_voids(st1, st2)[source]

Function returns structure with voids in the position of removed atoms

siman.geo.fit2host(st_host, st_oxide)[source]
siman.geo.flatten()

chain.from_iterable(iterable) –> chain object

Alternate chain() constructor taking a single iterable argument that evaluates lazily.

siman.geo.hex2rhombo(h, k, l)[source]
siman.geo.hkl2uvw(hkl, rprimd)[source]
siman.geo.hkl_slab(st, st_host, hkl, i_suf=None)[source]
siman.geo.image_distance(x1, x2, r, order=1, sort_flag=True, return_n_distances=False, coord_type='xcart')[source]

Calculate smallest distance and the next smallest distance between two atoms correctly treating periodic boundary conditions and oblique cells. x1, x2 - vector[3] xcart coordinates of two atoms r - rprimd of cell order - the order of periodic images which are accounted in the calcualtion of distances between atoms. for cubic cells, order = 1 always provide correct result. For highly oblique cell you should test and find the needed value of ‘order’ after which results are the same. sort_flag (bool) - use False if you do not need sorting of distances

return_n_distances(bool) - returns required number of smallest distances, depending on order

coord_type (str)
  • ‘xred’
  • ‘xcart’

return d1, d2 - the smallest and next smallest distances between atoms

siman.geo.image_vector(st, x1, x2, coord_type='xcart')[source]

Calculate smallest vector between two atoms correctly treating periodic boundary conditions and oblique cells. x1, x2 - vector[3] xcart coordinates of two atoms r - rprimd of cell

coord_type (str)
  • ‘xred’
  • ‘xcart’
siman.geo.interpolate(st1, st2, images, write_poscar=0, poscar_folder='', omit_edges=1)[source]

Linear interpolation between two structures. The number of atoms and order should be the same

INPUT: images (int) - number of intermediate images write_poscar (int) - starting from given number

omit_edges (bool) - first and last corresponding to st1 and st2 are omitted,

siman.geo.local_surrounding(x_central, st, n_neighbours, control='sum', periodic=False, only_elements=None, only_numbers=None, round_flag=1)[source]

Return list of distances to n closest atoms around central atom. (By defauld sum of distances)

Input: - x_central - cartesian coordinates of central atom; vector - st - structure with xcart list of coordinates of all atoms in system - n_neighbours - number of needed closest neighbours

  • control - type of output;
    sum - sum of distances, av - average distance, avsq - average squared dist avharm - average harmonic - it minimal average ‘mavm’: #min, av, max, av excluding min and max av_dev - return (average deviation, maximum deviation) from average distance in mA. list - list of distances; atoms - coordinates of neighbours
  • periodic - if True, then cell is additionaly replicated; needed for small cells
Only for control = atoms
  • only_elements - list of z of elements to which only the distances are needed;
  • only_numbers (list of int) - calc dist only to this atoms

round_flag (bool) - if 1 than reduce distance prec to 2 points

#TODO: the periodic boundary conditions realized very stupid by replicating the cell!

siman.geo.local_surrounding2(x_central, st, n_neighbours, control='sum', periodic=False, only_elements=None, only_numbers=None, round_flag=1)[source]

!!! Attempt to improve speed of periodic conditions! #control = ‘atoms’ could work wrong!!! check #In case of small cell also works wrong with PBC. Does not take into account the several atoms should be counted more than once

Return list of distances to n closest atoms around central atom. (By defauld sum of distances)

Input: - x_central - cartesian coordinates of central atom; vector - st - structure with xcart list of coordinates of all atoms in system - n_neighbours - number of needed closest neighbours

  • control - type of output;
    sum - sum of distances, av - average distance, avsq - average squared dist ‘mavm’: #min, av, max, av excluding min and max av_dev - return (average deviation, maximum deviation) from average distance in mA. list - list of distances; atoms - coordinates of neighbours
  • periodic - if True, then cell is additionaly replicated; needed for small cells
Only for control = atoms
  • only_elements - list of z of elements to which only the distances are needed;
  • only_numbers (list of int) - calc dist only to this atoms

round_flag (bool) - if 1 than reduce distance prec to 2 points

#TODO: the periodic boundary conditions realized very stupid by replicating the cell!

siman.geo.make_neutral(self, oxidation=None, type='element', at_fixed=None, mode='equal', return_oxidation=1, silent=1)[source]

Makes slab with total a charge equal to 0

INPUT:

st (Structure) - input structure oxidation (dir integer) - list of oxidation states

E.g oxi_state = {“Li”: 1, “La”: 2, “Zr”:4, “O”: -2}
type (dir integer) - assign oxidation states based on algorythm
‘element’ - by chemical element, requires oxidation in format:
E.g oxi_state = {“Li”: 1, “La”: 2, “Zr”:4, “O”: -2}
‘position’ - by position of chemical element, requires oxidation in format:
E.g oxi_state = {“Li”: 1, “La”: 2, “Zr”:4, “O”: -2}

at_fixed (dir string) - list of atoms with fixed oxidation states mode (string) - how uncompensated charge will be redistributed between unfixed atoms

‘equal’ - equally between unfixed atoms ‘propotional’ - proportionally to oxidation state
RETURN:
if (return_oxidation == True)
returns a new structure with a neutral charge and new oxidation states
else
returns only a new structure

author - A. Burov

siman.geo.move_edge(self, mode='bottom', tol=0.0)[source]

Removes closest lying atoms of type el

INPUT:

st (Structure) - input structure mode (str) - to which edge of the cell structure shall be shifted tol (float) - tolerance factor, the distance from the edge. May be used to preserve

the structure as a whole on one cell side.
RETURN:
st (Structure) - modified structure

COMMENT: make for all vectors author - A. Burov

siman.geo.ortho_vec(rprim, ortho_sizes=None, silent=0)[source]

Function returns mul_mat - 3 vectors of integer numbers (ndarray) By calculating np.dot(mul_matrix, rprim) you will get rprim of orthogonal supercell (actually as close as possible to it)

siman.geo.ortho_vec_old(rprim, ortho_sizes=None)[source]

old function Function returns mul_mat - 3 vectors of integer numbers (ndarray) By calculating np.dot(mul_matrix, st.rprimd) you will get rprim of orthogonal supercell (actually as close as possible to it)

siman.geo.primitive(st)[source]
siman.geo.remove_atoms(st, atoms_to_remove)[source]

remove atoms either of types provided in atoms_to_remove or having numbers provided in atoms_to_remove st (Structure) atoms_to_remove (list) - list of element names or numbers

siman.geo.remove_closest(self, el, nn=6, n=0, x=0.0)[source]

Removes closest lying atoms of type el

INPUT:
st (Structure) - input structure el (int array) - list of elements to remove nn (int) - number of closest atoms n (int array) - number of removing atoms x (float array) - relative number of removing atoms
RETURN:
st (Structure) - modified structure

author - A. Burov

siman.geo.remove_half(st, el, sg=None, info_mode=0)[source]

# works only for

sg - required space group

TODO 1. Take care about matching the initial cell and supercell from primitive Now the manual shift is done

  1. Make full conversion from pymat structure to mine
siman.geo.remove_half_based_on_symmetry(st, sg=None, info_mode=0)[source]

Generate all possible configurations by removing half of atoms sg (int) - give back structure with specific space group

info_mode (bool) if 1 then return list of possible space groups

return list of structures with sg space groups

siman.geo.remove_one_atom(st, element, del_pos=None, iat=0)[source]

removes one atom of element type from position del_pos iat - number of atom inside subset

siman.geo.remove_vacuum(self, thickness=0.0)[source]

Removes vacuum from a structure

INPUT:
st (Structure) - input structure thickness (float) - remaining thickness of vacuum
RETURN:
slab with vacuum specified thickness

author - A. Burov

siman.geo.remove_x(st, el, sg=None, info_mode=0, x=None, silent=0, return_sts=None)[source]

Allows to remove x of element el from the structure. You should know which space group you want to get. If you don’t know the space group, first use info_mode = 1

st (Structure) - input structure el (str) - element name, e.g. Li

x - remove x of atoms, for example 0.25 of atoms

info_mode (bool) - more information

sg - number of required space group obtained with info_mode = 1

return_sts - return all structure, otherwise only first one is returned

TODO 1. Take care about matching the initial cell and supercell from primitive Now the manual shift is done

  1. Make full conversion from pymat structure to mine
siman.geo.remove_x_based_on_symmetry(st, sg=None, info_mode=0, x=None, silent=None)[source]

Generate all possible configurations by removing x of atoms

st (Structure) - structure with only one element!

sg (int) - give back structure with specific space group

info_mode (bool) if 1 then return list of possible space groups (and structures)

return list of structures (only first ten) with sg space groups

siman.geo.removed_atoms(st1, st2, tol=0.01)[source]

This function finds voids by comparing ideal structure and structure with removed atoms Input: st1 - ideal, st2 - with removed atoms Return list with atomic numbers of removed atoms

siman.geo.replace_x_based_on_symmetry(st, el1, el2, x=None, sg=None, info_mode=0, silent=0, mag=0.6, mode='rep')[source]

Generate all possible configurations by replacing x of element el1 by el2 from the structure. You should know which space group you want to get. If you don’t know the space group, first use info_mode = 1

st (Structure) - input structure el1 (str) - element name to replace, e.g. Li el2 (str) - replace by mag (float) - magnetic moment of new element x - replace x of atoms, for example 0.25 of atoms

info_mode (bool) - print all possible configurations

mode
  • ‘rep’ - replace atoms
  • ‘pol’ - create polarons

sg - number of required space group obtained with info_mode = 1 return list of structures with sg space groups

siman.geo.replic(structure, mul=(1, 1, 1), inv=1, only_atoms=None, cut_one_cell=None, include_boundary=(1, 1))[source]

Replicate structure() according to: mul[i]*rprimd[i]

Input: structure - structure() type mul[] - is tuple of three integer numbers Use from structure: xcart, typat, rprimd, natom, xred inv - 1 or -1 allows to replicate in different directions

inv = 0 - cell is replicated in both directions by mul[i]; 2 still gives -1 0 1 but 3 gives -2 -1 0 1 2; for ‘only_matrix’ may work not correctly

only_atoms - allows to replicate only specific atoms; now
‘only_matrix’
Warning - st.select is not working here

cut_one_cell - allows to cut only one cell with replicated edge atoms include_boundary (A) - the width of region to include additional edge atoms (bottom, up)

TODO:
oxi_states are not added yet

Return: replicated structure

siman.geo.rhombo2hex(h, k, l)[source]
siman.geo.rms_between_structures(st1, st2)[source]

Compare atoms position and calculated RMS between them Useful to see the effect of relaxation, or atoms moves during NEB st1 and st2 should be imposed on each other

INPUT
  • st1 (Structure) - structure 1
  • st2 (Structure) - structure 2

RETURN:

siman.geo.rms_between_structures2(st1, st2, el=None)[source]

Compare atoms position and calculated RMS between two structures with the same order of atoms Useful to see the effect of relaxation, or atoms moves during NEB st1 and st2 should be imposed on each other

INPUT
  • st1 (Structure) - structure 1
  • st2 (Structure) - structure 2
  • el (str) - calculate only for element el, if None then for all elments
RETURN:
  • d_list (list) - list of shifts for each atom
  • rms (float) - rms over all atoms

Aksyonov

siman.geo.rms_pos_diff(st1, st2)[source]

Calculate rms difference of atomic positions, excluding moving atom

siman.geo.rotate_align_with_vector(st1, at1, at2)[source]

The function orients the given structure by aligning the z-axis with a vector between two atoms.

cl1 (str) - Structure() object at1 (int) - atomic number since 0 at2 (int) - atomic number since 0

returns a structure oriented along a vector

Author: A.Boev

siman.geo.scale_cell_by_matrix(st, scale_region=None, n_scale_images=7, parent_calc_name=None, mul_matrix=None)[source]

Scale rprimd and xcart of structure() object st from scale_region[0] to scale_region[1] (%) using n_scale_images images and mul_matrix. parent_calc_name is added to st.des Return: list of scaled Structure() objects

TODO: Take care of vol, recip and so on - the best is to create some method st.actual() that update all information

siman.geo.scale_cell_uniformly(st, scale_region=None, n_scale_images=7, parent_calc_name=None)[source]

Scale uniformly rprimd and xcart of structure() object st from scale_region[0] to scale_region[1] (%) using n_scale_images images. parent_calc_name is added to st.des Return: list of scaled Structure() objects

TODO: Take care of vol, recip and so on - the best is to create some method st.actual() that update all information

siman.geo.sl_misfit(st1, st2, silent=0)[source]
siman.geo.stoichiometry_criteria(st1, st2)[source]
siman.geo.stoichiometry_criteria2(st1, st2, silent=1)[source]
siman.geo.supercell(st, ortho_sizes)[source]

wrapper

siman.geo.symmetry_criteria(st)[source]
siman.geo.symmetry_criteria_at(st)[source]
siman.geo.symmetry_multiply(st_ideal, st, el, ops=None, rm_ovrlp=None, name='')[source]

Allows to multiply atomic positions of atoms el in st according to symmetry of st_ideal Usually st_ideal and st are commensurate crystal structures, but st has some defects, which are required to multiply according the symmetry of the ideal structure.

st_ideal (Structure) - the structure with required symmetry st (Structure) - the structure to be modified el (str) - name of element, atoms of which should be multiplied; several elements can be given separated by space rm_ovrlp (float) - atoms closer than rm_ovrlp (in A) will be removed, if None - nothing is done

ops (list ) - pymatgen type list of symmetry operations used in addition to that obtained from st_ideal

name (str)

TODO:

RETURN:
st (Structure) - the structure in which all atoms el are multiplied according to the given symmetry

Author: DA

siman.geo.test_transform_miller(rprimd1, rprimd2, hkl, silent=1)[source]

Different attempts to find correct way of index transformstion rprimd1 (list of arrays) - primitive vectors 1 rprimd2 (list of arrays) - primitive vectors 2 hkl (list of int) - miller index for rprimd1

siman.geo.transform_miller(rprimd1, rprimd2, hkl, silent=1)[source]

Convert miller indicies between two choices of primitive vectors for the same lattice. defined in rprimd1 to miller indicies defined in rprimd2. rprimd1 and rprimd2 are two primitive vectors chosen

Can be used for different homomorphic lattices, but first be sure that they are correctly oriented in space.

rprimd1 (list of arrays) - first set of vectors rprimd2 (list of arrays) - second set of vectors hkl (list of int) - hkl - miller index for first set of vectors

RETURN hkl2 - miller index for second set of vectors corresponding to hkl

siman.geo.triangle_area_points(v1, v2, v3)[source]
siman.geo.two_cell_to_one(st1, st2)[source]

Join two cells st1 - first cell st2 - second cell

siman.geo.uvw2hkl(uvw, rprimd)[source]
siman.geo.xcart2xred(xcart, rprimd)[source]

Convert from cartesian coordinates xcart to dimensionless reduced coordinates Input: xcart - list of numpy arrays, rprimd - list of numpy arrays Output: xred - list of numpy arrays

siman.geo.xred2xcart(xred, rprimd)[source]

Convert from dimensionless reduced coordinates to cartesian coordinates xcart;

Input: xred - list of numpy arrays, rprimd - list of numpy arrays Output: xcart - list of numpy arrays

siman.header module

class siman.header.CalcDict[source]

Bases: dict

items() → a set-like object providing a view on D's items[source]
siman.header.pickle_module_migration_script()[source]

This script allows to update modules in database after moving them to siman package

siman.header.print_and_log(*logstrings, **argdic)

‘’ - silent e - errors and warnings a - attentions m - minimalistic output of scientific procedures - only obligatory mess are shown M - maximalistic output of scientific procedures debug_level importance:

‘n’ - not important at all - for debugging ‘’ - almost all actions, no flag is needed ‘y’ - important - major actions ‘Y’ - super important, or output asked by user
siman.header.printlog(*logstrings, **argdic)[source]

‘’ - silent e - errors and warnings a - attentions m - minimalistic output of scientific procedures - only obligatory mess are shown M - maximalistic output of scientific procedures debug_level importance:

‘n’ - not important at all - for debugging ‘’ - almost all actions, no flag is needed ‘y’ - important - major actions ‘Y’ - super important, or output asked by user
siman.header.runBash(cmd, env=None, detached=False, cwd=None)[source]

Input - string; Executes Bash commands and returns stdout Need: import subprocess

siman.header.run_win_cmd(cmd)[source]

siman.helper_for_writing_beatiful_code module

Template for doc using markdown markup language [https://daringfireball.net/projects/markdown/]:

Function description;

###INPUT:

  • parameter 1 (type) - description
  • parameter 2 (type) - description

###RETURN:

None

###DEPENDS:

siman.impurity module

siman.impurity.add_impurity(it_new, impurity_type=None, addtype='central', calc=[], r_pore=0.5, it_to='', ise_to='', verlist_to=[], copy_geo_from='', find_close_to=(), add_to_version=0, write_geo=True, only_version=None, fine=4, put_exactly_to=None, check_pore_vol=0, replace_atom=None, override=False)[source]

Add impurities in pores.

Input: it_new - name of new structure with impurity

impurity_type - name of impurity from Mendeley table, for example ‘C’

addtype - type of adding: [‘central’,]; ‘central’ means that impurity will be placed as close to the geometrical center of cell as possible.

it_to , ise_to , verlist_to - completed calculations in which impurity will be added

if ‘verlist_to’ is empty, function will try to find geometry files in ‘geo_folder + struct_des[it_to].sfolder’ folder; even if ‘it_to’ is empty it will try to find files in ‘geo_folder + struct_des[it_new].sfolder+’/from’ ‘ folder. ‘ise_to’ also can be empty

if ‘copy_geo_from’ is not empty, then programm copy all files from folder ‘copy_geo_from’ to folder ‘geo_folder + struct_des[it_to].sfolder+”/”+it_to’ or ‘geo_folder + struct_des[it_new].sfolder+”/from” ‘

‘find_close_to’ is tuple of three reduced coordinates of point close to which you want to find impurity. If empty - ignored;

‘add_to_version’ is integer number added to each ‘verlist_to’ number to produce ver_new.

‘only_version’ - if == [v,], then instertion will be provided only for v. If None insertion will be made in all found versions

If you want to add impurity to relaxed structure …

‘fine’ - integer number; allows to reduce number of small steps for defining center

Possible addtype’s: ‘central’ - add one atom to the pore which is most close to the center of the cell but with reduced coordinates less than 0.5 0.5 0.5 ‘all_pore’ - add atoms in every found pore ‘all_local’ - add atoms to every local point which allows to visualise topology of pores. ‘gb’ - uses self.gbpos and places atom close to this value assuming that it will be at gb ‘grain_vol’ - uses self.gbpos and assuming that cell contains two gb and two equal grains, places atom close to the centre of grain; y and z can be arbiratry

put_exactly_to - will add impurity to this point find_close_to - will try to find closest void and insert pore here.

check_pore_vol - allows to estimate volume of pores; has problems for big cells

replace_atom - if not None, than the specified atom is substituted

Side effects: creates new geometry folder with input structures;

siman.impurity.create_c_array(pylist, ctype)[source]
siman.impurity.determine_unique_voids(st_pores, sums, avds)[source]
siman.impurity.determine_voids(st, r_impurity, fine=1, step_dec=0.05)[source]
siman.impurity.find_pores(st_in, r_matrix=1.4, r_impurity=0.6, step_dec=0.05, fine=0.3, prec=0.1, calctype='central', gbpos=0, find_close_to=(), check_pore_vol=0)[source]

st_in - input Structure() object r_impurity (A)- all pores smaller than this radius will be found r_matrix (A) - radius of matrix atoms disregarding to their type step_dec - scanning step of the cell in Angstroms fine - allows to change density of local points; local_step = step_dec/fine prec - precicion of pore center determination check_pore_vol - allows to estimate volume of pores; has problems for big cells

‘find_close_to’ - works in the cases of gb and grain_vol; allows to ignore all and find pore close to provided three reduced coordinates return - instance of Structure() class with coordinates of pores. Number and type of included pores depend on the argument of ‘calctype’.

siman.impurity.insert(it_ins, ise_ins, mat_path, it_new, calc, type_of_insertion='xcart')[source]

For insertion of atoms to cells with changed lateral sizes Input: ‘type_of_insertion = xred’ used to add xred coordinates mat_path - path to geo files which are supposed to be changed it_ins - already existed calculation; xred will be used from this calculation. it_new - new folder in geo folder for obtained structure

This function finds version of calculation in folder mat_path and tries to use the same version of it_ins

siman.impurity.insert_atom(st, el, i_void=None, i_void_list=None, r_imp=1.6)[source]

Simple Wrapper for inserting atoms

i_void (int) has higher priority than i_void_list

return st_new, i_add, sts_by_one
st_new - all positions are filled i_add - the number of last inserted atom sts_by_one - list of structures with only one inserted atom in all found positions
siman.impurity.insert_cluster(insertion, i_center, matrix, m_center)[source]

Take care of orientation; typat should be consistent Input: insertion - object of class Structure(), which is supposed to be inserted in matrix in such a way that i_center will be combined with m_center. matrix - object of class Structure(). i_center, m_center - numpy arrays (3) cartesian coordinates

siman.impurity.make_interface(main_slab, m_xc, second_slab, s_xc)[source]

Make interfaces Both slabs should have close sizes along x and y and should be oriented correctly

Input: main_slab (Structure) - slab second_slab (Structure) - slab, scaled to coincide with the main slab m_xc, s_xc (array(3)) - cartesian coordinates of pointis in main_slab and secondary slab to be combined

Return Slab with interface and scaled second slab

siman.impurity.make_interface2(st1, st2, shift, mesh=[5, 5], oxi={}, at_fixed=[], mode='top', tol=0.05)[source]

Creates interface from two input structures

INPUT: st1 (Structure) - main input structure st2 (Structure) - appending input structure thickness (float) - remaining thickness of vacuum shift (float array) - shift atoms along axis tol (float) - relative difference between two steps with different meshes mode (str) - type of interfaces or interfaces that will be returned

‘top’ - returns one structure that was made from highest atoms from st1 and lowest atom from st2 ‘min’ - returns
‘min’ mode requires these arguments:

mesh (int array) - mesh in AB plane to find a structure with lowest Ewald energy oxi (float dic) - dictionary oxidation states. Look siman.geo.make_neutral() for more details

E.g {“Li”: 1, “La”: 2, “Zr”:4, “O”: -1}

at_fixed (string array) - atoms with fixed oxidation states

RETURN:
interface and new structure st2.

author - A. Burov

siman.inout module

siman.inout.cif2poscar(cif_file, poscar_file)[source]
siman.inout.determine_file_format(input_geo_file)[source]
siman.inout.get_file_by_version(geofilelist, version)[source]

Find file with needed version from filelist according to certain rules

siman.inout.read_aims_out(cl, load='', out_type='', show='')[source]
siman.inout.read_atat_fit_out(filename, filter_names=None, i_energy=1)[source]

read fit.out of atat filter_names - do not read name numbers greater than filter_name i_energy - 1 for fit.out, 2 for predstr.out return - concentration list, energy list

siman.inout.read_csv(filename, delimiter=', ')[source]
siman.inout.read_poscar(st, filename, new=True)[source]
siman.inout.read_structure(filename=None, format=None, object_type=None, silent=0)[source]

Smart wrapper for reading files with atomic structure. New version of smart_structure_read

INPUT:
  • filename (str)
  • format (str) - file format. Normally the format is determined automatically from the name or extension
    • ‘abinit’
    • ‘vasp’
    • ‘cif’
    • ‘gaussian’
  • object_type (str)
    • ‘molecule’ - based on pymatgen
    • ‘structure’ - siman internal Structure() class

returns Structure() if file is found and read successfully otherwise None

siman.inout.read_vasp_out(cl, load='', out_type='', show='', voronoi='', path_to_outcar='', path_to_contcar='')[source]

Try to read xred from CONCAR and calculate xcart

siman.inout.read_xyz(st, filename, rprimd=None)[source]

Read xyz file into st

rprimd (list of lists) - if None or [None, ] then Tv are read; if Tv does not exist then create automatically

siman.inout.smart_structure_read(filename=None, curver=1, calcul=None, input_folder=None, input_geo_format=None, input_geo_file=None)[source]

Wrapper for reading geometry files (use new reader read_structure() from siman.inout ) calcul (Calculation()) - object to which the path and version read

curver (int) - version of file to be read input_geo_file or filename (str) - explicitly provided input file, has higher priority input_folder (str) - folder with several input files, the names doesnot matter only versions input_geo_format (str) - explicitly provided format of input file

returns Structure()

siman.inout.write_geometry_aims(st, filename, coord_type='cart', periodic=True)[source]
siman.inout.write_jmol(xyzfile, pngfile, scriptfile=None, atomselection=None, topview=0, orientation=None, axis=False, bonds=True, rprimd=None, shift=None, rotate=None, label=None, high_contrast=None, specialcommand=None, boundbox=2, atom_labels=None)[source]

atomselection - string in gmol format with number of atoms to be nrotateSelected topview - additional top view, requires two models in xyz orientation - additional rotation axis - add axes rotate - rotation of all atoms around view axis in degrees label (tuple ()) - used for impurities, please decribe atom_labels (bool) - turn on atom labels

help: frame all - turn on all frames

siman.inout.write_lammps(st, filename='', charges=None)[source]

Writes structure in lammps format

charges (list of float) - list of charges for each atom type

siman.inout.write_occmatrix(occs, folder)[source]
siman.inout.write_xyz(st=None, path=None, filename=None, file_name=None, include_vectors=True, repeat=1, shift_2view=1.0, replications=None, full_cell=False, analysis=None, show_around=None, show_around_x=None, nnumber=6, only_elements=None, gbpos2=None, gbwidth=1, withgb=False, include_boundary=2, imp_positions=[], imp_sub_positions=None, jmol=None, jmol_args=None, sts=None, mcif=0, suf='')[source]

Writes st structure in xyz format in the folder xyz/path #void are visualized with Pu if repeat == 2: produces jmol script shift_2view - in rprimd[1][1] - shift of the second view gbpos2 - position of grain boundary in A gbwidth - atoms aroung gbpos2 will be colored differently

imp_positions - (x1,x2,x3, element, label)- xcart and element name coordinates additionally to be added to structure; to visulaze all impurity positions: for jmol, additional key ‘s’, ‘i’ can be added after element imp_sub_positions - list of atom numbers; the typat of these atoms is changed: not used now

analysis - additional processing, allows to show only specifice atoms,
‘imp_surrounding’ - shows Ti atoms only around impurity nnumber - number of neighbours to show show_around - choose atom number around which to show, from 1 show_around_x - show atoms around point, has higher priority only_elements - see local_surrounding

replications - list of replications, (2,2,2)

full_cell - returns atoms to cell and replicate boundary atoms

include_vectors (bool) - write primitive vectors to xyz

jmol - 1,0 - use jmol to produce png picture jmol_args (dict) - arguments to write_jmol see write_jmol() mcif - write magnetic cif for jmol

specialcommand - any command at the end of jmol script suf - additional suffix for name

sts - list of Structure - write several structures to xyz file - other options are not working in this regime

siman.monte module

Program Monte-Carlo by Aksyonov Dmitry, Skoltech, Moscow

siman.monte.check(cl, exit=0)[source]
siman.monte.check_poscar(filename)[source]
siman.monte.exchange_atoms(st, xcart_voids, zr=None, condition=None, params=None)[source]

Swap two atoms

INPUT:
  • st (Structure) - input structure
  • xcart_voids (list) - xcart of voids
  • zr (float) - reduced position of the surface
  • condition (str) - possible additional conditions:
    • ‘no_surface_TM’ - do not make swaps which reduce oxygen coordination of transition metals
    • ‘max_avdist_increase’ - maximum allowed increase of TM-O distance after swapping;
      (for example larger than 0.5 A allows to exclude swaps to surface)
  • params (dict) - params from json
COMMENTS:
voidz - list with z voids; actually either None or [300] z_groups = params.get(‘z_groups’) # z_groups for exchange, list of lists; e.g. [[300], [42]] if None than all groups are used
siman.monte.exchange_with_external(st, zr, thickness, external=None)[source]

external (dict) - {‘Ni’:[‘Li’]} - atoms from external reservior which can replace existing elements, in this example Ni can replace Li

siman.monte.get_zr_range(st, thickness, zr)[source]
siman.monte.initial_run(xcart_voids)[source]
  1. Run initial calculation
siman.monte.vasp_run(n, des, vasprun_command=None)[source]

siman.monte_functions module

siman.monte_functions.metropolis(E1, E2, T=1)[source]

Metropolis algorithm

siman.monte_functions.random() → x in the interval [0, 1).

siman.neb module

siman.neb.add_neb(starting_calc=None, st=None, st_end=None, it_new=None, ise_new=None, i_atom_to_move=None, up='up2', search_type='vacancy_creation', init_neb_geo_fld=None, images=None, r_impurity=None, calc_method=['neb'], inherit_option=None, mag_config=None, i_void_start=None, i_void_final=None, atom_to_insert=None, atom_to_move=None, rep_moving_atom=None, end_pos_types_z=None, replicate=None, it_new_folder=None, it_folder=None, inherit_magmom=False, x_start=None, xr_start=None, x_final=None, xr_final=None, upload_vts=False, center_on_moving=True, run=False, add_loop_dic=None, old_behaviour=None, params=None)[source]

Prepare needed files for NEB Provides several regimes controlled by search_type flag:

  • existing_voids - search for voids around atom and use them as a final position
  • vacancy_creation - search for neighbors of the same type and make a vacancy as a start position
  • interstitial_insertion - search for two neighboring voids; use them as start and final positions
    by inserting atom atom_to_insert
  • None - just use st and st2 as initial and final
  • external - folder with subfolders 00, 01, … in VASP format is provided using init_neb_geo_fld
INPUT:
  • starting_calc (Calculation) - Calculation object with structure
  • st (Structure) - structure, can be used instead of Calculation
    • it_new (str) - name for calculation
  • st_end (Structure) - final structure
  • i_atom_to_move (int) - number of atom for moving starting from 0;
  • mag_config (int ) - choose magnetic configuration - allows to obtain different localizations of electron
  • replicate (tuple 3*int) - replicate cell along rprimd
  • i_void_start, i_void_final (int) - position numbers of voids (or atoms) from the suggested lists
  • atom_to_insert (str) - element name of atom to insert
  • atom_to_move (str) - element name of atom to move
  • it_new_folder or it_folder (str) - section folder
  • inherit_option (str) - passed only to add_loop
  • inherit_magmom (bool) - if True than magmom from starting_calc is used, else from set
  • end_pos_types_z (list of int) - list of Z - type of atoms, which could be considered as final positions in vacancy creation mode
  • calc_method (list)
    • ‘neb’
    • ‘only_neb’ - run only footer
  • x_start, x_final (array) - explicit xcart coordinates of moving atom for starting and final positions, combined with atom_to_insert
  • xr_start, xr_final (array) - explicit xred
  • rep_moving_atom (str)- replace moving atom by needed atom - can be useful than completly different atom is needed.
  • upload_vts (bool) - if True upload Vasp.pm and nebmake.pl to server
  • run (bool) - run on server
  • init_neb_geo_fld - folder with initial geometry files in VASP format, automatically switch on ‘external’ mode
  • old_behaviour (str) - choose naming behavior before some date in the past for compatibility with your projects
    ‘020917’ ‘261018’ - after this moment new namig convention applied if end_pos_types_z is used
  • add_loop_dic - standart parameters of add()
  • params (dic) - provide additional parameters to add() # should be removed
RETURN:
None

DEPENDS:

TODO 1. Take care of manually provided i_atom_to_move in case of replicate flag using init_numbers 2. For search_type == None x_m and x_del should be determined for magnetic searching and for saving their coordinates to struct_des; now their just (0,0,0)

siman.neb.determine_unique_final(st_pores, sums, avds, x_m)[source]

siman.pairs module

siman.pairs.PBC(dx, r)[source]

can be incorrect Realisation of periodic boundary conditions in common case dx - vector[3] difference between coordinates of two atoms r - rprimd of cell return dx - the smallest distance between atoms

siman.pairs.create_coseg_samples(base_name, it_b, ise_b, ver, calc, path_template, imp_size=0.44, fine_mul=4, gbpos=None, segtyp=None, input_dlist_coseg=None, xcart1imp=None, xcart2imp=None, main_path=None)[source]

Create all cells for co-segregation calculations.

Input: base_name - the names of seg and coseg cases will be started from this name

input_dlist_coseg - needed to construct corresponding segregation cases (segtyp = ‘segreg’), but in relaxed cell, where one atom is in grain volume. Must be initialy constructed using segtyp = ‘coseg’;

1. it_b, ise_b, base cell with relaxed grain boundaries (self.gbpos - position of one gb) ver - version to create and one carbon atom in the volume of one grain (can be several versions).

2. path_template - path to geo files with template cells with correct rprimd for cell with CO (can be several versions).

imp_size - size of pores, which are being found trying to insert impurity

siman.pairs.find_pairs(base_name, segtyp, in_calc, central_atoms=[], xcart1imp=None, input_dlist_coseg=None, prec=2, gvolume_config_num=None, gbpos=None, take_final_rprimd_from=None, main_path=None, based_on=None, target_znucl=[22, 6, 8], max_dist_between_atoms=4.8, add_typat=[2, 3])[source]

Find uniq pairs of atoms and analyse them Input:

segtyp - three regimes for cells with grain boundaries: ‘segreg’ assumes that in_calc contains carbon atom in grain volume, and creates all cases; ‘coseg’ assumes pure cell and creates only coseg cases. cosegregation cases of course should be the same for two regimes, however co-segregation configuations after ‘coseg’ is more easy to relax. ‘grainvol’ - searching for pairs in grain volume

two regimes for bulk cells: ‘bulk_triple’ - used for bulk cells without grain boundaries; first step is searching for pairs, second step for triples. ‘bulk_pairs’ - used for bulk cells without grain boundaries; searching for pairs.

new_name - name of created structures; at first should be added to struct_des[] in_calc - Calculation() type or path to geo file region - list of numbers which determine region central_atoms - list of atoms for which pairs are constructed (Warinig! numbers in new array xcart_pores!); - parameter to change mode;

xcart1imp - coordinates of first interstitial in the grain interior

input_dlist_coseg - list of configurations with cosegregation cases. Needed to construct corresponding segregation cases. the format is quiet tricky

prec - precision of lengths used to determine unique positions.

gvolume_config_num - number of configuration with two atoms in grain volume choosen by user (usually should be the most favourable)

gbpos - position of grain boundary

take_final_rprimd_from - path to geo file from which rprimd will be used

target_znucl - numbers of target atoms

max_dist_between_atoms - now at least used for ‘bulk_pairs’ and ‘bulk_triple’; maximum length of found pairs.

add_typat - mannualy set please update

siman.pairs.wrapper_create_coseg()[source]
siman.pairs.wrapper_create_coseg_C1()[source]
siman.pairs.wrapper_create_coseg_CSL7s(calc)[source]
siman.pairs.wrapper_create_coseg_T1s(calc)[source]
siman.pairs.wrapper_create_coseg_T2(calc)[source]
siman.pairs.wrapper_create_pairs_H(basename=None, add_typat=[2, 3], path2temp=None)[source]

siman.picture_functions module

siman.picture_functions.fit_and_plot(ax=None, power=None, xlabel=None, ylabel=None, image_name=None, filename=None, show=None, pad=None, xlim=None, ylim=None, title=None, figsize=None, xlog=False, ylog=False, scatter=False, legend=False, ncol=1, fontsize=None, legend_fontsize=None, markersize=None, linewidth=None, hor=False, ver=False, fig_format='pdf', dpi=300, ver_lines=None, hor_lines=None, xy_line=None, x_nbins=None, alpha=0.8, fill=False, first=True, last=True, convex=None, dashes=None, corner_letter=None, corner_letter_pos=None, hide_ylabels=None, hide_xlabels=None, annotate=None, params=None, **data)[source]

Produce complex plots using arbirtary number of axes and arbirtary number of curves on each axis. See tutorial with examples (to be created).

INPUT:

  • ax (axes) - matplotlib axes object - to create multiple axes plots. If None than single axes is used
  • data (tuple or dict) - each entry should be
    • (X, Y, fmt)
    • (X, Y, fmt, label)
    • (X, Y, R, fmt) - for scatter = 1, R - size of spots;
    • {‘x’:,’y’:, ‘fmt’:, …, any argument valid for pyplot.plot() } not implemented for powers and scatter yet
      • ‘label’ (str) -
      • ‘xticks’ (list) -
      • ‘annotate_fontsize’ (str)
      • ‘annotate_arrowprops’ (dict)
  • first, last (int) - allows to call this function multiple times to put several axes on one impage. Use first = 1, last = 0 for the first axes, 0, 0 for intermidiate, and 0, 1 for last axes.
  • power (int) - the power of polynom, turns on fitting
  • scatter (bool) - plot scatter points - the data format is slightly different - see data
  • convex (bool) - plot convex hull around points like in ATAT
  • fill (bool) - fill under the curves
  • filename (str) - name of file with figure, image_name - deprecated
  • fig_format (str) - format of saved file.
  • dpi - resolution of saved file
  • ver_lines - list of dic args for vertical lines {‘x’:, ‘c’, ‘lw’:, ‘ls’:}
  • hor_lines
  • ver - vertical line at 0
  • hor - horizontal line at 0
  • hide_ylabels - just hide numbers
  • ncol - number of legend columns
  • corner_letter - letter in the corner of the plot
  • corner_letter_pos (list*2 float) - list with [x,y] corner position, default left upper corner is set
  • pad - additional padding, if dict than the same keys as in plt.subplots_adjust() are used
  • annotate - annotate each point, ‘annotates’ list should be in data dic!
  • linewidth - was 3 !
  • markersize - was 10
  • x_nbins - number of ticks
  • params (dict) - dictionary with parameters, should be used instead of new arguments
    • ‘xlim_power’ - xlim for power
    • ‘y0’ - move plot to have y = 0
    • ‘xnbins’ - number of bins x

TODO:

  • remove some arguments that can be provided in data dict
  • move all rare arguments to params

RETURN:

filename of the saved image

AUTHOR:

Aksyonov D.A.
siman.picture_functions.fitplot(ax=None, power=None, xlabel=None, ylabel=None, image_name=None, filename=None, show=None, pad=None, xlim=None, ylim=None, title=None, figsize=None, xlog=False, ylog=False, scatter=False, legend=False, ncol=1, fontsize=None, legend_fontsize=None, markersize=None, linewidth=None, hor=False, ver=False, fig_format='pdf', dpi=300, ver_lines=None, hor_lines=None, xy_line=None, x_nbins=None, alpha=0.8, fill=False, first=True, last=True, convex=None, dashes=None, corner_letter=None, corner_letter_pos=None, hide_ylabels=None, hide_xlabels=None, annotate=None, params=None, **data)

Produce complex plots using arbirtary number of axes and arbirtary number of curves on each axis. See tutorial with examples (to be created).

INPUT:

  • ax (axes) - matplotlib axes object - to create multiple axes plots. If None than single axes is used
  • data (tuple or dict) - each entry should be
    • (X, Y, fmt)
    • (X, Y, fmt, label)
    • (X, Y, R, fmt) - for scatter = 1, R - size of spots;
    • {‘x’:,’y’:, ‘fmt’:, …, any argument valid for pyplot.plot() } not implemented for powers and scatter yet
      • ‘label’ (str) -
      • ‘xticks’ (list) -
      • ‘annotate_fontsize’ (str)
      • ‘annotate_arrowprops’ (dict)
  • first, last (int) - allows to call this function multiple times to put several axes on one impage. Use first = 1, last = 0 for the first axes, 0, 0 for intermidiate, and 0, 1 for last axes.
  • power (int) - the power of polynom, turns on fitting
  • scatter (bool) - plot scatter points - the data format is slightly different - see data
  • convex (bool) - plot convex hull around points like in ATAT
  • fill (bool) - fill under the curves
  • filename (str) - name of file with figure, image_name - deprecated
  • fig_format (str) - format of saved file.
  • dpi - resolution of saved file
  • ver_lines - list of dic args for vertical lines {‘x’:, ‘c’, ‘lw’:, ‘ls’:}
  • hor_lines
  • ver - vertical line at 0
  • hor - horizontal line at 0
  • hide_ylabels - just hide numbers
  • ncol - number of legend columns
  • corner_letter - letter in the corner of the plot
  • corner_letter_pos (list*2 float) - list with [x,y] corner position, default left upper corner is set
  • pad - additional padding, if dict than the same keys as in plt.subplots_adjust() are used
  • annotate - annotate each point, ‘annotates’ list should be in data dic!
  • linewidth - was 3 !
  • markersize - was 10
  • x_nbins - number of ticks
  • params (dict) - dictionary with parameters, should be used instead of new arguments
    • ‘xlim_power’ - xlim for power
    • ‘y0’ - move plot to have y = 0
    • ‘xnbins’ - number of bins x

TODO:

  • remove some arguments that can be provided in data dict
  • move all rare arguments to params

RETURN:

filename of the saved image

AUTHOR:

Aksyonov D.A.
siman.picture_functions.plot_and_annotate(power=2, xlabel='xlabel', ylabel='ylabel', filename=None, xlim=None, ylim=None, title=None, fit=None, legend=None, **data)[source]

Should be used in two below sections! Creates one plot with two dependecies and fit them; return minimum fitted value of x2 and corresponding valume of y2; if name == “” image will not be plotted power - the power of polynom

data - each entry should be (X, Y, ‘r-‘)

siman.picture_functions.plot_bar(xlabel='xlabel', ylabel='ylabel', xlim=None, ylim=None, legend=0, image_name=None, title=None, bottom=0.18, hspace=0.15, barwidth=0.2, data1=[], data2=[], data3=[], data4=[], hor_lines=None, **data)[source]
siman.picture_functions.plot_bar_simple(xlabel='xlabel', ylabel='ylabel', xlim=None, ylim=None, image_name=None, title=None, data=[])[source]
siman.picture_functions.plot_conv(list_of_calculations=None, calc=None, type_of_plot=None, conv_ext=[], labelnames=None, cl=None, plot=1, filename=None)[source]

Allows to fit and plot different properties; Input: ‘type_of_plot’ - (“fit_gb_volume”-fits gb energies and volume and plot dependencies without relaxation and after it,

‘dimer’

cl - calculation to use - new interface, please rewrite the old one

siman.picture_functions.plot_mep(atom_pos, mep_energies, image_name=None, filename=None, show=None, plot=1, fitplot_args=None, style_dic=None)[source]

Used for NEB method atom_pos (list) - xcart positions of diffusing atom along the path or just coordinates along one line (for polarons) mep_energies (list) - full energies of the system corresponding to atom_pos

image_name - deprecated, use filename style_dic - dictionary with styles

‘p’ - style of points ‘l’ - style of labels ‘label’ - label of points

plot - if plot or not

siman.picture_functions.process_fig_filename(image_name, fig_format)[source]

siman.project_funcs module

siman.set_functions module

class siman.set_functions.InputSet(ise=None, path_to_potcar=None, calculator='vasp')[source]

Bases: object

docstring for InputSet The second important class which is used to store parameters of calculation

For VASP parameters self.vasp_params dict is used; usually it contains the parameters in the same format as INCAR file. However, several exceptions are: for ‘LDAUU’, ‘LDAUJ’, ‘LDAUL’ you should provide dictionaries with correponding values for each element in the form: {‘Co’:3.4,}.

self.potdir (dict) - name of POTCAR folder for each element, for example {3:’Li’, 8:’O’}

self.blockfolder (str) - additional subfolder will be created calculation with this set

self.save_last_wave (bool) - set True to save last WAVECAR in u-ramping mode

self.kpoints_file - if True, k-points file is created, if string then it is considered as path to external kpoints file

self.path_to_potcar (str) - explicit path to potcar, can be used instead of self.potdir

self.set_sequence (list) - list of InputSet() objects to make multiset runs. The current set is used as a first one.

TODO Describe the difference between update() and load() methods !

add_conv(arg, type_of_conv)[source]
add_conv_kpoint(arg)[source]
add_conv_tsmear(arg)[source]
load(param, inplace=False)[source]

Update parameters of set from dict param

printme()[source]

Print set

read_incar(filename)[source]
read_universal(filename)[source]
set_add_nbands(arg)[source]
set_attrp(token, arg, des='see manual')[source]

set any attribute.

set_compare_with(arg)[source]
set_ngkpt(arg)[source]
set_params_dict(token, arg, des='see manual')[source]

Used for setting parameters for different calculators, such as VASP, Gaussian, etc

set_potential(znucl, arg='')[source]
set_relaxation_type(type_of_relaxation)[source]
toJSON()[source]
toabinit(st)[source]

Convert from VASP (add more codes in the future) to Abinit

update()[source]
siman.set_functions.aims_keys = ['k_grid', 'default_initial_moment', 'spin']

put here quantum espresso keys

siman.set_functions.inherit_iset(ise_new, ise_from, varset, override=False, newblockfolder=None)[source]

Create new set copying from existing and update some fields. If ise_from does not exist create new

siman.set_functions.init_default_sets(init=0)[source]

Pre-defined sets for Vasp Initialized in read_database(scratch = False, init_sets = 0) and can be updated with init_sets arg

siman.set_functions.make_sets_for_conv(isefrom, conv, list_of_parameters, varset)[source]
siman.set_functions.qe_keys = []

gaussian keys

siman.set_functions.read_vasp_sets(user_vasp_sets, override_global=False)[source]

Read user sets for different calculators and add them to project database Works not only for VASP but other codes as well, such as Gaussian

INPUT:
  • varset (dict) - database dict with all sets of a project
  • user_vasp_sets (list) - list of user sets that describes creation of new sets based on inheritance
  • override - allows to recreate all sets; can be usefull than you want to add some new property to all your sets - very dangerous to do!
RETURN:
  • user_vasp_sets (list)

siman.small_functions module

class siman.small_functions.TracePrints[source]

Bases: object

write(s)[source]
siman.small_functions.angle(v1, v2)[source]
siman.small_functions.b2s(b)[source]
siman.small_functions.bash_chk_file_cmd(file)[source]
siman.small_functions.block_print()[source]

Blocks standard output. It may be used in functions that do not have silent mode.

siman.small_functions.calc_ngkpt(recip, kspacing)[source]
siman.small_functions.cat_files(files, output_file)[source]
siman.small_functions.cwd(path)[source]

Alows to change working directory inside

with cwd():
expression
siman.small_functions.enable_print()[source]

Enables standard output. It may be used in functions that do not have silent mode.

siman.small_functions.get_common_chemical_base(st1, st2)[source]
siman.small_functions.get_mismatch(a, b)[source]

relative mistmatch between the lattice vectors a and b

siman.small_functions.get_vec(a, b)[source]
siman.small_functions.get_vector(a, b)[source]
siman.small_functions.grep_file(string, file, reverse=False)[source]
siman.small_functions.gunzip_file(filename)[source]
siman.small_functions.is_list_like(obj)[source]
siman.small_functions.is_string_like(s)[source]
siman.small_functions.is_unique(d, dist, prec=0.001)[source]

check if d is unique within the provided precision in the given list dist return 1 if unique, else 0

siman.small_functions.latex_chem(formula)[source]
siman.small_functions.latex_spg(spg)[source]
siman.small_functions.list2string(ilist, joiner=' ')[source]
siman.small_functions.makedir(path, renew_folder=False)[source]

path - path to some file Make dirname(path) directory if it does not exist

siman.small_functions.merge_dics(dic1, dic2)[source]

return dic

siman.small_functions.normal(v1, v2)[source]
siman.small_functions.red_prec(value, precision=100.0)[source]
siman.small_functions.return_xred(xr, shift=0)[source]
siman.small_functions.setting_sshpass(cl=None, clust=None)[source]

Creates some variables for sshpass mode cl (Caluculation) - object, should contain cluster dict, has higher priority clust (dict) - cluster dicts

siman.small_functions.vec_l(vec)[source]

siman.table_functions module

siman.workflow_utilities module

siman.workflow_utilities.create_segregation_cases(it, ise, verlist, dist_gb, gbpos=None, ise_new=None, option=None, precip_folder=None, use_init=False, precision=None)[source]

Written for Ti-Fe project. Allows to create segregation by substituting atoms; dist_gb - distance from gb inside which the atoms are included

option = ‘precip’- adding additional impurities to the already existing at gb. Please use ‘precip_folder’ use_init - allows to use initial structure.

!Warning PBC are not used in determination of seg positions

siman.workflow_utilities.make_defect(cl, el, st_type='end', option='vac', pos=None, ise=None, opt_vol=0, suf='', it_folder=None, el_rep='', pos_rep=1, pos_rep2=None, polaron_pos=None, occ_matrix=None, up=0, fit=0, outcar=None, only_read=0, Eref=0, compat1=False, add_loop_arg={})[source]
Function allow to create point defects and run them
previous name: make_vacancy()

cl - starting Calculation st_type - starting structure of cl: ‘init’ or ‘end’ el - element to be removed or replaced

option -
‘vac’ - make vacancy ‘rep’ - replace one atom with ‘el_rep’, ‘pair’ - make vacancy -Ti complex for V-Ti project

pos - unique position of el if non-eqivalent atoms exist - for vac pos_rep - number of position to replace from 0

ise - new set opt_vol (bool) - optimize volume

suf (str) - mannually added suffix it_folder - mannually provided it_folder

up (bool) - [ 0, 1 ] update current calculation fit = 0, outcar = None, only_read = 0 - flow control as usual

polaron_pos - choose polaron position occ_matrix - list of lists see format in classes

compat1 - compatability with previous calculations, which were used for Na2FePO4F project

Eref - reference energy for solution energy

TODO: rename to ?_point_defects()

siman.workflow_utilities.optimize_wrapper(cl, ise, add=0, show_fit=1, params=None)[source]
siman.workflow_utilities.prepare(it_new, opt_vol, it_folder, ise, cl, st_type, option)[source]
siman.workflow_utilities.process_modified(cl, mod_dic=None, scale_region=(-4, 4), opt_vol=1, fit=0, st_type='end', name=None, el_new=None, run=0, ise=None, it_folder=None, mode=None, add_loop_arg=None)[source]

inherited from create_charges - functionality is extended The utility allows to (contrlolled by mode parameter): 1) create charged cells by removing specific atoms provided in del_dic 2) replace specific atoms

add_loop res_loop

mode -
delete remove None

mod_dic - dic of configurations with atom numbers starting from 1

siman.workflow_utilities.run_wrapper(sts, ise=None, add=0, cl=None, suf='w', it_folder=None, cls=None, ngkpt=None, acc=None, ise1=None, acc2=None, ise2=None, params=None)[source]

Add Several structures

params - pass to add_loop

if add == 0:
read results

RETURN cl with lowest energy

Module contents