Skip to content

Matgenix/wetting-angle-kit

Repository files navigation

wetting-angle-kit

tests docs code coverage pypi version Python versions License: BSD 3-Clause Documentation

wetting-angle-kit provides modular tools to parse MD trajectories (LAMMPS dump, XYZ, ASE) and compute droplet contact angles using two complementary approaches:

  1. Slicing Method (per-frame circle fit) – robust against transient shape changes.
  2. 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.

Installation

Prerequisites

Before installing wetting-angle-kit, ensure you have the following prerequisites:

  1. Python 3.10 or higher: Make sure you have Python 3.10 or higher installed on your system.
  2. 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-kit

With OVITO:

pip install wetting-angle-kit[ovito]

With ASE:

pip install wetting-angle-kit[ase]

All optional:

pip install wetting-angle-kit[all]

Install OVITO

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.3

Quick Start

from 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)

About

wetting-angle-kit: a Python package for automated wetting contact angle analysis of nanodroplets

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors