示例#1
0
    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 
示例#2
0
    def set_of_sites_from_input_data( cls, input_data, limits, defect_species, site_charge, core, temperature, offset=0.0 ):
        """
        Takes the data from the input file and creates a Set_of_Sites object for those sites. 
	The input data file is a .txt file where each line in the file corresponds to a site. The values in each line are formatted and separated into the corresponding properties before creating a Site object for each site.

        Args:
	    input_data (file): A .txt file where each line includes the information about a site. 
	    limits (list): Minimum and maximum x coordinated 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. '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:
	    :obj:`Set_of_Sites`: `Set_of_Sites` object for the input data.

 	"""
        site_data = load_site_data( input_data, limits[0], limits[1], site_charge, offset )
        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
        if core == 'multi_site':
            for line in site_data:
                if ( -boltzmann_eV * temperature) <= line[4] <= ( boltzmann_eV * temperature ):
                    line[4] = 0.0
        return Set_of_Sites( [ site_from_input_file( line, defect_species, site_charge, core, temperature ) for line in site_data ] )