User Tools

Site Tools


exercises:2014_uzh_molsim:h2o_diff

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
exercise:mm_uzh:h2o_diff [2014/05/08 22:32] talirzexercises:2014_uzh_molsim:h2o_diff [2020/08/21 10:15] (current) – external edit 127.0.0.1
Line 2: Line 2:
  
 When simulating liquids or solids under periodic boundary conditions, we are making two fundamental approximations: When simulating liquids or solids under periodic boundary conditions, we are making two fundamental approximations:
-  - We simulate an infinite system, thus neglecting the fact that any real-world system has surfaces. This approximation becomes problematic, when the real-world system to be studied consists only of a few simulation cells.+  - We simulate an infinite system, thus neglecting the fact that any real-world system is finite. This approximation becomes problematic, when the real-world system to be studied consists only of a few simulation cells.
   - We impose the condition that the properties of the system under study repeat //exactly// from one simulation cell to the next. The quality of this approximation depends on the system under study and the quantity of interest.   - We impose the condition that the properties of the system under study repeat //exactly// from one simulation cell to the next. The quality of this approximation depends on the system under study and the quantity of interest.
  
Line 11: Line 11:
  
 Calculating transport properties typically requires lots of sampling. Calculating transport properties typically requires lots of sampling.
-Start the MD simulation for 32 water molecules and see how far you can get (aim at least for 200ps).+Start the MD simulation for 32 water molecules and see how far you can get (aim at least for 200 ps).
 <note tip> <note tip>
-This simulation will take some time. +This simulation will take a considerable amount of time. 
 Tasks 1 and 2 can already be completed, while it is running. Tasks 1 and 2 can already be completed, while it is running.
 </note> </note>
 <note>**TASK 1** <note>**TASK 1**
-  - While the job is running, check output of CP2K to verify that all is fine. What is the average temperature? +  - While the job is running, check the output of CP2K to verify that all is fine. What is the average temperature? 
-  - We want to simulate diffusion at room temperature. Why aren't we using the NVT ensemble? //Hint:// Think about how thermostats work. +  - We want to simulate diffusion at room temperature. Why aren't we using the $NVTensemble? //Hint:// Think about how thermostats work. 
-  - Use the provided script ''./get_t_sigma abc.ener'' to calculate the standard deviation of the temperature for your simulation as well as for the provided simulations of larger cells containing 64, 128 and 256 water molecules. +  - Use the provided script ''./get_t_sigma file.ener'' to calculate the standard deviation of the temperature for your simulation as well as for the provided simulations of larger cells containing 64, 128 and 256 water molecules. 
-  - How are temperature fluctuations expected to depend on system size? Use gnuplot's fitting functionality to check whether they follow the corresponding law.+  - How are temperature fluctuations expected to depend on system size? Use gnuplot's fitting functionality to check whether they follow the corresponding law. //Hint:// See e.g. [[http://books.google.ch/books?id=5qTzldS9ROIC|"Understanding Molecular Simulations"]] by Frenkel and Smit, sections 4.1 and 6.2. (2P)
 </note> </note>
  
 The mean squared displacement (msd) is defined as  The mean squared displacement (msd) is defined as 
 $$\text{msd}(t) = \langle |r(t+t_0)-r(t_0)|^2 \rangle$$ $$\text{msd}(t) = \langle |r(t+t_0)-r(t_0)|^2 \rangle$$
-where the average $\langle ... \rangle$ runs over all random walkers in the system+where the average $\langle ... \rangle$ runs over all particles in the system.
-Once you have calculated the msd, you will use Eq. 17 in the article to compute the diffusion constant.+
  
 Our simulations are not large enough to obtain reasonable statistics just from averaging over all water molecules. Our simulations are not large enough to obtain reasonable statistics just from averaging over all water molecules.
 We therefore perform an additional average over the time $t_0$: $\text{msd}(t)$ is calculated as an average over all non-overlapping time windows of width $t$ that fit into the total simulation time $T$. We therefore perform an additional average over the time $t_0$: $\text{msd}(t)$ is calculated as an average over all non-overlapping time windows of width $t$ that fit into the total simulation time $T$.
-We have provided a Fortran program that uses this algorithm to extract the msd from a trajectory in a ''.xyz'' file in units of $\unicode{x212B}^2$ as a function of time in fs.+We have provided a Fortran program that uses this algorithm to extract the msd from a trajectory in a ''.xyz'' file. 
 <code bash> <code bash>
-gfortran msd.f90 -o msd.x     # compile msd.x executable +gfortran msd.f90 -o msd.x  # compile msd.x executable 
-./msd.x < msd.in > msd-64.out run it with msd.in input file+./msd.x < msd.in           check input file 'msd.in' before you run!
 </code> </code>
 +Per default, ''msd.x'' writes the msd in units of $\unicode{x212B}^2$ as a function of time in fs.
  
 +Once you have calculated the msd, have a look into section III of the article on how to fit the diffusion constant.
  
 <note>**TASK 2** <note>**TASK 2**
  
-  - While your simulation is running, calculate the msd for the provided simulations of 64, 128 and 256 water molecules, modifying ''msd.in'' as needed. //Note:// ''msd.x'' may run up to 30min for the largest cell. FIXME do we have a progress indicator? +  - We have precalculated trajectories for 64, 128 and 256 water molecules (ask your teaching assistant). Use ''msd.x'' to calculate the msd, modifying ''msd.in'' as needed. //Note:// ''msd.x'' may run up to 30 minutes for the largest cell. 
-  - Plot the msd as a function of time using a double logarithmic scale. Can you identify different regimes? Why does the signal become noisy towards long times? +  - Plot the msd as a function of time on a double logarithmic scale. Can you identify different regimes? Why does the signal become noisy towards long times? (2P) 
-  -  Obtain the diffusion constant $D_{pbc}$ by fitting a line through the mean square displacement data in the range $2-10$ ps. +  - Obtain the diffusion constant $D_{pbc}$ by fitting a line through the mean square displacement data in the range $2-10$ ps. 
-  - Compare against the values in Table I. //Note:// We are using a slightly different force field, but the values should be similar. If not, check your units!+  - Compare against the values in Table I of the article. //Note:// We are using a slightly different force field, but the values should be  of a similar magnitude. If not, check your units!
 </note> </note>
  
-When your MD of the 32 water molecules has finished, you can start fitting the diffusion constant.+When your MD of the 32 water molecules has finished (for example on the next day), you can start fitting the diffusion constant.
 <note>**TASK 3** <note>**TASK 3**
  
-  - Calculate also $D_{PBC}(L)$ for the 32 water molecules.+  - Calculate $D_{PBC}(L)$ also for the 32 water molecules.
   - Plot $D_{PBC}$ as a function of $1/L$, where $L$ is the length of the edge of the simulation box.   - Plot $D_{PBC}$ as a function of $1/L$, where $L$ is the length of the edge of the simulation box.
   - Perform a linear fit of this curve to obtain the diffusion constant $D=D_{pbc}(L=\infty)$   - Perform a linear fit of this curve to obtain the diffusion constant $D=D_{pbc}(L=\infty)$
-  - Use Eq. 12 in the article to calculate the viscosity.+  - Use equation (12in the article to calculate the viscosity $\eta$ from the slope of $D_{PBC}(1/L)$.
   - Compare the results to the data in the paper.   - Compare the results to the data in the paper.
 </note> </note>
exercises/2014_uzh_molsim/h2o_diff.1399588354.txt.gz · Last modified: 2020/08/21 10:14 (external edit)