Skip to main content

A simple molecular geometry manipulation library.

Project description

molgeom

A Simple Python library for molecular geometry manipulation.

Note: molgeom is under active development. The implemented features and method names may change in future updates. Please check the repository regularly for the latest information.

molgeom_view_mols_example_1

✨ Key Features

  • Read and write molecular geometries:
    • Formats supported: XYZ, Gaussian input, GAMESS input, MOL, SDF, CIF, VASP POSCAR.
  • Calculate molecular properties:
    • Nuclear repulsion energy.
    • Center of mass.
    • Bond lengths.
  • Perform geometry manipulations:
    • Translation and rotation (including matrix and Rodrigues' rotation formula).
    • Cell replication using lattice vectors and symmetry operations (e.g., -y, x + 1/2, -z + 1/2).
    • Merge molecule geometries.
  • Visualize molecular geometries:
    • Display molecules in your Jupyter Notebook or browser using 3Dmol.js.
  • Command-line interface:
    • molgeom command is available after installation.
    • See Command Line Usage section below for details
  • Additional utilities:
    • Filter atoms by element.
    • Cluster fragments.
    • Identify bond cycles.

🚀 Getting Started

You can try out example of molgeom in Jupyter Notebook:
👉 Try Example Code in Jupyter Notebook

For a version with NumPy, see the numpyfy branch.


🔽 Installation

Install molgeom using pip:

pip install molgeom

Alternatively, clone the repository for development:

git clone https://github.com/sio-salt/molgeom.git
cd molgeom
pip install -e .

The minimum Python version required is 3.10 for the main branch.

📟 Command Line Usage

After installation, the molgeom command becomes available. Enable shell completion by copying and pasting the following command into your terminal:

Bash:

echo 'eval "$(_MOLGEOM_COMPLETE=bash_source molgeom)"' >> ~/.bashrc && source ~/.bashrc

Zsh:

echo 'eval "$(_MOLGEOM_COMPLETE=zsh_source molgeom)"' >> ~/.zshrc && source ~/.zshrc

Fish:

_MOLGEOM_COMPLETE=fish_source molgeom | source

Available commands:

# Single file commands
molgeom modify <file> [-op <op>]   # Transform structure (translate/reflect/rotate)
molgeom split <file>               # Split into molecular clusters
molgeom poscar2xyz <file> <ranges> # Convert POSCAR with cell replication
                                   # ( e.g., molgeom poscar2xyz POSCAR_H2O -1 2 -1 0 1 2 )

# Multiple file commands (space-separated)
molgeom center <file1> <file2> ...         # Print center of mass for multiple files
molgeom nuclrep <file1> <file2> ...        # Calculate nuclear repulsion energy for multiple files
molgeom bonds <file1> <file2> ... [--tol]  # List bonds for multiple files
molgeom view <file1> <file2> ...           # View multiple structures in browser

# Get help for any command
molgeom --help
molgeom <command> --help

🛠️ Future Plans

  • Support Z-matrix format.
  • Add more symmetry utilities.
  • Handle multi-molecule systems.
  • Additional features and improvements.

🔗 Links

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

molgeom-0.8.0.tar.gz (140.2 kB view details)

Uploaded Source

Built Distribution

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

molgeom-0.8.0-py3-none-any.whl (124.1 kB view details)

Uploaded Python 3

File details

Details for the file molgeom-0.8.0.tar.gz.

File metadata

  • Download URL: molgeom-0.8.0.tar.gz
  • Upload date:
  • Size: 140.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.2

File hashes

Hashes for molgeom-0.8.0.tar.gz
Algorithm Hash digest
SHA256 b63c3d717ba0cec669718b36fc965752ccb09ac3a8b9894b98580bba183918ca
MD5 60923a00ba2c24bc495fc037bd91e540
BLAKE2b-256 30ba03c09c0e6b88928546851364292c94469df594de47a78429569f5ef83196

See more details on using hashes here.

File details

Details for the file molgeom-0.8.0-py3-none-any.whl.

File metadata

  • Download URL: molgeom-0.8.0-py3-none-any.whl
  • Upload date:
  • Size: 124.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.2

File hashes

Hashes for molgeom-0.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e685b08970f1dd38d989dd817bf91eedac28876888c3facd43187361fb51767f
MD5 fac6ca88dda16a0f7c2e15c7c35b1d20
BLAKE2b-256 c111f3e87e9d00209d0684f57bde17c59cde8ada6b9b5e866243880848c69942

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