Downloading the code
What can be downloaded ?
The source of CP2K is open and freely available for everybody under the GPL license.
Installation instructions can be found on the wiki and in the
INSTALL.md
file which is part of the download.
The sparse matrix library DBCSR is part of CP2K, and made available standalone at the DBCSR page.
Available versions of CP2K
Development Version | Released Version |
---|---|
|
|
Looking at the version history might help you to decide.
How to download
From an official release
Sources of released versions are available at our GitHub project page. Alternatively, precompiled single node, optimised CP2K versions for Linux with or without OpenMP support are available as well.
From a Distribution
From a third party
- Debian/Ubuntu alternative: http://packages.mccode.org/
Git Access
The code in Git is under constant development. Check the Dashboard for current issues.
The Git (
git
) program must be installed on your machine for this to work.Initial checkout
The latest and all prior versions are available from the CP2K GitHub repository.
To clone the current master:
git clone --recursive https://github.com/cp2k/cp2k.git cp2k
or to directly checkout a branch (check the CP2K GitHub project page for available branches):
git clone --recursive -b support/v6.1 https://github.com/cp2k/cp2k.git cp2k
Keeping your clone up-to-date (Git >= 2.14)
Set the following once on your CP2K Git clone. It will tell Git to automatically update included submodules as well and to always use rebase instead of merge.
Executing the code
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.
In Part I you find the instructions for computing the energy of two Kr atoms at a distance .
In Part II you find the instructions for getting the energy profile as a function of .
Additonal parameters for Neon (Ne) and combination rules to obtain new parameters are provided in Part III and IV.
In Part I you find the instructions for computing the energy of two Kr atoms at a distance .
In Part II you find the instructions for getting the energy profile as a function of .
Additonal parameters for Neon (Ne) and combination rules to obtain new parameters are provided in Part III and IV.
Part I: Single Point (Energy) calculation
In this section a commented CP2K input example for a single point calculation is provided. Comments are added and signaled with '!'.
1. Step
Save the following input to a file named
energy.inp
- energy.inp
&GLOBAL ! section to select the kind of calculation RUN_TYPE ENERGY ! select type of calculation. In this case: ENERGY (=Single point calculation) &END GLOBAL &FORCE_EVAL ! section with parameters and system description METHOD FIST ! Molecular Mechanics method &MM ! specification of MM parameters &FORCEFIELD ! parameters needed to describe the potential &SPLINE EMAX_SPLINE 10000 ! numeric parameter to ensure calculation stability. Should not be changed &END &NONBONDED ! parameters for the non bonded interactions &LENNARD-JONES ! Lennard-Jones parameters atoms Kr Kr EPSILON [K_e] 164.56 SIGMA [angstrom] 3.601 RCUT [angstrom] 25.0 &END LENNARD-JONES &END NONBONDED &CHARGE ATOM Kr CHARGE 0.0 &END CHARGE &END FORCEFIELD &POISSON ! solver for non periodic calculations PERIODIC NONE &EWALD EWALD_TYPE none &END EWALD &END POISSON &END MM &SUBSYS ! system description &CELL ABC [angstrom] 10 10 10 PERIODIC NONE &END CELL &COORD UNIT angstrom Kr 0 0 0 Kr 4 0 0 &END COORD &END SUBSYS &END FORCE_EVAL
2. Step
Submit a CP2K calculation with the following commands:
bsub -n 1 mpirun cp2k.popt -i energy.inp -o energy.out
3. Step
Afterwards the file energy.out will look like this:
**** **** ****** ** PROGRAM STARTED AT 2014-01-20 11:32:08.142 ***** ** *** *** ** PROGRAM STARTED ON some_server.ethz.ch ** **** ****** PROGRAM STARTED BY you ***** ** ** ** ** PROGRAM PROCESS ID 24183 **** ** ******* ** PROGRAM STARTED IN /home/you/XERCISES ... some stufff ... ENERGY| Total FORCE_EVAL ( FIST ) energy (a.u.): 0.003617048870059 ... some other stuff ... **** **** ****** ** PROGRAM ENDED AT 2014-01-20 12:24:18.154 ***** ** *** *** ** PROGRAM RAN ON some_server.ethz.ch ** **** ****** PROGRAM RAN BY you ***** ** ** ** ** PROGRAM PROCESS ID 24993 **** ** ******* ** PROGRAM STOPPED IN /home/you/EXERCISES
If you get the closing Banner you know that cp2k worked. The following line tells you the result:
ENERGY| Total FORCE_EVAL ( FIST ) energy (a.u.): 0.003617048870059
This is the energy (in Hartree) for a system of 2 Kr atoms at distance
Note, that in the input-file
EPSILON
is given in units of Kelvin, whereas in the output the energy is printed in Hartree, which is the unit of energy in the system of atomic units (a.u.). To convert from Kelvin to Hartree you have to multiply with the Boltzmann constant .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
energy.inp
input file and change the Kr coordinates in order to get different starting distances.
The output file will be rewritten every time you run a calculation, unless you change its name.
To do so:
$ mv energy.out energy_dist4A.out
If you run multiple calculations, it is always good to keep track of what you have done by producing an input and an output for every distance you are planning to run.
For doing so:
$ cp energy.inp energy_dist2A.inp
then edit the input file with the new coordinates (e.g. 2 Ã…). you can now run CP2K and produce the output file:
$ cp2k.popt -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 (Eh) |
---|---|---|
energy_dist1A.inp | 1 | … |
energy_dist2A.inp | 2 | … |
energy_dist3A.inp | 3 | … |
… | … | … |
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.
3. Step
Here are reported the LJ parameters for Ne atoms. Those are to replace the Kr parameters in the input file, along with your Ne coordinates that have to replace the Kr coordinates. A new LJ curve for Ne atoms can be now generated.
&NONBONDED &LENNARD-JONES ! Lennard-Jones Ne parameters atoms Ne Ne EPSILON [K_e] 36.831 SIGMA [angstrom] 2.775 RCUT [angstrom] 25.0 &END LENNARD-JONES &END NONBONDED &CHARGE ATOM Ne CHARGE 0.0 &END CHARGE
4. Step
Here are reported the combination rules for pairs unlike pairs, i.e. for pairs of non identical atoms.
Once generated the ε and σ parameters for the couple Kr/Ne, generate once more the LJ dissociation curve.
Compare the “mixed” curve to the two “pure” curves and report the position and depth of the minimum.
Once generated the ε and σ parameters for the couple Kr/Ne, generate once more the LJ dissociation curve.
Compare the “mixed” curve to the two “pure” curves and report the position and depth of the minimum.
Remember that you are running with two different atom types. For this reason some of the input sections MUST BE REPLICATED for the two kinds of atoms present
- The “ LENNARD-JONES ” section must be present for all the three possible couples: Kr-Kr, Ne-Ne and Ne-Kr. Example:
&LENNARD-JONES ! Lennard-Jones parameters for Ar-Ar interaction atoms Kr Kr EPSILON [K_e] 164.56 SIGMA [angstrom] 3.601 RCUT [angstrom] 25.0 &END LENNARD-JONES &LENNARD-JONES ! Lennard-Jones Ne-Ne parameters atoms Ne Ne EPSILON [K_e] 36.831 SIGMA [angstrom] 2.775 RCUT [angstrom] 25.0 &END LENNARD-JONES &LENNARD-JONES ! Lennard-Jones parameters for Kr-Ne interaction atoms Kr Ne EPSILON [K_e] YOUR EPSILON SIGMA [angstrom] YOUR SIGMA RCUT [angstrom] 25.0 &END LENNARD-JONES
- The “ CHARGE ” section must be also duplicated:
&CHARGE ATOM Ne CHARGE 0.0 &END CHARGE &CHARGE ATOM Kr CHARGE 0.0 &END CHARGE
Questions
- Sketch the LJ energy curve for the two set of parameters ( and ) provided.
- Report, for both curves, the minimum energy distance and the depth of the minimum.
- What are the major differences between the curves? How do they relate to the sets of parameters provided?
Reference: https://www.cp2k.org/exercises:2016_ethz_mmm:single_point_calculation
0 Comments