Skip to content
jcwang587Public

About

A minimal crystal structure viewer for the web.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Repository files navigation

bravais

npm CI

A minimal crystal structure viewer for the web.

Install

npm install bravais three

Use

import { buildScene, createViewer, expandStructure, readCif } from "bravais";

const scene = buildScene(expandStructure(await readCif(cifText)));
createViewer(document.getElementById("viewer")).setLayers([{ scene }]);

Built with

  • three.js: rendering, as a peer dependency.
  • moyo: space-group operations, bundled as WebAssembly.
  • VESTA: the bond cutoffs, the element colours, used here in Pretty Lattice's softened version, and the occupancy pies.
  • pymatgen: the copy of VESTA's cutoff table this package ships.
  • OKLab: Björn Ottosson's public-domain colour formulas. They supply no colours: they measure how alike two colours look, and move an element's colour only when it would clash with one already on screen.

Thanks to Feitong Song's Pretty Lattice, which this viewer follows in its lighting and materials, depth fading, trackball feel, axes gizmo, legend swatch, standard view and softened element colours.

The code was written by Claude Code, under the author's direction and review.

License

MIT. Notices for the bundled third-party material are in THIRD_PARTY_NOTICES.md.

About

A minimal crystal structure viewer for the web.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages