Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/dimonaks/siman
Browse files Browse the repository at this point in the history
  • Loading branch information
dimonaks committed Jul 18, 2021
2 parents 5801669 + 03c4854 commit f50e133
Show file tree
Hide file tree
Showing 6 changed files with 365 additions and 30 deletions.
4 changes: 2 additions & 2 deletions siman/analysis.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

# -*- coding: utf-8 -*-
#Copyright Aksyonov D.A
from __future__ import division, unicode_literals, absolute_import
Expand Down Expand Up @@ -68,7 +69,7 @@ def calc_oxidation_states(cl = None, st = None, silent = 1):
z_vals.append(ox)
if not silent:
''
print(el, '{:3.1f}'.format(ox))
print(j, st.xred[j][2], el, '{:3.1f}'.format(ox))
# print(list(zip(z_vals, self.end.get_elements())))
# print(z_vals)
return z_vals
Expand Down Expand Up @@ -1559,7 +1560,6 @@ def suf_en(cl1, cl2, silent = 0, chem_pot = None, return_diff_energy = False, ev
else:
return gamma


def suf_en_polar_layered(formula, cl_surf, dmu_a = 0, dmu_b = 0, dmu_c = 0, printlog = True):
#This function calculates an energy of polar surface using chemical potentials for every elements
#Ef = Etot(AxByCz) - (xμA + yμB + zμC)
Expand Down
36 changes: 18 additions & 18 deletions siman/classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
get_from_server, push_to_server, run_on_server, smoother, file_exists_on_server, check_output)
from siman.inout import write_xyz, write_lammps, read_xyz, read_poscar, write_geometry_aims, read_aims_out, read_vasp_out
from siman.geo import (image_distance, replic, calc_recip_vectors, calc_kspacings, xred2xcart, xcart2xred,
local_surrounding, local_surrounding2, determine_symmetry_positions, )
local_surrounding, local_surrounding2, determine_symmetry_positions, remove_closest, remove_vacuum, make_neutral)
from siman.set_functions import InputSet, aims_keys


Expand Down Expand Up @@ -1049,6 +1049,11 @@ def order(ls, i):
# print(oxi_state[0:8])
return oxi_states


def make_neutral(self, *args, **kwargs):
return make_neutral(self, *args, **kwargs)


def get_conventional_cell(self):
"""
return conventional cell
Expand Down Expand Up @@ -1247,11 +1252,11 @@ def get_surface_area(self):
return np.linalg.norm( np.cross(st.rprimd[0] , st.rprimd[1]) )



def printme(self):
print(self.convert2pymatgen())
return


def get_space_group_info(self, symprec = None):

default = 0.01
Expand Down Expand Up @@ -1329,6 +1334,7 @@ def get_transition_elements(self, fmt = 'names'):
tra = ns
return tra


def get_specific_elements(self, required_elements = None, fmt = 'n', z_range = None, zr_range = None):
"""Returns list of specific elements (chemical names. z, or numbers from 0) in the structure
required_elements - list of elements z of interest
Expand Down Expand Up @@ -1380,7 +1386,6 @@ def additional_condition(xr):
return tra



def get_dipole(self, ox_states = None, chg_type = 'ox'):
""" Return dipole moment in e*A calculated by pymatgen
ox_states (dict) - oxidation states of elements
Expand All @@ -1392,8 +1397,6 @@ def get_dipole(self, ox_states = None, chg_type = 'ox'):
return slab.dipole




def add_atoms(self, atoms_xcart = None, element = 'Pu', return_ins = False, selective = None, atoms_xred = None, mag = None):
"""
appends at the end if element is new. Other case insertered according to VASP conventions
Expand Down Expand Up @@ -2173,7 +2176,6 @@ def add_vacuum(self, vector_i, thickness):




# def sum_of_coord(self):
# sumx = 0
# for x in self.xcart:
Expand Down Expand Up @@ -2365,7 +2367,7 @@ def find_atom_num_by_xcart(self, x_tar, prec = 1e-6, search_by_xred = 1 ):
def shift_atoms(self, vector_red = None, vector_cart = None, return2cell = 1):
"""
Shift all atoms according to *vector_red* or *vector_cart*
Use *return2cell* if atoms coordinates should be inside cell
Use *return2cell* if atoms coordinates should be inside cell
"""
st = copy.deepcopy(self)
if vector_cart is not None:
Expand Down Expand Up @@ -2586,13 +2588,13 @@ def remove_close_lying2(self, tol = 0.4):
return st


def remove_closest(self, *args, **kwargs):
return remove_closest(self, *args, **kwargs)







def remove_vacuum(self, *args, **kwargs):
return remove_vacuum(self, *args, **kwargs)


def find_closest_atom(self, xc = None, xr = None):
Expand Down Expand Up @@ -3169,15 +3171,16 @@ def ewald(self, ox_st = None, site = None):
# site if provided (from 0), than site energy is printed
from pymatgen.analysis.ewald import EwaldSummation
# from siman.analysis import set_oxidation_states
st = self

st = copy.deepcopy(self)

if ox_st == 1:
# st = set_oxidation_states(st)
# st.printme()
#st.printme()
stpm = st.convert2pymatgen(chg_type = 'pm')
# print('The following oxi states were set', st.oxi_state)
if ox_st == 2:
elif ox_st == 2:
stpm = st.convert2pymatgen(chg_type = 'pot')

else:
stpm = st.convert2pymatgen()

Expand Down Expand Up @@ -7285,6 +7288,3 @@ def calc_ec_es(self, ev = 0):
except AttributeError:
self.ec_es = None




0 comments on commit f50e133

Please sign in to comment.