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/mechanics

v0.1.0

Published

Elastic tensors, moduli, stability checks, and equation-of-state helpers for MATTERIA.

Readme

@matteria-js/mechanics

Elastic and equation-of-state helpers for MATTERIA.

This package stores stiffness data and computes common post-processing summaries. It does not run DFT calculations, finite-strain workflows, molecular dynamics, or plotting code.

Included

  • ElasticTensor for 3D Voigt stiffness matrices.
  • Cubic tensor construction.
  • Compliance matrices.
  • Voigt-Reuss-Hill bulk, shear, Young's modulus, Poisson ratio, and universal anisotropy.
  • Directional Young's modulus samples and anisotropy ranges from existing 3D compliance matrices.
  • Born stability checks for general, cubic, hexagonal, and orthorhombic stiffness matrices.
  • JSON-friendly 3D elastic summaries for dashboards.
  • ElasticTensor2D for in-plane elastic constants.
  • 2D Young's moduli, Poisson ratios, shear modulus, layer modulus, and Born-style stability checks.
  • JSON-friendly 2D elastic summaries.
  • Basic quadratic equation-of-state fitting from energy-volume points.
  • Third-order Birch-Murnaghan equation-of-state evaluation and derivative-free fitting from energy-volume points.
  • Vinet equation-of-state evaluation and derivative-free fitting from energy-volume points.
  • Compact equation-of-state fit summaries without typed residual arrays.

Example

import {
  ElasticTensor,
  ElasticTensor2D,
  computeDirectionalYoungModulus,
  fitBirchMurnaghanEquationOfState,
  fitQuadraticEquationOfState,
  fitVinetEquationOfState,
  sampleDirectionalYoungModulus,
  summarizeEquationOfStateFit,
} from "@matteria-js/mechanics";

const siliconLike = ElasticTensor.cubic(240, 80, 70);
const moduli = siliconLike.voigtReussHill();
const stability = siliconLike.bornStability({ crystalSystem: "cubic" });
const elasticSummary = siliconLike.summary({ crystalSystem: "cubic" });
const xYoungModulus = computeDirectionalYoungModulus(siliconLike, [1, 0, 0]);
const directionalElasticity = sampleDirectionalYoungModulus(siliconLike);

const sheet = ElasticTensor2D.fromPlaneStress({
  c11: 150,
  c22: 100,
  c12: 30,
  c66: 40,
});
const sheetSummary = sheet.summary();

const fit = fitQuadraticEquationOfState([
  { volume: 9.5, energy: -9.8 },
  { volume: 10.0, energy: -10.0 },
  { volume: 10.5, energy: -9.85 },
]);

const birchMurnaghan = fitBirchMurnaghanEquationOfState([
  { volume: 8.0, energy: -9.2 },
  { volume: 9.0, energy: -9.8 },
  { volume: 10.0, energy: -10.0 },
  { volume: 11.0, energy: -9.85 },
  { volume: 12.0, energy: -9.4 },
]);

const vinet = fitVinetEquationOfState([
  { volume: 8.0, energy: -9.2 },
  { volume: 9.0, energy: -9.8 },
  { volume: 10.0, energy: -10.0 },
  { volume: 11.0, energy: -9.85 },
  { volume: 12.0, energy: -9.4 },
]);
const eosSummary = summarizeEquationOfStateFit(vinet);

console.log(moduli.bulkHill);
console.log(stability.stable);
console.log(elasticSummary.averages.universalAnisotropy);
console.log(xYoungModulus);
console.log(directionalElasticity.anisotropyRatio);
console.log(sheetSummary.properties.youngX);
console.log(fit.equilibriumVolume);
console.log(summarizeEquationOfStateFit(birchMurnaghan).maxAbsResidual);
console.log(eosSummary.bulkModulusGPa);

All matrices are copied on input. APIs are browser and Node.js compatible and return JSON-friendly records, compact summaries, or typed arrays. Summary helpers avoid carrying typed residual arrays into dashboard payloads, and directional summaries use plain arrays for viewer/dashboard transfer.

Limits

  • stiffness tensors use Voigt notation and assume GPa for 3D tensors
  • 2D tensors store in-plane constants only
  • directional sampling reports supplied or reference directions only; it does not build full anisotropy surfaces
  • Born stability checks are deterministic screening helpers, not a substitute for reviewing the full elastic tensor and crystal symmetry
  • equation-of-state support covers quadratic, third-order Birch-Murnaghan, and Vinet fits only; other EOS models are deferred
  • no workflow submission, strain generation, plotting, or rendering