exercises:2016_uzh_cmest:first_simulation_run
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| exercises:2016_uzh_cmest:first_simulation_run [2016/09/22 08:53] – (Delete) exercises:2016_uzh_cmest:first_simulation_run renamed to exercises:2016_uzh_cmest:login tmueller | exercises:2016_uzh_cmest:first_simulation_run [2020/08/21 10:15] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | This page is redirected | + | ====== Run your first simulation using CP2K ====== |
| + | |||
| + | When you check CP2K's [[:: | ||
| + | Together with the parameters for the numerical solvers this means that an average CP2K configuration file will contain quiet 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, organizing and editing the input file and analyze the output. | ||
| + | |||
| + | ====== Computation of the Lennard Jones curve ====== | ||
| + | |||
| + | In this exercise you will compute the Lennard-Jones energy curve for a system of two Krypton (Kr) atoms using a Molecular Mechanics simulation rather than the analytical form of the potential. | ||
| + | |||
| + | In Part I you find the instructions for computing the energy of two Kr atoms at a distance $r=4.00 Å$. | ||
| + | |||
| + | In Part II you find the instructions for getting the energy profile as a function of $r$. | ||
| + | |||
| + | Additonal parameters for Neon (Ne) and combination rules to obtain new parameters are provided in Part III and IV. | ||
| + | |||
| + | You are expected to hand in the respective plots by email, either as one PDF or as one file per plot (PNG, JPEG, or PDF format). | ||
| + | ===== Part I: Single Point (Energy) calculation ===== | ||
| + | |||
| + | In this section a commented CP2K input example for a single point calculation is provided. | ||
| + | Comments are added, they start with an exclamation mark ' | ||
| + | |||
| + | === 1. Step === | ||
| + | |||
| + | Load the CP2K module as shown before, create a directory '' | ||
| + | |||
| + | < | ||
| + | mkdir ex1 | ||
| + | cd ex1 | ||
| + | </ | ||
| + | |||
| + | Save the following input to a file named '' | ||
| + | |||
| + | <code - energy.inp> | ||
| + | & | ||
| + | | ||
| + | &END GLOBAL | ||
| + | & | ||
| + | METHOD FIST ! Molecular Mechanics method | ||
| + | & | ||
| + | & | ||
| + | & | ||
| + | EMAX_SPLINE 10000 ! numeric parameter to ensure calculation stability. Should not be changed | ||
| + | &END SPLINE | ||
| + | & | ||
| + | & | ||
| + | ATOMS Kr Kr | ||
| + | EPSILON | ||
| + | SIGMA [angstrom] | ||
| + | RCUT [angstrom] | ||
| + | &END LENNARD-JONES | ||
| + | &END NONBONDED | ||
| + | & | ||
| + | ATOM Kr | ||
| + | CHARGE 0.0 | ||
| + | &END CHARGE | ||
| + | &END FORCEFIELD | ||
| + | & | ||
| + | PERIODIC NONE | ||
| + | & | ||
| + | EWALD_TYPE none | ||
| + | &END EWALD | ||
| + | &END POISSON | ||
| + | &END MM | ||
| + | & | ||
| + | &CELL | ||
| + | ABC [angstrom] 10 10 10 | ||
| + | PERIODIC NONE | ||
| + | &END CELL | ||
| + | & | ||
| + | UNIT angstrom | ||
| + | Kr 0 0 0 | ||
| + | Kr 4 0 0 | ||
| + | &END COORD | ||
| + | &END SUBSYS | ||
| + | &END FORCE_EVAL | ||
| + | </ | ||
| + | |||
| + | <note tip> | ||
| + | |||
| + | === 2. Step === | ||
| + | |||
| + | Run a CP2K calculation with the following command: | ||
| + | |||
| + | < | ||
| + | $ cp2k.sopt -i energy.inp -o energy.out | ||
| + | </ | ||
| + | |||
| + | <note tip> | ||
| + | |||
| + | === 3. Step === | ||
| + | |||
| + | The output ('' | ||
| + | |||
| + | < | ||
| + | [...] | ||
| + | **** **** ****** | ||
| + | ***** ** *** *** ** | ||
| + | | ||
| + | ***** ** ** ** ** | ||
| + | **** ** ******* | ||
| + | [...] | ||
| + | ENERGY| Total FORCE_EVAL ( FIST ) energy (a.u.): | ||
| + | [...] | ||
| + | |||
| + | The number of warnings for this run is : 0 | ||
| + | |||
| + | | ||
| + | **** **** ****** | ||
| + | ***** ** *** *** ** | ||
| + | | ||
| + | ***** ** ** ** ** | ||
| + | **** ** ******* | ||
| + | </ | ||
| + | |||
| + | If you get the closing banner you know that CP2K finished. | ||
| + | |||
| + | The following line tells you the result: | ||
| + | < | ||
| + | ENERGY| Total FORCE_EVAL ( FIST ) energy (a.u.): | ||
| + | </ | ||
| + | |||
| + | This is the energy (in Hartree) for a system of 2 Kr atoms at distance $ r=4.00 Å$ | ||
| + | |||
| + | Note, that in the input-file '' | ||
| + | |||
| + | To convert from //Kelvin// to //Hartree// you have to multiply with the Boltzmann constant $ k_\text{b} = 3.1668154 \cdot 10^{-6} \frac{E_\text{H}}{\text{K}} $ . | ||
| + | |||
| + | <note warning> | ||
| + | ===== Part II: Computation of the LJ energy curve ===== | ||
| + | |||
| + | In this section a few scripts to get the LJ energy profiles are presented. | ||
| + | |||
| + | === 1. Step === | ||
| + | |||
| + | In order to get a good profile, a set of energy values as a function of the interatomic distance is needed. You can use the '' | ||
| + | |||
| + | <note important> | ||
| + | The output file will be overwritten every time you run a calculation, | ||
| + | </ | ||
| + | |||
| + | To do so: | ||
| + | < | ||
| + | $ mv energy.out energy_dist4A.out | ||
| + | </ | ||
| + | |||
| + | <note tip> | ||
| + | If you run multiple calculations, | ||
| + | </ | ||
| + | |||
| + | For doing so: | ||
| + | < | ||
| + | $ cp energy.inp energy_dist2A.inp | ||
| + | </ | ||
| + | |||
| + | then edit the input file to update to the new coordinates (e.g. 2 Å) and rerun CP2K to produce a new output file: | ||
| + | |||
| + | < | ||
| + | $ cp2k.sopt -i energy_dist2A.inp -o energy_dist2A.out | ||
| + | </ | ||
| + | |||
| + | === 2. Step === | ||
| + | |||
| + | When you have tested a few distances, you can produce a table looking like: | ||
| + | |||
| + | ^ Input file ^ Distance (Å) ^ Energy | ||
| + | | energy_dist1A.inp | ||
| + | | energy_dist2A.inp | ||
| + | | energy_dist3A.inp | ||
| + | | ... | ... | ... | | ||
| + | |||
| + | This is the Lennard Jones energy curve for two Kr atoms. | ||
| + | |||
| + | By using any plotting program you can now get a representation of the energy profile. | ||
| + | Choose a an appropriate minimum distance and step size. | ||
| + | |||
| + | === 3. Step === | ||
| + | |||
| + | Now we do the same for Ne atoms: use the previous input file as a template and update the parameters according to the following: | ||
| + | |||
| + | < | ||
| + | & | ||
| + | & | ||
| + | ATOMS Ne Ne | ||
| + | | ||
| + | SIGMA [angstrom] | ||
| + | | ||
| + | & | ||
| + | & | ||
| + | & | ||
| + | ATOM Ne | ||
| + | | ||
| + | & | ||
| + | </ | ||
| + | |||
| + | Plot the energy curve again. | ||
| + | |||
| + | === 4. Step === | ||
| + | |||
| + | Finally we look at the curve for Kr-Ne. | ||
| + | |||
| + | The epsilon and sigma for the Lennard-Jones potential between Kr and Ne can be calculated using the parameters from the Kr-Kr and Ne-Ne interaction: | ||
| + | |||
| + | $$ \sigma_{ij}= \sqrt{\sigma_i\sigma_j}$$ \\ | ||
| + | $$ \epsilon_{ij}= \sqrt{\epsilon_i\epsilon_j}$$ | ||
| + | |||
| + | Please note: | ||
| + | |||
| + | * The '' | ||
| + | |||
| + | < | ||
| + | & | ||
| + | ATOMS Kr Kr | ||
| + | EPSILON | ||
| + | SIGMA [angstrom] | ||
| + | RCUT [angstrom] | ||
| + | &END LENNARD-JONES | ||
| + | & | ||
| + | ATOMS Ne Ne | ||
| + | EPSILON | ||
| + | SIGMA [angstrom] | ||
| + | RCUT [angstrom] 25.0 | ||
| + | &END LENNARD-JONES | ||
| + | & | ||
| + | ATOMS Kr Ne | ||
| + | EPSILON | ||
| + | SIGMA [angstrom] | ||
| + | RCUT [angstrom] | ||
| + | &END LENNARD-JONES | ||
| + | </ | ||
| + | |||
| + | * The '' | ||
| + | |||
| + | < | ||
| + | & | ||
| + | ATOM Ne | ||
| + | | ||
| + | & | ||
| + | & | ||
| + | ATOM Kr | ||
| + | | ||
| + | & | ||
| + | |||
| + | </ | ||
| + | |||
| + | * one of the atom kinds in the ''& | ||
| + | |||
| + | Plot again the energy curve. | ||
| + | |||
| + | ====== Tips & Tricks ====== | ||
| + | |||
| + | ===== Parsing the output ===== | ||
| + | |||
| + | Many times you will have to get some value out of a simulation output, in this case, the energy. | ||
| + | This can achieved in a number of ways: | ||
| + | |||
| + | * Using the '' | ||
| + | $ grep "Total FORCE_EVAL" | ||
| + | </ | ||
| + | | ||
| + | </ | ||
| + | * Using the '' | ||
| + | $ awk '/ | ||
| + | </ | ||
| + | -0.000250281091139 | ||
| + | </ | ||
| + | |||
| + | ===== Generating input files ===== | ||
| + | |||
| + | Many times you will have to run the same simulation with different parameters (here the distance). | ||
| + | |||
| + | A simple way to generate the different input files is using shell scripting in combination with '' | ||
| + | |||
| + | < | ||
| + | for d in $(seq 2 0.1 4); do | ||
| + | sed -e "s|4 0 0|${d} 0 0|" energy.inp > energy_${d}A.inp | ||
| + | cp2k.sopt -i energy_${d}A.inp -o energy_${d}A.out | ||
| + | awk '/ | ||
| + | done | ||
| + | </ | ||
| + | |||
| + | * The command '' | ||
| + | * With '' | ||
| + | * '' | ||
| + | * ... and using ''> | ||
| + | * Then we run '' | ||
| + | * Using '' | ||
exercises/2016_uzh_cmest/first_simulation_run.1474534397.txt.gz · Last modified: (external edit)
