Metadata-Version: 2.2
Name: lattice-mind
Version: 0.5.2
Summary: LatticeMind: The AI agent for materials science.
Keywords: materials science,DFT,density functional theory,RESCU,VASP,NanoDCAL,computational chemistry,AI agent
Author: Nanoacademic Technologies Inc.
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Scientific/Engineering :: Chemistry
Classifier: Topic :: Scientific/Engineering :: Physics
Project-URL: Homepage, https://www.nanoacademic.com/
Project-URL: Documentation, https://docs.nanoacademic.com/
Project-URL: Support, https://nanoacademic.atlassian.net/servicedesk/customer/portal/1
Requires-Python: >=3.10
Requires-Dist: rich
Requires-Dist: fastapi
Requires-Dist: uvicorn
Requires-Dist: python-multipart
Requires-Dist: langgraph
Requires-Dist: langchain-core<2.0.0,>=1.0.1
Requires-Dist: openai
Requires-Dist: python-dotenv
Requires-Dist: ipython
Requires-Dist: art
Requires-Dist: pyperclip
Requires-Dist: numpy
Requires-Dist: h5py
Requires-Dist: scipy
Requires-Dist: matplotlib
Requires-Dist: requests
Requires-Dist: packaging>=23
Requires-Dist: ase
Requires-Dist: seekpath>=2.1
Provides-Extra: postprocess
Provides-Extra: qwen
Provides-Extra: pdf
Requires-Dist: pymupdf; extra == "pdf"
Provides-Extra: all
Requires-Dist: pymupdf; extra == "all"
Description-Content-Type: text/markdown

# LatticeMind

**The AI agent for materials science.** Describe the calculation you want in
plain words; LatticeMind builds the structure, writes the solver inputs,
validates them, asks permission to run them, and reports the physics with its
own assessment of whether the numbers are trustworthy.

By default it is a conversation, not a single command: it does the next thing,
reads the result, and decides what follows, and you can correct it as it goes or
pick the work up again tomorrow.

**RESCU** is fully supported. **NanoDCAL** is supported across all 40 calculation
types its manual documents — ground state, electronic structure, phonons, and
two-probe quantum transport — verified by a 60-case benchmark executed both on a
local installation and on an HPC cluster. **VASP** support is in preview.

---

## Install

CPython 3.10 through 3.14, on Linux x86-64, Windows AMD64, or macOS. Install into a
virtual environment -- `python3 -m venv .venv && source .venv/bin/activate` -- so
`pip` cannot resolve to a different interpreter than the one you mean.

Install from the Nanoacademic PyPI index. LatticeMind's dependencies come from public
PyPI, so pip needs both indexes:

```bash
python -m venv .venv && source .venv/bin/activate    # Windows: .venv\Scripts\activate
pip install \
  --index-url https://pypi.nanoacademic.ca/simple/ \
  --extra-index-url https://pypi.org/simple/ \
  lattice-mind
```

Add `--upgrade` to move to a newer release, and check what you got with
`latticemind --version`. Interactive CLI and Web startup print that command when
the public index contains a newer compatible stable wheel; set
`LATTICEMIND_UPDATE_CHECK=0` to disable the once-daily check. Startup waits at
most 1.5 seconds for the notice. To install from a wheel file instead, see
[INSTALL.md](INSTALL.md).

## License

LatticeMind is licensed separately from RESCU: a RESCU license does not activate
it, and it does not activate RESCU. Put exactly one `*.lic` or `*.license` file
in `~/.nanoacademic/LATTICEMIND` — on Windows,
`C:\Users\<YourUsername>\.nanoacademic\LATTICEMIND` — or point
`LATTICEMIND_LICENSE_FILE` at its exact path. LatticeMind checks it at startup,
before the CLI or Web UI opens, whichever solver is selected.

