Skip to content

Commit

Permalink
Merge pull request #122 from romerogroup/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
lllangWV authored Jul 31, 2023
2 parents 10395e0 + 11e2c07 commit 3f5eff3
Show file tree
Hide file tree
Showing 16 changed files with 835 additions and 696 deletions.
101 changes: 101 additions & 0 deletions pyprocar/cfg/band_structure.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
spin_colors:
description: The colors for the plot lines.
value:
- blue
- red
color:
description: The colors for the plot lines.
value: 'black'
cmap:
description: The colormap used for the plot.
value: jet
clim:
description: The color scale for the color bar
value:
-
-
fermi_color:
description: The color of the Fermi line.
value: blue
fermi_linestyle:
description: The linestyle of the Fermi line.
value: dotted
fermi_linewidth:
description: The linewidth of the Fermi line.
value: 1
grid:
description: If true, a grid will be shown on the plot.
value: false
grid_axis:
description: Which axis (or both) the grid lines should be drawn on.
value: both
grid_color:
description: The color of the grid lines.
value: grey
grid_linestyle:
description: The linestyle of the grid lines.
value: solid
grid_linewidth:
description: The linewidth of the grid lines.
value: 1
grid_which:
description: Which grid lines to draw (major, minor or both).
value: major
label:
description: The labels for the plot lines.
value:
- $\uparrow$
- $\downarrow$
legend:
description: If true, a legend will be shown on the plot.
value: true
linestyle:
description: The linestyles for the plot lines.
value:
- solid
- dashed
linewidth:
description: The linewidths for the plot lines.
value:
- 1.0
- 1.0
marker:
description: The marker styles for the plot points.
value:
- o
- v
- ^
- D
markersize:
description: The size of the markers for the plot points.
value:
- 0.2
- 0.2
opacity:
description: The opacities for the plot lines.
value:
- 1.0
- 1.0
plot_color_bar:
description: If true, a color bar will be shown on the plot.
value: true
savefig:
description: The file name to save the figure. If null, the figure will not be saved.
value: null
title:
description: The title for the plot. If null, no title will be displayed.
value: null
weighted_color:
description: If true, the color of the lines will be weighted.
value: true
weighted_width:
description: If true, the width of the lines will be weighted.
value: false
figure_size:
description: The size of the figure (width, height) in inches.
value:
- 9
- 6
dpi:
description: The resolution in dots per inch. If 'figure', use the figure's dpi value.
value: 'figure'
136 changes: 136 additions & 0 deletions pyprocar/cfg/dos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
cmap:
description: The colormap used for the plot.
value: jet
colors:
description: List of colors for the plot lines.
value:
- red
- green
- blue
- cyan
- magenta
- yellow
- orange
- purple
- brown
- navy
- maroon
- olive
fermi_color:
description: The color of the Fermi line.
value: black
fermi_linestyle:
description: The linestyle of the Fermi line.
value: dotted
fermi_linewidth:
description: The linewidth of the Fermi line.
value: 1
figure_size:
description: The size of the figure (width, height) in inches.
value:
- 9
- 6
font:
description: The font style for the plot text.
value: Arial
font_size:
description: The size of the font used in the plot.
value: 16
grid:
description: If true, a grid will be shown on the plot.
value: false
grid_axis:
description: Which axis (or both) the grid lines should be drawn on.
value: both
grid_color:
description: The color of the grid lines.
value: grey
grid_linestyle:
description: The linestyle of the grid lines.
value: solid
grid_linewidth:
description: The linewidth of the grid lines.
value: 1
grid_which:
description: Which grid lines to draw (major, minor or both).
value: major
legend:
description: If true, a legend will be shown on the plot.
value: true
linestyle:
description: The linestyles for the plot lines.
value:
- solid
- dashed
linewidth:
description: The linewidths for the plot lines.
value:
- 1
- 1
marker:
description: The marker styles for the plot points.
value:
- o
- v
- ^
- D
markersize:
description: The size of the markers for the plot points.
value:
- 0.2
- 0.2
opacity:
description: The opacities for the plot lines.
value:
- 1.0
- 1.0
plot_bar:
description: If true, a bar plot will be displayed.
value: true
plot_color_bar:
description: If true, a color bar will be shown on the plot.
value: true
plot_total:
description: If true, the total plot will be displayed.
value: true
savefig:
description: The file name to save the figure. If null, the figure will not be saved.
value: null
spin_colors:
description: The colors for the spin up and spin down lines.
value:
- black
- red
spin_labels:
description: The labels for the spin up and spin down.
value:
- $\uparrow$
- $\downarrow$
title:
description: The title for the plot. If null, no title will be displayed.
value: null
verbose:
description: If true, the program will print detailed information.
value: true
weighted_color:
description: If true, the color of the lines will be weighted.
value: true
weighted_width:
description: If true, the width of the lines will be weighted.
value: false
clim:
description: Value range to scale the colorbar
value:
stack_y_label:
description: The label for the y-axis for stack mode
value: DOS
x_label:
description: The label for the x-axis.
value: Energy (eV)
y_label:
description: The label for the y-axis.
value: DOS
dpi:
description: The resolution in dots per inch. If 'figure', use the figure's dpi value.
value: 'figure'

