Skip to content

Commit

Permalink
Fix interpolation in projected band structures
Browse files Browse the repository at this point in the history
  • Loading branch information
utf committed Oct 21, 2019
1 parent 2def534 commit ff8d18e
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions sumo/plotting/bs_plotter.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,10 +376,12 @@ def get_projected_plot(self, selection, mode='rgb', interpolate_factor=4,
weights = [proj[nd][i][spin][mask] for i in range(len(selection))]

# interpolate band structure to improve smoothness
dx = (distances[1] - distances[0]) / interpolate_factor
temp_dists = np.arange(distances[0], distances[-1], dx)
bands = interp1d(distances, bands, axis=1)(temp_dists)
weights = interp1d(distances, weights, axis=2)(temp_dists)
temp_dists = np.linspace(distances[0], distances[-1],
len(distances) * interpolate_factor)
bands = interp1d(distances, bands, axis=1, bounds_error=False,
fill_value="extrapolate")(temp_dists)
weights = interp1d(distances, weights, axis=2, bounds_error=False,
fill_value="extrapolate")(temp_dists)
distances = temp_dists

# sometimes VASP produces very small negative weights
Expand Down

0 comments on commit ff8d18e

Please sign in to comment.