Installing the metalwalls

Here is a quick and dirty instruction for installation of the metalwalls code.

Download the source code using https protocol:

git clone https://gitlab.maisondelasimulation.fr/amarinla/mw2.git

You will be prompted for your username and password.

Preinstall gfortran and openmpi. Then copy compile.something.mk from the computer directory to the mw2 folder as compile.mk. Add a line “FPPFLAGS := -DMW_USE_MPI”. Comment the path to the pFUnit package.

Execute make.

Go to tests directory and execute tests:

python regression_tests.py -s nist

python regression_tests.py -s nacl

python regression_tests.py -s lammps

MD simulation of BMPyrDCA between graphene walls

Simple demonstration of a molecular dynamics simulation of 408 BMPyrDCA ionic pairs between two graphene walls.

Inputs (packmol.inp, STEEP.mdp, RUN.mdp, topol.top) and force field parameters: github.com/vilab-tartu/LOKT.02.048/tree/master/MD_Gr-BMPyrDCA_pbc. The force fields are taken from github: github.com/vladislavivanistsev/RTIL-FF. References are given within the files.

Continue reading “MD simulation of BMPyrDCA between graphene walls”

MD simulation of bulk BMPyrDCA ionic liquid

Simple demonstration of a molecular dynamics simulation of 25 BMPyrDCA ionic pairs in a box.

Inputs (packmol.inp, STEEP.mdp, RUN.mdp, topol.top) and force field parameters: github.com/vilab-tartu/LOKT.02.048/tree/master/MD_BMPyrDCA_box. The force fields are taken from github: github.com/vladislavivanistsev/RTIL-FF. References are given within the files.

Continue reading “MD simulation of bulk BMPyrDCA ionic liquid”

Installation of LibXC 4.0.0 trunk + GPAW1.3.0 + ASE

Assume that all the requirements are fulfilled:

  • Python 2.7-3.5
  • NumPy 1.6.1 or later (base N-dimensional array package)
  • ASE 3.15.0 or later (atomic simulation environment)
  • a C-compiler
  • LibXC 2.0.1 or later
  • BLAS and LAPACK libraries

Optional, but highly recommended:

  • SciPy 0.7 or later (library for scientific computing, requirered for some features)
  • an MPI library (required for parallel calculations)
  • FFTW (for increased performance)
  • BLACS and ScaLAPACK

LibXC compilation:

svn co http://www.tddft.org/svn/libxc/trunk/ libxc
cd libxc
autoreconf -i
./configure --enable-shared --prefix=/home/USER/xc
make -j N
make install

The LibXC compilation might not work, and GPAW would complain, so configure as follows:

./configure CFLAGS="-O2 -fPIC" --prefix=/home/USER/xc

After compiling LibXC add these lines to your .bashrc:

export C_INCLUDE_PATH=/home/USER/xc/include
export LIBRARY_PATH=/home/USER/xc/lib
export LD_LIBRARY_PATH=/home/USER/xc/lib

Let’s install ASE using pip, because it is easy.

pip install --upgrade --user ase

Get the GPAW source code and remove in libxc.c in c/xc/ line xc_mgga_x_tb09_set_params(self->functional[0], c);. Them compile GPAW with python setup.py install --user. You might want to add the .local/bin to the path.

Use either Python or Python3, and be consistent with that.

The official guideline also recommends adding these lines to your .bashrc:

export PYTHONPATH=/home/USER/gpaw:$PYTHONPATH
export PATH=/home/USER/tools:$PATH

Don’t forget to get setups. E.g. execute gpaw install-data DIR. After that run the tests.

Transpose paste

Despite python etc we still heavily rely on the tables. Sometimes it is need to transpose a vertical data-set to a horizontal representation. That is easy. In LibreOffice Calc use special paste (Shift+Ctrl+v) and tick transpose and numbers. One can do similar trick in Excel. That is it.

Omnipotent compose key

Two keyboard layouts are all you need. I have a Cyrillic and a Latin one. So I can type in Russian and many-many other languages including Estonian. For the later one, I use the omnipotent compose key. The compose key is a key to trigger the insertion of a precomposed character. Shortly, it allows me to type “äöüõ”. Moreover, it simplifies typing “š” in my family name (Ivaništšev). Believe me, this is more difficult with the Estonian layout. Also, I can type “€” sign.

On Linux (Gnome) you can activate it as: System > Preferences > Keyboard > Layouts > Layout Options > Compose key. Choose the preferred button that will turn on the composition mode. I prefer Caps Lock. On Windows one requires special software. For example, wincompose.

The life seems so beautiful when everything is set, and the UK layout is set to default.

Besides, one can enable compose for Greek alphabet by adding to ~/.XCompose file:

