exercises:common:ensemble
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
exercises:common:ensemble [2022/10/31 16:07] – created jglan | exercises:common:ensemble [2022/10/31 17:28] (current) – [NVT Ensemble] jglan | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Lennard-Jones liquids ====== | + | ====== |
In this exercise, you will simulate a fluid of monoatomic particles that interact with a Lennard-Jones potential. The method to be used is molecular dynamics (MD) with periodic boundary conditions using CP2K. The aim is to explore the method, calculate the radial distribution function g(r) and investigate a variety of ensembles. | In this exercise, you will simulate a fluid of monoatomic particles that interact with a Lennard-Jones potential. The method to be used is molecular dynamics (MD) with periodic boundary conditions using CP2K. The aim is to explore the method, calculate the radial distribution function g(r) and investigate a variety of ensembles. | ||
- | You are expected to hand in the short report via OLAT, ONLY in PDF format. | ||
- | | ||
- | When you check CP2K's [[:: | ||
- | Together with the parameters for the numerical solvers, this means that an average CP2K configuration file will contain quite a number of options (even though for many others the default value will be applied) and not all of them will be discussed in the lecture or the exercises. | ||
- | |||
- | The [[https:// | ||
- | |||
- | To get you started, we will do a simple exercise using Molecular Mechanics (that is: a classical approach). The point is to get familiar with the options, learn how to organize and edit the input file and analyze the output. | ||
====== Background ====== | ====== Background ====== | ||
Line 24: | Line 16: | ||
The radial distribution function, (or pair correlation function) g(r), in a system of particles (atoms, molecules, colloids, etc.), describes how the density varies as a function of distance from a reference particle. | The radial distribution function, (or pair correlation function) g(r), in a system of particles (atoms, molecules, colloids, etc.), describes how the density varies as a function of distance from a reference particle. | ||
- | ===== Part I: Set up MD simulation | + | ===== NVE Ensemble |
In this section, we provide you with an example CP2K input for an MD calculation. | In this section, we provide you with an example CP2K input for an MD calculation. | ||
- | Extensive comments have been added to the file, which start with a has symbol '#' | + | Extensive comments have been added to the file, which starts |
- | === 1. Step === | ||
Load the CP2K module as explained in Exercise 0, create a directory '' | Load the CP2K module as explained in Exercise 0, create a directory '' | ||
Line 48: | Line 39: | ||
&GLOBAL | &GLOBAL | ||
PROJECT ar108 # | PROJECT ar108 # | ||
- | RUN_TYPE md # | + | RUN_TYPE md # |
&END GLOBAL | &END GLOBAL | ||
Line 66: | Line 57: | ||
& | & | ||
ATOM Ar # | ATOM Ar # | ||
- | CHARGE 0.0 #Defines the charge of the MM atom in electron charge unit | + | CHARGE 0.0 #Defines the charge of the MM atom in an electron charge unit |
&END | &END | ||
& | & | ||
Line 222: | Line 213: | ||
*Run calculations with different timesteps (0.5, 2, 5fs), different temperatures(84, | *Run calculations with different timesteps (0.5, 2, 5fs), different temperatures(84, | ||
</ | </ | ||
- | ===== Part II: Force Field Parameter | ||
- | In this section we investigate the dependence of the L-J potential on the its different parameters. To do se, we investigate a small system of only two Ar atoms. The following code snippet shows the changes that you need to make to the input file in order to run such a calculation. | ||
- | & | ||
- | | ||
- | &END GLOBAL | ||
- | ... | ||
- | & | ||
- | & | ||
- | atoms Ar Ar # | ||
- | EPSILON 119.8 # | ||
- | SIGMA 3.405 # | ||
- | RCUT 8.4 #Defines the cutoff parameter of the LJ potential | ||
- | &END LENNARD-JONES | ||
- | &END NONBONDED | ||
- | ... | ||
- | & | ||
- | & | ||
- | ABC [angstrom] 10 10 10 | ||
- | | ||
- | & | ||
- | & | ||
- | UNIT angstrom | ||
- | Ar 0 0 0 | ||
- | Ar 4 0 0 | ||
- | &END COORD | ||
- | &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: | + | ===== NVT Ensemble |
- | - you need to actually vary the L-J force-field parameters, ϵ and σ | + | |
- | - you need to run each calculation at different distances between the two Ar atoms | + | |
- | A simple way to generate | + | 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 ensembles. |
- | < | + | Although the most popular Nose-Hoover thermostat is commonly-used |
- | for d in $(seq 2 0.1 4); do | + | In CP2K, the default length of the Nose-Hoover chain is set to 3. (See Manual [[https:// |
- | | + | |
- | | + | |
- | | + | To set up an NVT calculation, |
- | done | + | |
- | </ | + | |
+ | | ||
+ | ENSEMBLE NVT | ||
+ | STEPS 3000 | ||
+ | TIMESTEP 5 | ||
+ | TEMPERATURE 298 | ||
+ | & | ||
+ | REGION MASSIVE | ||
+ | & | ||
+ | TIMECON 100 # | ||
+ | &END NOSE | ||
+ | &END | ||
+ | &END MD | ||
+ | |||
+ | |||
+ | Alternatively, | ||
+ | (CSVR)]] as developed by Giovanni [[https:// | ||
+ | &MD | ||
+ | ENSEMBLE NVT | ||
+ | STEPS 3000 | ||
+ | TIMESTEP 5 | ||
+ | TEMPERATURE 298 | ||
+ | & | ||
+ | & | ||
+ | TIMECON 100 # | ||
+ | &END CSVR | ||
+ | &END | ||
+ | &END MD | ||
+ | |||
+ | ===== NPT Ensemble | ||
+ | |||
+ | |||
+ | To set up an NPT calculation, | ||
+ | |||
+ | & | ||
+ | ... | ||
+ | | ||
+ | | ||
+ | | ||
+ | ... | ||
+ | ... | ||
+ | & | ||
+ | ENSEMBLE NPT_I #constant temperature and pressure using an isotropic cell | ||
+ | STEPS 3000 | ||
+ | TIMESTEP 5. | ||
+ | TEMPERATURE 85.0 | ||
+ | & | ||
+ | PRESSURE 0. # PRESSURE, unit[bar] | ||
+ | TIMECON 1000 | ||
+ | &END BAROSTAT | ||
+ | & | ||
+ | &NOSE | ||
+ | TIMECON 1000 | ||
+ | &END NOSE | ||
+ | &END THERMOSTAT | ||
+ | & | ||
- | * The command '' | ||
- | * With '' | ||
- | * '' | ||
- | * ... and using ''> | ||
- | * Then we run '' | ||
- | * Using '' | ||
- | | ||
< | < | ||
**TASK** | **TASK** | ||
- | | + | *Run a calculation using the NVT ensemble at 300K. Check the temperature and energy of the whole system, and compare the result to an NVE ensemble |
- | *Repeat | + | |
+ | | ||
+ | </ | ||
+ | <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 '' | ||
+ | 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: < | ||
+ | - 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: < | ||
+ | |||
+ | 2. You can also tell CP2K to load a specific RESTART-file. | ||
+ | - Write a new input file as usual: < | ||
+ | - Add an [[https:// | ||
+ | < | ||
+ | & | ||
+ | RESTART_FILE_NAME ar108-1.restart | ||
+ | &END EXT_RESTART</ | ||
+ | - And now, again, simply run CP2K: < | ||
</ | </ | ||
- | ===== 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. | 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. | You can use VMD (as explained below) or write your own program (Fortran, C, C++, Python etc.) to calculate the rdf. | ||
Line 455: | Line 491: | ||
</ | </ | ||
- | ===== Part IV: Other 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. | ||
- | |||
- | To set up an NVT calculation, | ||
- | |||
- | |||
- | &MD | ||
- | ENSEMBLE NVT | ||
- | STEPS 3000 | ||
- | TIMESTEP 5 | ||
- | TEMPERATURE 298 | ||
- | & | ||
- | REGION MASSIVE | ||
- | & | ||
- | TIMECON 1000 # | ||
- | &END NOSE | ||
- | &END | ||
- | &END MD | ||
- | | ||
- | | ||
- | To set up an NPT calculation, | ||
- | |||
- | & | ||
- | ... | ||
- | STRESS_TENSOR ANALYTICAL | ||
- | ... | ||
- | &END FORCE_EVAL | ||
- | ... | ||
- | ... | ||
- | &MD | ||
- | ENSEMBLE NPT_I #constant temperature and pressure using an isotropic cell | ||
- | STEPS 3000 | ||
- | TIMESTEP 5. | ||
- | TEMPERATURE 85.0 | ||
- | & | ||
- | PRESSURE 0. # PRESSURE, unit[bar] | ||
- | TIMECON 1000 | ||
- | &END BAROSTAT | ||
- | & | ||
- | &NOSE | ||
- | TIMECON 1000 | ||
- | &END NOSE | ||
- | &END THERMOSTAT | ||
- | & | ||
- | |||
- | < | ||
- | **TASK** | ||
- | *Run a 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 a calculation using the NVT ensemble (300K) until the system is equilibrated, | ||
- | | ||
- | </ | ||
- | |||
- | <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 '' | ||
- | 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: < | ||
- | - 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: < | ||
- | |||
- | 2. You can also tell CP2K to load a specific RESTART-file. | ||
- | - Write a new input file as usual: < | ||
- | - Add an [[https:// | ||
- | < | ||
- | & | ||
- | RESTART_FILE_NAME ar108-1.restart | ||
- | &END EXT_RESTART</ | ||
- | - And now, again, simply run CP2K: < | ||
- | </ |
exercises/common/ensemble.1667232475.txt.gz · Last modified: 2022/10/31 16:07 by jglan