67 changes: 67 additions & 0 deletions pyprocar/cfg/fermi_surface_2d.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@

add_axes_labels:
description: Boolean to add axes labels
value: true
add_legend:
description: Boolean to add legend
value: false
plot_color_bar:
description: Boolean to plot the color bar
value: false


cmap:
description: The colormap used for the plot.
value: jet

value: jet
clim:
description: The color scale for the color bar
value:
-
-
color:
description: The colors for the spin plot lines.
value:
- blue
- red
linestyle:
description: The linestyles for the spin plot lines.
value:
- solid
- dashed
linewidth:
description: The linewidth of the fermi surface
value: 0.2
no_arrow:
description: Boolean to use no arrows to represent the spin texture
value: False

arrow_color:
description: The linestyles for the spin plot lines.
value:

arrow_density:
description: The arrow density for the spin texture
value: 10
arrow_size:
description: The arrow size for the spin texture
value: 3
arrow_projection:
description: The projection for the color scale for spin texture
value: z^2

marker:
description: Controls the marker used for the spin plot
value: .
dpi:
description: The dpi value to save the image as
value: figure

x_label:
description: The x label of the plot
value: $k_{x}$ ($\AA^{-1}$)

y_label:
description: The x label of the plot
value: $k_{y}$ ($\AA^{-1}$)
23 changes: 18 additions & 5 deletions pyprocar/core/ebs.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# from . import Structure
from typing import List
import itertools

import copy
from scipy.interpolate import CubicSpline

import numpy as np
Expand Down Expand Up @@ -637,13 +637,15 @@ def calculate_scalar_gradient(self,scalar_mesh):
n_kz=len(np.unique(self.kpoints[:,2]))
scalar_gradients = np.zeros((3,n_kx,n_ky,n_kz))

if n_kx==1 or n_ky==1 or n_kz==1:
raise ValueError("The mesh cannot be 2 dimensional")

# Calculate cartesian separations along each crystal direction
sep_vectors_i = np.abs(self.kpoints_cartesian[self.index_mesh[[0]*n_kx, :, :], :] - self.kpoints_cartesian[self.index_mesh[[1]*n_kx, :, :], :])
sep_vectors_j = np.abs(self.kpoints_cartesian[self.index_mesh[:, [0]*n_ky, :], :] - self.kpoints_cartesian[self.index_mesh[:, [1]*n_ky, :], :])
sep_vectors_k = np.abs(self.kpoints_cartesian[self.index_mesh[:, :, [0]*n_kz], :] - self.kpoints_cartesian[self.index_mesh[:, :, [1]*n_kz], :])

if n_kz>1:
sep_vectors_k = np.abs(self.kpoints_cartesian[self.index_mesh[:, :, [0]*n_kz], :] - self.kpoints_cartesian[self.index_mesh[:, :, [1]*n_kz], :])
else:
sep_vectors_k=copy.copy(sep_vectors_j)
sep_vectors_k[:,:,:,:]=0

# Calculate indices with periodic boundary conditions
plus_one_indices_x = np.arange(n_kx) + 1
Expand All @@ -669,6 +671,14 @@ def calculate_scalar_gradient(self,scalar_mesh):
# Calculating gradients
sep_vectors = [sep_vectors_i,sep_vectors_j,sep_vectors_k]
energy_diffs = [scalar_diffs_i,scalar_diffs_j,scalar_diffs_k]

# Calculate gradients
# sep_vectors = [sep_vectors_i,sep_vectors_j]
# energy_diffs = [scalar_diffs_i,scalar_diffs_j]
# if n_kz > 1: # Only add sep_vectors_k and scalar_diffs_k in 3D
# sep_vectors.append(sep_vectors_k)
# energy_diffs.append(scalar_diffs_k)

for sep_vector,energy_diff in zip(sep_vectors,energy_diffs):
for i_coord in range(3):

Expand All @@ -677,6 +687,9 @@ def calculate_scalar_gradient(self,scalar_mesh):
# Changing infinities to 0
tmp_grad = np.nan_to_num(tmp_grad, neginf=0,posinf=0)
scalar_gradients[i_coord, :, :, :] += tmp_grad

if n_kz == 1:
scalar_gradients[2,:,:,:]=0
return scalar_gradients

def calculate_scalar_integral(self,scalar_mesh):
Expand Down
Loading

0 comments on commit 3f5eff3

Please sign in to comment.