# GREEK CAPITAL LETTERS
<Multi_key> <G> <A> : "Α" U0391 # GREEK CAPITAL LETTER ALPHA
<Multi_key> <G> <B> : "Β" U0392 # GREEK CAPITAL LETTER BETA
<Multi_key> <G> <G> : "Γ" U0393 # GREEK CAPITAL LETTER GAMMA
<Multi_key> <G> <D> : "Δ" U0394 # GREEK CAPITAL LETTER DELTA
<Multi_key> <G> <E> : "Ε" U0395 # GREEK CAPITAL LETTER EPSILON
<Multi_key> <G> <Z> : "Ζ" U0396 # GREEK CAPITAL LETTER ZETA
<Multi_key> <G> <H> : "Η" U0397 # GREEK CAPITAL LETTER ETA
<Multi_key> <G> <I> : "Ι" U0399 # GREEK CAPITAL LETTER IOTA
<Multi_key> <G> <K> : "Κ" U039A # GREEK CAPITAL LETTER KAPPA
<Multi_key> <G> <L> : "Λ" U039B # GREEK CAPITAL LETTER LAMDA
<Multi_key> <G> <M> : "Μ" U039C # GREEK CAPITAL LETTER MU
<Multi_key> <G> <N> : "Ν" U039D # GREEK CAPITAL LETTER NU
<Multi_key> <G> <P> : "Π" U03A0 # GREEK CAPITAL LETTER PI
<Multi_key> <G> <R> : "Ρ" U03A1 # GREEK CAPITAL LETTER RHO
<Multi_key> <G> <S> : "Σ" U03A3 # GREEK CAPITAL LETTER SIGMA
<Multi_key> <G> <T> : "Τ" U03A4 # GREEK CAPITAL LETTER TAU
<Multi_key> <G> <U> : "Υ" U03A5 # GREEK CAPITAL LETTER UPSILON
<Multi_key> <G> <F> : "Φ" U03A6 # GREEK CAPITAL LETTER PHI
<Multi_key> <G> <X> : "Χ" U03A7 # GREEK CAPITAL LETTER CHI
<Multi_key> <G> <W> : "Ω" U03A9 # GREEK CAPITAL LETTER OMEGA
<Multi_key> <G> <O> : "Θ" U0398 # GREEK CAPITAL LETTER THETA
<Multi_key> <G> <Y> : "Ψ" U03A8 # GREEK CAPITAL LETTER PSI
<Multi_key> <G> <C> : "Ξ" U039E # GREEK CAPITAL LETTER XI

# greek small letters
<Multi_key> <g> <a> : "α" U03B1 # GREEK SMALL LETTER ALPHA
<Multi_key> <g> <b> : "β" U03B2 # GREEK SMALL LETTER BETA
<Multi_key> <g> <g> : "γ" U03B3 # GREEK SMALL LETTER GAMMA
<Multi_key> <g> <d> : "δ" U03B4 # GREEK SMALL LETTER DELTA
<Multi_key> <g> <e> : "ε" U03B5 # GREEK SMALL LETTER EPSILON
<Multi_key> <g> <z> : "ζ" U03B6 # GREEK SMALL LETTER ZETA
<Multi_key> <g> <h> : "η" U03B7 # GREEK SMALL LETTER ETA
<Multi_key> <g> <i> : "ι" U03B9 # GREEK SMALL LETTER IOTA
<Multi_key> <g> <k> : "κ" U03BA # GREEK SMALL LETTER KAPPA
<Multi_key> <g> <l> : "λ" U03BB # GREEK SMALL LETTER LAMDA
<Multi_key> <g> <m> : "μ" U03BC # GREEK SMALL LETTER MU
<Multi_key> <g> <n> : "ν" U03BD # GREEK SMALL LETTER NU
<Multi_key> <g> <p> : "π" U03C0 # GREEK SMALL LETTER PI
<Multi_key> <g> <r> : "ρ" U03C1 # GREEK SMALL LETTER RHO
<Multi_key> <g> <s> : "σ" U03C3 # GREEK SMALL LETTER SIGMA
<Multi_key> <g> <t> : "τ" U03C4 # GREEK SMALL LETTER TAU
<Multi_key> <g> <u> : "υ" U03C5 # GREEK SMALL LETTER UPSILON
<Multi_key> <g> <f> : "φ" U03C6 # GREEK SMALL LETTER PHI
<Multi_key> <g> <x> : "χ" U03C7 # GREEK SMALL LETTER CHI
<Multi_key> <g> <w> : "ω" U03C9 # GREEK SMALL LETTER OMEGA
<Multi_key> <g> <t> : "o" U03B8 # GREEK SMALL LETTER THETA
<Multi_key> <g> <y> : "ψ" U03C8 # GREEK SMALL LETTER PSI
<Multi_key> <g> <c> : "ξ" U03BE # GREEK SMALL LETTER XI

