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 🙏

© 2025 – Pkg Stats / Ryan Hefner

omovi

v0.21.0

Published

Online Molecular Visualizer

Readme

OMOVI (Online Molecular Visualizer)

NPM Deploy to GitHub pages

OMOVI is a high-performance library for 3D visualization of molecular dynamics simulations in the browser using WebGL via Three.js. It is designed for simplicity, efficiency, and ease of integration into web applications.

See a live demo here where you can visualize simulation files by dragging and dropping them into the browser.

Features

  • Multiple File Formats: XYZ, LAMMPS data files, LAMMPS binary dump files
  • High Performance: GPU-accelerated rendering using instanced geometry
  • Interactive Controls: Camera controls, particle selection, and picking
  • Visual Effects: SSAO (ambient occlusion), particle outlines, customizable colors
  • Flexible API: Easy integration into React or vanilla JavaScript applications
  • Bond Visualization: Automatic or custom bond creation between atoms

Installation

npm install omovi

Quick Start

Basic Usage

import { Visualizer, Particles } from 'omovi'

// Create a visualizer attached to a DOM element
const container = document.getElementById('visualization')
const visualizer = new Visualizer({ domElement: container })

// Create particles
const particles = new Particles(3)
particles.add(0.0, 0.0, 0.0, 0, 1) // x, y, z, id, type
particles.add(1.0, 0.0, 0.0, 1, 1)
particles.add(0.0, 1.0, 0.0, 2, 2)

// Add to visualizer
visualizer.add(particles)

// Set colors by particle type
visualizer.setColor(1, { r: 255, g: 0, b: 0 })   // Red
visualizer.setColor(2, { r: 0, g: 0, b: 255 })   // Blue

// Set particle radii
visualizer.setRadius(1, 0.5)
visualizer.setRadius(2, 0.3)

Loading from Files

import { parseXyz, parseLAMMPSData, Visualizer } from 'omovi'

// Parse XYZ file
const xyzData = await fetch('molecules.xyz').then(r => r.text())
const simulationData = parseXyz(xyzData)

// Create visualizer
const visualizer = new Visualizer({ domElement: container })

// Add first frame
const frame = simulationData.getFrame(0)
visualizer.add(frame.particles)
if (frame.bonds) {
  visualizer.add(frame.bonds)
}

Creating Bonds

import { createBondsByDistance, Visualizer } from 'omovi'

// Define which particle types should form bonds and at what distance
const bondCreator = createBondsByDistance({
  radius: 0.1,
  pairDistances: [
    { type1: '1', type2: '8', distance: 1.5 },  // H-O bonds
    { type1: '6', type2: '6', distance: 1.8 },  // C-C bonds
  ]
})

// Apply to simulation data
simulationData.generateBondsFunction = bondCreator

// Bonds will be created automatically when getting frames
const frame = simulationData.getFrame(0)
visualizer.add(frame.particles)
if (frame.bonds) {
  visualizer.add(frame.bonds)
}

Particle Selection

import { Visualizer } from 'omovi'

const visualizer = new Visualizer({
  domElement: container,
  onParticleClick: (event) => {
    console.log('Clicked particle:', event.particleIndex)
    console.log('Position:', event.position)
    console.log('Shift key pressed:', event.shiftKey)
    
    // Toggle selection
    visualizer.setSelected(event.particleIndex, true)
  }
})

// Clear all selections
visualizer.clearSelection()

// Change selection color
import * as THREE from 'three'
visualizer.setSelectionColor(new THREE.Color(1.0, 0.5, 0.0)) // Orange

Camera Controls

import * as THREE from 'three'

// Get current camera state
const position = visualizer.getCameraPosition()
const target = visualizer.getCameraTarget()

// Set camera position
visualizer.setCameraPosition(new THREE.Vector3(10, 10, 10))
visualizer.setCameraTarget(new THREE.Vector3(0, 0, 0))

// Listen to camera changes
const visualizer = new Visualizer({
  onCameraChanged: (position, target) => {
    console.log('Camera moved to:', position)
    console.log('Looking at:', target)
  }
})

API Overview

Core Classes

Visualizer

Main visualization class that manages the 3D scene, camera, and rendering.

new Visualizer({
  domElement?: HTMLElement,
  onCameraChanged?: (position: THREE.Vector3, target: THREE.Vector3) => void,
  onParticleClick?: (event: ParticleClickEvent) => void,
  initialColors?: Color[]
})

Particles

Represents a collection of particles (atoms).

const particles = new Particles(capacity: number)
particles.add(x, y, z, id, type): boolean
particles.getPosition(index: number): THREE.Vector3
particles.getType(index: number): number

Bonds

Represents bonds between particles.

const bonds = new Bonds(capacity: number)
bonds.add(x1, y1, z1, x2, y2, z2, radius): boolean
bonds.getPosition1(index: number): THREE.Vector3
bonds.getRadius(index: number): number

Parsers

  • parseXyz(data: string): SimulationData - Parse XYZ format files
  • parseLAMMPSData(data: string): SimulationData - Parse LAMMPS data files
  • parseLAMMPSBinaryDump(buffer: ArrayBuffer): SimulationData - Parse LAMMPS binary dump files

Utilities

  • createBondsByDistance(options): BondCreator - Create bonds based on distance criteria
  • getColor(particleType: number): Color - Get default color for particle type

Development

# Install dependencies
npm install

# Build library
npm run build

# Run tests
npm test

# Watch mode for tests
npm run test:watch

# Type checking
npm run typecheck

# Linting
npm run lint
npm run lint:fix

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

GPLv3 © andeplane