Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfix: dos.py for sublattice #11

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions src/hwave/dos.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,11 @@ def calc_dos(
data = np.load(os.path.join(filename))
eigenvalues = data["eigenvalue"]
Lx, Ly, Lz = input_dict["mode"]["param"]["CellShape"]
Lxsub, Lysub, Lzsub = input_dict["mode"]["param"].get("SubShape", (Lx,Ly,Lz))
norb = eigenvalues.shape[1]
if verbose:
print("Lx, Ly, Lz, norb: ", Lx, Ly, Lz, norb)
eigenvalues.reshape(Lx, Ly, Lz, norb)
print("Lxsub, Lysub, Lzsub, norb: ", Lxsub, Lysub, Lzsub, norb)

input_info_dict = input_dict["file"]["input"]["interaction"]
file_name = os.path.join(
Expand All @@ -121,7 +122,8 @@ def calc_dos(
if verbose:
print("Energy window min, max, num: ", ene_min, ene_max, ene_num)

eig = eigenvalues.reshape(Lx, Ly, Lz, norb)
eig = eigenvalues.reshape(int(Lx/Lxsub), int(Ly/Lysub), int(Lz/Lzsub), norb)

if verbose:
print("Finish calculating DOS")
wght = libtetrabz.dos(bvec, eig, ene)
Expand All @@ -132,7 +134,6 @@ def calc_dos(
def main():
import tomli
import argparse

parser = argparse.ArgumentParser(formatter_class=argparse.RawTextHelpFormatter)
parser.add_argument("input", type=str, help="input file of hwave")
parser.add_argument("-o","--output", type=str, default="dos.dat", help="DoS output")
Expand All @@ -152,10 +153,8 @@ def main():
parser.add_argument(
"-v", "--version", action="version", version=f"hwave_dos v{hwave.__version__}"
)

args = parser.parse_args()
verbose = not args.quiet

file_toml = args.input
if os.path.exists(file_toml):
if verbose:
Expand Down