# special characters
<Multi_key> <minus> <minus> <minus>     : "−" U2212 # MINUS
<Multi_key> <minus> <minus> <greater>   : "→" U2191 # RIGHTWARDS ARROW
<Multi_key> <minus> <minus> <less>      : "←" U2193 # LEFTWARDS ARROW
<Multi_key> <minus> <greater> <greater> : "↑" U2191 # UPWARDS ARROW
<Multi_key> <minus> <less> <less>       : "↓" U2193 # DOWNWARDS ARROW
<Multi_key> <minus> <less> <greater>    : "⇌" U21cc # EQUILIBRIUM ARROW
<Multi_key> <minus> <greater> <less>    : "⇄" U21c4 # BACKFORWARD ARROW

P.S. a useful link https://tuttle.github.io/python-useful/compose-key-cheat-sheet.html
P.P.S. the missing signs can be inserted as Ctrl+Shift+U+XXXX+Enter, 2212 for −, 21cc for ⇌, 21c4 for ⇄, 2191 for ↑, 2193 for ↓.

Nasty PBC

In most cases the output gro files cut particles at the PBC borders. This does not look too nice to me, when visualized in VMD. Fortunately, it can be fairly easily fixed by:

gmx trjconv -f NVT.xtc -s NVT.tpr -n index.ndx -o NVT_mol.xtc -pbc mol

or, simpler, in the VMD terminal:

pbc unwrap

pdftk allmighty

For the Estonian chemistry competition I had to work a lot with pdf-s. pdftk utilite turned to be extremely useful.
To split pdf-s into peaces:
pdftk in.pdf cat N output cut.pdf
To rotate pdf-s:
pdftk in.pdf cat 1east 2east output rotated.pdf
To merge pdf-s:
pdftk in*.pdf cat output merged.pdf

Working abroad

Sometimes for some reason some VPN might not work as one expects. Then one can login to a node with a key.

First, check if you have a public key already. On your own computer in a terminal run:

cat ~/.ssh/id_rsa.pub

If this command worked, then skip the next step. If an error appeared, run this:

ssh-keygen

It will ask for a password. This is the password you give to the key. You can make one without password, in which case it will not ask for a password each time you try to use it.

You must have an access to the cluster somehow to run the following command:

ssh-copy-id <your-username>@cluster

This trick does not work for all machines. So, you might use the established connection to connect to other machines. In my case I wanted to work with some notebooks, so I did:

ssh -N -L localhost:PORT1:localhost:PORT2 <your-username>@cluster

and so it worked.

Installation of LibXC 3.0.0 trunk + GPAW1.1.0 + ASE

For a long time we wanted to try SCAN functional implemented in LibXC using GPAW. However, at first, fresh LibXC 3.0.0 did not work. Then we could not compile GPAW. Unit today. Here is a recipe that works for Fedora 25.

First, let’s prepare clean Fedora 25:

sudo dnf groupinstall "Development Tools"
sudo dnf groupinstall 'C Development Tools and Libraries'
sudo dnf install gcc-gfortran python-devel zlib-devel
sudo dnf install python-pip blas-devel lapack-devel atlas-devel openblas-devel rpm-build
sudo dnf install openmpi-devel scalapack-openmpi-devel blacs-openmpi-devel
sudo pip install --upgrade pip
pip install --upgrade --user numpy scipy matplotlib
sudo dnf install nano

Nano is installed in case you don’t like vi or emacs. Some packages might not be needed, but we installed them anyway.

LibXC compilation:

svn co http://www.tddft.org/svn/libxc/trunk/ libxc
cd libxc
autoreconf -i
./configure --enable-shared --prefix=/home/USER/xc
make -j N
make install

After compiling LibXC add these lines to your .bashrc:

export C_INCLUDE_PATH=/home/USER/xc/include
export LIBRARY_PATH=/home/USER/xc/lib
export LD_LIBRARY_PATH=/home/USER/xc/lib

Let’s install ASE using pip, because it is easy.

pip install --upgrade --user ase

Get the GPAW source code and remove in libxc.c in c/xc/ line “xc_mgga_x_tb09_set_params(self->functional[0], c);”. Them compile GPAW with python setup.py install --user.  YOu might want to add the .local/bin to the path.

Don’t forget to get setups. E.g. execute gpaw install-data DIR. After that try this example:


from ase import Atom, Atoms
from gpaw import GPAW
xc = 'MGGA_X_SCAN+MGGA_C_SCAN'
bulk = Atoms([Atom('Li')], pbc=True)
k = 4
g = 8
calc = GPAW(gpts=(g, g, g), kpts=(k, k, k),
xc=xc)#, txt=None)
bulk.set_calculator(calc)
bulk.get_potential_energy()