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.

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()

pdf optimisation

While preparing an online report for the PUT1107 project, I encountered a limit for uploaded pdf-files as low as 3 Mb. Thus, I was forced to reduce the pdf-file size to this limit as follows:

1. I merged a set of articles into one files: pdftk 1.pdf 2.pdf 3.pdf output set.pdf

2. Then I reduced the size of the resulting file: gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -dNOPAUSE -dQUIET -dBATCH -sOutputFile=out.pdf set.pdf

The size was reduced by more than 50% with almost the same visual quality.

Taming the equations in Libreoffice

Working on large documents with many equations in a word processor is a torture. In my case, booklets of chemistry problems require a lot of work. For certain reason I prefer to use LibreOffice. When is needed to reformat all equations in a document the following macro is very useful:

Sub FormulaFontSizeChanger

o = ThisComponent.getEmbeddedObjects()

fontSize = 12

fontFamily = “Arial”

For i = 0 to o.count-1

if (not IsNull(o(i))) and (not IsNull(o(i).Model)) then

o(i).Model.TopMargin = 0

o(i).Model.BottomMargin = 0

o(i).Model.LeftMargin = 0

o(i).Model.RightMargin = 0

o(i).Model.BaseFontHeight = fontSize

o(i).Model.FontNameVariables = fontFamily

o(i).Model.FontVariablesIsItalic = 1

o(i).Model.FontNameFunctions = fontFamily

o(i).Model.FontNameNumbers = fontFamily

o(i).Model.FontNameText = fontFamily

o(i).Component.BaseFontHeight = fontSize

o(i).ExtendedControlOverEmbeddedObject.update()

endif

Next i

End Sub

 

P.S. The script might be useful also when writing a thesis with a lot of chemistry inside and many Zotero references. LaTeX might not be so comfortable, and in Word one is still limited with few math fonts.

Installing Gromacs and Lammps

FFTW:

./configure –enable-float –enable-shared –enable-sse2
make -j N
make install

===

Gromacs:

$ tar xvfz gromacs-x.y.z.tar.gz
$ ls
gromacs-x.y.z
$ mkdir build
$ cd build
$ cmake ../gromacs-x.y.z -DCMAKE_INSTALL_PREFIX=/home/yourUser/opt/gromacs.x.y.z -DGMX_CPU_ACCELERATION=SSE2 -DGMX_SIMD=SSE2
$ make -j N
$ make install

===

LAMMPS:

$ git clone git://git.lammps.org/lammps-ro.git LAMMPS
$ make yes-molecule
$ make mpi

===

To the .bashrc add:

#Gromacs

source /home/yourUser/opt/gromacs.x.y.z/bin/GMXRC
#or source /your/installation/prefix/here/bin/GMXRC

#LAMMPS
export LD_LIBRARY_PATH=~/LAMMPS/src:$LD_LIBRARY_PATH
export PATH=~/LAMMPS/src:$PATH