A toy example of molecule aggregation to familiarize with LAMMPS software

in #steemstem5 years ago (edited)

Hello friends... Welcome to my new molecular dynamics post. As I mentioned in my previous post, I am going to start the new series on coarse-grained lipid models. As an opening article to this series, I will start with a toy example which will make you familiarize with the software LAMMPS, tools topotools, and VMD etc. I have mentioned about VMD in previous article series on MD:
Part 1 (The Fundamentals)
Part 2 (The Force Field!)
Part 3 (Solving the molecular dynamics equation)
Part 4a (Setting up NAMD simulation and running it)
Part 4b (Running small systems on your computer)

<p dir="auto">Today we are going to try a system which will exhibit aggregation of molecules: <p dir="auto">
<br /> <em>(Aggregation of molecules simulated via LAMMPS) <p dir="auto">My previous articles were about all-atom molecular dynamics simulations. This means that we care about each individual atoms. Even hydrogen atoms matter. The partial charges and mass of every atoms whether it be carbon atom or nitrogen atom. Every detail matter. In contrast to this, what I am going to talk from today is something called coarse-grained molecular dynamics. We dont simulate "atoms" here. But you simulate particles that will "hopefully" capture the global dynamics of systems. (But it is a common practice to call atom and particle interchangeably). Remember our <a href="https://hive.blog/steemstem/@dexterdev/phospholipids-the-unsung-heroes-in-biomoleucles">DMPC lipid molecule? See the figure below: <p dir="auto"><img src="https://images.hive.blog/768x0/https://i.imgur.com/MampLNS.png" srcset="https://images.hive.blog/768x0/https://i.imgur.com/MampLNS.png 1x, https://images.hive.blog/1536x0/https://i.imgur.com/MampLNS.png 2x" /><br /> <em><span>(Image Courtesy: <a href="/@dexterdev">@dexterdev) <p dir="auto">This lipid molecule has phosphocholine head(which is hydrophilic, i.e water liking group) and fatty acid tails(hydrophobic or water hating). What if a Physicist who loves <a href="https://en.wikipedia.org/wiki/Spherical_cow" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">spherical cow models wanted to just study about certain phenomenon of lipids. One way to proceed is to come up with hypothetical models for lipids. Like as in below: <p dir="auto"><img src="https://images.hive.blog/768x0/https://i.imgur.com/bJQ9f9W.png" srcset="https://images.hive.blog/768x0/https://i.imgur.com/bJQ9f9W.png 1x, https://images.hive.blog/1536x0/https://i.imgur.com/bJQ9f9W.png 2x" /><br /> <em><span>This is a 3 bead lipid model where 1st particle is hydrophilic and other two particles are hydrophobic!(Image Courtesy: <a href="/@dexterdev">@dexterdev) <p dir="auto">Outrageous, right? How can these physicists remove the entire details. Of course biologists will not be happy! But surprisingly enough there are many features which these models can capture. Not just that it makes modelling them in computer easy. Larger systems can be simulated for long enough without having too much of computing luxury. <p dir="auto">Let us get into the business right now. My aim is to illustrate the phenomenon of aggregation using a minimal coarse-grained model using LAMMPS. For that purpose I will define a 2 bead particle. <p dir="auto"><img src="https://images.hive.blog/768x0/https://i.imgur.com/rGAmuzI.png" srcset="https://images.hive.blog/768x0/https://i.imgur.com/rGAmuzI.png 1x, https://images.hive.blog/1536x0/https://i.imgur.com/rGAmuzI.png 2x" /><br /> <em><span>Two bead(type 1 and type 2) particle(Image Courtesy: <a href="/@dexterdev">@dexterdev) <h3>Bonding between particles <p dir="auto">At this point it is very important to understand what kinds of interactions we define between particles. There are kind of interactions which I will explain in this example. First kind of interaction is between the particles in a single "molecule". For example, between particles 1 and 2 in the two bead particle. This is to mimick a covalent bond, which can be realized by a harmonic spring. Please see this article to understand covalent bonds better: <a href="https://chem.libretexts.org/Bookshelves/Physical_and_Theoretical_Chemistry_Textbook_Maps/Map%3A_Physical_Chemistry_(McQuarrie_and_Simon)/05%3A_The_Harmonic_Oscillator_and_the_Rigid_Rotor/5.01%3A_A_Harmonic_Oscillator_Obeys_Hooke's_Law" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">Article on harmonic oscillators, Hookes law and bonded interactions. <p dir="auto"><img src="https://images.hive.blog/768x0/https://i.imgur.com/XsLs7RY.png" srcset="https://images.hive.blog/768x0/https://i.imgur.com/XsLs7RY.png 1x, https://images.hive.blog/1536x0/https://i.imgur.com/XsLs7RY.png 2x" /><br /> <em>b_0 is the equilibrium bondlength, K_b is the bond coefficient. Higher the bond coefficient higher will be the stiffness of the bond.(Image Courtesy: Adapted from my <a href="https://hive.blog/steemstem/@dexterdev/classical-molecular-dynamics-series-part-2-the-force-field">previous article on force fields) <p dir="auto">The second type of interaction is to mimick the non-bonded interactions in the form of Lennard-Jones potential. Also known as LJ potential actually approximate the interactions between neutral atoms. LJ potential has a mathematical form as below:<br /> <img src="https://images.hive.blog/768x0/https://i.imgur.com/JtFJPT1.png" srcset="https://images.hive.blog/768x0/https://i.imgur.com/JtFJPT1.png 1x, https://images.hive.blog/1536x0/https://i.imgur.com/JtFJPT1.png 2x" /><br /> <em>(Image Courtesy: Adapted from my <a href="https://hive.blog/steemstem/@dexterdev/classical-molecular-dynamics-series-part-2-the-force-field">previous article on force fields) <p dir="auto">The (1/r)^12 is the repulsion term and the (1/r)^6 term is the long-range attraction term. Higher epsilon term in the LJ potential means the minima in the potential term is deeper. That means the attraction will be higher between LJ particles. Usually we assign a cut-off at 2.5 sigma so as to not compute the interactions till infinity. Once you cutoff at this value, you have to make the function smooth by adding higher differentials appropriately or clamp(shift) the entire potential to zero potential. The LJ potential looks like below:<br /> <img src="https://images.hive.blog/768x0/https://i.imgur.com/30ssf8Y.png" srcset="https://images.hive.blog/768x0/https://i.imgur.com/30ssf8Y.png 1x, https://images.hive.blog/1536x0/https://i.imgur.com/30ssf8Y.png 2x" /><br /> <em>(Image Courtesy: <a href="https://en.wikipedia.org/wiki/Lennard-Jones_potential#/media/File:12-6-Lennard-Jones-Potential.svg" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">wikimedia, Image by Olaf Lenz, manually modifield by Rainald62, License: <a href="https://creativecommons.org/licenses/by-sa/3.0/" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">CC BY-SA 3.0) <p dir="auto">The third potential necessary for today's example is something called WCA(Weeks-Chandler-Andersen) potential, which is just the repulsion term till r_m in LJ(and no attraction term), but clamped(shifted) to zero potential. The particles just gets repelled if they interact via WCA potential. <p dir="auto"><img src="https://images.hive.blog/768x0/https://i.imgur.com/bR7urpu.png" srcset="https://images.hive.blog/768x0/https://i.imgur.com/bR7urpu.png 1x, https://images.hive.blog/1536x0/https://i.imgur.com/bR7urpu.png 2x" /><br /> <em><span>WCA potential(Image Courtesy: <a href="/@dexterdev">@dexterdev) <h3>Modelling the system using LAMMPS <h4>Setting up the system <p dir="auto">As mentioned before we will simulate a 2 particle "molecule", but 500 of them. The initial system looks like this. (This is a bunch of molecules from a failed simulation. :P So I got randomly placed 500 molecules.)<br /> <img src="https://images.hive.blog/768x0/https://i.imgur.com/TwdraNH.png" srcset="https://images.hive.blog/768x0/https://i.imgur.com/TwdraNH.png 1x, https://images.hive.blog/1536x0/https://i.imgur.com/TwdraNH.png 2x" /><br /> <em><span>System of 500 hypothetical 2 bead molecules visualized in VMD software. (Image Courtesy: <a href="/@dexterdev">@dexterdev) <p dir="auto"><br /> Topology means how particles in a molecule is connected and coordinates are the x, y, and z coordinates of different particles. Let us see how they look like inside the file:<br /> <img src="https://images.hive.blog/768x0/https://i.imgur.com/kYT7JDQ.png" srcset="https://images.hive.blog/768x0/https://i.imgur.com/kYT7JDQ.png 1x, https://images.hive.blog/1536x0/https://i.imgur.com/kYT7JDQ.png 2x" /><br /> .<br /> .<br /> .<br /> .<br /> <img src="https://images.hive.blog/768x0/https://i.imgur.com/Yz4y6am.png" srcset="https://images.hive.blog/768x0/https://i.imgur.com/Yz4y6am.png 1x, https://images.hive.blog/1536x0/https://i.imgur.com/Yz4y6am.png 2x" /><span>Our topology plus initial coordinate file: <a href="https://github.com/dexterdev/Molecular_Dynamics/blob/master/AGGREGATION_EXAMPLE/2p_mol.data" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">https://github.com/dexterdev/Molecular_Dynamics/blob/master/AGGREGATION_EXAMPLE/2p_mol.data <h4>LAMMPS scripts: <ul> <li>system.in.settings <pre><code> pair_coeff 1 1 10.0 1.0 2.5 pair_coeff 2 2 1.0 1.0 2.5 pair_coeff 1 2 1.0 1.0 1.122 bond_coeff 1 300.0 1.0 <p dir="auto">What this means is that between type 1 and 1 atoms(from different molecules), the epsilon of LJ potential is (10.0) and comparing to between 2 and 2 interactions(1.0), the minima is 10 times deeper and so 1 and 1 attracts each other strongly than between 2 and 2! 2.5 represents the sigma where cutoff is done. Now coming 3rd line it defines the interaction between type 1 particle of one molecule with type 2 of others. This is a WCA potential. Only repulsion exists. Because the cutoff happens at 1.122. Actually you have to shift the potentials to zero. That is done in next script. That was pair_coeff commands. Now comes the bond_coeff, which defines the harmonic interaction for type 1 and 2 atoms in the same molecule. Its bond_coefficient is 300.0 and the equillibrium bond distance is 1.0. A note about units. This is all in reduced LJ units. So the units are all in dimensionless forms. <ul> <li>system.in.init <pre><code> dimension 3 boundary p p p units lj atom_style full bond_style harmonic pair_style lj/cut 2.5 pair_modify shift yes neigh_modify every 1 delay 1 neighbor 0.3 bin <p dir="auto">This script defines the 3D nature of simulation via <code>dimension 3. <code>boundary p p p means periodic boundary condition is 3 dimensions. We mentioned about units in the previous paragraph. <code>atom_Style full is easy to understand and so I recommend you to go their <a href="https://lammps.sandia.gov/doc/atom_style.html" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">documentation. bond_style is defined as harmonic as mentioned before. Other options like FENE do exist. But we will discuss it another point of time. the lj/cut at 2.5 and shifting to 0 potential was mentioned in last paragraph. While computing the program calculates a neighbor list. if we specify 0.3 bin as neighbor it takes neighbor molecules into a list from that total cutoff + 0.3 sigma distance and then compute LJ interactions among those. neigh_modify modifies list every steps you feed. In this case it calculates every step and updates the neighbors. <ul> <li>minimization.in <pre><code># -- Init section -- include system.in.init # -- Atom definition section -- read_data 2p_mol.data # -- Settings Section -- include system.in.settings # -- Run section -- dump 1 all custom 500 2p_mol_min.lammpstrj id mol type x y z ix iy iz thermo_style custom step pe etotal vol epair ebond eangle thermo 20 # time interval for printing out "thermo" data min_style quickmin min_modify dmax 0.3 neigh_modify every 1 delay 0 check yes minimize 1.0e-7 1.0e-9 10000 300000 write_data 2p_mol_after_min.data <p dir="auto">This script minimizes the structure/topology file 2p_mol.data and spits out the minimization trajectory file and final minimized 2p_mol_after_minimization.data file. If you look into the file you will see that we loaded 3 files. 2 settings scripts and the 2p_mol.data coordinate/topology data file. Now this script will check for steric clashes or hinderances and try to achieve a local minima for the system.<br /> You can run it using the command <code>lmp_serial < minimization.in > min.log on your computer. Once the minimized structure is available, you can feed it for the simulation run. <ul> <li>simulation run script <code>run_nvt.in <pre><code># -- Init Section -- include system.in.init # -- Atom Definition Section -- read_data 2p_mol_after_min.data # -- Settings Section -- include system.in.settings # -- Run Section -- timestep 0.01 dump 1 all custom 10 2p_mol_nvt_.lammpstrj id mol type x y z ix iy iz thermo_style custom step temp pe etotal vol epair ebond eangle thermo 100 # time interval for printing out "thermo" data fix 1 all langevin 0.9 0.9 1.2 48279 fix 2 all nve run 100000 write_data 2p_mol_nvt_.data <p dir="auto">We again loaded 3 files. The settings scripts and the minimized structure. Then we are defining the step size of 0.01. <code>dump is a command which will dump coordinates and other information to the trajectory file. thermo will spit out the time step, temperature, potential energy, total energy etc... <p dir="auto"><code>fix 2 all nve defines the classical molecular dynamics velocity verlet integrator. But if you ensembles other than NVE ones like NVT, you need a thermostat to be coupled with the system. In this example we use langevin thermostat(<code>fix 1 all langevin 0.9 0.9 1.2 48279) with temperature 0.9 epsilon. and 1.2 is the damping factor. and the number after that 48279 is a random seed. So the trajectory output <code>2p_mol_nvt_.lammpstrj looks like this: <p dir="auto">
<br /> <em>(Aggregation of molecules simulated via LAMMPS) <h4>Conclusion <p dir="auto">The aggregation of the molecules can be attributed to the preferential interaction between type 1 atoms compared to that of 1-2 and 2-2 interactions. <p dir="auto">So that is for today. Let me know your response via comments. Thank you. :) <h3>Repository of the project: <p dir="auto"><span><a href="https://github.com/dexterdev/Molecular_Dynamics/tree/master/AGGREGATION_EXAMPLE" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">https://github.com/dexterdev/Molecular_Dynamics/tree/master/AGGREGATION_EXAMPLE <h3>References: <ul> <li><a href="https://chem.libretexts.org/Bookshelves/Physical_and_Theoretical_Chemistry_Textbook_Maps/Map%3A_Physical_Chemistry_(McQuarrie_and_Simon)/05%3A_The_Harmonic_Oscillator_and_the_Rigid_Rotor/5.01%3A_A_Harmonic_Oscillator_Obeys_Hooke's_Law" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">Chem.libretexts.org article on harmonic oscillators, Hookes law and bonded interactions
Sort:  

