Metadata-Version: 2.4
Name: goldilocks-core
Version: 0.4.0
Summary: Materials machine learning tools for recommending DFT calculation inputs.
License-Expression: BSD-3-Clause
Project-URL: Documentation, https://stfc.github.io/goldilocks-core/
Project-URL: Repository, https://github.com/stfc/goldilocks-core
Project-URL: Issues, https://github.com/stfc/goldilocks-core/issues
Requires-Python: >=3.12
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: ase>=3.28
Requires-Dist: numpy>=2.4.4
Requires-Dist: pandas>=2.0
Requires-Dist: pymatgen>=2026.3.23
Requires-Dist: requests>=2.32
Requires-Dist: goldilocks-ml==0.4.0
Requires-Dist: pydantic>=2.12
Requires-Dist: spglib>=2.5
Requires-Dist: spinforge<2,>=1
Provides-Extra: http
Requires-Dist: fastapi>=0.115; extra == "http"
Requires-Dist: uvicorn; extra == "http"
Provides-Extra: mcp
Requires-Dist: mcp<3,>=2.3; extra == "mcp"
Dynamic: license-file

# goldilocks-core

Give Goldilocks a crystal structure and it sets up a Quantum ESPRESSO
calculation for you. It chooses the settings, tells you why it chose each one,
and writes input files that are ready to run.

- **In:** a CIF or POSCAR file.
- **Out:** a folder with the input files, the pseudopotentials, a SLURM
  script, and a record of every setting and the reason for it.

Documentation: https://stfc.github.io/goldilocks-core/

## Try it

**In your browser**, with nothing to install but
[Docker](https://docs.docker.com/get-docker/):

```bash
docker run --rm --publish 127.0.0.1:8000:8000 ghcr.io/stfc/goldilocks-core
```

Open **http://127.0.0.1:8000**, upload a structure, check the settings, and
download the input files.

**On the command line**, with Python 3.12 or newer on Linux (x86-64) or on
macOS 14 or newer with Apple silicon:

```bash
python3 -m venv .venv
. .venv/bin/activate
pip install goldilocks-core
goldilocks assets install default
goldilocks run "$(goldilocks examples path)/Si.cif" --out si-run
```

The first two lines make a virtual environment for Goldilocks. `goldilocks
assets install default` downloads the models and the default
pseudopotential table, once. The last line sets up an SCF for the bundled silicon in `si-run/`.
For your own structure:

```bash
goldilocks run my_structure.cif --out my-run
```

[Install](https://stfc.github.io/goldilocks-core/install/) covers the other
ways, including the browser interface without Docker and a smaller install
without a GPU.

## What it decides for you

| Setting | How Goldilocks chooses it |
| --- | --- |
| k-point grid | A machine-learning model predicts the spacing your structure needs |
| Metal or insulator, and smearing | A machine-learning classifier |
| Spin polarization | A machine-learning classifier (mMACE) |
| Magnetic ordering | Ferromagnetic by default. Goldilocks lists the antiferromagnetic and ferrimagnetic candidates and can rank them; you choose |
| Pseudopotentials and cutoffs | A published table for the functional: PseudoDojo PBEsol by default, with PBE, LDA and SSSP tables |
| Hubbard U, dispersion correction, vacuum handling | Published rules, applied to your structure |
| Cluster resources | Estimated from the size of the calculation |

Anything you set yourself wins. It sets up these calculations:

| Task | What runs |
| --- | --- |
| `scf_single_point` (default) | One SCF |
| `relax`, `vc-relax` | Relax the atoms, or the atoms and the cell |
| `dos` | SCF, then the density of states |
| `band` | SCF, then the band structure along a high-symmetry path |
| `phonon`, `relax-phonon`, `vc-relax-phonon` | Phonons, their density of states and dispersion, optionally after a relaxation |

## Common commands

| You want to | Command |
| --- | --- |
| See every choice and why, without writing files | `goldilocks explain my_structure.cif` |
| Set up another calculation | `goldilocks run my_structure.cif --task band --out my-bands` |
| Choose a setting yourself | `goldilocks run my_structure.cif --set 'k_grid=[6,6,6]' --out my-run` |
| List every setting | `goldilocks settings` |
| List candidate magnetic orderings | `goldilocks magnetic-orderings my_structure.cif` |

Each output folder must be new; Goldilocks never overwrites one.

## Run the calculation

On your own machine, with Quantum ESPRESSO installed:

```bash
cd si-run
pw.x -in scf.in > scf.out
```

On a cluster, copy the folder there and submit it:

```bash
cd si-run
sbatch submit.sh
```

`submit.sh` is written for STFC's SCARF cluster. On another SLURM cluster,
edit its `#SBATCH` and `module load` lines first. Give the job a walltime
when you generate it, such as `--set walltime_h=12`.

## Before you trust the numbers

The settings are a well-informed starting point, not a converged result.
Read the warnings in `goldilocks.json`, and test the k-points and cutoffs for
the property you need. [How settings are
chosen](https://stfc.github.io/goldilocks-core/science/) explains each choice
and where it is weak.

## Documentation

- [First calculation](https://stfc.github.io/goldilocks-core/quickstart/):
  generate, check and run an input, step by step.
- [Workbench](https://stfc.github.io/goldilocks-core/workbench/): the browser
  interface.
- [How settings are chosen](https://stfc.github.io/goldilocks-core/science/):
  every setting, topic by topic.
- [CLI reference](https://stfc.github.io/goldilocks-core/cli/) and
  [Python API](https://stfc.github.io/goldilocks-core/tutorial/).
- [Use from an agent](https://stfc.github.io/goldilocks-core/agents/): MCP and
  the HTTP API.

## Contributing and licence

To work on Goldilocks itself, see
[Contributing](https://stfc.github.io/goldilocks-core/architecture/).

Code: [BSD 3-Clause](https://github.com/stfc/goldilocks-core/blob/main/LICENSE).
Documentation and example structures:
[CC BY 4.0](https://creativecommons.org/licenses/by/4.0/). Downloaded
pseudopotentials keep their
[upstream licences](https://stfc.github.io/goldilocks-core/pseudopotentials/#licences-and-citations).
