Skip to content

Commit

Permalink
Added download of datafile
Browse files Browse the repository at this point in the history
  • Loading branch information
ceriottm committed Feb 14, 2024
1 parent 34c6623 commit caf94f0
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion examples/gaas_map/gaas_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,13 @@
"""

import os

import ase
import ase.io
import chemiscope
import numpy as np
import requests
from matplotlib import pyplot as plt
from metatensor import mean_over_samples
from rascaline import AtomicComposition, SoapPowerSpectrum
Expand All @@ -32,7 +35,15 @@
# train a ML potential to describe the full composition range.
#

structures = ase.io.read("gaas_training.xyz", ":")
filename = "gaas_training.xyz"
if not os.path.exists(filename):
url = f"https://zenodo.org/records/10566825/files/{filename}"
response = requests.get(url)
response.raise_for_status()
with open(filename, "wb") as f:
f.write(response.content)

structures = ase.io.read(filename, ":")
energy = np.array([f.info["energy"] for f in structures])
natoms = np.array([len(f) for f in structures])

Expand Down

0 comments on commit caf94f0

Please sign in to comment.