What experiments will you do to test your model?

This was supposed to be a toy model. The formation of micelles and bicelles like structures are an expected outcome of this model. Now what we can do more is to see the dependency of temperature on these structures.

Do you have any specific suggestions?

I was just having trouble figuring out what the model was intended to predict and how you do measurements to test the prediction.

The model was intended to capture the phenomenon of aggregation. It arises from the fact that the type 1 particles interact strongly via deeper epsilon in their LJ potential comparing to other interactions. You can run this simulation longer and analyze the aggregation numerically.

I have never really taken the time to leave you a comment here. And god knows I have read that post again and again, as I used it to debug the markdown converter of the stem.openhive platform...

I would like to state that I have really appreciated this post. It is very clear and it actually triggers (even in someone like me) the will to try out the software to see how it works in details. However, my time is so limited I will never have the time to do that... sorry... I hope others may be more courageous.

And of course I am looking forward to the next episode of the series!

My MD fundamentals are shaky. The governing equations are Hamiltonian? Are dimension reduction tricks used to speed up the process?

Hello @mathowl : The governing equations are from classical mechanics (Newton's 2nd law) and so you can write it in terms of Hamiltonian. Making the equations dimensionless has few advantages:

  • Firstly, numerical stability. less error accumulation and propagation in the dynamics.
  • So perhaps a minor effect on performance might be there. But I think I will have to check that.
  • Thirdly dimensionally reduced systems are convenient to deal for physicists and more general in nature. They can go to the required units via conversions.

I think you are confusing reducing dimensions with making dimensionless :P

With dimension reduction I mean: If you have an N-dimensional system (for example with states in \mathbb{R}^N ) then there could be symmetries present which allow you to move the system to an M-dimensional system with M < N. This is a useful trick in the study of Hamiltonian systems.

Hi @mathowl : Sorry for the confusion. Okay so coarse-grained simulations are indeed "dimensionally reduced" versions of original systems. Yes, a real lipid will access more configurations, but our 3 particle coarse-grained models will not have high frequency - low energy motions. Those motions are filtered out effectively. But still you can study many important phenomena. Also speed up certainly!

But is it possible to reduce the dimension of the coarse-grained simulation using symmetries in the governing equations?

You asking about reducing the dimension of already dimensionally reduced coarse grained system? I think we will lose lot of information then. But I don't know if there will be any symmetry existing in the system. It might depend on specific systems I guess. Maybe we can discuss on it if I am understanding your query in a wrong way.

If there is a symmetry or some conserved quantity then you can reduce the system without losing any of the dynamics. I am not sure if that is the case for your set of equations. We can discuss it at a later time :o)

This post has been voted on by the HiveSTEM curation team

If you appreciate the work we are doing, then consider supporting our witness @stem.witness. Additional witness support to the curie witness would be appreciated as well.

For additional information please join us on the SteemSTEM discord and to get to know the rest of the community!

Please consider using the stem.openhive.network app and including @steemstem as a beneficiary of this post. This could yield a stronger support.

and voting trail. It is elligible for support from @curie and @minnowbooster.