npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

spglibjs

v0.1.0

Published

JavaScript and WASM symmetry bindings for spglib.

Readme

spglibJS

JavaScript bindings for spglib with a small plain-data API for Node, browsers, and Web Workers.

The package is meant to do one job well: expose symmetry data, lattice reductions, and k-point mesh helpers without leaking WASM memory details into application code. Higher-level materials objects belong in MATTERIA; rendering belongs in viewer apps such as DRISHTI.

Install

npm install spglibjs

The deterministic JavaScript helpers work from the package source. Structure-aware calls use the WASM backend built from upstream spglib:

npm run build:wasm

Quick Use

import {
  getPointgroup,
  getSpacegroupType,
  getSymmetryFromDatabase,
  version,
} from "spglibjs";

const operations = getSymmetryFromDatabase(523);

console.log(version());
console.log(getSpacegroupType(523).internationalShort);
console.log(getPointgroup(operations.rotations).symbol);

For structure symmetry, create the WASM-backed engine:

import { createSpglib } from "spglibjs";
import createSpglibWasm from "spglibjs/wasm";

const spglib = await createSpglib({ moduleFactory: createSpglibWasm });

const nacl = {
  lattice: [
    [5.64, 0, 0],
    [0, 5.64, 0],
    [0, 0, 5.64],
  ],
  positions: [
    [0, 0, 0],
    [0.5, 0.5, 0.5],
  ],
  numbers: [11, 17],
};

const result = spglib.getSymmetryDataset(nacl);

console.log(result.succeeded);
console.log(result.dataset?.spacegroup.internationalShort);

Inputs are simple objects:

{
  lattice: number[][];   // three row-vector basis vectors
  positions: number[][]; // fractional coordinates
  numbers: number[];     // atomic numbers or symmetry type labels
}

Results are JSON-like objects with arrays, numbers, strings, booleans, and null. They are safe to pass through postMessage and easy for MATTERIA or viewer code to wrap.

Browser Use

The browser build exposes window.spglibJS:

<script src="./dist/spglibjs.global.js"></script>
<script type="module">
  import createSpglibWasm from "./dist/wasm/spglib.mjs";

  const spglib = await window.spglibJS.createSpglib({
    moduleFactory: createSpglibWasm,
    wasmUrl: "./dist/wasm/spglib.wasm",
  });

  console.log(spglib.detectSpaceGroup({
    lattice: [[5.64, 0, 0], [0, 5.64, 0], [0, 0, 5.64]],
    positions: [[0, 0, 0], [0.5, 0.5, 0.5]],
    numbers: [11, 17],
  }).spacegroup?.internationalShort);
</script>

The global name stays spglibJS; the npm package name is scoped as spglibjs.

API Groups

  • Space-group records: getSpacegroupType
  • Database operations: getSymmetryFromDatabase
  • Operation matching: getHallNumberFromSymmetry, getSpacegroupTypeFromSymmetry
  • Point groups: getPointgroup
  • Reciprocal-grid helpers: getGridPointFromAddress, getGridPointsByRotations
  • Lattice reductions: niggliReduce, delaunayReduce
  • WASM structure engine: createSpglib

C-style aliases such as spgGetSpacegroupType are kept for callers migrating from spglib naming.

Development

npm install
npm run build
npm test

Useful checks:

npm run test:types
npm run test:parity
npm pack --dry-run

npm run build:wasm requires Emscripten and CMake. Tests that need a local browser or WASM artifact skip when those pieces are not available.

Project Boundary

spglibJS does not parse POSCAR/CIF files, infer bonding, build Three.js scenes, or manage application state. Use MATTERIA for materials data models and DRISHTI or another viewer for UI.

See:

License

BSD-3-Clause. The package includes generated data and behavior derived from upstream spglib.