exercises:common:ensemble
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| exercises:common:ensemble [2022/10/31 16:09] – 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. | ||
| Line 16: | 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: NVE ensemble | + | ===== 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 40: | Line 39: | ||
| &GLOBAL | &GLOBAL | ||
| PROJECT ar108 # | PROJECT ar108 # | ||
| - | RUN_TYPE md # | + | RUN_TYPE md # |
| &END GLOBAL | &END GLOBAL | ||
| Line 58: | 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 215: | Line 214: | ||
| </ | </ | ||
| - | ===== Part III: Radial distribution function | + | |
| + | ===== NVT Ensemble | ||
| + | |||
| + | 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 in other MD codes, the original Nose-Hoover thermostat has an ergodic issue. This has been solved by Mark Tuckerman et al. See [[https:// | ||
| + | In CP2K, the default length of the Nose-Hoover chain is set to 3. (See Manual [[https:// | ||
| + | |||
| + | |||
| + | To set up an NVT calculation, | ||
| + | |||
| + | |||
| + | &MD | ||
| + | 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, | ||
| + | |||
| + | & | ||
| + | ... | ||
| + | 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: < | ||
| + | </ | ||
| + | |||
| + | |||
| + | |||
| + | ===== 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 392: | 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.1667232599.txt.gz · Last modified: by jglan
