User Tools

Site Tools


exercises:2018_uzh_acpc2:l-j_flu

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:2018_uzh_acpc2:l-j_flu [2018/04/20 14:08] gtocciexercises:2018_uzh_acpc2:l-j_flu [2020/08/21 10:15] (current) – external edit 127.0.0.1
Line 62: Line 62:
   &MM   &MM
     &FORCEFIELD     &FORCEFIELD
 +    &SPLINE
 +     EMAX_SPLINE 100000
 +    &END
       &CHARGE             #charge of the MM atoms       &CHARGE             #charge of the MM atoms
         ATOM Ar           #Defines the atomic kind of the charge         ATOM Ar           #Defines the atomic kind of the charge
Line 84: Line 87:
       &SUBSYS                 ! system description       &SUBSYS                 ! system description
        &CELL        &CELL
-         ABC [angstrom] 10 10 10+         ABC [angstrom] 40 40 40
          PERIODIC NONE          PERIODIC NONE
        &END CELL        &END CELL
Line 105: Line 108:
  
 <code> <code>
-for d in $(seq 0.1 4); do+for d in $(seq 3.0 0.1 9); 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|" argon.inp > energy_${d}A.inp
   cp2k.sopt -i energy_${d}A.inp -o energy_${d}A.out   cp2k.sopt -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 "'"${d}"'", $9; }' energy_${d}A.out >> Pot_En_vs_distance.dat
 done done
 </code> </code>
  
