Skip to content

Commit

Permalink
add doc to bloch
Browse files Browse the repository at this point in the history
  • Loading branch information
AsymmetryChou committed Feb 5, 2025
1 parent c7343b2 commit 43d7d0b
Showing 1 changed file with 26 additions and 2 deletions.
28 changes: 26 additions & 2 deletions dptb/negf/bloch.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
import numpy as np


# The Bloch class in Python defines a method to unfold k points based on a given Bloch factor.
class Bloch(object):

def __init__(self,bloch_factor) -> None:

if isinstance(bloch_factor,list):
Expand All @@ -12,9 +14,31 @@ def __init__(self,bloch_factor) -> None:
self.bloch_factor = bloch_factor


def unfold_points(self,k):
def unfold_points(self,k:list) -> np.ndarray:
'''The `unfold_points` function generates expansion k points based on Bloch theorem and reshapes the
output into a specific format.
Parameters
----------
k
The `k` parameter in the `unfold_points` method represents the original k-point in the Brillouin zone.
Returns
-------
The `unfold_points` method returns a reshaped array of expansion points calculated based on the
input parameter `k` and the bloch factor `B`. The expansion points are created using B-casting rules
and then reshaped into a 2D array with 3 columns.
'''


# check k is a 3D vector
if isinstance(k,list):
assert len(k) == 3, "kpoint should be a 3D vector"
elif isinstance(k,np.ndarray):
assert k.shape[0] == 3, "kpoint should be a 3D vector"
else:
raise ValueError("k should be a list or numpy array")

# Create expansion points
B = self.bloch_factor
unfold = np.empty([B[2], B[1], B[0], 3])
Expand Down

0 comments on commit 43d7d0b

Please sign in to comment.