wetting-angle-kit provides modular tools to parse MD trajectories (LAMMPS dump, XYZ, ASE) and compute droplet contact angles using two complementary approaches:
- Slicing Method (per-frame circle fit) – robust against transient shape changes.
- Binning Density Method – averages frames into a density field for a single representative angle.
The documentation is available here, you can find examples and tutorials.
Before installing wetting-angle-kit, ensure you have the following prerequisites:
- Python 3.10 or higher: Make sure you have Python 3.10 or higher installed on your system.
- Conda: Ensure you have Conda installed. If not, you can install it from here.
Core (only to analyse simple xyz trajectories):
pip install wetting-angle-kitWith OVITO:
pip install wetting-angle-kit[ovito]With ASE:
pip install wetting-angle-kit[ase]All optional:
pip install wetting-angle-kit[all]OVITO must be installed first in the conda environment and using the following Conda command:
conda install --strict-channel-priority -c https://conda.ovito.org -c conda-forge ovito=3.11.3from wetting_angle_kit.analysis import (
BinningTrajectoryAnalyzer,
SlicingTrajectoryAnalyzer,
)
from wetting_angle_kit.parsers import XYZParser, XYZWaterFinder
trajectory_file = "trajectory.xyz"
# Identify water oxygen atoms by neighbor count. ``particle_type_wall``
# lists the symbols of the substrate atoms so they are excluded.
finder = XYZWaterFinder(trajectory_file, particle_type_wall=["C"])
oxygen_ids = finder.get_water_oxygen_indices(frame_index=0)
parser = XYZParser(trajectory_file)
slicing = SlicingTrajectoryAnalyzer(
parser,
atom_indices=oxygen_ids,
droplet_geometry="spherical",
delta_gamma=5,
)
results = slicing.analyze(frame_range=range(0, 50))
print(results.mean_angle, results.std_angle)
binning = BinningTrajectoryAnalyzer(
parser,
atom_indices=oxygen_ids,
droplet_geometry="spherical",
)
results_binning = binning.analyze(frame_range=range(0, 200))
print(results_binning.mean_angle, results_binning.std_angle)