Skip to content
This repository has been archived by the owner on Apr 27, 2023. It is now read-only.

add a convertion step before GraphCrystalDisordered training #321

Open
wants to merge 1 commit into
base: master
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
7 changes: 7 additions & 0 deletions megnet/data/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,13 @@ def _generate_inputs(self, batch_index: list) -> tuple:
- [ndarray]: List of indices for the start of each bond
- [ndarray]: List of indices for the end of each bond
"""
import collections
if isinstance(self.atom_features[0][0], collections.defaultdict):
from megnet.data.crystal import CrystalGraphDisordered
cgd = CrystalGraphDisordered()
for i in range(len(self.atom_features)):
self.atom_features[i] = cgd.atom_converter.convert(
self.atom_features[i].tolist()).tolist()

# Get the features and connectivity lists for this batch
feature_list_temp = itemgetter_list(self.atom_features, batch_index)
Expand Down