diff --git a/macrodensity/density.py b/macrodensity/density.py index 4ab1c2f..855779c 100755 --- a/macrodensity/density.py +++ b/macrodensity/density.py @@ -243,23 +243,23 @@ def spherical_average( resolution_x = vector_a/NGX resolution_y = vector_b/NGY resolution_z = vector_c/NGZ - grid_pot, electrons = density_2_grid(cube_pot, NGX, NGY, NGZ, type="CUBE") + grid_pot, electrons = density_2_grid(cube_pot, NGX, NGY, NGZ, config="CUBE") elif 'vasp' in input_file or 'LOCPOT' in input_file or 'CHGCAR' in input_file: vasp_pot, NGX, NGY, NGZ, lattice = read_vasp_density(input_file) vector_a,vector_b,vector_c,av,bv,cv = matrix_2_abc(lattice) resolution_x = vector_a/NGX resolution_y = vector_b/NGY resolution_z = vector_c/NGZ - grid_pot, electrons = density_2_grid(vasp_pot, NGX, NGY, NGZ, type="VASP") + grid_pot, electrons = density_2_grid(vasp_pot, NGX, NGY, NGZ, config="VASP") elif 'gulp' in input_file or '.out' in input_file: gulp_pot, NGX, NGY, NGZ, lattice = read_gulp_density(input_file) vector_a,vector_b,vector_c,av,bv,cv = matrix_2_abc(lattice) resolution_x = vector_a/NGX resolution_y = vector_b/NGY resolution_z = vector_c/NGZ - grid_pot, electrons = density_2_grid(gulp_pot, NGX, NGY, NGZ, type="GULP") + grid_pot, electrons = density_2_grid(gulp_pot, NGX, NGY, NGZ, config="GULP") else: - raise ValueError("Invalid input file. File must be in VASP, GULP, or CUBE type.") + raise ValueError("Invalid input file. File must be in VASP, GULP, or CUBE configuration.") cube = cube_size origin = cube_origin travelled = [0,0,0] @@ -392,7 +392,7 @@ def density_2_grid( nz: int, charge: bool=False, volume: float=1, - type: str = 'VASP' + config: str = 'VASP' ) -> tuple: """ Convert density data to a 3D grid. @@ -412,7 +412,7 @@ def density_2_grid( volume (float, optional): volume of the grid cell. Used to convert charge density to electrons. Default is 1. - type (str, optional): type of the density data (e.g., 'VASP', 'GULP'). + config (str, optional): config of the density data (e.g., 'VASP', 'GULP'). Default is 'VASP'. Returns: @@ -434,7 +434,7 @@ def density_2_grid( l = 0 Potential_grid = np.zeros(shape=(nx, ny, nz)) - if type.lower() == "gulp": + if config.lower() == "gulp": for k in range(nx): for j in range(ny): for i in range(nz): @@ -442,7 +442,7 @@ def density_2_grid( l = l + 1 return Potential_grid - elif type.lower() == "vasp": + elif config.lower() == "vasp": total_electrons = 0 for k in range(nz): for j in range(ny): @@ -461,7 +461,7 @@ def density_2_grid( return Potential_grid, total_electrons else: - raise ValueError("Invalid type. type must be 'VASP' or 'GULP'.") + raise ValueError("Invalid config. config must be 'VASP' or 'GULP'.") def planar_average_charge( diff --git a/macrodensity/plotting.py b/macrodensity/plotting.py index bb6d3d2..86fedbc 100644 --- a/macrodensity/plotting.py +++ b/macrodensity/plotting.py @@ -1,4 +1,4 @@ -"""macrodensity.plotting contains different types of plotting functions such as band +"""macrodensity.plotting contains different configs of plotting functions such as band alignment diagrams and potentials at different grid points.""" from __future__ import division, print_function @@ -366,7 +366,7 @@ def plot_on_site_potential( resolution_y = vector_b / NGY resolution_z = vector_c / NGZ grid_pot, electrons = density_2_grid( - vasp_pot, NGX, NGY, NGZ, type="VASP" + vasp_pot, NGX, NGY, NGZ, config="VASP" ) elif "cube" in potential_file: grid_pot, atoms = cube.read_cube_data(potential_file) @@ -385,7 +385,7 @@ def plot_on_site_potential( resolution_x = vector_a / NGX resolution_y = vector_b / NGY resolution_z = vector_c / NGZ - grid_pot = density_2_grid(gulp_pot, NGX, NGY, NGZ, type="GULP") + grid_pot = density_2_grid(gulp_pot, NGX, NGY, NGZ, config="GULP") else: raise ValueError(f"File {potential_file} not recognised!") @@ -445,7 +445,7 @@ def plot_planar_average( new_resolution: int = 3000, ) -> tuple: """Calculate planar and macroscopic averages of potential data from different - filetypes like gulp, cube, and vasp. + fileconfigs like gulp, cube, and vasp. Args: lattice_vector (float): The lattice vector value. @@ -529,11 +529,11 @@ def _save_df(planar, macro, output_file, interpolated_potential=None): resolution_x = vector_a / NGX resolution_y = vector_b / NGY resolution_z = vector_c / NGZ - # TODO: Update type parameter in density_2_grid to be consistent with + # TODO: Update config parameter in density_2_grid to be consistent with # code naming in other functions (e.g. if here we use GULP to refer to GULP, # should do the same in other functions) - # Also use lower case for type variable following python conventions (eg type -> type) - grid_pot = density_2_grid(pot, NGX, NGY, NGZ, type="GULP") + # Also use lower case for config variable following python conventions (eg config -> config) + grid_pot = density_2_grid(pot, NGX, NGY, NGZ, config="GULP") ## POTENTIAL PLANAR AVERAGE planar = planar_average(grid_pot, NGX, NGY, NGZ, axis=axis) @@ -564,7 +564,7 @@ def _save_df(planar, macro, output_file, interpolated_potential=None): resolution_x = vector_a / NGX resolution_y = vector_b / NGY resolution_z = vector_c / NGZ - grid_pot, electrons = density_2_grid(pot, NGX, NGY, NGZ, type="VASP") + grid_pot, electrons = density_2_grid(pot, NGX, NGY, NGZ, config="VASP") ## PLANAR AVERAGE planar = planar_average(grid_pot, NGX, NGY, NGZ, axis=axis) @@ -639,7 +639,7 @@ def plot_field_at_point( resolution_y = vector_b / NGY resolution_z = vector_c / NGZ grid_pot, electrons = density_2_grid( - vasp_pot, NGX, NGY, NGZ, type="VASP" + vasp_pot, NGX, NGY, NGZ, config="VASP" ) ## Get the gradiens (Field), if required. ## Comment out if not required, due to compuational expense. @@ -751,7 +751,7 @@ def plot_plane_field( resolution_y = vector_b / NGY resolution_z = vector_c / NGZ grid_pot, electrons = density_2_grid( - vasp_pot, NGX, NGY, NGZ, type="VASP" + vasp_pot, NGX, NGY, NGZ, config="VASP" ) ## Get the gradiens (Field), if required. ## Comment out if not required, due to compuational expense. @@ -829,7 +829,7 @@ def plot_active_plane( resolution_y = vector_b / NGY resolution_z = vector_c / NGZ grid_pot, electrons = density_2_grid( - vasp_pot, NGX, NGY, NGZ, type="VASP" + vasp_pot, NGX, NGY, NGZ, config="VASP" ) potential_variance = np.var(grid_pot)