Table of Contents

First Login

In this exercise you will learn how to login and run commands on our infrastructure.

Part I: Login

As mentioned in the lecture, you absolutely need

optionally you may want:

Use the instructions giving in the lecture/available via OLAT to login on the server tcopt3.chem.uzh.ch using your assigned student account.

Change the password of your account after your first login, using:
$ passwd
Login the remote machine using (if you use Linux or MacOS):
$ ssh -X username@tcopt3.chem.uzh.ch

The bash terminal

Many tasks in the following weeks will need to be performed on the terminal (or 'command line').

If you use Mac OS X: In order to keep the terminal in the dock also after you close it, right click on the symbol and select 'Options' → 'keep in dock'.

Let's start with a list of useful commands – just type them into the command line and confirm with RETURN.

ls             # get list of files in the current directory
mkdir molsim   # make directory 'molsim'
cd             # change into your home directory
cd molsim      # change into directory 'molsim'
cd ..          # go up one directory
pwd            # print path to the current working directory

Now it is time to copy some files from the teacher account.

cp ~student10/whatever.txt .               # copy 'whatever.txt' to you current folder
scp your_username@remotehost.edu:foobar.txt /some/local/directory  #Copy the file "foobar.txt" from a remote host to the local host
scp foobar.txt your_username@remotehost.edu:/some/remote/directory #Copy the file "foobar.txt" from the local host to a remote host

After this, please close and reopen your terminal in order to activate the course-specific settings you copied.

We are now ready to get started. Below you find some additional commands that will come in handy later.

vim myfile      # opens 'myfile' in vim (less intuitive but more powerful command line text editor)
vi myfile       # opens 'myfile' in vim (less intuitive but more powerful command line text editor)

Part II: Loading and running a program

Module loading

Since there are numerous applications with different and possibly conflicting requirements, the module system is used. This means that only basic commands are available until explicitly loaded.

To list all available modules:

$ module avail

while using

$ module list

gives the list of loaded moules.

To load the CP2K module used in this course, use:

$ module load cp2k/r17408_2016_09_19

When you list the loaded modules again at this point (see command above), you will notice that the list has changed.

Now run the following command to verify that the CP2K executable is available:

$ 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 you can run cp2k using:

$ cp2k.sopt -i cp2k.inp -o cp2k.out &

Another program we need for visualization is VMD.

Load the respective module (since there is only one version available, the shorthand vmd can be used when specifying the module to load) and start it using:

$ vmd

Two new windows named VMD Main and VMD 1.9.2 … Display should open on your local machine while the server shows:

Info) VMD for LINUXAMD64, version 1.9.2 (December 29, 2014)
Info) http://www.ks.uiuc.edu/Research/vmd/                         
Info) Email questions and bug reports to vmd@ks.uiuc.edu           
Info) Please include this reference in published work using VMD:   
Info)    Humphrey, W., Dalke, A. and Schulten, K., `VMD - Visual   
Info)    Molecular Dynamics', J. Molec. Graphics 1996, 14.1, 33-38.
Info) -------------------------------------------------------------
Info) Multithreading available, 32 CPUs detected.
Info) Free system memory: 256213MB (99%)
Warning) Detected a mismatch between CUDA runtime and GPU driver
Warning) Check to make sure that GPU drivers are up to date.
Info) No CUDA accelerator devices available.
Warning) Detected X11 'Composite' extension: if incorrect display occurs
Warning) try disabling this X server option.  Most OpenGL drivers
Warning) disable stereoscopic display when 'Composite' is enabled.
libGL error: failed to load driver: swrast
libGL error: Try again with LIBGL_DEBUG=verbose for more details.
Info) OpenGL renderer: GeForce GTX 760 (192-bit)/PCIe/SSE2
Info)   Features: STENCIL MSAA(4) MDE MTX NPOT PP PS 
Info)   GLSL rendering mode is NOT available.
Info)   Textures: 2-D (16384x16384), 3-D (2048x2048x2048), Multitexture (4)
Info) Dynamically loaded 2 plugins in directory:
Info) /sw/build/generic/app/vmd/vmd-1.9.2/lib/vmd/plugins/LINUXAMD64/molfile
vmd >

If you only get the output on the server but not the 2 windows there is something wrong with your setup and you should check the lecture notes again. You can exit VMD by either closing the VMD Main or by giving the quit command at the vmd > prompt:

vmd > quit
The module loading is not persistent. You have to reload the modules every time you log back in.

Part III: Advanced account configuration

Make module loading persistent

Upon login, the shell (bash in our case) executes a number of files if they exist. One of them is the .bashrc. To prepare it for management using the the module command, simply execute the following once:

$ echo 'module load ' >> ~/.bashrc

after that you can add and remove modules to be loaded at startup using module initadd or module initrm.

To add vmd and cp2k, run for example:

$ module initadd vmd
$ module initadd cp2k/r17408_2016_09_19

to remove vmd again from the list of modules to load:

$ module initrm vmd

Alternatively you can of course simply edit .bashrc using your favorite editor and add a line like module load vmd cp2k/r17408_2016_09_19 by yourself.

Setup key-based authentication

To avoid having to type the password every time you log in (and to increase the security), keys can be used for authentication instead. The following instructions are for OSX and Linux.

First generate a key-pair on your local machine using

$ ssh-keygen

and accept the defaults proposed and do not set a password.

Upload the public key from your local machine to tcopt3:

$ scp ~/.ssh/id_rsa.pub studentXX@tcopt3.chem.uzh.ch:~/

Now login to tcopt3.chem.uzh.ch and move the uploaded public key to the right place:

$ mkdir -p .ssh
$ chmod 0700 .ssh
$ mv id_rsa.pub .ssh/authorized_keys

When connecting to the server from your local machine now, use:

$ ssh -i ~/.ssh/id_rsa studentXX@tcopt3.chem.uzh.ch

Simplify the login

The following instructions apply apply to OSX and Linux.

On your local machine add the following part to the file .ssh/config in your home directory:

Host tcopt3
  HostName tcopt3.chem.uzh.ch
  User studentXX

after which you will be able to connect to tcopt3 simply by using

$ ssh tcopt3

If you have setup key-based authentication as shown above, augment the entry to the following instead, to always use key-based authentication without having to specify -i ~/.ssh/id_rsa manually:

Host tcopt3
  HostName tcopt3.chem.uzh.ch
  User studentXX
  IdentityFile ~/.ssh/id_rsa
  IdentitiesOnly yes
  PreferredAuthentications publickey