Molly for Emulsion Rheology

Greetings, How does one implement on imposed shear force in MD simulations in general and Molly in particular? For context, see e.g. https://github.com/ziolai/finite_element_electrical_engineering/tree/main/project-based-assignment/making_mayonnaise

Could you point to a particular interaction equation you want to implement?

Molly only works with particle simulations, so finite element or fluid dynamics methods may not be applicable.

1 Like

Dear Joe,

We want to implement two interactions.

The first interaction is the random motion of oil droplets in water. This interaction can be modeled be the minimization of the entropic free energy. This term dominates in case of low volume fraction of oil droplets in water.

The second interaction in the deformation of the interface between the oil droplets and water. This interaction can be modeled by the minimization of the interfacial energy. This term dominates in case of high volume fraction of oil droplets in water.

Both interaction depend on the magnitude of external force (dilation or shear) applied to the sample. The entropic interaction depends on the amount of external force via the partition function. The interfacial interaction depends on the amount of external force via the amount of deviation from perfect spheres.

Both interactions have closed-form expressions for the free energy as a function of the volume fraction in case of mono-disperse oil droplets (all oil droplets having the same diameter). We are happy to start MD assuming mono-disperse simulations.

Does Molly allow to derive interaction potentials from free energy potential expressed in terms of the volume fraction of the droplets?

Thank you. Domenico.

I don’t have much experience of what this would look like. If the potential can be calculated as a function of the droplet positions and properties then yes, you should be able to implement it in Molly.

1 Like

Thanks!

Are there examples of Molly.jl simulations with post-processing for local values of the mixture fraction of particles or the partition function?

Not that I know of, sorry.

1 Like

Many thanks! Good to know that my queries are not naive.

1 Like

Not at all, and if you do find something useful then consider contributing it as an example to the documentation.

1 Like

Correct!

Our current path of flight is therefore as outlined below.

Build Your Own Particle Simulator from Scratch

The code listed below is taken from this Discourse Post.

With 15 lines, Leandro Martinez (@lmiq) writes a code to perform a particle simulation with periodic boundary conditions, a langevin thermostat, a quadratic potential between the particles, and produce an animation (see below).

The code below uses the function wrap that in turn uses the ternary operator a?b:c explained at control flow.

Exercise Extend this code with:

  1. monitor the potential, kinetic and total energy on each particle. Verify in which conditions (implicit vs. explicit time stepping, order of time stepping method, fixed vs. adaptive time step, time step size) the total energy remains preserved (i.e. constant in time);
  2. assume a uniform mesh on the domain of computation. Compute the mixture fraction on the mesh;
  3. assume a computed mixture fraction on a uniform mesh. Compute the partion function on this mesh;
  4. differentiate the total energy wrt the position vector \mathbf{x}_i of particle i to obtain the force vector \mathbf{F}_i on particle i. Possibly use ForwardDiff or any for this differentiation;
  5. differentiate the force vector \mathbf{F}_i on particle i wrt its position vector \mathbf{x}_i (thus obtaining the second derivative of the energy) to obtain the coefficients in the constitutive force-strain relation;
  6. repeat above for alternative choices of the potential between particles. Choices include adding a cubic term to the potential (Duffing oscillators), Langevin and Van der Waals potentials. Verify whether the later allow to take particle sizes into account;
  7. taylor the above framework to emulsions formed by vegetable oil droplets in water by considering the entropic and interfacial free energy of the emulsion undergoing a shear force;
  8. verify to what extend the package Molly allows to automate and/or extend any of the above steps. Please note that the Molly package allows for differentiable simulations. This property motivates our choice for this package;