siman package¶
Subpackages¶
Submodules¶
siman.3d_plot module¶
siman.SSHTools module¶
siman.analysis module¶
-
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:
- Add analysis of bond lengths to distinguish small polarons
- Janh-Teller
- 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.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.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.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.bands module¶
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, 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)¶ 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’ - outcar, chgcar, chg, dos, AECCAR,WAVECAR, xml
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
- ‘atat’ - create all input for ATAT
- params[‘atat’]
- ‘active_atoms’ - now dictionary of elements, which can be substituted by what e.g. {‘Li’:’Vac’}
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
‘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
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, 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)[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]¶ Function adds description to 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, 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)[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’ - outcar, chgcar, chg, dos, AECCAR,WAVECAR, xml
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
- ‘atat’ - create all input for ATAT
- params[‘atat’]
- ‘active_atoms’ - now dictionary of elements, which can be substituted by what e.g. {‘Li’:’Vac’}
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
‘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
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.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_file_by_version(geofilelist, version)[source]¶ Find file with needed version from filelist according to certain rules
-
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, it_folder=None, occ_atom_coressp=None, ortho=None, mul_matrix=None, 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 ionreplace_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 themconfdic
- 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 folderOutput:
noDepends from:
header.struct_des header.calcComments:
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.prepare_run()[source]¶ - INPUT:
- schedule_system - type of job scheduling system:’PBS’, ‘SGE’, ‘SLURM’
-
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 outcarsreadfiles (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
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_sge_script()
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 energiescheck_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 outcarsreadfiles (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
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_sge_script()
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 energiescheck_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.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 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.classes module¶
-
class
siman.classes.Calculation(inset=None, iid=None, output=None)[source]¶ Bases:
objectMain class of siman. Objects of this class contain all information about first-principles calculation List of important fields:
- init (Structure)
- end (Structure)
- occ_matrices (dict) - occupation matrices, number of atom (starting from 0) is used as key
-
actualize_set(curset=None, params=None)[source]¶ Makes additional processing of set parameters, which also depends on calculation
adding parameters for atat
-
add_new_name(idd)[source]¶ just adding new key in database for that calculation warning cl.id is updated; old name in db remains the calculation folder remains the same
idd - key
-
calc_kspacings(ngkpt=None, sttype='init')[source]¶ Calculates reciprocal vectors and kspacing from ngkpt
-
calculate_nbands(curset, path_to_potcar=None, params=None)[source]¶ Should be run after add_potcar() updates set, including number of electrons
-
check_kpoints(ngkpt=None)[source]¶ The method updates init.ngkpt and ngkpt_dict_for_kspacings !!! as well provides possible options for it TODO probably the method should transfered to Structure? Attention: the order should be the same as in make_kpoints_file
-
dos(isym=None, el=None, i_at=None, iatoms=None, *args, **kwargs)[source]¶ Plot dos either for self or for children with dos isym (int) - choose symmetry position to plot DOS, otherwise use i_at - number of atom from 0 iatoms - list of atom numbers (from 0) to make one plot with several dos el - element for isym, otherwise first TM is used orbitals
-
e0_at¶
-
get_file(filetype='', nametype='', up='up1', root=0)[source]¶ allow to get any file of type filetype cl - (Calculation) filetype (str) - ‘CHG’, ‘CHGCAR’, etc just the name of file in calculation folder nametype (str) - ‘asoutcar’ - update filetype to OUTCAR format up (str) - control flag
‘1’ - do not update ‘2’ - updateroot - root calculation folder location of file
- Comment
- initially used for chg files - rename!
-
mag_diff(cl2, dm_skip=0.5, el='FeNiCoVMnO', more=0)[source]¶ rms difference of magmom, skippting large deviations, due to defects dm_skip (float) - skip differences larger than this el (str) - only for this element, could be several more (bool) - show more info about mag diff at each pos the order of elements should be the same!!!
-
occ_diff(cl2, li_at1=None, li_at2=None)[source]¶ difference bettween occupation matricies for atoms li_at1 from self and li_at2 from cl2
li_at1 - list of atom numbers from self li_at2 - list of atom numbers from cl2 both lists should have the same length and the differences are taken between items at the same positions in lists
otherwise
self and cl2 should be commensurate, ideally having completly the same order of atoms first five for spin up then five for spin down
-
serialize_json(filename)[source]¶ save in json object - works the problem is how to decode correctly
-
sfolder¶
-
write_geometry(geotype='init', description='', override=False, atomic_units=0)[source]¶ Writes geometrical data in custom siman format bases on abinit format to self.path[“input_geo”]
-
write_sge_script(input_geofile='header', version=1, option=None, prevcalcver=None, savefile=None, schedule_system=None, output_files_names=None, mode=None, batch_script_filename=None)[source]¶ Without arguments writes header, else adds sequence of calculatios option - the same as inherit_option, ‘inherit_xred’ - control inheritance, or ‘master’ - run serial on master prevcalcver - ver of previous calc; for first none savefile - ‘cdawx’, where c-charge, d-dos, a- AECCAR, w-wavefile, x-xml schedule_system - type of job scheduling system:’PBS’, ‘SGE’, ‘SLURM’,
‘none’ - just run without any system- mode -
- body footer
-
class
siman.classes.CalculationAbinit(inset=None, iid=None, output=None)[source]¶ Bases:
siman.classes.Calculationdocstring for CalculationAbinit
-
class
siman.classes.CalculationAims(inset=None, iid=None, output=None)[source]¶ Bases:
siman.classes.Calculationobject for Aims code
-
class
siman.classes.CalculationVasp(inset=None, iid=None, output=None)[source]¶ Bases:
siman.classes.CalculationMethods for calculations made using VASP DFT code
-
full(ise=None, up=0, fit=1, suf='', add_loop_dic=None, up_res='up1')[source]¶ Wrapper for full optimization ise (str) - optimization set; if None then choosen from dict up (int) - 0 read results if exist, 1 - update fit (int) - 1 or 0 suf - additional suffix
-
get_occ_mat(i)[source]¶ return occupation matrix for atom i (from zero)
TODO: probably it is better to move occ_matrix to structure class and make this method their
-
make_incar()[source]¶ Makes Incar file for current calculation and copy all TO DO: there is no need to send all POSCAR files; It is enothg to send only one. However for rsync its not that crucial
-
read_pdos_using_phonopy(mode='pdos', poscar='', plot=1, up='up1')[source]¶ - mode -
- pdos band free - thermal properties, converted to eV!!!
-
read_results(load='', out_type='', voronoi=False, show='', choose_outcar=None, alkali_ion_number=None, only_load=False)[source]¶ Download and Read VASP OUTCAR file
- ###INPUT:
- load (str) - ‘x’ - download xml, o - download outcar and contcar, un - read unfinished
- show (str) - print additional information
- alkali_ion_number - show mag around this ion
- choose_outcar - see description in res_loop(), from 1
- out_type - controls the return string
- see in code, add here also controls reading of OUTCAR ‘xcarts’ read xcart every relaxation step and write into self.end.list_xcart
- only_load (bool) - if true - only load the files (used for database)
- ###RETURN:
- ?
###DEPENDS: TODO: please split into outcar parser, downloader, and checker-formatter
-
run(ise, iopt='full_nomag', up='up1', vers=None, i_child=-1, add=0, it_suffix_del=True, *args, **kwargs)[source]¶ Wrapper for add_loop (in development). On a first run create new calculation. On a second run will try to read results. All children are saved in self.children list. By default uses self.end structure To overwrite existing calculation use combination of parameters: add = 1, up = ‘up2’. Allows to use all arguments available for add_loop()
- INPUT:
ise (str) - name of new set available in header.varset
- iopt (str) - inherit_option
- ‘full_nomag’ - full without magmom ‘full’ - full with magmom ‘full_chg’ - full with magmom and including chg file
- up (str) - update key transferred to add_loop and res_loop;
- ‘up1’ - create new calculation if not exist ‘up2’ - recreate new calculation overwriting old; for reading results redownload output files
vers (list of int) - list of version for which the inheritance is done
- i_child (int) - choose number of child in self.children to run res_loop(); can be relevant if more than one
- calculation exists for the same set
- add (bool) -
- 1 - overwrite existing children
it_suffix_del (bool) - needed to be false to use it_suffix with run. Provides compatibility with old behaviour; should be improved
- RETURN:
- cl (Calculation) - new created calculation
TODO: 1. if ise is not provided continue in the same folder under the same name, however, it is not always what is needed, therefore use inherit_xred = continue
-
set_occ_mat(i, m)[source]¶ set occupation matrix m for atom i (from zero)
TODO: probably it is better to move occ_matrix to structure class and make this method their
-
vasp_dipole_center()[source]¶ Determine dipole center in reduced coordinates based on vasp definition, https://www.vasp.at/wiki/index.php/DIPOL as only number of position of minimum charge density is given
TODO works only in the case of dipole along z axis, as min_pos is read only for one direction
-
write_structure(name_of_output_file, type_of_coordinates='dir', option=None, prevcalcver=None, path=None, state='init')[source]¶ Generates POSCAR file type_of_coordinates - ‘direct’ (xred) or ‘cartesian’ (xcart) option -inheritance option prevcalcver - ver of first calc in calc list; for first None state - ‘init’ or ‘end’
-
-
class
siman.classes.Description(sectionfolder='forgot_folder', description='forgot_description')[source]¶ Bases:
objectObjects 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:
objectThis class includes information about chemical compounds from MatProj and next operations (bulk calc, slab construction etc.)
db key is ‘pretty_formula.MP’: (‘AgC.MP’)
-
class
siman.classes.Structure[source]¶ Bases:
objectThis class includes only structure related information such as primitive vectors, coordinates, forces and so on
-
add_atom(xr=None, element='Pu', xc=None, selective=None)[source]¶ allows to add one atom using reduced coordinates or cartesian xr - reduced xc - cartesian element - element name
-
add_atoms(atoms_xcart=None, element='Pu', return_ins=False, selective=None, atoms_xred=None, mag=None)[source]¶ appends at the end if element is new. Other case insertered according to VASP conventions Updates ntypat, typat, znucl, nznucl, xred, magmom and natom atoms_xcart (list of ndarray) atoms_xred (list of coordinate lists) - if provided both, this has higher priority
selective (list of lists) - selective dynamics
- mag magnetic moment of added atoms, if None, than 0.6 is used
- magmom is appended with 0.6, please improve me! by using the corresponding list of magmoms
- if return_ins:
- Returns Structure(), int - place of insertion of first atom
- else:
- Structure()
-
add_vacuum(vector_i, thickness)[source]¶ Allows to add or remove vacuum along one of the rprimd vectors vector_i (int) - index of vector along which vacuum should be added 0, 1, 2 thickness (float) - thickness of added (positive) or removed (negative) vacuum
TODO: add capability to add vacuum normal to surface in case of non-orthogonal cells
-
combine(st_list, only_numbers=None)[source]¶ Combine several structures into one using reduced coordinates
-
combine_atoms(d=0.1)[source]¶ Combine close-lying atoms into one d (float) - all atoms with d less then d are combined into one in Angstrom
-
convert2pymatgen(oxidation=None, slab=False, chg_type='ox')[source]¶ oxidation (dict) - {‘Ti’:’Ti3+’} if self.charges exist then it is used to update oxidation states of atoms chg_type - ‘ox’ - oxidation states calculated from self.charges
- ‘norm’ - normalized self.charges
- ‘tot’ - just self.charges ‘pot’ - charges from potentials zval, number of valence electrons ‘pm’ - guess oxidation states using pymatgen, s
slab - if True return slab object is returned - limited functional is implemented
-
cover_surface(el, d=1)[source]¶ Covers both surfaces of the slab with element el, each surface atoms on top positions
the third vector should be parallel to z axis
el - element name d - distance in A
-
del_atom(iat)[source]¶ Now can delete only one atom with number iat (int), starting from 0. Takes care of magmom, ntypat, typat, znucl, nznucl, xred and natom Returns Structure()
-
del_layers(xred_range=None, xcart_range=None)[source]¶ remove atoms normal to R3 in given range
xred_range (list) [from, to] highlight - replace with Pu to check
-
distance(i1=None, i2=None, x1=None, x2=None, coord_type='xcart')[source]¶ Shortest distance between two atoms acounting PBC, from 0 i1 and i2 override x1 and x2
coord_type - only when x1 and x2 are provided
-
el_diff(st2, mul=1, silent=0)[source]¶ Determine difference in number of atoms between two structures self and st2 mul (int) - allows to compare supercells; self.natom = mul * st2.natom
RETURN: dict[key], where key is element and the value is difference in number of atoms of this element
-
find_atom_num_by_xcart(x_tar, prec=1e-06, search_by_xred=1)[source]¶ take into account periodic conditions
search_by_xred - use xred to search with PBC prec - difference in atomic positions in A; transformed to reduced difference using the longest vector
TODO: make normal function that treats periodic boundary conditions normally!!!
done please test
-
find_closest_atom(xc=None, xr=None)[source]¶ Find closest atom in structure to xc (cartesian) or xr (reduced) coordinate
RETURN: i shifts, and dist
-
find_unique_topologies(el1, el2, nn=6, tol=0.5, told=0.005, tolmag=0.4, write_loc=0)[source]¶ Looks for unique topologies Currently only octahedral and pentahedral are realized
el1, el2 (str) - elements that forms topology nn (int) - number of neighbours for topology analysis tol (float) - tolerance for unique centers defined by deviation, mA told (float) - tolerance for distances applied for grouping bonds, A tolmag (float) - tolerance for magnetic moments works with tol write_loc (int) - write local topology
-
fix_layers(xred_range=None, xcart_range=None, highlight=False)[source]¶ fix atoms in layers normal to R3
xred_range (list) [from, to] highlight - replace with Pu to check
-
generate_charge_orders(el, states=None, x=0.5)[source]¶ Method generates charge order for provided ion, oxidation states, and ratio (not realized yet)
- INPUT:
- el (str) - element with charge order states (tuple) - two possible charge states (e.g. +2 and +4) x (float) - concentration of ions with state[0] charge state
- RETURN:
- oxi_states (list of lists) - list of oxi_state lists
-
get_dipole(ox_states=None, chg_type='ox')[source]¶ Return dipole moment in e*A calculated by pymatgen ox_states (dict) - oxidation states of elements chg_type (str) - type of charges if provided in self.charges; see description of self.convert2pymatgen()
If you need to convert e*A to debye (D), use 1 D = 0.20819434 eA = 3.33564×10−30 Cm; 1 eA = 4.8 D
-
get_maglist()[source]¶ return bool list of which elements are magnetic (here all transition metals are searched!) and dictionary with numbers in lists for each transition metal
- RETURN:
- ifmaglist (list of bool) - magnetic or not mag_numbers (dict of int) - for each element using z, their numbers
-
get_nznucl()[source]¶ list of numbers of atoms of each type, order is as in typat and znucl updated directly
-
get_oxi_states(typ='charges')[source]¶ Create and return list of oxidation states from charges and valences self.charges should exist as full charges (e.g. from Bader analysis)
- INPUT:
- typ (str)
- ‘charges’ - from charges and zval ‘guess’ - from guess
- RETURN
- oxi (list) - list of oxidation states for each atom
-
get_refined_structure()[source]¶ Get the refined structure based on detected symmetry. The refined structure is a conventional cell setting with atoms moved to the expected symmetry positions.
-
get_specific_elements(required_elements=None, fmt='n', z_range=None, zr_range=None)[source]¶ Returns list of specific elements (chemical names. z, or numbers from 0) in the structure required_elements - list of elements z of interest z_range - (2 index tuple) range of z coordinates in A: only atoms from z1 to z2 are taken fmt - format of output
‘names’ ‘z’ ‘n’ - numbers of atoms ‘x’ - xcart ‘xr’ - xred
-
get_surface_atoms(element=None, surface=0, surface_width=0.5)[source]¶ - return numbers of surface atoms
- elememt (str) - which element is interesting? can be CoO to take two elements; if None than all elements are takes surface_width - which atoms to consider as surface surface (int) - 0 or 1 - one of two surfaces; surface 1 has smaller z coordinate TODO - now only along third vector, make more general PBC may work incorrect
-
get_surface_pos(reduced=False)[source]¶ Allows to return positions of bottom and top surfaces (edge atoms) in cartesian assumed normal to R3 small number is added or subtracted to/from edge atom to overcome further numericall errors
reduced - reduced coordinatesreturns list of two z coordinates [bottom, top]
-
get_symmetry_operations(symprec=0.1)[source]¶ Return symmetry operations as a list of SymmOp objects. By default returns fractional coord symmops. But cartesian can be returned too.
-
get_transition_elements(fmt='names')[source]¶ Returns list of transition elements (chemical names or z) in the structure fmt -
‘names’ ‘z’ ‘n’ - numbers of atoms
-
group_magmom(tol=0.3)[source]¶ Group magmom according to values tol - tolerance according to which the magmom are grouped
-
jmol(shift=None, r=0, show_voids=False, rep=None, program='jmol')[source]¶ open structure in Jmol or vesta
INPUT: shift (list) - shift vector in reduced coordinates r (int ) - parameter
0 - open POSCAR 1 - open OUTCAR to see optimization steps 2 - open mcif to see magnetic moments 3 - xyzshow_voids (bool) - replace voids (z = 300) with Po to visualize them rep (list 3*int) - replicate along vectors program -
‘jmol’ ‘vesta’
-
localize_polaron(i, d, nn=6)[source]¶ Localize small polaron at transition metal by adjusting TM-O distances i - number of transition atom, from 0 d - shift in angstrom; positive increase TM-O, negative reduce TM-O distance nn - number of neigbours
-
localize_polaron_dist(i_center, d, nn=6, axis=None, direction=None, mode='axis_expand')[source]¶ localization small polaron at transition metal by adjusting TM-O distances with distortions i_center - number of transition atom, from 0 d - shift in angstrom; positive increase TM-O, negative reduce TM-O
or shift along directionnn - number of neighbors axis - axis of octahedra, 0, 1, 2, direction - vector to shift central atom in reduced coordinates
Axes of octahedra are determined relative to cartesian coordinates- mode
- ‘axis_expand’ ‘shift_center’
TODO Make it more general to include any ligands; now only O and F are supported Make for other topologies, now tested only for octa
-
mov_atoms(iat=None, to_x=None, to_xr=None, relative=False)[source]¶ Move one atom to xcart position to_x relative (bool) - if shift is relative
-
nn(i, n=6, ndict=None, only=None, silent=0, from_one=True, more_info=0, oxi_state=0, print_average=0)[source]¶ show neigbours
INPUT: i - number of central atom, from 1 or 0 (from_one = True or False) n - number of neigbours to return ndict (dic) - number of specific neigbour atoms to take into account e.g ndict = {8:3} - 3 oxygen atoms will be considered only - list of interesting z neighbours
more_info - return more output - takes time
from_one - if True, strart first atom from 1, otherwise from 0
oxi_state (bool) - if 1 then showing oxidation state as well
print_average (bool) - print more
- RETURN
- dict with the following keys: ‘av(A-O,F)’ ‘numbers’ ‘dist’ ‘xcart’ ‘st’ - surrounding
- Important:
- ‘numbers’ from 0 in the new version!!!!!
-
permutate_to_ref(st_ref)[source]¶ Permutate atom numbers of self according to st Structures should have the same amount of atoms and be quite similar the self can have one extra type of atoms
#TODO: now extra atom types could be only in self structure
-
remove_atoms(atoms_to_remove, from_one=0, clear_magmom=1)[source]¶ remove atoms either of types provided in atoms_to_remove or having numbers provided in atoms_to_remove, starting from 0 st (Structure) atoms_to_remove (list) - list of element names or numbers from_one (int)- if 1 the numbers of atoms in provided list are starting from one clear_magmom - by default magmom is cleared
-
remove_close_lying(rm_both=0, rm_first=0, tol=0.4)[source]¶ rm_both (bool) - if True than remove both atoms, if False than only the second atom is removed rm_first (bool) - if True than the first atom of two overlapping is removed, otherwise the second atom is removed tol (float) - atoms separated by distance less than tol A are removed
PBC is realized through image_distance
- SIDE:
- write _removed field to returned st
- TODO:
- Works incorrectly for more than one overlap !!!
-
remove_close_lying2(tol=0.4)[source]¶ Very fast removal, linear with respect to number of atoms Support multiple overlaps Makes a mesh with cubes and determine wich atoms appeared in the mesh
Leaves only the first entry, the rest are removed
TODO: A problem may occur if two-close lying atoms goes into neibouring bins
This may be solved by making three additional meshes, where all atoms are shifted by (tol/2, 0, 0), (0, tol/2, 0), (0, 0, tol/2)- Problem with PBC, not taken into account
- can be solved by making mesh for atoms with (tol, tol, tol) shift
Then all overlaps detected on any mesh are treated
Replace all overlapping atoms by their center of gravity.
-
remove_part(element, new_conc)[source]¶ element to remove new_conc <1 - new concentration of element atoms (part of unity)
-
reorder(new_order)[source]¶ Reorder according to new_order list, len(new_order) should be equal to natom
-
reorder_element_groups(order=None, inplace=False)[source]¶ Group and order atoms by atom types; consistent with VASP order (list) -required order e.g. [‘O’, ‘Li’] or str ‘alphabet’
return st
-
reorder_for_vasp(inplace=False)[source]¶ Group and order atoms by atom types; consistent with VASP return st
-
replace_atoms(atoms_to_replace, el_new, mag_new=None, silent=1, mode=1)[source]¶ atoms_to_replace - list of atom numbers starting from 0 el_new - new element periodic table short name mag_new - new magnetic moment mode
1 - old behaviour, numbering is not conserved 2 - numbering is conserved if el_new already exists in selfTODO: Now if el_new already exists in structure, numbering is conserved, otherwise numbering is not conserved. Make numbering conservation in case when new element is added Both modes can be useful, as the first case is compat with VASP
-
replace_atoms2(el_old, el_new, concentration)[source]¶ Replace atoms using random
el_old - element to replace
el_new - new element
concentration - part of atoms el_old to replace by el_new. Number from 0 to 1.
-
rotate(axis, angle)[source]¶ Rotate relative to cartesian coordinates axis - list of 3 elements, [0,0,1] in cartesian coordinates angle in degrees
-
selective_byCompare(st2, tol=0.0001, freeze='present')[source]¶ set selective dynamics falgs in the calling structure (self) by freezing the atoms that are present (or missing) in the supplied structure (st2) tol - tolerance for finding the same atoms in the two structures freeze = ‘present’ or ‘missing’
TODO: read st2 from file optional save flag-changed atoms to cif (to check the result)
-
shake_atoms(amplitude=0.1, el_list=None)[source]¶ Randomly shake atoms around the lattice amplitude (float) - maximum shift in A it is multiplied by random vector el_list (list of int) - shake only el atoms, None - shake all atoms
-
shift_atoms(vector_red=None, vector_cart=None, return2cell=1)[source]¶ Shift all atoms according to vector_red or vector_cart Use return2cell if atoms coordinates should be inside cell
-
update_from_pymatgen(stpm)[source]¶ stpm - pymatgen structure update the current structure from pymatgen structure stil experimental!!!!!
TODO:
-
vlen¶
-
write_cif(filename=None, mcif=False, symprec=0.1, write_prim=0)[source]¶ Find primitive cell and write it in cif format
filename (str) - name of produced cif file mcif (bool) - if True, than write mcif file with magnetic moments included, primitive cell is not supported symprec (float) - symmetry precision, symprec = None allows to write the structure as is write_prim (bool) - convert structure to primitive
-
write_poscar(filename=None, coord_type='dir', vasp5=True, charges=False, energy=None, selective_dynamics=False, shift=None)[source]¶ write
charges (bool) - write charges, self.charges should be available energy - write total energy
- selective dynamics -
- if at least one F is found than automatically switched on !works only for coord_type = ‘dir’ and charges = False None - not written
shift - shift atoms
NOTE #void element type is not written to POSCAR
- TODO
- selective_dynamics for coord_type = ‘cart’ Velocity and predictor are not reordered; Can be used only for continiue MD
-
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
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.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.check_output(filename, check_string, load)[source]¶ Check if file exist and it is finished by search for check_string
-
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.invert(el)¶
-
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_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_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.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.salary_inflation()[source]¶ Calculate salary growth in Russia taking into account inflation
-
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.update_incar(parameter=None, value=None, u_ramp_step=None, write=True, f=None, run=False, st=None)[source]¶ Modifications of INCAR. Take attention that parameter will be changed to new value if it only already exist in INCAR. u_ramp_step-current step to determine u, write-sometimes just the return value is needed. Returns U value corresponding to u_ramp_step.
siman.geo module¶
-
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.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 configurationsunder_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.determine_symmetry_positions(st, element, silent=0)[source]¶ determine non-equivalent positions for atoms of type element
element (str) - name of element, for example Li
return list of lists - atom numbers for each non-equivalent position
-
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
-
siman.geo.find_voids(st1, st2)[source]¶ Function returns structure with voids in the position of removed atoms
-
siman.geo.flatten()¶ chain.from_iterable(iterable) –> chain object
Alternate chain() constructor taking a single iterable argument that evaluates lazily.
-
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.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, 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}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.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.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
- 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)[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
TODO 1. Take care about matching the initial cell and supercell from primitive Now the manual shift is done
- Make full conversion from pymat structure to mine
-
siman.geo.remove_x_based_on_symmetry(st, sg=None, info_mode=0, x=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.rms_pos_diff(st1, st2)[source]¶ Calculate rms difference of atomic positions, excluding moving atom
-
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.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.header module¶
-
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.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.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.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_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.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_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.exchange_atoms(st, xcart_voids, z2, thickness, zr=None, condition=None)[source]¶ Swap two atoms xcart_voids - list of xcart of voids voidz - list with z voids; actually either None or [300] zr - position of 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)
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', 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
- ###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
- 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.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.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=True, fig_format='eps', 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]¶ Plot multiple plots on one axes using data
return filename of saved plot
ax (axes) - matplotlib axes object - to create multiple axes plots
- data - each entry should be
- (X, Y, fmt) or (X, Y, fmt, label) or {‘x’:,’y’:, ‘fmt’:, ‘label’, ‘xticks’ } not implemented for powers and scatter yet or (X, Y, R, fmt) - for scatter = 1, R - size of spots
first, last - allows to call this function multiple times to put several plots on one axes. Use first = 1, last = 0 for the first plot, 0, 0 for intermidiate, and 0, 1 for last
power (int) - the power of polynom, turn 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 - dictionary with parameters
- ‘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
-
siman.picture_functions.plot_and_annotate(power=2, xlabel='xlabel', ylabel='ylabel', image_name=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, image_name=None, title=None, bottom=0.18, hspace=0.15, barwidth=0.2, data1=[], data2=[], data3=[], data4=[], **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 pointsplot - if plot or not
siman.project_funcs module¶
siman.set_functions module¶
-
class
siman.set_functions.InputSet(ise=None, path_to_potcar=None)[source]¶ Bases:
objectdocstring 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 !
-
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.read_vasp_sets(user_vasp_sets, override_global=False)[source]¶ Read user sets and add them to project database Now for VASP ###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¶
-
siman.small_functions.block_print()[source]¶ Blocks standard output. It may be used in functions that do not have silent mode.
-
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_mismatch(a, b)[source]¶ relative mistmatch between the lattice vectors a and b
-
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.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.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