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.
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.
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.
Many thanks! Good to know that my queries are not naive.
Not at all, and if you do find something useful then consider contributing it as an example to the documentation.
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:
- 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);
- assume a uniform mesh on the domain of computation. Compute the mixture fraction on the mesh;
- assume a computed mixture fraction on a uniform mesh. Compute the partion function on this mesh;
- 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;
- 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;
- 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;
- 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;
- 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;
Here is a Video showing how students are taking advantage of Molly to make progress in their project. I am happy to discuss this further.
Thanks for sharing. The link seems to require a login though?
Apologies for this glitch. I asked students to prepare more results. Hope to be back here soon. Thx.
The video is now available at video
The animation shows two kinds of particles. The first and second kind are inside and outside the disk, respectively.
In a next step, we would like to gain a better understanding of these simulations.
We plan to do so by
- considering one kind of spherical particles only (oil droplets);
- lowering the numbering of particles, thus allowing faster computations on smaller problem size;
- considering an entropic force as surface force between the particles. We plan to take advantage of user-defined pairwise interactions in Molly to implement such a force. Aside from the entropic force, particles will also be subjected to the wall shear force;
- run simulations at a fixed temperature (using a thermostat to fix the T-value) and fixed angular frequency of the wall shearing force until the entropic energy reaches a steady-state value;
- computing the average shear stress on the particles (output of the simulations) hoping to recover a sinusoidal signal at a single dominant frequency;
- computing the auto-correlation of the shear stress (Green-Kubo) hoping again to recover a sinusoidal signal at a single dominant frequency;
- repeat above for a set of frequencies of the wall shear hoping to recover a plateau zone for the real part of the dynamic modulus (the elastic modulus);
- repeat above for various temperature hoping to recover published results for the elastic modulus;
Details are missing and need to be filled in.
Very nice, I’d be interested to hear how you get on.