User Tools

Site Tools


exercises:2021_uzh_acpc2:ex01

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
exercises:2021_uzh_acpc2:ex01 [2021/04/26 07:09] – [Background] mrossmannekexercises:2021_uzh_acpc2:ex01 [2021/05/17 11:35] (current) – [Part III: Radial distribution function] Fix type mrossmannek
Line 223: Line 223:
 </note> </note>
 ===== Part II:  Force Field Parameter  ===== ===== Part II:  Force Field Parameter  =====
-You need to modify the L-J force field parameter. Run calculations with different $\sigma$ and $\epsilon$ and inspect the insight of L-J potential (Energiesvelocities, temperatures etc )Then use the force field parameter provided to plot the L-J potential curve.+In this section we investigate the dependence of the L-J potential on the its different parameters. To do sewe investigate a small system of only two Ar atomsThe following code snippet shows the changes that you need to make to the input file in order to run such a calculation. 
       &GLOBAL                  ! section to select the kind of calculation       &GLOBAL                  ! section to select the kind of calculation
          RUN_TYPE ENERGY       ! select type of calculation. In this case: ENERGY (=Single point calculation)          RUN_TYPE ENERGY       ! select type of calculation. In this case: ENERGY (=Single point calculation)
Line 249: Line 250:
   &END SUBSYS   &END SUBSYS
  
- +In order to investigate the effect of the force-field parameters on the L-J potential you need to vary multiple parameters of your calculation: 
-any times you will have to run the same simulation with different parameters (here the distance).+  you need to actually vary the L-J force-field parameters, $\epsilon$ and $\sigma$ 
 +  - you need to run each calculation at different distances between the two Ar atoms
  
 A simple way to generate the different input files is using shell scripting in combination with ''sed'' (the stream editor): A simple way to generate the different input files is using shell scripting in combination with ''sed'' (the stream editor):
Line 256: Line 258:
 <code> <code>
 for d in $(seq 2 0.1 4); do for d in $(seq 2 0.1 4); do
-  sed -e "s|4 0 0|${d} 0 0|" argon.inp > energy_${d}A.inp+  sed -e "s|4 0 0|${d} 0 0|" energy.inp > energy_${d}A.inp
   cp2k.popt -i energy_${d}A.inp -o energy_${d}A.out   cp2k.popt -i energy_${d}A.inp -o energy_${d}A.out
   awk '/Total FORCE_EVAL/ { print $9; }' energy_${d}A.out   awk '/Total FORCE_EVAL/ { print $9; }' energy_${d}A.out
Line 266: Line 268:
   * ''sed -e "s|4 0 0|$d 0 0|" energy.inp'' looks for ''4 0 0'' in the file ''energy.inp'' (the original file from above) and replaces ''4 0 0'' by ''$d 0 0'' (that is: ''2.0'', ''2.1'', ''2.2'', ...)   * ''sed -e "s|4 0 0|$d 0 0|" energy.inp'' looks for ''4 0 0'' in the file ''energy.inp'' (the original file from above) and replaces ''4 0 0'' by ''$d 0 0'' (that is: ''2.0'', ''2.1'', ''2.2'', ...)
   * ... and using ''> energy_${d}A.out'' we redirect the output of the ''sed'' command to new files ''energy_2.0A.out'', ''energy_2.1A.out'', etc.   * ... and using ''> energy_${d}A.out'' we redirect the output of the ''sed'' command to new files ''energy_2.0A.out'', ''energy_2.1A.out'', etc.
-  * Then we run ''cp2k.popt'' as shown before on those new input files and write the output to new output files as well +  * Then we run ''cp2k.popt'' as shown in Exercise 0 on those new input files and write the output to new output files as well 
-  * Using ''awk'' we extract the energy from the output file+  * Using ''awk'' we extract the energy from the output file and print it
              
 <note> <note>
 **TASK** **TASK**
-  *Plot the Lennard-Jones potential against Ar-Ar distance $r$ (2-4 Å) using different $\epsilon$ and $\sigma$. +  *Plot the Lennard-Jones potential against the Ar-Ar distance $r$ (2-4 Å) using different values for $\epsilon$ and $\sigma$. 
-  *Repeat the L-J MD calculation with different $\epsilon$ and $\sigma$, and compare the potential energytemperature evolution, and explain the relation between calculated properties and force field parameters.+  *Repeat the L-J MD calculation with different $\epsilon$ and $\sigma$, compare the potential energy and temperature evolution, and explain the relation between the calculated properties and force field parameters.
  
  
 </note> </note>
-===== Part III:  Radial distribution functions  =====+===== Part III:  Radial distribution function  ===== 
 +In this section we analyze the dependence of the radial distribution function (rdf), $g(r)$, on the temperature of the system. To do so, you should plot $g(r)$ against various temperatures and examine the effects. 
 +You can use VMD (as explained below) or write your own program (Fortran, C, C++, Python etc.) to calculate the rdf.
  
