This is an old revision of the document!
First CP2K simulation
It is possible to run cp2k from any directory on your own machine by adding a line to your .bashrc
file, without having to specify the location of the cp2k.sopt
file.
To do this change to the directory where the cp2k.sopt
binary is located and type pwd
. Copy the output of this command and edit the .bashrc
file located on your home directory:
To edit the .bashrc
file type
vim ~/.bashrc
Add the following line, replacing /path_of_cp2k_binary/
with the actual path where cp2k.sopt
is located.
export PATH=${PATH}:/path_of_cp2k_binary/
Save the .bashrc
file and quit. You can do this by typing :wq
in normal mode if you use vim.
In the terminal after typing
source ~/.bashrc
you can run cp2k from any directory. To do this enter
cp2k.sopt --help
Which should give you the output
cp2k.sopt [-c|--check] [-e|--echo] [-h|--help] [--html-manual] [-i] <input_file> [-mpi-mapping|--mpi-mapping] <method> [-o] <output_file> [-r|-run] [--xml] starts the CP2K program, see <https://www.cp2k.org/> The easiest way is cp2k.sopt <input_file> The following options can be used: -i <input_file> : provides an input file name, if it is the last argument, the -i flag is not needed -o <output_file> : provides an output file name [default: screen] These switches skip the simulation, unless [-r|-run] is specified: --check, -c : performs a syntax check of the <input_file> --echo, -e : echos the <input_file>, and make all defaults explicit The input is also checked, but only a failure is reported --help, -h : writes this message --html-manual : writes a HTML reference manual of the CP2K input in the current directory. The file index.html is a good starting point for browsing --license : prints the CP2K license --mpi-mapping : applies a given MPI reordering to CP2K --run, -r : forces a CP2K run regardless of other specified flags --version, -v : prints the CP2K version and the SVN revision number --xml : dumps the whole CP2K input structure as a XML file xml2htm generates a HTML manual from this XML file
Now, make a new directory, for instance called exercise0
. Download and extract the file argon.zip into this directory and run cp2k by typing
cp2k.sopt -i argon.inp -o out_ex0.out
You just ran a short Molecular Dynamics trajectory of liquid argon.
Visualization with VMD
We will visualize this trajectory with VMD, a molecular visualization program. First of all, download and install VMD for your operating system as indicated here.The current official release doesn't support MacOS Catalina. For those who have Catalina OS, please download VMD here.
Open VMD. From File → New molecule…
open the file with the .xyz
extension. Go to Graphics → Representations..
and change the Drawing Method to VDW. On the VMD shell type the following commands to define the unit cell of the system and wrap the atoms back to their original unit cell.
pbc set {17.158 17.158 17.158} -all pbc box pbc wrap -all
A snapshot of the molecular dynamics trajectory should approximately look like this:
Plotting tools
Throughout the course, you will also need to plot some graphs. You can use any tool you like for that. gnuplot
and Xmgrace
are two programs often used in Linux environments that are rather easy to use, but you can also use MS Office
, Numbers
, the plotting library of python Matplotlib
, etc. Take care to install any of these software on your machine as needed.