Skip to main content

openWFN: lightweight wavefunction geometry analysis toolkit

Project description

openWFN

Tests License Python

openWFN (open WaveFunction Network) is a lightweight toolkit for molecular geometry post-processing from Gaussian checkpoint data.

It is built for users who want:

  • fast command-line geometry analysis from .fchk files
  • reproducible atom-index-based calculations
  • a minimal, script-friendly toolchain with low dependencies

Key Capabilities

  • Read Gaussian .fchk files
  • Convert .chk to .fchk automatically when formchk is available
  • Convert coordinate units from Bohr to Angstrom internally
  • Calculate distance, angle, and dihedral from atom indices
  • Detect covalent bonds using tabulated covalent radii
  • Build molecular fragments (connected components)
  • Export coordinates to XYZ format
  • Run in command mode or interactive terminal menu mode

Requirements

  • Python 3.10+
  • numpy
  • Gaussian formchk only if you provide .chk files

Installation

git clone https://github.com/sha786muhammed/openWFN.git
cd openWFN
pip install -e .

Quick Start

Use one of the included examples:

openwfn examples/water/water.fchk summary
openwfn examples/ammonia/ammonia.fchk dist 1 2
openwfn examples/methane/methane.fchk graph
openwfn examples/water/water.fchk xyz water.xyz

If no subcommand is provided:

  • in a TTY terminal, openWFN starts interactive mode
  • in non-interactive contexts, openWFN runs summary

Command Reference

General form:

openwfn <file.chk|file.fchk> <command> [arguments]

Available commands:

  • summary: one-page molecular overview (formula, atom count, charge, multiplicity, center of mass, energy if present, bonds, fragments)
  • info: print parsed scalar metadata from FCHK
  • dist i j: distance in Angstrom between atom i and atom j
  • angle i j k: bond angle (i-j-k) in degrees
  • dihedral i j k l: torsion angle (i-j-k-l) in degrees
  • bonds: print detected covalent bonds and distances
  • graph: print molecular fragments (connected components)
  • xyz output.xyz: export Cartesian coordinates to XYZ file
  • interactive: force interactive menu mode
  • density --export out.vtk [--grid-size NxNxN]: experimental density-export pathway; currently unavailable and exits with an error
  • mo <index> --export out.vtk: experimental molecular-orbital pathway; currently unavailable and exits with an error

Note:

  • geometry and export commands (summary, info, dist, angle, dihedral, bonds, graph, xyz) are the stable user-facing surface today
  • density and mo are reserved for future development work and should not be treated as supported end-user commands yet

Get CLI help:

openwfn --help

Interactive Mode Guide

Start:

openwfn examples/water/water.fchk

Main menu options:

Landing page
  openWFN
  Open WaveFunction Network
  A lightweight terminal toolkit for Gaussian .fchk geometry analysis.

Features
  1  Molecular summary
  2  Detailed metadata
  3  Atom index table
  4  Distance between two atoms
  5  Bond angle (i-j-k)
  6  Dihedral angle (i-j-k-l)
  7  Export XYZ
  8  List detected covalent bonds
  9  Show fragments / connectivity

Session
  0  Exit

Feature page
  Shows the selected feature
  Supports `back` to return to the landing page
  Supports `exit` to quit openWFN

Typical interactive workflow:

  1. Start on the landing page and choose a feature number.
  2. openWFN opens that feature as its own page.
  3. Use back to return to the landing page.
  4. Use exit from either the landing page or a feature page to quit immediately.

Input behavior:

  • atom indices are 1-based
  • invalid indices are reported as errors
  • malformed numeric input is rejected and reprompted
  • back returns from any feature page to the landing page
  • exit quits from any page
  • textual aliases such as summary, dist, bonds, graph, xyz, and exit are accepted
  • interactive mode intentionally shows only the working end-user features

Example Sessions

Distance and angle:

openwfn examples/water/water.fchk dist 2 1
openwfn examples/water/water.fchk angle 2 1 3

Molecular summary:

openwfn examples/ammonia/ammonia.fchk summary

Fragment detection:

openwfn examples/methane/methane.fchk graph

XYZ export:

openwfn examples/water/water.fchk xyz outputs/water.xyz

File and Data Notes

  • Atomic coordinates in Gaussian FCHK are read in Bohr and converted to Angstrom.
  • Geometry commands assume coordinates are present in Current cartesian coordinates.
  • Bond detection uses element covalent radii with a fixed scaling factor (currently 1.2 in code).

Current Implementation Status

Fully supported and tested:

  • parsing of essential scalar and coordinate data
  • geometry calculations (dist, angle, dihedral)
  • bond detection and graph fragments
  • XYZ export

Partially implemented:

  • density is exposed for future development, but electron-density evaluation is not implemented yet; the command currently exits with an explanatory error.
  • mo is exposed for future development, but molecular-orbital grid evaluation is not implemented yet; the command currently exits with an explanatory error.

Use these two commands only if you are extending the codebase.

Development

Run tests:

pytest -q

Project layout:

src/openwfn/        package source
tests/              unit and CLI regression tests
examples/           sample molecules and Gaussian artifacts

License

MIT License. See LICENSE.

Author

Muhammed Shah Shaji
PhD Researcher, Computational Chemistry
GitHub: https://github.com/sha786muhammed

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

openwfn-0.4.0.tar.gz (26.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

openwfn-0.4.0-py3-none-any.whl (24.5 kB view details)

Uploaded Python 3

File details

Details for the file openwfn-0.4.0.tar.gz.

File metadata

  • Download URL: openwfn-0.4.0.tar.gz
  • Upload date:
  • Size: 26.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for openwfn-0.4.0.tar.gz
Algorithm Hash digest
SHA256 22481129ac899030a69ab3665c06ce816d0aa20653d313e50be24860254889f3
MD5 2c525e3cfd92d64125dd275bc18c4fa4
BLAKE2b-256 856f2fc141f003e6ad3d8cc17d7bdab6ae6e5706e91856c64020d44dc447deb5

See more details on using hashes here.

File details

Details for the file openwfn-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: openwfn-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 24.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for openwfn-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d985ed6521d8dd2bccd2c641f337a8ef30869799792b24b94036eda5288095b4
MD5 a25c60f64e78e35332344dbd09ad52fa
BLAKE2b-256 a97b18f9f85605418db91e06dafaa4664d7f5cd7bef608c8586a1c61c2be9199

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page