-Use VMD or write your own program (Fortran, C, C++, Python etc.) to calculate radial distribution $g(r)$. Plot $g(r)$, and against various the temperatures to examine the effects. +VMD comes with an extension for exactly this purpose: In the VMD Main window open “Extensions → Analysis” click on “Radial Pair Distribution function $g(r)$. In the appearing window use “Utilities → Set unit cell dimensions” to tell VMD the size of the simulation box you used. After that use Selection 1 and 2 to define the atomic types that you want to calculate the rdf for, for example “element Ar”. In the plot window, use the "File" menu to save the plot data.
-VMD comes with an extension for exactly this purpose: In the VMD Main window open “Extensions → Analysis” click on “Radial Pair Distribution function $g(r)$. In the appearing window use “Utilities → Set unit cell dimensions” to let VMD know the simulation box you used. After that use Selection 1 and 2 to define the atomic types that you want to calculate the rdf for, for example “element Ar”. In the plot window, use "File", you can save the plot data.+
  
 <note>**TASK** <note>**TASK**
  
   * Plot $g(r)$ at 84, 300 and 400 K into the same graph.   * Plot $g(r)$ at 84, 300 and 400 K into the same graph.
-  * What are the differences in the height of the first peak, and why does temperature contribute to the differences? +  * What are the differences in the height of the first peak, and why/how does the temperature contribute to the differences? 
-  * Compared to experimental data ''exp_gr.dat'' taken at 84 Kwhat does this say about the structure of the liquid and is this expected+  * Compare your results to the experimental data taken at 84 K (given in ''exp_gr.dat'', below). What does this say about the structure of the liquid and did you expect this?
 </note> </note>
 <code - exp_gr.dat> <code - exp_gr.dat>
Line 439: Line 442:
 10.2150    1.1041                                               10.2150    1.1041                                              
 10.2831    1.0977                                               10.2831    1.0977                                              
-10.3512    1~0904                                              +10.3512    1.0904                                              
 10.4193    1.0835                                               10.4193    1.0835                                              
 10.4874    1.0774                                               10.4874    1.0774                                              
Line 452: Line 455:
 </code>                                            </code>                                           
  
-===== Part IV:  Ensembles  =====+===== Part IV: Other Ensembles  =====
  
-In previous section, you have already run NVE ensemble molecular dynamics for Ar liquid. In this section, we will focus on the NVTNPT ensembles.+In the previous sections, you have already run NVE ensemble molecular dynamics calculations for liquid Ar. In this section, we will focus on the NVT and NPT ensembles.
  
-Step up NVT calculation, change the setting in &MD section.  +To set up an NVT calculation, change the settings in the &MD section as shown below:
  
  
Line 473: Line 476:
      
      
-Step up NPT calculation, change the setting in &MD section.  +To set up an NPT calculation, change the settings in the &MD section as shown below:
  
   &FORCE_EVAL   &FORCE_EVAL
Line 500: Line 503:
 <note> <note>
 **TASK** **TASK**
-   *Run calculation using NVT at 300K, check the temperatureand energy of the whole system, and compare the result to NVE (300K)and rationalize the difference.  +   *Run calculation using the NVT ensemble at 300K. Check the temperature and energy of the whole system, and compare the result to an NVE ensemble (300K). Rationalize and discuss the difference. 
-   *Run calculation using NVT (300K) until the system is equilibrated then run NVE, check the temperatureand energy of the whole system, and  compare to previous NVE simulation. +   *Run calculation using the NVT ensemble (300K) until the system is equilibratedthen run an NVE ensemble calculation. Check the temperature and energy of the whole system, and compare to the previous NVE simulation. Discuss your observations
-   *Remove some atoms and run NPT simulation then check the size of the simulation box.+   *Remove some atoms and run an NPT ensemble simulation. Then, check the size of the simulation box. Discuss your observations. 
 +</note> 
 + 
 +<note tip> 
 +You have multiple options on how to restart a CP2K calculation off of a previous one. What all approaches have in common, is that you need to make use of the RESTART-files which are automatically written by CP2K (unless you explicitly disable them).
  
 +For the purposes of this example, you should see a file called ''ar108-1.restart'' (at least for Part 1 of this exercise). //Note:// there will also be multiple backup files (''.bak-#'' suffixes) which you do not need to care about.
 +These files are nothing but another input file. However, their parameters are set such that they continue a CP2K calculation from the last step of the simulation which generated the RESTART file.
  
 +Here are two options for how you can use these RESTART-files:
  
 +1. Directly using the RESTART as an input.
 +   - You can copy the RESTART file to a new input file: <code>cp ar108-1.restart argon_follow_up.inp</code>
 +   - Now you can change the input to your liking (e.g. change the ensemble, etc.)
 +   - And finally simply run CP2K with the new input file: <code>cp2k -i argon_followup.inp -o argon_followup.out</code>
  
 +2. You can also tell CP2K to load a specific RESTART-file.
 +   - Write a new input file as usual: <code>argon_followup.inp</code>
 +   - Add an [[https://manual.cp2k.org/trunk/CP2K_INPUT/EXT_RESTART.html|EXT_RESTART]] section:
 +      <code>
 +&EXT_RESTART
 +  RESTART_FILE_NAME ar108-1.restart
 +&END EXT_RESTART</code>
 +   - And now, again, simply run CP2K:  <code>cp2k -i argon_followup.inp -o argon_followup.out</code>
 </note> </note>
exercises/2021_uzh_acpc2/ex01.1619420985.txt.gz · Last modified: 2021/04/26 07:09 by mrossmannek