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

@galihru/mnp

v0.1.4

Published

Integrated electromagnetic response of metallic nanoparticles: Drude dielectric model combined with Rayleigh quasi-static scattering.

Readme

@galihru/mnp

Integrated computational package for the single-nanoparticle electromagnetic response in the Rayleigh quasi-static limit. Composes dielectric-function evaluation with polarizability and optical cross-section computation into a unified, self-consistent simulation API.


Physical Scope

This package solves the single-nanoparticle optical response problem: given a metallic sphere of radius a << lambda embedded in a dielectric host medium, compute as functions of illumination wavelength:

  1. Complex permittivity via the Drude free-electron model:

    epsilon Drude

  2. Complex polarizability via the Clausius-Mossotti relation:

    alpha CM

  3. Electromagnetic cross sections from the optical theorem:

    cross sections


Composed Packages

| Package | Description | |---|---| | @galihru/mnp-material | Drude dielectric model for Au, Ag, Al; constant epsilon; complex wave number | | @galihru/mnp-mie | Rayleigh polarizability; extinction, scattering, and absorption cross sections |


Install

npm install @galihru/mnp

API Reference

simulateSphereResponse(options) -- High-level

Computes the complete optical response of a metallic nanosphere in a single call.

import { simulateSphereResponse } from "@galihru/mnp";

const result = simulateSphereResponse({
  material:              "Au",   // "Au" | "Ag" | "Al"
  wavelengthNm:          548.1,  // nm -- scalar or Array for spectral scan
  radiusNm:              50,     // nm
  mediumRefractiveIndex: 1.33    // dimensionless refractive index of host medium
});

Return value:

| Field | Unit | Description | |---|---|---| | inputs | -- | Echo of all input parameters | | epsParticle | {re, im} | Complex permittivity of the metal particle | | epsMedium | {re, im} | Permittivity of the embedding medium | | alpha | {re, im} nm^3 | Quasi-static complex polarizability | | crossSection.cExt | nm^2 | Extinction cross section | | crossSection.cSca | nm^2 | Scattering cross section | | crossSection.cAbs | nm^2 | Absorption cross section |


Low-level Re-exports

All functions from sub-packages are re-exported directly:

import {
  // Dielectric models
  drudeEpsilon, makeDrudeMaterial, constantEpsilon, wavenumberInMedium,
  // Scattering
  rayleighPolarizability, rayleighCrossSections,
  // Complex arithmetic
  complex, add, sub, mul, div, sqrtComplex, fromReal,
  // Constants
  EV_TO_NM, HARTREE_EV
} from "@galihru/mnp";

Example -- Spectral Scan

import { drudeEpsilon, constantEpsilon, rayleighCrossSections } from "@galihru/mnp";

const wavelengths = [400, 450, 500, 548, 600, 700];

// Au permittivity across wavelengths
const epsAu  = drudeEpsilon("Au", wavelengths);

// Host medium: water (n = 1.33, eps = n^2)
const epsH2O = wavelengths.map(w => constantEpsilon(1.769, w));

// Cross sections for a 50 nm radius Au sphere
const spectra = rayleighCrossSections(wavelengths, 50, epsAu, epsH2O);

spectra.forEach((cs, i) =>
  console.log(
    wavelengths[i] + " nm  Cext=" + cs.cExt.toFixed(1) + " nm^2" +
    "  Cabs=" + cs.cAbs.toFixed(1) + " nm^2"
  )
);

Author

GALIH RIDHO UTOMO | [email protected] Universitas Negeri Semarang (UNNES) License: GPL-2.0-only