Bader analysis with python

Bader analysis is a fast and simple way of getting atomic charges. It is especially useful for periodic calculations. The analysis can be done on the fly using pybader tool from https://pypi.org/project/pybader. I recommend using it within conda environments.

The installation is straightforward:

pip install pybader

The usage is less obvious. Here is how relevant atomic charges can be obtained with some ase help:

from ase import *
from pybader.io import gpaw
from pybader.interface import Bader

import numpy as np
bader = Bader(*gpaw.read_obj(atoms.calc)) # atoms is an ase object
bader(threads=4) # specify the number of CPU
f = open('{0}_bader.out'.format(name), 'w') # name is a variable
Z_bader = np.array(bader.atoms_charge) # get number of electrons per atom
Z_elem = np.array(atoms.get_atomic_numbers()) # get atomic numbers
S_elem = atoms.get_chemical_symbols() # get chemical symbols
z_elem = atoms.get_positions() # get positions of the atoms
for i in range(len(Z_bader)): # for each atom, print z-position, symbol, and charge
  f.write(str(round(z_elem[i][2],1))+'\t'+str(S_elem[i])+'\t'+str(round(Z_elem[i] - Z_bader[i],3))+'\n')
f.close()

“Resurrections”

I have not been writing to the blog for approximately 2.5 years. That period overlaps with the birth of my second child, pandemic, and absence of research funding – all the reasons for prioritizing family and grant writing above the blog writing. At the moment, there are no barriers to blogging, as I have the MSCA fellowship, some vaccine protection, and my adapted to a nursery.

I am now returning to that blog for several reasons. First, it is the right place for summarising research activity. Foremost for myself and close colleagues. Second, I feel the need to communicate science-related thoughts and emotions, especially in changing the working environment (from Tartu Univ. to Copenhagen Univ.). So, I am back!

ILMAT5 presentation

LINK to the PRESENTATION

Abstract

In this work [0], we have applied the DFT-based delta Kohn–Sham (ΔKS) method to ion pairs in a vacuum to obtain X-ray pho­toelectron spectra of corresponding ionic liquids (IL). On the example of forty ion pairs, we demonstrate how the core level binding energy (BE) values can be calcu­lated and used to plot theo­retical spectra at a low computational cost. Furthermore, we compare the ΔKS results, 1s Kohn–Sham orbital energies, and atomic charges against the experi­mental X-ray photoelec­tron data. Recently, in connection to the electro­chemical application in the super­capacitors, we have measured spectra for EMImBF4 and EMImB(CN)4 ionic liquids at the carbon–IL interface [1–3]. Other experimental spectra were obtained from the literature [4,5]. Both the ΔKS BE values and the 1s Kohn–Sham orbital energies show a correlation, yet with a different order of the BEs assigned to spe­cific atoms. We find that neither DDEC6 nor Bader charges cor­relate with the experi­mental data. Thus, the DFT calculations of 1s Kohn–Sham orbital energies provide the fastest way of pre­dicting the XPS spectra. However, more detailed experimental studies are required to resolve the right order of the BE values and its rela­tion to the atomistic structure of the ILs. The ΔKS calculations provide the most precise estimations of the BEs. Herewith, they also demand more resources and cause computa­tional difficulties discussed in the presenta­tion. Besides the prediction power, a robust computational method can help in intepre­tating experimental data when the appropriate reference values are either not available nor directly applicable. Thus, the ΔKS method can find its application in various fields of physics and chemistry where the XPS is used for re­solving electronic and geometric structures of pure ILs, their mixtures, and at interfaces.