-  * The command ''seq 0.1 4'' generates the numbers ''2.0'', ''2.1'', ''2.2'', ... , ''4.0'' (try it out!) +  * The command ''seq 0.1 9.0'' generates the numbers ''3.0'', ''3.1'', ''3.2'', ... , ''9.0'' (try it out!) 
-  * With ''for d in $(seq 0.1 4); do'' we use the shell to run all commands which follow once for every number (stored in ''$d''+  * With ''for d in $(seq 0.1 9.0); do'' we use the shell to run all commands which follow once for every number (stored in ''$d''
-  * ''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: ''3.0'', ''3.1'', ''3.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_3.0A.out'', ''energy_3.1A.out'', etc.
   * Then we run ''cp2k.sopt'' as shown before on those new input files and write the output to new output files as well   * Then we run ''cp2k.sopt'' as shown before 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
 +  * The energy as a function of distance for all the single point calculations is then printed to the file ''Pot_En_vs_distance.dat''
  
 Plot distance vs. potential energy and find the minimum in energy, which corresponds to the equilibrium distance. After having done it, you can calculate the minimum analytically as well. Plot distance vs. potential energy and find the minimum in energy, which corresponds to the equilibrium distance. After having done it, you can calculate the minimum analytically as well.
Line 314: Line 318:
   *Run the calculation and visualize the trajectories using VMD. Plot the total energies (conserved quantity), temperature, potential energies (you need to look into the *.ener file). Comment and explain what you observe.   *Run the calculation and visualize the trajectories using VMD. Plot the total energies (conserved quantity), temperature, potential energies (you need to look into the *.ener file). Comment and explain what you observe.
   *Change the timestep to 40 fs and rerun, look into the ener file again and compare to the simulation with the smaller timestep. What happens to the energy conservation?   *Change the timestep to 40 fs and rerun, look into the ener file again and compare to the simulation with the smaller timestep. What happens to the energy conservation?
-  *Change the temperature to 30 K (use the smaller timestep of 5 fs) and compare the temperatures that you set up in the input files with the average temperature. Are they the same? Comment.+  *Change the temperature to 150 K (use the smaller timestep of 5 fs) and compare the temperatures that you set up in the input files with the average temperature. Are they the same? Comment.
 </note> </note>
  
Line 322: Line 326:
 [[ https://www.cp2k.org/exercises:2018_uzh_acpc2:installation | exercise 0 ]] to remember the commands to define the unit cell in VMD and how to wrap the coordinates to the original cell. [[ https://www.cp2k.org/exercises:2018_uzh_acpc2:installation | exercise 0 ]] to remember the commands to define the unit cell in VMD and how to wrap the coordinates to the original cell.
 </note> </note>
-===== Part III:  Radial distribution functions  =====+===== Part III:  Radial distribution functions in NVT ensemble ===== 
 + 
 +In this exercise you are asked to compute the radial distribution function of liquid Ar at different temperatures. First of all perform two simulations at 85 K and 150 K for liquid Ar in the NVT ensemble to ensure the simulations are equilibrated at the right temperatures. To perform simulations in NVT copy the relevant section in the input file as shown below. 
 + 
 +<code> 
 +  &MD 
 +    ENSEMBLE NVT 
 +    STEPS 10000 
 +    TIMESTEP 5 
 +    TEMPERATURE 85.0 
 +    &THERMOSTAT 
 +      &NOSE                    #Uses the Nose-Hoover thermostat 
 +        TIMECON 100           #timeconstant of the thermostat chain, how often does thermostat adjust your system  
 +      &END NOSE 
 +    &END 
 +  &END MD 
 +</code>
  
 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. 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.
Line 329: Line 349:
 <note>**TASK** <note>**TASK**
  
-  * Plot $g(r)$ at 85 and 30 K into the same graph.+  * Plot $g(r)$ at 85 and 150 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 does temperature contribute to the differences?
   * Compared to experimental data ''exp_gr.dat'' taken at 84 K, what does this say about the structure of the liquid and is this expected? .    * Compared to experimental data ''exp_gr.dat'' taken at 84 K, what does this say about the structure of the liquid and is this expected? . 
Line 500: Line 520:
 ===== Part IV:  Ensembles  ===== ===== Part IV:  Ensembles  =====
  
-In previous section, you have already run NVE ensemble molecular dynamics for Ar liquid. In this section, we will focus on the NVT, NPT ensembles.+In previous section, you have already run NVE and NVT ensemble molecular dynamics for Ar liquid. In this section, we will focus on the NPT ensembles and you will compare the results in different ensembles.
  
-Step up NVT calculation, change the setting in &MD section.   +Set up NPT calculation, change the setting in &MD section.  
- +
- +
-  &MD +
-    ENSEMBLE NVT +
-    STEPS 10000 +
-    TIMESTEP 5 +
-    TEMPERATURE 85.0 +
-    &THERMOSTAT +
-      &NOSE                    #Uses the Nose-Hoover thermostat +
-        TIMECON 100           #timeconstant of the thermostat chain, how often does thermostat adjust your system  +
-      &END NOSE +
-    &END +
-  &END MD +
-   +
-   +
-Step up NPT calculation, change the setting in &MD section.  +
  
   &FORCE_EVAL   &FORCE_EVAL
Line 533: Line 537:
     TEMPERATURE 85.0     TEMPERATURE 85.0
     &BAROSTAT     &BAROSTAT
-      PRESSURE 0.                 # PRESSURE, unit[bar]+      PRESSURE 1.                 # PRESSURE, unit[bar]
       TIMECON 1000       TIMECON 1000
     &END BAROSTAT     &END BAROSTAT
Line 544: Line 548:
 <note> <note>
 **TASK** **TASK**
-   *Run calculations in the NVT ensembles at 30 and 85 K, check the temperature, and energy of the whole system, and compare the result to the previous simulations run in NVE, and rationalize the difference.+   *For the calculations in the NVT ensemble at 150 and 85 K, check the temperature, and energy of the whole system, and compare the result to the previous simulations run in NVE, and rationalize the difference.
    *It is a common practice to first perform a simulation in NVT and then run an NVE simulation. What is a possible reason for doing this?    *It is a common practice to first perform a simulation in NVT and then run an NVE simulation. What is a possible reason for doing this?
-   *It is often required to perform MD simulations in the NPT ensemble. Perform an NPT simulation at atmospheric pressure. In NPT the volume of the cell changesCheck the variation of the unit cell during your NPT simulation. To do this you need to add the keyword &CELL in the print section. Plot and comment the results. +   * It is often needed to perform MD simulations in the NPT ensemble. For the case of Argon, it is liquid at 85 K at atmospheric pressure. First perform an NPT simulation at 85 K and atmospheric pressure. Then, based on the phase diagram reported in this [[https://www.nature.com/articles/srep15850/figures/1 | link]], choose a possible value of the pressure for liquid Argon at 150 K, edit the input file accordingly and run the simulation in NPT. 
 +   * For these two simulations plot the time evolution of the cell volume as well as the pressure. To print the cell to file you need to add the keyword &CELL in the print section. For the pressure you can use the following command from the terminal ''grep 'PRESSURE' NAME_OF_OUTPUT_FILE.out  | awk '{i++; print i, $4}' ''  Plot and comment the results. 
  
    &END MD    &END MD
exercises/2018_uzh_acpc2/l-j_flu.1524233289.txt.gz · Last modified: 2020/08/21 10:15 (external edit)