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

Fix read_raw_entries #97

Merged
merged 1 commit into from
Jun 6, 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
16 changes: 9 additions & 7 deletions openqdc/datasets/potential/waterclusters3_30.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import zipfile
from io import StringIO
from os.path import join as p_join

Expand All @@ -8,8 +9,6 @@
from openqdc.methods import PotentialMethod
from openqdc.utils.constants import ATOM_TABLE, MAX_ATOMIC_NUMBER

# we could use ase.io.read to read extxyz files


def content_to_xyz(content, n_waters):
content = content.strip()
Expand Down Expand Up @@ -80,12 +79,15 @@ class WaterClusters(BaseDataset):

def read_raw_entries(self):
samples = []
parent_folder = p_join(self.root, "W3-W30_all_geoms_TTM2.1-F/")
for i in range(3, 31):
raw_path = p_join(self.root, f"W3-W30_all_geoms_TTM2.1-F/W{i}_geoms_all.xyz")
data = read_xyz(
raw_path,
i,
)
name = f"W{i}_geoms_all"
zip_path = p_join(parent_folder, f"{name}.zip")
xyz_path = p_join(parent_folder, f"{name}.xyz")
with zipfile.ZipFile(zip_path, "r") as zip_ref:
zip_ref.extractall(parent_folder)

data = read_xyz(xyz_path, i)
samples += data

return samples
Loading