Skip to main content

Vector Transformations and Thermostats for ASE Atoms and Molecules

Project description

Vectra: Vector Transformations and Thermostats for ASE Atoms and Molecules

Vectra is a Python package designed to provide tools for vector transformations on ASE atoms and molecules, as well as specialized thermostats for molecular dynamics simulations.

Features

  • Decomposition of Quantities: Decompose total quantities (e.g., forces, momenta) into translational, rotational, and vibrational components for individual molecules or groups of atoms.
  • Decomposed Berendsen Thermostat: Apply Berendsen thermostats that operate independently on translational, rotational, and vibrational degrees of freedom.

Installation

pip install vectra

Usage

Decomposing Quantities

Decompose a quantity (like forces or velocities) for a set of atoms into translational, rotational, and vibrational components for each identified molecule.

import ase
import numpy as np
from vectra import decompose
from rdkit2ase import smiles2atoms
from mace.calculators import mace_mp

atoms = smiles2atoms(smiles="O")
atoms.calc = mace_mp() # Any ASE calculator. We are using a uMLIP here.

# Get forces from the calculator
forces = atoms.get_forces()

# Decompose forces
# The 'decompose' function automatically identifies molecules based on connectivity.
decomposed_molecules = decompose(atoms, quantity=forces)

for i, (trans_c, rot_c, vib_c, component_indices) in enumerate(decomposed_molecules):
    print(f"\nMolecule {i+1} (atoms {component_indices}):")
    print("  Translational component:", trans_c)
    print("  Rotational component:", rot_c)
    print("  Vibrational component:", vib_c)

Using Decomposed Berendsen Thermostat

Apply a Berendsen thermostat that can control translational, rotational, and vibrational temperatures independently.

import ase.units
from vectra import DecomposedBerendsenThermostat
from rdkit2ase import smiles2conformers, pack
from mace.calculators import mace_mp

# Create a system with multiple water molecules using smiles2conformers and pack
water = smiles2conformers(smiles="O", num_conformers=1)[0] # Get one conformer
atoms = pack([water], counts=[3], density=1000)

atoms.calc = mace_mp()

md = DecomposedBerendsenThermostat(
    atoms=atoms,
    timestep=0.5, # fs
    temperature_trans=500,
    temperature_rot=400,
    temperature_vib=300,
    tau_trans=0.5 * 100 * ase.units.fs,
    tau_rot=0.5 * 100 * ase.units.fs,
    tau_vib=0.5 * 100 * ase.units.fs,
)

md.run(1000)

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

vectra-0.1.2.tar.gz (89.2 kB view details)

Uploaded Source

Built Distribution

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

vectra-0.1.2-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file vectra-0.1.2.tar.gz.

File metadata

  • Download URL: vectra-0.1.2.tar.gz
  • Upload date:
  • Size: 89.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.17

File hashes

Hashes for vectra-0.1.2.tar.gz
Algorithm Hash digest
SHA256 86cbc4cc4c7fd7e6517aa0ccf061d24bed5ccbcef20e73d14e56de4635f306ee
MD5 2b9dd1db3cb4d747de5b7334fc579e2c
BLAKE2b-256 f3b689a3bec7a9d9e266b95f040ce24710b6963f6afcc4d0bc0f1f20e693a8c2

See more details on using hashes here.

File details

Details for the file vectra-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: vectra-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 7.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.17

File hashes

Hashes for vectra-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 40aa8baf090d996cf03f7b9ca89bfa98709401f985e8142c997db8778224e4b9
MD5 5828f179f554b5cfe552e0937d20eeb3
BLAKE2b-256 5d2cc09b653f305e86cb430b79ce632b32b218ddda147ca69842bd9f3f7924c0

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