lab-cosmo / metatrain

Training and evaluating machine learning models for atomistic systems.
https://lab-cosmo.github.io/metatrain/
BSD 3-Clause "New" or "Revised" License
13 stars 3 forks source link

Automatically Importing Rascaline's JSON Schema #278

Open PicoCentauri opened 6 days ago

PicoCentauri commented 6 days ago

it would be interesting to check if we can automatically import rascaline's JSON schema file here.

_Originally posted by @Luthaf in https://github.com/lab-cosmo/metatrain/pull/241#discussion_r1647328627_

This should be feasible in principle since the jsonschema library allows external referencing, either via an external file or a URL. The easiest approach would be to expose the schemas in the Rascaline online documentation. This way, we wouldn't need to copy the files into metatrain every time there are changes in the hypers.

However, one issue we might encounter is that in Rascaline, some arguments are required. For example:

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "PowerSpectrumParameters",
  "description": "Parameters for SOAP power spectrum calculator.\n\nIn the SOAP power spectrum, each sample represents rotationally-averaged atomic density correlations, built on top of the spherical expansion. Each sample is a vector indexed by `n1, n2, l`, where `n1` and `n2` are radial basis indexes and `l` is the angular index:\n\n`< n1 n2 l | X_i > = \\sum_m < n1 l m | X_i > < n2 l m | X_i >`\n\nwhere the `< n l m | X_i >` are the spherical expansion coefficients.\n\nSee [this review article](https://doi.org/10.1063/1.5090481) for more information on the SOAP representations.",
  "type": "object",
  "required": [
    "atomic_gaussian_width",
    "center_atom_weight",
    "cutoff",
    "cutoff_function",
    "max_angular",
    "max_radial",
    "radial_basis"
  ]
}

In metatrain, we don't require these parameters because we use default values if the user doesn't provide them. I'm not sure how to reconcile this difference at the moment. Maybe we can discuss potential solutions, @Luthaf?