To obtain a license, submit a request through the
[Nanoacademic Customer Support Center](https://nanoacademic.atlassian.net/servicedesk/customer/portal/1).

## Configure

LatticeMind needs one AI provider key. Put it in a `.env` file in the directory
you work from, or export it as an environment variable.

```env
OPENAI_API_KEY=sk-your-key-here
```

That is the only required setting beyond the license — everything else has a
working default. Common additions:

```env
# Optional: fetch exact structures by Materials Project id ("scf for Al: mp-134")
MATERIALS_PROJECT_API_KEY=your_key_here

# Optional: where the RESCU solver lives, if it is not on PATH
LATTICEMIND_RESCU_CMD=/path/to/rescu

# Optional: exact LatticeMind license file, if it is not in ~/.nanoacademic/LATTICEMIND
LATTICEMIND_LICENSE_FILE=/path/to/license.lic
```

Prefer a different model? Type `/model` inside LatticeMind: it lists the
current OpenAI, Claude, Gemini and Qwen models and a local Ollama, marks each one
configured or not, and asks for a missing key. Or set `RESCU_LLM_PROVIDER` to
`openai`, `claude`, `gemini`, `qwen`, or `ollama` and supply that provider's key.
See [INSTALL.md](INSTALL.md#ai-provider--models) for every variable.

## Run

The first time, LatticeMind asks two questions in the terminal and remembers
the answers in `~/.latticemind/.env` for both the terminal and the browser:
which model to use (an OpenAI API key by default, or another provider's key)
and where RESCU is (it offers the copy it finds). `latticemind setup`
asks them again any time; `latticemind setup --show` prints what is ready.

Change into the folder you want to work in and start LatticeMind there. That
folder is the project: LatticeMind keeps its records in a hidden `.latticemind/`
directory and writes the solver inputs, `pseudopotentials/`, `results/` and the
figures beside them.

```bash
mkdir silicon-study && cd silicon-study
latticemind          # a research conversation (the default)
latticemind-web      # the same conversation in a browser, plus a control room, at http://127.0.0.1:7865
```

Describe a calculation in a sentence. LatticeMind builds the structure, writes
and validates the inputs, then shows exactly what it will run and where and asks
for permission — answer with a number or in words. Start it in the same folder
again and the conversation resumes.

`latticemind quick` runs the older one-shot pipeline instead: one prompt in, a
finished report out, no conversation.

Inside the app, `/examples` lists ready-to-run prompts and `/help` shows the
handful of commands. Everything else is plain language.

## What you can ask for

| | example |
|---|---|
| Ground state | `scf for silicon` |
| Electronic structure | `scf + bs + dos for Si: mp-149` |
| Band gap | `compute the band gap of SiC: mp-8062` |
| Magnetism | `spin-polarized scf for bcc Fe and report the magnetic moment` |
| Relaxation | `relax the structure of Si and report the relaxed lattice constant` |
| Convergence study | `k-point convergence for Si at 6x6x6, 8x8x8 and 12x12x12` |
| Quantum transport (NanoDCAL) | `Using NanoDCAL, run a transmission calculation along z for a homogeneous aluminum two-probe device` |
| Continuing a project | `Now compute the current-voltage curve for the same device from 0 to 0.4 V in 0.2 V steps` |

Naming a Materials Project id builds from that exact published cell. Without an
id, LatticeMind uses its curated crystal reference table.

`/examples` inside the app covers a wider range, including phonons, defect
formation energies and strain comparisons.

## Running calculations

Generating and validating inputs needs the LatticeMind license and an API key.
To *execute* calculations you also need the solver itself, installed and
licensed on the machine that runs it. A runtime pseudopotential bundle ships
with the package, so no separate download is needed for the elements it covers.

A project is a conversation, not a single request. Follow-up turns build on
what the project already holds: a request to add a Seebeck coefficient to a
finished conductance project inherits the device, the material, and the settings
the project was founded on, adds only the missing steps, and reuses every
calculation that has already converged.

Every solver launch asks first. LatticeMind shows the exact command, the inputs
and the directory, then offers `1. yes   2. yes, always   3. no`; you can answer
with a number or in words. Select a cluster with `/remote <profile>` and the
question names that host. A long calculation keeps running while you are away —
start LatticeMind in the same folder later and ask for the results. Spending on
metered AI providers is capped per turn and per session
(`LATTICEMIND_MAX_COST_PER_TURN_USD`, `LATTICEMIND_MAX_COST_PER_SESSION_USD`;
defaults 5 and 25 USD).

```text
/remote my-cluster
Using NanoDCAL, run a conductance calculation along z for a homogeneous copper
two-probe device.

Add a Seebeck coefficient calculation to this project, reusing everything it
already has.
```

While a solver runs, its own output streams into the session as it is written
(RESCU's iteration log, NanoDCAL's output, VASP's `OSZICAR`), so you can watch a
calculation converge without opening a log file. Below the status line an input
line marked `>` shows anything you type mid-turn; Enter sends it as a correction.

Results land in the project folder you started in — the generated inputs,
`pseudopotentials/`, raw solver output under `results/`, the figures, and an
HTML report. Figures are also drawn inline where the terminal supports images.
Ask in plain words to tidy the folder ("move everything into si_test, keeping
the structure") and LatticeMind shows the moves as one question, then does them.

The one-shot pipeline, `latticemind quick`, still takes a whole request on the
command line and writes its project under `latticemind_outputs/`:

```bash
latticemind run "Using NanoDCAL, run a conductance calculation along z for a homogeneous copper two-probe device" \
    --solver nanodcal --execute --approve-execution --remote-profile my-cluster --detach
```

Pass `--no-subdir` to make it work in the current folder instead; a home, root,
system, or software folder still gets a project subdirectory.

## Documentation

**The full LatticeMind manual ships with the package.** After installing, find
it under `rescu_agent/latticemind_manual/` in your Python environment, including
`LatticeMind_Documentation_v0.5.2.pdf` and chapters covering:

- installation, API keys and solver setup
- your first project, and how LatticeMind works
- the research conversation, the web interface, and the command reference
- releasing long calculations and reattaching to them later
- remote and HPC execution
- every configuration setting
- worked tutorials

| | |
|---|---|
| [INSTALL.md](INSTALL.md) | installation, `.env` configuration, deployment, HPC, troubleshooting |
| [RELEASE_NOTES.md](RELEASE_NOTES.md) | what changed in each release |
| [docs.nanoacademic.com](https://docs.nanoacademic.com/) | solver documentation |

## Support

Nanoacademic Technologies Inc.

Technical support, bug reports and feature requests go to the [Nanoacademic Customer Support Center](https://nanoacademic.atlassian.net/servicedesk/customer/portal/1).
