jewettaij / moltemplate

A general cross-platform tool for preparing simulations of molecules and complex molecular assemblies
http://www.moltemplate.org
MIT License
257 stars 99 forks source link

About OPLSAA example of hexadecane #98

Open chaosicong opened 8 months ago

chaosicong commented 8 months ago

I ran the file on the OPLSAA force field for n-hexadecane.However, there are a few questions that I am not quite sure about. Firstly, regarding the creation speed, the annotation is 300K, but the actual creation speed is 900K.Secondly, why is there a sudden temperature drop and then a rapid increase to equilibrium in the command "fix fxlan all langevin 900.0 900.0 120 48279 fix fxnve all nve"output,Like in the picture.Finally, I really don't quite understand your comment on NPT balance, # At the very end of the previous simulation, the temperature dropped below#The boiling point Run the simulation for longer at these conditions to#Give it a chance for the vapor ->liquid transition to complete#We will also slowly decrease the pressure to 1 bar. Why is there a gas-liquid phase transition? Although high temperatures (900K)were initially used, the output pressure at high temperatures(900) was particularly high, and n-hexadecane is a liquid. Isn't this high pressure going to convert into a gas first 屏幕截图 2024-03-17 203847

hothello commented 7 months ago

The annotation most likely comes from a previous example. The actual velocity command is the one executed and it sets the temperature to 900 K. To understand the behaviour of the energy at the beginning of the simulation, it is useful to visualise the trajectory.

The initial guess of the system is created with the Moltemplate command:

molecules = new Hexadecane [12].move(0, 0, 5.2)
                           [12].move(0, 5.2, 0)
                           [2].move(31.2, 0, 0)

which creates an orthogonal grid where the molecules are placed. The drop in temperature you observe in the first 50 steps is due to the kinetic energy being redistributed to the other degrees of freedom, thus decreasing the temperature. After that, the thermostat pumps energy into the system to reach the target temperature, thus also increasing the kinetic energy.

Why is there a gas-liquid phase transition?

The initial structure of the sample is created at low density to avoid bad contacts, but the molecules are oriented on a lattice by construction. The strategy of the simulation is to disrupt this order by annealing at high temperature and fixed volume, followed by an NPT step where the sample is exposed to high pressure and cooled to ensure a liquid phase is formed. In the last step, the pressure is decreased to 1 atm, at which point the sample should remain liquid.

I appreciate that this example is a bit convoluted. I will prepare a tidied-up version of the same simulation which will be delivered in the next update. I hope this answers your questions.

jewettaij commented 7 months ago

I could not have answered this better myself. Thank you Otello!

Yes. Unless you use packmol (or some other geometry generation program), the initial geometry created by moltemplate using a lattice is extremely unrealistic for a liquid, and likely to put the system a kinetic trap (local minimum). So this example uses high temperatures to completely obliterate any memory of that initial lattice shape. Then it uses a combination of high pressures and cooling to bring the system back down to a temperature and density of a liquid at 1atm, 300K. There are many moltemplate examples which use this strategy. (I did the same thing for the packmol examples, even though I probably didn't need to.)

Thanks for the feedback.I see what you mean about this comment:

# Give each atom a random initial velocity consistent with a system at 300K.

My apologies! That was a typo. It should have been 900K. I will take a look at the README files for these examples to see where else they can be improved. (But it might be a week or two.)

chaosicong commented 7 months ago

Thank you @jewettaij.Your explanation made it clear to me that it would be great if the in file description provided in moltemplate could be a little clearer