Skip to content

SoftSimu/droplets

Repository files navigation

Droplet Shape Analysis

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.

Local and circle fitting.

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.

Usage

The main module and related functions can be found in drop_lib.py. For examples and specific usage see the example notebook.

FAQ

  • What is calculated?

You can compute the contact angle and contact radius. The method computes contact angle and contact radius for the left and right sides, separately. You can also analyze both sides 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 (3D spherical cap) or pseudo-two-dimensional (2D cylindrical). Start with analyzing a single frame using Single Measurement (Frame) examples. Once the satisfactory results are achieved, simply wrap your analysis in a loop to analyze all available time steps. You can follow Entire Simulation examples and test the procedure using the provided GRO and XTC sample 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 2D procedure 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 3D or 2D examples. If you would like to use the modules procedure, simply provide the position of all droplet particles as an MDAnlaysis 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 the swap_xy function and use it as a transformation. For more information, please see the examples notebook.

  • 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_il or 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_pts variable of the analyze_droplet function.

Acknowledgements

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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •