This repository provides the module for characterizing the wetting behavior of a droplet using its profile. The code can be applied to any particle-based simulation or experimental measurement image and is written in python.
Article: Robust methods for the characterization of droplet behavior in molecular dynamics: from contact radius to contact angle, F. Esmaeilian, M. T. Rad, M. Foroutan, M. Karttunen, PCCP, 2026.
BibTeX file with some additional references is given as the file refs.bib.
The main module and related functions can be found in drop_lib.py. For examples and specific usage see the example notebook.
- What is calculated?
You can compute the contact angle and contact radius. The method computes contact angle and contact radius for the
leftandrightsides, separately. You can also analyzebothsides at once, in which case a standard circle fitting is used.
- How can I analyze a molecular dynamics simulation?
In molecular dynamics (MD) simulations, the droplet system is either three-dimensional (
3Dspherical cap) or pseudo-two-dimensional (2Dcylindrical). Start with analyzing a single frame usingSingle Measurement (Frame)examples. Once the satisfactory results are achieved, simply wrap your analysis in a loop to analyze all available time steps. You can followEntire Simulationexamples and test the procedure using the providedGROandXTCsample files.
- How can I analyze an experimental image?
You can use gray scale images and extract the droplet profile using any edge detection method. Then, the profile can be treated as a two-dimensional droplet and analyzed using the
2Dprocedure provided in the examples notebook.
- Is it possible to apply the method to other particle-based simulation?
Yes. If you can extract the droplet profile, you can simply use the
3Dor2Dexamples. If you would like to use the modules procedure, simply provide the position of all droplet particles as anMDAnlaysis Universe. Then, given the dimensionality of your system, you can use the examples to run the analysis.
- How are the Cartesian coordinates,
$x-$ ,$y-$ , and$z-$ , defined for the system?
For the three-dimensional droplet (spherical cap), the normal to the surface is assumed to be along $z-$direction and the
$xz-$ projection is analyzed based on the methodology described in the reference. For the pseud-two-dimensional systems (cylindrical),$xz-$ profile is analyzed and the$y-$ direction is assumed to be a periodic direction. If your system uses $x-$direction as the periodic one, you can simply call theswap_xyfunction and use it as a transformation. For more information, please see theexamplesnotebook.
- When Analyzing, some molecules appear in the profile close to the center of contact area and separate from the main profile. Why does this happen? Does it affect the results?
Thermal fluctuations in MD or poor image quality in experimental measurements can lead to additional points being identified as molecules above the interfacial layer's threshold. The procedure usually takes care of those values and treats them as outliers. If, however, they are included in the calculation, one may see poor behavior in profile smoothing. In such rare cases, you can either increase the input value of
z_ilor improve the image quality of the experimental measurement.
- How can I improve the accuracy of the method?
In general, the method has been optimized using various droplet sizes and wettabilities. If required, a standard flexibility analysis can be performed on the
opt_num_ptsvariable of theanalyze_dropletfunction.
This work was supported by:
- Flight PS752 Commemorative Scholarship Program
- Natural Sciences and Engineering Research Council of Canada (NSERC)
- Canada Research Chairs Program
- Foundation PS
- Digital Research Alliance of Canada
- Research Council of Finland (Flagship of Advanced Mathematics for Sensing Imaging and Modelling grant 358944).
