Skip to content

Commit

Permalink
Commented out core_width_analysis method.
Browse files Browse the repository at this point in the history
  • Loading branch information
bjmorgan committed Jul 5, 2021
1 parent 52a1aba commit afb4475
Showing 1 changed file with 43 additions and 37 deletions.
80 changes: 43 additions & 37 deletions pyscses/set_of_sites.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,40 +246,46 @@ def set_of_sites_from_input_data(cls: object,
line[4] = 0.0
return SetOfSites([site_from_input_file(line, defect_species, site_charge, core, temperature) for line in site_data])

@ classmethod
def core_width_analysis(cls,
input_data, limits, defect_species, site_charge, core, temperature ):
"""
Calculated the width of the 'core' region. This is given as the region where the segregation energies in the system are within a region of positive to negative kT.
Args:
input_data (file): A .txt file where each line includes information about a site.
limits (list): Minimum and maximum x coordinates defining the calculation region.
defect_species (object): Class object containing information about the defect species present in the system.
site_charge (bool): The site charge refers to the contribution to the overall charge of a site given by the original, non-defective species present at that site. True if the site charge contribution is to be included in the calculation, False if it is not to be included.
core (str): Core definition. Allowed keywords: 'single' = Single segregation energy used to define the core. 'multi-site' = Layered segregation energies used to define the core while the energies fall in the region of positive and negative kT. 'all' = All sites between a minimum and maximum x coordinate used in calculation.
temperature (float): Temperature that the calculation is being run at.
Returns:
float: Distance between the minimum and maximum x coordinates where the segregation energy is in the range of positive to negative kT.
"""
site_data = load_site_data( input_data, limits[0], limits[1], site_charge )
energies = [ line[4] for line in site_data ]
min_energy = min(energies)
if core == 'single':
for line in site_data:
if line[4] > min_energy:
line[4] = 0.0
#print(boltzmann_eV * temperature, flush=True)
if core == 'multi_site':
for line in site_data:
if ( -boltzmann_eV * temperature) <= line[4] <= ( boltzmann_eV * temperature ):
line[4] = 0.0
energies = [line[4] for line in site_data ]
x = [line[2] for line in site_data ]
x_seg = np.column_stack(( x, energies ))
minval = np.min(x_seg[:,0][np.nonzero(x_seg[:,1])])
maxval = np.max(x_seg[:,0][np.nonzero(x_seg[:,1])])
core_width = maxval-minval
return core_width
# BEN: Is this used?
# @ classmethod
# def core_width_analysis(cls,
# input_data,
# limits,
# defect_species,
# site_charge,
# core,
# temperature):
# """
# Calculated the width of the 'core' region. This is given as the region where the segregation energies in the system are within a region of positive to negative kT.
#
# Args:
# input_data (file): A .txt file where each line includes information about a site.
# limits (list): Minimum and maximum x coordinates defining the calculation region.
# defect_species (object): Class object containing information about the defect species present in the system.
# site_charge (bool): The site charge refers to the contribution to the overall charge of a site given by the original, non-defective species present at that site. True if the site charge contribution is to be included in the calculation, False if it is not to be included.
# core (str): Core definition. Allowed keywords: 'single' = Single segregation energy used to define the core. 'multi-site' = Layered segregation energies used to define the core while the energies fall in the region of positive and negative kT. 'all' = All sites between a minimum and maximum x coordinate used in calculation.
# temperature (float): Temperature that the calculation is being run at.
#
# Returns:
# float: Distance between the minimum and maximum x coordinates where the segregation energy is in the range of positive to negative kT.
#
# """
# site_data = load_site_data( input_data, limits[0], limits[1], site_charge )
# energies = [ line[4] for line in site_data ]
# min_energy = min(energies)
# if core == 'single':
# for line in site_data:
# if line[4] > min_energy:
# line[4] = 0.0
# #print(boltzmann_eV * temperature, flush=True)
# if core == 'multi_site':
# for line in site_data:
# if ( -boltzmann_eV * temperature) <= line[4] <= ( boltzmann_eV * temperature ):
# line[4] = 0.0
# energies = [line[4] for line in site_data ]
# x = [line[2] for line in site_data ]
# x_seg = np.column_stack(( x, energies ))
# minval = np.min(x_seg[:,0][np.nonzero(x_seg[:,1])])
# maxval = np.max(x_seg[:,0][np.nonzero(x_seg[:,1])])
# core_width = maxval-minval
# return core_width

0 comments on commit afb4475

Please sign in to comment.