In this work, we have applied the DFT-based delta Kohn–Sham (ΔKS) method to ion pairs in a vacuum to obtain X-ray pho­toelectron spectra of corresponding ionic liquids (IL). On the example of forty ion pairs, we demonstrate how the core level binding energy (BE) values can be calcu­lated and used to plot theo­retical spectra at a low computational cost. Furthermore, we compare the ΔKS results, 1s Kohn–Sham orbital energies, and atomic charges against the experi­mental X-ray photoelec­tron data. Recently, in connection to the electro­chemical application in the super­capacitors, we have measured spectra for EMImBF4 and EMImB(CN)4 ionic liquids at the carbon–IL interface [1–3]. Other experimental spectra were obtained from the literature [4,5]. Both the ΔKS BE values and the 1s Kohn–Sham orbital energies show a correlation, yet with a different order of the BEs assigned to spe­cific atoms. We find that neither DDEC6 nor Bader charges cor­relate with the experi­mental data. Thus, the DFT calculations of 1s Kohn–Sham orbital energies provide the fastest way of pre­dicting the XPS spectra. However, more detailed experimental studies are required to resolve the right order of the BE values and its rela­tion to the atomistic structure of the ILs. The ΔKS calculations provide the most precise estimations of the BEs. Herewith, they also demand more resources and cause computa­tional difficulties discussed in the presenta­tion. Besides the prediction power, a robust computational method can help in intepre­tating experimental data when the appropriate reference values are either not available nor directly applicable. Thus, the ΔKS method can find its application in various fields of physics and chemistry where the XPS is used for re­solving electronic and geometric structures of pure ILs, their mixtures, and at interfaces.

[0] M. Lembinen, E. Nõmmiste, H. Ers, B. Docampo‐Álvarez, J. Kruusma, E. Lust, V.B. Ivaništšev, Calculation of core‐level electron spectra of ionic liquids, Int. J. Quantum Chem. 120 (2020). https://doi.org/10.1002/qua.26247.

[1] J. Kruusma, A. Tõnisoo, R. Pärna, E. Nõmmiste, I. Tallo, T. Romann, E. Lust, Electrochimica Acta 206 (2016) 419–426.

[2] J. Kruusma, A. Tõnisoo, R. Pärna, E. Nõmmiste, I. Kuusik, M. Vahtrus, I. Tallo, T. Romann, E. Lust, J. Electrochem. Soc. 164 (2017) A3393–A3402.

[3] A. Tõnisoo, J. Kruusma, R. Pärna, A. Kikas, M. Hirsimäki, E. Nõmmiste, E. Lust, J. Electrochem. Soc. 160 (2013) A1084–A1093.

[4] A. Foelske-Schmitz, D. Weingarth, R. Kötz, Surf. Sci. 605 (2011) 1979–1985.

[5] I.J. Villar-Garcia, E.F. Smith, A.W. Taylor, F. Qiu, K.R.J. Lovelock, R.G. Jones, P. Licence, Phys. Chem. Chem. Phys. 13 (2011) 2797–2808.

Oriental fonts in Ubuntu

!/bin/bash

for i in fonts-kacst fonts-kacst-one fonts-khmeros-core fonts-lklug-sinhala fonts-guru fonts-nanum fonts-noto-cjk fonts-takao-pgothic fonts-tibetan-machine fonts-guru-extra fonts-lao fonts-sil-padauk fonts-sil-abyssinica fonts-tlwg-* fonts-lohit-* fonts-beng fonts-beng-extra fonts-gargi fonts-gubbi fonts-gujr fonts-gujr-extra fonts-kalapi fonts-lohit-gujr fonts-samyak-* fonts-noto-unhinted fonts-noto-hinted fonts-navilu fonts-nakula fonts-orya-extra fonts-pagul fonts-sahadeva fonts-sarai fonts-smc fonts-telu-extra fonts-wqy-microhei; do
sudo apt purge -y $i
echo
done

echo “==== Fixing font cache”
sudo fc-cache -f -v && sudo dpkg-reconfigure fontconfig

echo “==== Packages remained (each containing multiple fonts)”
dpkg -l fonts*|grep ^ii|awk ‘{print $2}’

echo
read -p “Press any key to close.”

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”

Mascot again

A long time ago a student told me that I am a mascot of the chemistry olympiad. Since then I have graduated, made a post-doc, and after that returned to the olympiad business. It is very touching that the Estonian team named its mascot “Vlad”. Apparently, I am a mascot again.

Mascot Vlad and Hanna-Riia.