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

@matteria-js/surfaces

v0.1.0

Published

Surface, slab, adsorption-site, STM plane, and work-function helpers for MATTERIA structures.

Downloads

61

Readme

@matteria-js/surfaces

Surface and slab helpers for MATTERIA structures.

This package prepares data for slab, adsorption, STM, and work-function workflows. It does not run DFT, choose terminations automatically, extract isosurfaces, or render geometry.

Included

  • Miller plane metadata from a lattice or structure.
  • Oriented slab construction with vacuum through @matteria-js/transformations.
  • Surface layer detection along a lattice axis.
  • Candidate termination enumeration from detected layer gaps on already-oriented slabs.
  • Ontop, bridge, and hollow adsorption-site generation for top, bottom, or both surfaces.
  • Adsorbate placement with site metadata.
  • STM plane metadata for viewer or workflow code.
  • Simple work-function estimates from planar potential profiles.
  • JSON-friendly slab and adsorption-site summaries for workflow reports and viewer side panels.

Example

import {
  generateAdsorptionSites,
  getMillerPlane,
  makeSurfaceSlab,
  placeAdsorbate,
  summarizeAdsorptionSites,
  summarizeSurfaceSlab,
  enumerateSurfaceTerminations,
  summarizeSurfaceTerminations,
} from "@matteria-js/surfaces";

const plane = getMillerPlane(structure, [0, 0, 1]);
const slab = makeSurfaceSlab(structure, {
  millerIndex: [0, 0, 1],
  minSlabSize: 12,
  minVacuumSize: 15,
});

const sites = generateAdsorptionSites(slab.structure, {
  side: "top",
  height: 1.8,
  kinds: "all",
});
const terminations = enumerateSurfaceTerminations(slab.structure);

const withHydrogen = placeAdsorbate(slab.structure, "H", sites[0]);
const slabSummary = summarizeSurfaceSlab(slab);
const siteSummary = summarizeAdsorptionSites(sites);
const terminationSummary = summarizeSurfaceTerminations(terminations);

console.log(plane.dSpacing);
console.log(slab.layers.at(-1)?.siteIndices);
console.log(withHydrogen.numSites);
console.log(slabSummary.emptyNormalSpanEstimate);
console.log(siteSummary.labels);
console.log(terminationSummary.labels);

Limits

  • slab construction assumes the input structure is already oriented with the surface normal along lattice c
  • no Miller-index reorientation, automatic termination choice, reconstruction, or dipole correction policy yet
  • termination enumeration reports detected layer-gap candidates only; it collapses repeated lower/upper layer formula pairs by default and does not create new slabs or rank surface energies
  • adsorption-site generation covers ontop sites by default and opt-in bridge pairs plus hollow triplets on detected surface layers
  • no automatic molecule-orientation or coverage enumeration
  • STM helpers return plane metadata only; they do not sample charge density or render an image
  • work-function helpers average a caller-provided planar potential profile; they do not parse LOCPOT directly