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.0.tar.gz (88.7 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.0-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for vectra-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4edd7ffe227b3e0ce4c98723e37db85a548f841e56942569ffd48f4678caba75
MD5 3cc854daf01cf082587624145add3399
BLAKE2b-256 01e714936276e66589a1bc62108a9d9176cf3b24c0fffcf1f3c2c946f8c0244c

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for vectra-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4d4237766da4e16a3f1f6dcf12f5d6043719702457e7a88263917461b5e1a2fa
MD5 993265af1007aa2651af40d25d8149c7
BLAKE2b-256 27d8d54d51bce78d977c9269b5ad906dfcbdb4aa9c2b9188f13a59ee97e64fed

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