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

feat: add -v to get dptb version, and update the version.py to load version number and git version #158

Merged
merged 13 commits into from
Apr 30, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
fix: update nnsk from reference and change the sign of ovp_thr
  • Loading branch information
QG-phy committed Apr 29, 2024
commit 6b237b350a2d6dd9e3550fb46c18b73b551d5286
8 changes: 6 additions & 2 deletions dptb/nn/nnsk.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ def push_decay(self, rs_thr: float=0., rc_thr: float=0., w_thr: float=0., ovp_th
self.hopping_options["w"] += w_thr
if abs(rc_thr) > 0:
self.hopping_options["rc"] += rc_thr
if abs(ovp_thr) > 0 and self.ovp_factor >=ovp_thr:
if abs(ovp_thr) > 0 and self.ovp_factor >= abs(ovp_thr):
self.ovp_factor += ovp_thr
log.info(f"ovp_factor is decreased to {self.ovp_factor}")
self.model_options["nnsk"]["hopping"] = self.hopping_options
Expand Down Expand Up @@ -511,8 +511,12 @@ def from_reference(
model = cls(**common_options, **nnsk, transform=transform)

if f["config"]["common_options"]["basis"] == common_options["basis"] and \
f["config"]["model_options"] == model.model_options:
f["config"]["model_options"]["nnsk"]["onsite"] == model.model_options["nnsk"]["onsite"] and \
f["config"]["model_options"]["nnsk"]["hopping"] == model.model_options["nnsk"]["hopping"] and \
f["config"]["model_options"]["nnsk"]["soc"] == model.model_options["nnsk"]["soc"]:

model.load_state_dict(f["model_state_dict"])

else:
#TODO: handle the situation when ref_model config is not the same as the current model
# load hopping
Expand Down
Loading