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

add overlap output in feature_to_block #208

Merged
merged 2 commits into from
Sep 19, 2024
Merged
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
24 changes: 15 additions & 9 deletions dptb/data/interfaces/ham_to_feature.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,19 +319,25 @@ def block_to_feature(data, idp, blocks=False, overlap_blocks=False, orthogonal=F
# if overlap_blocks:
# data[_keys.EDGE_OVERLAP_KEY] = torch.as_tensor(np.array(edge_overlap), dtype=torch.get_default_dtype())

def feature_to_block(data, idp):
def feature_to_block(data, idp, overlap: bool = False):
idp.get_orbital_maps()
idp.get_orbpair_maps()

has_block = False
if data.get(_keys.NODE_FEATURES_KEY, None) is not None:
node_features = data[_keys.NODE_FEATURES_KEY]
edge_features = data[_keys.EDGE_FEATURES_KEY]
has_block = True
blocks = {}

idp.get_orbital_maps()
idp.get_orbpair_maps()
if not overlap:
if data.get(_keys.NODE_FEATURES_KEY, None) is not None:
node_features = data[_keys.NODE_FEATURES_KEY]
edge_features = data[_keys.EDGE_FEATURES_KEY]
has_block = True
blocks = {}
else:
if data.get(_keys.NODE_OVERLAP_KEY, None) is not None:
node_features = data[_keys.NODE_OVERLAP_KEY]
edge_features = data[_keys.EDGE_OVERLAP_KEY]
has_block = True
blocks = {}
else:
raise KeyError("Overlap features not found in data.")

if has_block:
# get node blocks from node_features
Expand Down