fluid dynamics of a lennard-jones fluid

23
3D Molecular Dynamics Computational Quantum Physics ario Xavier February 27, 2015 Abstract In this project for Computational Quantum Physics, a 3D simula- tion of a molecule fluid using Lennard-Jones potentials was approached with the intent of applying data structures and time integration tech- niques to accurately model the behavior of a given system. Some more sophisticated things that’re routinely used in the realm of molecular dynamics, like cell lists and thermostats, are also approached. A short application to a real system is included.

Upload: mario-david-xavier

Post on 25-Sep-2015

235 views

Category:

Documents


0 download

DESCRIPTION

Report done for the Computational Quantum Physics course at Uni Ulm, taught by Prof. Simone Montangero.

TRANSCRIPT

  • 3D Molecular Dynamics

    Computational Quantum Physics

    Mario Xavier

    February 27, 2015

    Abstract

    In this project for Computational Quantum Physics, a 3D simula-tion of a molecule fluid using Lennard-Jones potentials was approachedwith the intent of applying data structures and time integration tech-niques to accurately model the behavior of a given system. Some moresophisticated things thatre routinely used in the realm of moleculardynamics, like cell lists and thermostats, are also approached. A shortapplication to a real system is included.

  • Mario Xavier 10 Feb. 2015

    Contents

    1 Conceptual introduction 31.1 Lennard-Jones potential . . . . . . . . . . . . . . . . . . . . . 31.2 Maxwell-Boltzmann distribution . . . . . . . . . . . . . . . . . 41.3 Box-Muller method . . . . . . . . . . . . . . . . . . . . . . . . 41.4 Cell linked-list . . . . . . . . . . . . . . . . . . . . . . . . . . . 51.5 Beemans algorithm . . . . . . . . . . . . . . . . . . . . . . . . 61.6 Nose-Hoover thermostat . . . . . . . . . . . . . . . . . . . . . 6

    2 Code development 82.1 Initial considerations . . . . . . . . . . . . . . . . . . . . . . . 82.2 Inputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82.3 Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

    2.3.1 CONSTANTS . . . . . . . . . . . . . . . . . . . . . . . 92.3.2 UTILITIES . . . . . . . . . . . . . . . . . . . . . . . . 92.3.3 MOLECULAR DYNAMICS . . . . . . . . . . . . . . . 10

    2.4 Outputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112.5 Compiler options . . . . . . . . . . . . . . . . . . . . . . . . . 11

    3 Result analysis 123.1 Initialization conditions . . . . . . . . . . . . . . . . . . . . . . 123.2 Variation with N . . . . . . . . . . . . . . . . . . . . . . . . . 133.3 Comparison with theory . . . . . . . . . . . . . . . . . . . . . 16

    4 Conclusions 204.1 Code evaluation . . . . . . . . . . . . . . . . . . . . . . . . . . 20

    4.1.1 Correctness . . . . . . . . . . . . . . . . . . . . . . . . 204.1.2 Stability . . . . . . . . . . . . . . . . . . . . . . . . . . 204.1.3 Accuracy of discretization . . . . . . . . . . . . . . . . 214.1.4 Flexibility . . . . . . . . . . . . . . . . . . . . . . . . . 214.1.5 Efficiency . . . . . . . . . . . . . . . . . . . . . . . . . 21

    4.2 General remarks . . . . . . . . . . . . . . . . . . . . . . . . . . 22

    2

  • Mario Xavier 10 Feb. 2015

    Chapter 1

    Conceptual introduction

    1.1 Lennard-Jones potential

    The Lennard-Jones potential, also known as the L-J potential or the 6/12potential, is a simple approximation model for the interaction between a pairof neutral atoms or molecules. Its most common definition is:

    ULJ(r) = 4[(

    r)12 (

    r)6] (1.1)

    Where is the magnitude of the potential well and is a parameterrelated to the distance at which the potential reaches its minimum by

    = 216 rmin

    As one can see, this definition of a potential is very simple and lends itselfquite easily to data fitting. Its also computationally not expensive and thusit is usually the choice potential for general-precision molecular dynamicssimulations, even though its not necessarily the most precise one.

    An intuitive explanation for this potential comes from splitting it: therepulsive term r12 describes the short range exchange interaction betweenoverlapping electron orbitals. This term has no direct physical justificationand is simply used because it approximates this Pauli repulsion well and dueto its efficiency in being calculated from the value of r6, the dependency inthe attractive term. This attractive term describes the long range interac-tions through the Van der Waals force, and is well-known as one of the keyresults in atomic and molecular physics.

    Something that can be shown is the fact that the lowest energy arrange-ment of a large number of atoms described by this potential is of a hexagonalclose-packing structure. As temperature rises, it becomes cubic close-packingbefore becoming a liquid. Under pressure it can be either.

    3

  • Mario Xavier 10 Feb. 2015

    1.2 Maxwell-Boltzmann distribution

    The Maxwell-Boltzmann distribution is a description of particle speeds inan ideal gas in thermodynamical equilibrium. By ideal gas, one stipulatesthat particle movement is relatively unaffected by any type of collisions ordispersions, which would in principle ruin any idea for its use in moleculardynamics and other applications of gaseous nature.

    However, not very dense gases can be approximated at reasonable tem-peratures by ideal gases and we can make this approximation hold really well- this is the basis of the kinetic theory of gases.

    Either way, its a probability distribution function of velocity magnitudeswith the form:

    f(v) = (m

    2kBT)32 4v2e

    mv22kBT (1.2)

    Where m is the mass of the particles were considerating, T the temper-ature of the ensemble and kB the Stefan-Boltzmann constant.

    With some integrations and mathematics work, one can derive a fewuseful expressions from this distribution. For example, the root mean squarevelocity can be derived and shown as:

    v2 =

    0

    v2f(v)dv =

    3kBT

    m= vrms (1.3)

    This relation will be quite useful later for rescaling purposes.

    1.3 Box-Muller method

    As we initialize the system, we will require the assignment of pseudo-randomvelocities to the particles. A good, quick way to do this is to use the polarform of the already-applied-in-course Box-Muller method.

    Its a simple calculation algorithm that generates a pair of independent,standard, normally distributed random numbers. The polar form was usedjust to avoid using trigonometrical functions, which are a bit more expensiveas an algorithm that runs over thousands of particles. Its defined as:

    Qrand = a

    2ln(s)

    s(1.4)

    s = a2 + b2

    Where a and b are randomly generated numbers in the interval [-1, 1].

    4

  • Mario Xavier 10 Feb. 2015

    1.4 Cell linked-list

    A cell linked-list is a data structure used for an efficient finding of all theatom pairs within a given cut-off distance of each other in molecular dynamicssimulations. Its obvious that well need this to calculate the Lennard-Jonesinteraction between each particle. So how does it work?

    Basically, the idea is to divide the simulation into cells whose dimensionsare greater than or equal to the cut-off distance chosen for the potential. Onethen sorts the particles into these newly mapped cells.

    From here, several approaches can be followed. In our case, the pairedinteractions were then computed to all the adjacent cells, spanning the cal-culation over a total of 33 = 27 cells.

    Since were taking cells larger than or equal to the cut-off distance thepotential specifies, the possibility for error is just associated with the cut-off chosen in the case of the Lennard-Jones potential. Its also quite moreefficient to scan all the surrounding cells and the one in which the particle isas compared to scanning ALL the particles in the simulation.

    The comparison in big-O notation come to O(N) for the cell-list case andO(N2) for the more brute-force way, which is VERY significant when werelooping this procedure thousands upon thousands of times.

    Another case to take into account is that the cells at the boundaries arenot surrounded by 26 other cells - for this, we implement a workaround: avector that stores the correction that we need to apply to a certain cell inorder to wrap it around the set of cells and make it interact with the otherboundary. A good analogy is imagining a 2D cell linked-list structure andfolding it into a sphere, making the system have no bounds.

    Figure 1.1: Illustration of the wrap-around of boundaries.

    5

  • Mario Xavier 10 Feb. 2015

    1.5 Beemans algorithm

    Beemans algorithm is a method for numerical integration of order 2 ODEs,and especially used for equations of motion of the form x = A(x), which isthe case. It was essentially made to allow high particle numbers in moleculardynamics, and so its use here is already justified.

    There are a few variants of this algorithm, but well be focusing andusing the predictor-corrector modification to accomodate our system, sinceour forces are a function of position as well as velocity when we add thethermostat friction element, later on.

    The basic iterative structure is as such:

    x(t+ t) = x(t) + v(t)t+2

    3a(t)t2 1

    6a(tt)t2 +O(t4)

    v(t+ t)predicted = v(t) +3

    2a(t) 1

    2a(tt)t+O(t3) (1.5)

    v(t+ t)corrected = v(t) +5

    12a(t+ t)t+

    2

    3a(t)t 1

    12a(tt) +O(t3)

    One can see in the group of equations (1.5) that the order of error thatwere doing is negligible if we take a time step of the order of t = 103.

    However, to use this algorithm one has to do a first, more error-prone step,to determine the initial position, velocity and acceleration of the ensemble,because it depends in the former value of these variables in the iteration. Asimple Taylor expansion to second order suffices.

    Then, one can proceed: calculating the position and the predicted veloc-ity, computing the acceleration for that set of values and then calculating thecorrected velocity with this correction. This corrector step becomes relevantand clearer when we take into account the friction term for the thermostatintroduced in the following section.

    1.6 Nose-Hoover thermostat

    In classically done molecular dynamics, the simulations are done in the mi-crocanonical ensemble: we wish to conserve number of particles, volume andenergy. However, in experiments, the temperature is usually controlled in-stead of energy, for obvious reasons. The ensemble is then canonical, notmicrocanonical, and they are two completely different beasts.

    There are several methods to keep the temperature constant while usingthe microcanonical ensemble all the same. The idea is to keep the tem-perature constant enough but also fluctuating enough to obtain a canonicaldistribution instead.

    6

  • Mario Xavier 10 Feb. 2015

    One of them is the thermostat we present her, but there are other ther-mostats and a velocity rescaling method - the latter, we actually apply ini-tially for the first few steps.

    The velocity rescaling method is simply what it sounds like: after eachstep, we rescale the velocity to the temperature we wish to keep more or lessconstant, through the simple expression:

    vrescaled = v

    TcontrolTcurrent

    (1.6)

    Where Tcontrol is the temperature within which we want to keep the sim-ulation.

    However, this is quite crude and just doesnt cut it for a simulation withgood results since we wish to have oscillations characteristic of a canonicaldistribution, like in experiment. We use this simply to let the system stabilizesomewhat through the first few steps.

    Simplifying quite a bit, we define a friction term in the calculation of theforce on the next time step used in the corrected velocity, defined by:

    Ffriction = mvpredicted (1.7)

    Where is the friction coefficient.This friction coefficient undertakes different dimensions depending on the

    temperatures and thats where the scaling comes in.For each iteration, the friction coefficient undergoes a change of:

    i+1 = i + (3N + 1)(Tcurrent Tcontrol)

    Mthermostatt (1.8)

    The working out of these relations is not included in the report but a shortintroduction to several types of thermostats and velocity rescaling methodsis included in the bibliography.

    7

  • Mario Xavier 10 Feb. 2015

    Chapter 2

    Code development

    2.1 Initial considerations

    The plan for this simulation was somewhat clear from the start:

    1. Initialization of the particles in a simple cubic array of positions withrandom velocities through Box-Muller.

    2. Establishing a cell list data structure to more efficiently and cleanlycalculate the forces for the equation of motion that follows.

    3. Solving of the equation of motion with a small time-step to propagatein time using Beemans algorithm with a Nose-Hoover thermostat.

    4. Measuring of several different relevant gas properties - pressure, poten-tial, temperature...

    5. Application to concrete cases and verification of results.

    2.2 Inputs

    The only two inputs required are the simulation temperature and density.Other parameters of relevance can be directly ajusted in the code, like thenumber of particles, their mass, the thermostat mass and the cut-off radius,but the variation of the results with these other parameters is not as inter-esting as with the two direct inputs. However, a small look at variation ofthe results with the number of particles is going to be carried out.

    8

  • Mario Xavier 10 Feb. 2015

    2.3 Structure

    The program is split into 3 modules:

    CONSTANTS - used to store global parameters thatll be used all overthe program;

    UTILITIES - has auxiliary functions that are not directly related toMolecular Dynamics;

    MOLECULAR DYNAMICS - the main module in which we do theinitialization and simulation of the system.

    And an external package, taken from the SklogWiki, a known source forstatistical mechanics, for theoretical calculation of the pressure and potentialenergy of the gas through the Kolafa and Nezbeda equation of state for aLennard-Jones fluid.

    I will be going over them here in some detail, complemented strongly bythe commentary included with the source code - for maximum clarity, referto both, following the code and its comments as reading the report.

    2.3.1 CONSTANTS

    The main global parameters that come to mind are the things we wish to keepcompletely constant: the number of particles N , the mass of the particles m,and so on. As a side note, we are using densities in this program: it is inprinciple more useful to analyze densities than volumes and thus we have thisparameter instead of a hypothetical volume parameter. Since we conservenumber of particles, we also conserve density if we wish to conserve volume.

    On the other hand, we also have to think about the simulation - whatrethe global parameters that we need to fine-tune this simulation to the pointwhere its a good approximation? Looking at the conceptual introduction,we quickly spot a few: the time step of the simulation t, the cut-off distanceof the potential rcut, and the cut-off energy for the potential, Ucut, directlycomputed from rcut.

    Its a very straightforward module and doesnt need much explanation.

    2.3.2 UTILITIES

    Two subroutines are included in this module: one for initializing the randomseed used for the initialization of the system based on the system clock - I

    9

  • Mario Xavier 10 Feb. 2015

    prefer to do this to generate a seed - and the Box-Muller method already de-scribed in equation (1.4). Both are used for the attribution of initial randomvelocities to the particle ensemble. Again, quite simple.

    2.3.3 MOLECULAR DYNAMICS

    This module contains a number of subroutines and functions.The subroutine for initialization of the system does a few things:

    Calculates the number of particles per dimension and the dimensionsof the box and particles.

    Assigns random velocities and rescales them to the inputted tempera-ture through the mean of the squared velocity, using equation (1.3).

    Assigns the positions to the particles according to a simple cubic grid,meaning they are uniformly distributed.

    What follows is the calculation of the particle forces and potentials. Thisis easily the most complex part of the program because it interacts with celllists and the wrap-around conditions already specified.

    The subroutine to create a cell list basically goes through the algorithmdescribed - for each particle, it finds the appropriate cell, linking the particleto it.

    There is another auxiliary subroutine for boundary condition checkingthat is applied in the force calculations due to its lengthiness.

    The subroutine for the force calculation does also a variety of things:

    Checks if the 27 nearest cells are in the boundary and stores the result- 1 for a lower boundary, 2 for an upper boundary and 0 for signifyingthat it is already surrounded by cells - in each of the three possibledimensions.

    For each particle in each of the 27 nearest cells - in which 1 is the cellin which the particle in question is present - we check for the boundaryconditions and move the position of the particle in question accordinglythrough the subroutine BOUNDARY.

    We check if the particle with which were pairing the reference particleis within the cut-off radius - if not, we jump to the next one.

    Then, we add up the potential and force, using equation (1.1) wherewe set = = 1 for simplicity.

    10

  • Mario Xavier 10 Feb. 2015

    This, done over each particle, and for each particle computing the forcepairings over the 27 nearest cells, should yield a great approximation of thetotal force balance of the system.

    We can then move on to the time evolution. We have a single subroutinetentatively titled TIME STEP, with two modes.

    In mode 0, we do only the initial step, based on the simple Taylor expan-sion of the position to second order and the velocity to first order, checkingthen for the boundaries of the box and moving the particles accordingly towrap around to the other side.

    In mode 1, we use Beemans predictor-corrector algorithm, specified inequation (1.5), also with a check for the particles surpassing the boundariesand adjusting them properly. The smaller picture and details are in the codeand properly commented.

    What follows are some functions to calculate several gas properties -namely temperature, pressure and total potential - in order for us to beable to characterize and apply our simulation to something interesting.

    2.4 Outputs

    The program outputs three sets of data as files: pressure.dat, potential.datand temperature.dat. These are attached to the following chapter for severalrelevant cases and analyzed for correctness using the extra package. TheKolafa and Nezbeda results for the pressure and potential energy of the gasare also outputted, but to the console, for a direct comparation with theconvergence value one observes in the plot.

    2.5 Compiler options

    The program is compilable on both iFort and GNUFortran and requires oneexternal package. However, there was a stability problem in iFort that Iabsolutely could not fix - the rescaling of the velocities was simply spiralingout of control. And so I ended up very reluctantly using GNUFortran (itsabout 10 % slower) even though it compiles in iFort but with terrible results:

    > gfortran -O3 eqstate.f main.f

    Where O3 is a simple optimization command that turns on a great dealof flags that affect performance of loops and other heavy operations. Sincethis program has a lot of nested loops that really cannot be avoided, thisis a nice boost to the speed of the algorithms. Also present is the alreadymentioned external package eqstate.f.

    11

  • Mario Xavier 10 Feb. 2015

    Chapter 3

    Result analysis

    In this chapter, most of the behaviour of the program and appropriate dis-cussion of results will be approached.

    Well start by testing the initialization conditions, proceeding to the vari-ations in stability and running time of the ensemble simulation with particlenumber will be approached, followed by some routine measurements andsubsequent comparison with the results output by the program.

    At the end, the relations from the arbitrary units to the real-world units- so, temperature in Kelvin, density in m3, and so on - will be presented,which basically frames every single simulation in a real-world context, fur-thering its reach in possible applications and predictions.

    3.1 Initialization conditions

    We simply verify that the grid is properly filled out and the velocities areindeed Gaussian in their initial distribution, for the case of 10000 particles.

    For the velocities, we get the expected Gaussian shape:

    Figure 3.1: Velocity histogram, Gaussian-shaped.

    12

  • Mario Xavier 10 Feb. 2015

    For the positions, we get this grid-like layout with simple-cubic structure:

    Figure 3.2: Initial grid positions.

    3.2 Variation with N

    A short benchmark was ran, for T = 5 and = 0.5, to illustrate thoroughlythe behaviour of the program for several different particle numbers. Firstly,the determination of how the program scales with the dimension of the en-semble follows:

    Figure 3.3: Running time variation with particle number and appropriate fit,y = axb, with fit parameters a = 0.0000486 and b = 1.88697 illustrated inthe plot.

    13

  • Mario Xavier 10 Feb. 2015

    From the fit results, included in the description of the former plot, weconclude that the program scales more or less like O(N1.9), for = 0.5. Ofcourse, as gets higher, the calculations should become a bit slower, but thisis already a good idea of the rough dependence of this programs efficiencyon the particle number itself - it should always be around O(N2).

    We can observe, in the following page, the variations of 3 parameters -temperature, pressure and total potential energy - as we change the particlenumber. The expected is that the oscillations should reduce to insignificanceas we reach a considerable particle number - 10000 should be enough.

    Figure 3.4: Temperature oscillations for 100, 1000 and 10000 particles.

    Figure 3.5: Pressure oscillations for 100, 1000 and 10000 particles.

    14

  • Mario Xavier 10 Feb. 2015

    Figure 3.6: Potential oscillations for 100, 1000 and 10000 particles.

    One can really observe that for the 100 particle case, its a complete mess- the temperature varies within 20% of its original value and it originates alot of oscillation in the equilibrium values - for the 1000 particle case, its lessalarming but still not good enough - oscillations are within 5% of the originalvalue - while for the 10000 particle case, it is basically constant, varying onlywithin less than 1% of the desired constant value, which reflects in the strongequilibrium that the two macroscopic quantities we measured reflect.

    15

  • Mario Xavier 10 Feb. 2015

    3.3 Comparison with theory

    In line with the conclusions taken earlier, the simulations will be done with10000 particles, for minimum error possibilities. The results from theory,taken from the already mentioned external package, will be printed out to theconsole post-simulation, and the results from the simulation have to be takenfrom the plots - the average value at which the equilibrium is maintainedshould be the result.

    For example, for T = 1, = 1, where pth = 7.444 and Uth = 6.359:

    Figure 3.7: Pressure and potential measurements for T = 1, = 1.

    16

  • Mario Xavier 10 Feb. 2015

    We can see both of the values are close to expected, with the pressurealmost on point! However, the potential is not as close as one would like.Reasons for this are given in the conclusions of this report.

    For T = 2, = 0.5, where pth = 1.074 and Uth = 3.150:

    Figure 3.8: Pressure and potential measurements for T = 2, = 0.5.

    We can take basically the same conclusions as for the first case: thepressure is quite accurate and the potential is a bit higher than one wouldexpect.

    17

  • Mario Xavier 10 Feb. 2015

    For T = 2, but now a severely reduced density, = 0.05, where pth =0.009 and Uth = 0.338:

    Figure 3.9: Pressure and potential measurements for T = 2, = 0.05.

    Again, the pressure is basically accurate but the potential is a bit higherthan one would expect, the same as the other two cases.

    Now, we heighten the temperature considerably and put the density at areasonable, not too low or high value.

    18

  • Mario Xavier 10 Feb. 2015

    So, for T = 5, = 0.5, where pth = 4.660 and Uth = 2.3601:

    Figure 3.10: Pressure and potential measurements for T = 5, = 0, 5.

    Where yet again we keep observing the same behavior.One can keep in note that the varying intervals for these temperature and

    density parameters are actually smaller than they would appear. Room tem-perature, 300 K, would be described by approximately 2.5 in our arbitraryunits, where then an arbitrary unit of temperature in our program is definedby 1 arbitrary unit = 119.6K. For the density, a similar relation exists, inthe shape of 1 arbitrary unit = 2.5 1028m3.

    19

  • Mario Xavier 10 Feb. 2015

    Chapter 4

    Conclusions

    4.1 Code evaluation

    4.1.1 Correctness

    The program yields great results for the pressure measurement and appre-ciable results for the potential.

    As the temperature goes to extremes it doesnt describe the potentialenergy so well - this could be due to the fact that we might need some long-distance interaction corrections, which could be implemented. The pressureremains largely in accordance with theory though it also drifts off a bit inthe extreme temperatures.

    One can also observe the variation of the results with the number ofparticles in the previous chapter. This lets us conclude many natural things,like the fact that the results and oscillations of the measured values will bemuch smaller the higher the number of particles - the more it behaves likean actual gas.

    4.1.2 Stability

    The number is numerically stable in all cases where its ran for a considerableammount of time.

    The only sources of non-negligible error are the cut-off for the potentialand the time discretization, which are already in their optimal values. It willnever spiral out of control at all.

    20

  • Mario Xavier 10 Feb. 2015

    4.1.3 Accuracy of discretization

    The time discretization is fixed for a reason - the value in the program of 1milisecond is pretty much in the sweet spot: not so big as to produce lopsidedresults and not so small as to be prohibitive to calculate longer times.

    The scaling of the error of the time evolution with the time step is of orderO(t3) to O(t4), depending on position, acceleration or velocity being whatwere computing. One can quickly see that its probably fruitless to go under0.001 seconds as far as discernible error goes and quite risky to go above asthe error might be just too large.

    4.1.4 Flexibility

    The program is already somewhat narrow in its application due to the stip-ulation that it is a Lennard-Jones potential. The force calculation couldvebeen implemented with a variable associated to the potential, which wouldmake the program work for several cases on input. However, a simple changeon the force calculation does make it applicable to several different potentials,so one can say it is quite flexible and applicable to several different cases.

    4.1.5 Efficiency

    One of my major worries when writing the program was to make the moreintensive steps - the pairing of the particles and the time-evolution - be aslight on the processor as possible. What comes out in the end is a relativelyefficient program for the type of computation we are doing, As was verified,the scaling of the program with particle number is something close to O(N2),which is a good, reasonable result, close to the best possible way to do thesesimulations.

    21

  • Mario Xavier 10 Feb. 2015

    4.2 General remarks

    Only the surface of molecular dynamics was scratched - even though theprogram has some degree of sophistication due to the cell list-based forcecalculation, improvements can be made in the name of efficiency, extra ef-ficiency that can of course be used to accomodate more particles and moreelaborate potentials in the frame and structure of this program.

    Thinking more outside-the-box but within molecular dynamics, one couldlook into quantum mechanical methods to circumvent some of the limitationsthat these classical models have, namely in the sense of the very extensiveparametrization required, the innacuracy when it comes to energies, the in-ability to provide for chemical phenomena, and so on. The main drawbackhere would be speed. For further elaborations see the hybrid quantum me-chanics/molecular mechanics (QM/MM) approach, which is sort of an at-tempt at having the best of both worlds - the computation speed of theclassical approach with the accuracy of the quantum approach.

    Back to the program itself, some difficulties arose in the calculation of theforces - for some time the cell list structure wasnt completely clear to me- and so some time was spent dwelling on incorrect results. One thing thatsaved a lot of time was the external package I found with an implementationof the calculation of the macroscopic quantities measured for our particularmodel - the expressions are quite big and it would be a burden in time tohave to implement them all.

    A good explanation for the total potential energy simulated with theprogram being always slightly higher than the theoretical prediction is thefact that we are not taking long-range corrections into account. One of thereferences provides the correction required to do in order to account for thedistance cut-off that we promote for efficiency purposes. The implementationof this would be very simple and a paper regarding this is included in thebibliography.

    Another big setback and something that put a dent in my good spiritswas the fact that I was perhaps too optimistic in believing that GNUFortranand iFort would be compatible - instead, when trying to initially compile theprogram in iFort I found an output discrepancy which just proved too time-consuming to fix. Thus, I tried GFortran and I was getting better results.However, it is not a significant setback, as GNUFortran is only 5 to 10%slower in calculating the output for this particular program, which I verifiedwith the time for iForts inaccurate outputs.

    Either way, as was observed, the results were appropriate to the predic-tions to a very appreciable degree, which is exposed in more detail in theformer section.

    22

  • Mario Xavier 10 Feb. 2015

    Bibliography

    [1] Sklog Wiki: a resource for all statistical physics simulations

    [2] Lecture notes

    [3] Pedro Gonnet, A Simple Algorithm to Accelerate the Computation ofNon-Bonded Interactions in Cell-Based Molecular Dynamics Simula-tions, 2007

    [4] Yanxiang Zhao, Brief introduction to the thermostats

    [5] Author unknown, FORTRAN code for the Kolafa and Nezbeda equationof state

    [6] F. Siperstein, A. L. Myers, O. Talu, Long range corrections for computersimulations of adsorption, 2001

    23

    http://www.sklogwiki.org/SklogWiki/index.php/Main_Pagehttp://onlinelibrary.wiley.com/doi/10.1002/jcc.20563/pdfhttp://onlinelibrary.wiley.com/doi/10.1002/jcc.20563/pdfhttp://onlinelibrary.wiley.com/doi/10.1002/jcc.20563/pdfhttp://www.math.ucsd.edu/~y1zhao/ResearchNotes/ResearchNote007Thermostat.pdfhttp://www.sklogwiki.org/SklogWiki/index.php/FORTRAN_code_for_the_Kolafa_and_Nezbeda_equation_of_statehttp://www.sklogwiki.org/SklogWiki/index.php/FORTRAN_code_for_the_Kolafa_and_Nezbeda_equation_of_statehttp://www.seas.upenn.edu/~amyers/MolPhys.pdfhttp://www.seas.upenn.edu/~amyers/MolPhys.pdfConceptual introductionLennard-Jones potentialMaxwell-Boltzmann distributionBox-Mller methodCell linked-listBeeman's algorithmNos-Hoover thermostatCode developmentInitial considerationsInputsStructureCONSTANTSUTILITIESMOLECULAR_DYNAMICSOutputsCompiler optionsResult analysisInitialization conditionsVariation with NComparison with theoryConclusionsCode evaluationCorrectnessStabilityAccuracy of discretizationFlexibilityEfficiencyGeneral remarks