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

Enable the Ace loader to return a conformation index #174

Merged
merged 2 commits into from
May 25, 2023
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
5 changes: 3 additions & 2 deletions torchmdnet/datasets/ace.py
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ def sample_iter(self, mol_ids=False):
mols = list(h5.values())[0].items()
load_confs = self._load_confs_2_0
else:
raise RuntimeError(f"Unsuported layout verions: {version}")
raise RuntimeError(f"Unsupported layout version: {version}")

# Iterate over the molecules
for i_mol, (mol_id, mol) in tqdm(
Expand All @@ -180,7 +180,7 @@ def sample_iter(self, mol_ids=False):
fq = pt.tensor(mol["formal_charges"], dtype=pt.long)
q = fq.sum()

for pos, y, neg_dy, pq, dp in load_confs(mol, n_atoms=len(z)):
for i_conf, (pos, y, neg_dy, pq, dp) in enumerate(load_confs(mol, n_atoms=len(z))):

# Skip samples with large forces
if self.max_gradient:
Expand All @@ -193,6 +193,7 @@ def sample_iter(self, mol_ids=False):
)
if mol_ids:
args["mol_id"] = mol_id
args["i_conf"] = i_conf
data = Data(**args)

if self.pre_filter is not None and not self.pre_filter(data):
Expand Down
Loading