Pages

How to 32 bit OS or 64 bit machine

To get the machine type:

uname -m
x86_64 (64 bit)
i686      (32 bit)

You can also use the cammand 'arch'.

For more details see the manual. The manual for uname provides following information.

       -a, --all
              print all information, in the following order, except omit -p and -i if unknown:

       -s, --kernel-name
              print the kernel name

       -n, --nodename
              print the network node hostname

       -r, --kernel-release
              print the kernel release

       -v, --kernel-version
              print the kernel version

       -m, --machine
              print the machine hardware name

       -p, --processor
              print the processor type (non-portable)

       -i, --hardware-platform
              print the hardware platform (non-portable)

       -o, --operating-system
              print the operating system

       --help display this help and exit

       --version
              output version information and exit





Density Functional Theory

In December 1926, Schroedinger published his seminal paper titled "An Undulatory Theory of the Mechanics of Atoms and Molecules" in Physical Review Letters. A few years later, Paul Dirac wrote in his paper (published in Proceedings of the Royal Society) as follow:

"The underlying physical laws necessary for the mathematical theory of a large part of physics and the whole of chemistry are thus completely known, and the difficulty is only that the exact application of these laws leads to equations much too complicated to be soluble. It therefore becomes desirable that approximate practical methods of applying quantum mechanics should be developed, which can lead to an explanation of the main features of complex atomic systems without too much computation." P. A. M. Dirac (1929)

To get an idea, consider a small molecule $C_{6}H_{6}$)  which contains 6 carbon atoms (6 $\times$ 6 electrons) and 6 hydrogen atoms (6 $\times$ 1 electrons), totaling 36+6=42 electrons.

You may know the Schrodinger's equation for a single particle in a potential $V(x,y,z)$ can be written as

$-\frac{{\hbar}^2}{2m}\dot {{\bigtriangledown}^2}{\psi(x,y,z)}+V(x,y,z)\psi(x,y,z)=E\psi(x,y,z)$

Here, the equation is written in its time-independent form. For time-dependent form see here in the page. Since Kohn-Sham equations were originally developed for ground state systems, now I move forward with time-independent Schrodinger's equation. Later, I will discuss more advanced topics.

(Later P W Anderson wrote a paper opposing Dirac's view. See that paper titled "More is different" published in Science Magazine. 

OK. Let us take the words of Dirac. Approximate practical methods of applying quantum mechanics have to be developed. 

What are the approaches? Firs of all what we should know? Total energy. What is total energy? The total energy (kinetic energy + potential energy+ any other energy) associated with the total system that include nucleus and electrons. 

As a simple approach, consider that there is only kinetic energy and potential energy contribution and set all other contribution to zero. Then, 

Total energy = kinetic energy + potential energy.

Let us assume $C_{6}H_{6}$) molecule. For this molecule, as we saw above, there are 42 electrons. So, considering 3 co-ordinates for each electrons, $42 \times 3$ becomes 126 coordinates (see this description from Prof. Hardy Gross's lecture to understand this).

(for electron) simply kinetic energy = $\frac{p^{2}}{2m}$, where $p$ is the moment of the electron and $m$ is the mass of the electron. What is the potential energy? We can calculate the potential energy of a single electron on positive or negative charges. But, our system is a interacting system. right? Lets come to that interacting system later. Now let us focus on the non-interacting system. Consider that the electrons are non-interacting with each other and they interact only with the nucleus (positive ions). Then, we need to account only the nucleus-electron attraction and the kinetic energy of the electron. This is exactly what Thomas-Fermi model does in electronic structure calculation (look for post on this). This omit the electron-electron interaction completely and considers that the electrons are like gases.

Now, what we need is to calculate the Hamiltonian for a given system (let us construct for C6H6). How to construct the kinetic energy functional (in terms of density) and electron-neucleus potential functional? Let us see further in this.

Kinetic enregy = $\frac{p^{2}}{2m}$.

Now, this is in momentum space. We need to convert this kinetic energy in to a functional of density. Let us do that.

The exchange correlation functional is an important correction to the the total energy which gives about 3% of total energy. Eventhough it is small percentage, it is crucial in dermining (....)

(this page will be updated regularly).


Checking the status of the submitted job in HPC

The submitted jobs in PBS queue system can be checked whether they are in queue still, or running, or completed, etc. The command to use (in PBS software) is qstate.

Job id            Name             User              Time Use S Queue
----------------  ---------------- ----------------  -------- - -----
306.clr     jobname              user              10:36:59 R worke

Commands to use are:
qstat    (lists all the jobs with some details)
qstat -n  (list all the jobs with total number of CPUs running the jobs
qstat -u user (list all the jobs submitted by the user)


To see a list of things to know (for a newbie) to use high performance cluster, click here

Git and GitHub Tutorial

What is a version control and usage?

When we write a project with a number of files, it is not easy to maintain. Some times, we might have edited the source file a lot but later we might realize that we want the earlier version of the source code. Git does that.

Git is a version control system which can be used to manage changes made to the files and directories in any project. There are a number of version control systems out there. But, git is famous may be because of its developer (who?).

Anything saved to git is ever lost and at any time you can go back to earlier versions and also can clearly see which version of the program generated which version of the output.

It is also useful when you work with collaborators. Git will notify the changes as well as confilicts with others. So, overwriting problem will not occur.

"Git can synchronize work done by different people on different machines, so it scales as your team does."

Version control uses: It is not just for developing code. It can be used for writing books, books, journal papers, parameter sets (anything that change over time or need to be shared)

The first step:

Create a directory (My-Repo) in your home directory or anywhere in your linux system.

Now type, git status in that directory.

Now you will get.
fatal: Not a git repository (or any of the parent directories): .git
This shows that, the current directory is not a git repository. To start that directory as a repository, you have to use

git init

Now,

Initialized empty Git repository in /home/user/path/to/directory/My_Repo/.git/

will be displayed. This means, the current directory has been initalized as Git repository.

git status

On branch master

Initial commit


nothing to commit (create/copy files and use "git add" to track)


This means that we are in the master branch of the repository.

Now, create an empty file inside this directory (i.e., repository). You can use touch hello.txt

Now, again type

git status

Now, you will get,

On branch master

Initial commit

Untracked files:
  (use "git add <file>..." to include in what will be committed)

        hello.txt

nothing added to commit but untracked files present (use "git add" to track)

This means that (git says) a new file hello.txt is created in the repository (now the current directory is a repository) and the file is not tracked by the git.

To make the git to track the created file hello.txt, you have to use the command

The git has following status of the files.

untracked: Git is not tracking this file yet, usually indicating that the file is new.
tracked: The file is part of the Git snapshot and Git is tracking changes to it.
unstaged: A tracked file has changes but it has not been staged for commit.
staged: The file is ready to be committed.
deleted: The file has been deleted and should be removed from Git.

Now, the steps to follow is
git add hello.txt

This upgrade the status of the hello.txt to staged.

Now, if you type

git status in the repository,

On branch master

Initial commit

Changes to be committed:
  (use "git rm --cached <file>..." to unstage)

        new file:   hello.txt

will be displayed. This means that the file hello.txt is tracked.

We can more files and just use git add (fileName). This will add all the files to staged mode. Or you can use
git add .
This command will all the files in the current directory to track mode.

So far, your file is just staged. To make it track,

git commit -m "This is a new repository"

The message inside the "" is for reference purpose.

Now, you will get following message.

git commit -m "This is to learn git and github"
[master (root-commit) 8de3ed7] This is to learn git and github
 2 files changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 hello.txt
 create mode 100644 hello2.txt

Now, at this stage, don't worry about connecting to GitHub and configuring your email ID to github etc. We will see them later.


Now, we will see little bit about the git config.

To see the status of your configure,

cat .git/config

This will display the configure name and emailID.

You can also try
git config --global --list

This will display the name and email associated with the repository.

If not name and emailID is not set so far, follow this.

git config --global user.name "yourName"
git config --global user.email "yourid@gmail.com"

Now, if you hit
git config --global --list

you will get

YouName
user.email=yourid@gmail.com
user.name=yourName

The basic workflow is as follow:

git status
git add
git commit
git push

If your configuration correct, your changes would be pushed to the remote repository.
Till git commit, you can work locally and saving the track of each modification by using add and commit. But, if you want to export the changes to the remote repository, you have to use git push.

In my case, first time I am trying to push to the remote repository.

git push

warning: push.default is unset; its implicit value has changed in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the traditional behavior, use:

  git config --global push.default matching

To squelch this message and adopt the new behavior now, use:

  git config --global push.default simple

When push.default is set to 'matching', git will push local branches
to the remote branches that already exist with the same name.

Since Git 2.0, Git defaults to the more conservative 'simple'
behavior, which only pushes the current branch to the corresponding
remote branch that 'git pull' uses to update the current branch.

See 'git help config' and search for 'push.default' for further information.
(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode
'current' instead of 'simple' if you sometimes use older versions of Git)

Now, I am prompted to enter the username and password:

Username for 'https://github.com': userName
Password for 'https://userName@github.com':
To https://github.com/userName/github-workflow.git
 ! [rejected]        master -> master (fetch first)
error: failed to push some refs to 'https://github.com/ssthurai/github-workflow.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

This shows that the push is not success. Let us see more about this push later. Keep in touch.

When we commit a change in a file, we are prompted for inserting comment. For me, the default browser "nano" came. However, I prefer 'vim'. To change to vim as a default editor

git config --global core.editor "vim"









Best sites for Physics (and other things) Discussion


Stack Exchange (for basic questions)

Stack Exchange Overflow sites (for advanced questions)

Physics Forums

Socratic 

Reddit

Commonly used Unix/Linux commands

Here are the mostly used command in command line. To see more details, click on each commad.
ls
grep
alias
reverse search
tab completion
disk space (du, df and quoto)
exctract files
compiling source code (configure, make and make install)
downloading link (wget and git clone)
editors (vim, emacs, atom, visual code, etc)
file conversion



ctrl C interrupts whatever is currently running.  (to come out if anything went wrong)
ctrl Z to put a foreground process into the background.
ctrl S suspends current terminal
ctrl Q resumes current terminal




Following passage is taken from Stanford's Micro and Nano Mechanics Group.
Here is a list of commands from wiki for UNIX/LINUX.

Efficient use of grep command

The command grep can be used in following ways.

grep "HELLO"  *    (to print the match lines)

grep -v "HELLO" * (to print the non-match lines)

grep -i "hello"  * (case insensitive grep)

grep -A2  (2 lines after the matching line)

grep -B2    (2 lines before the matching line)

grep -C2    (5 lines before and after the matching line

grep -l "converged" *     (to display only the file names with the match

grep -L "converged" *   ( to display the files without match)

grep -c "converged" *   (to count the number of occurrences of the match in each file)

grep -n "converged" fileName.txt (to get the line number)

grep -n "matchLine") fileName.txt | cut -d : -f1  ( to get the line number of the matching line)

grep -nr  (for search inside a directory)

grep -n "matchLine" fileName.txt | awk -F: '{print $1}'   (to get the line number)

grep -in "matchlLine" fileName.txt   (to get all the matching line with line number (no case sensitive)

grep -e " B " -e " C " fileName.txt (to get lines that contain B and C. useful to extract the coordinates)

More on this blog (related)
List of Linux commands and their common and efficient usage (how to use series)
List of high performance computing (HPC) skills you need to know (for a beginner)

Install important numerical libraries in Ubuntu

To install fftw, blas, lapack etc.


sudo apt-get install fftw3 fftw3-dev pkg-config
sudo apt-get install libblas-dev liblapack-dev
sudo apt-get install libblas-dev checkinstall
sudo apt-get install libblas-doc checkinstall
sudo apt-get install liblapacke-dev checkinstall
sudo apt-get install liblapack-doc checkinstall

AWK tutorial

Sed and AWK are powerful yet simple programming languages.

The simple format to use awk is

awk '{print}' fileName.txt

awk '{print $0 }' fileName.txt will print all the lines in the file
awk '{print $1 }' fineName.txt will display the first column
awk '{print $1, $2}' fineName.txt will display the first and the second column



To Understand NR and NF options, See this marks.txt

cat marks.txt gives

Kannan 12 34 56 78 43
Kamalan 76 23 56 12 90
Mukilan 41 76 34 12 34
Selvam 90 89 23 12 56
Pandi 56 78 87 23 12

In this, if you print

awk '{NR, "=====" NF}' marks.txt will display

1 ===== 43
2 ===== 90
3 ===== 34
4 ===== 56
5 ===== 12

From this we understand that the NF gives the last coloumn and the NR gives the line numbers.

Similarly,
awk '{NR, $1, "=====" NF}' marks.txt will display
1 Kannan ===== 43
2 Kamalan ===== 90
3 Mukilan ===== 34
4 Selvam ===== 56
5 Pandi ===== 12


Problems in dimers

There are a number of interesting and challenging problems that are unsolved yet. At the first instance, these problems may seem simple, but, these problems are floating around for long time. The problem is to describe simple molecules made of the light-weight elements, eg. dimers of H, He, Li, Be, B, C, N, O, F, Ne (not just these: transition-metal dimers also)

Here, I will brief the challenges on each dimer.
  • H dimer (H$_{2}$ molecule) : the description of the H$_{2}$ bond breaking (or even more astonishingly H$^{+}$ ion's at various bond lengths) is a difficulty problem to describe by theoretical methods. 
  • He dimer This has many interesting features. The van der Waals force exists between helium atoms which is the reason for the existence of liquid helium. This is because, at a certain range of distances between atoms the attraction exceeds the repulsion. To understand vdW forces fundamentally, this molecule should be studied. This molecule has other interesting features: 1) He2 is the largest known molecule of two atoms when in its ground state, due to its extremely long bond length. 2) The He2 molecule has a large separation distance between the atoms of about 5200 pm (= 52 Ã¥ngström). 3) This is the largest for a diatomic molecule without ro-vibronic excitation. 4) The binding energy is only about 1.3 mK, 10−7eV or 1.1×10−5 kcal/mol, or 150 nanoelectron Volts. 5) The bond is 5000 times weaker than the covalent bond in the hydrogen molecule (more on this see this on Wikipedia
  • Li dimer This is the lightest metal dimer. (will be updated)
  • Be dimer (Be$_{2}$ and Be$_{2+} dimer: It has been difficult to explain the bonding of Be dimer (see this recent Science paper on this topic and this paper using Quantum Monte-Carlo method). Molecular orbital theory, valance band theory, SCF (HF theory), configuration interaction, etc are not able to capture the properties of this elusive molecule. Multi-reference methods also have lead to controversy by predicting different strengths between Be atoms with different bond lengths.
  • C dimer (C$_{2}$ molecule) is a difficult problem because of the associated strong static correlation and the difficulty in finding the ground state electron density (see this paper by Ayers and discussion in this paper)
  • N dimer (Nitrogen molecule) : The splitting of N$_{2}$ is a difficult problem because of increasing strong static correlation effects as bond is stretched. See this view point by Prof. Burke: "[....its [nitrogen molecule's] triple bond exhibits a high level of static correlation (loosely, electron correlations that arise from the the symmetry of the molecule), which increases as the molecule is stretched. If a computational tool can handle N$_{2}$ well, it can tackle most main-group chemistry correctly."
  • O dimer (oxygen molecule): The room temperature O$_{2}$ is largely triplet in ground state and a small portion of the O$_{2}$ are in singlet state. See this JACS article Dioxygen: What Makes This Triplet Diradical Kinetically Persistent?. Also, the dissociation of O$_{2}$ is well studied?
  • Transition metal dimers?


Morse potential has been important in understanding molecular spectroscopy of dimers (as well as poly atomic molecules). Here is a Wikipedia text.

"An important extension of the Morse potential that made the Morse form very useful for modern spectroscopy is the MLR (Morse/Long-range) potential.[4] The MLR potential is used as a standard for representing spectroscopic and/or virial data of diatomic molecules by a potential energy curve. It has been used on N2,[5] Ca2,[6] KLi,[7] MgH,[8][9][10] several electronic states of Li2,[4][11][12][13][9][12] Cs2,[14][15] Sr2,[16] ArXe,[9][17] LiCa,[18] LiNa,[19] Br2,[20] Mg2,[21] HF,[22][23] HCl,[22][23] HBr,[22][23] HI,[22][23] MgD,[8] Be2,[24] BeH,[25] and NaH.[26] More sophisticated versions are used for polyatomic molecules.
"

While these problems are of interest on the fundamental level, the dimers of transition metal atoms provide applications such as memory storage. Monomer, dimer, trimer on different 2D materials (graphene, phosphorene, etc) are widely studied for their MAE, etc.

(Is there any other dimer which gives challenge to theory or experiment? comment here.

If this post is useful, please let me know by commenting below the article. Also share this post to increase visibility. Thanks for your support.

Relativity importance

Removing the files containing a match word/string

If you have a number of files and want to remove only those files with a matching line

Option 1: Using echo to check

for file in $(grep -l error *); do echo rm -i $file; done

Option 2: Prompt each time

for file in $(grep -l error *); do echo rm -i $file; done


Note: here | grep -l | gives the files with matching string.


Copy files from cluster to local and vice versa using SCP

To know the details about 'scp', type man scp in the terminal.

To copy files from the cluster to local system

scp -P 4200 userName@cluster.domain:/home/path/to/the/file/ .     

(notice that the 'dot' at the end is for copying files to the current folder)

Similarly, to copy the files from current folder to the cluster

scp ./fileName -P 4200 userName@cluster.domain:/home/path/to/directory

To copy a directory and its files and subdirectories to to the cluster

scp -r ./Dir1 -P 4200 userName@cluster.domain:/home/path/to/directory

Copy a directory recursively from cluster to your local system

scp -P -r 4200 userName@cluster.domain:/home/Dir1 .     




Courses Learning (Coursera, Edx, DataCamp, Khan Academy etc)

Python

Energy Conversion table

Conversion Table

Energy Conversion Notes
1 Ha 627.509 kcal mol-1 To learn what is one Ha click here
1 Hartree 27.2116 Usually 27.21 is taken for calculations

Here is a number sites that I use for unit conversion.

Energy Conversion (go here http://web.utk.edu/~rcompton/constants)
Another Site for energy conversion is here.




1 Hartree 627.509 kcal mol-1
1 Hartree 27.2116 eV
1 kcal mol-1 4.184 J mol-1
1 Electron volt 23.06035 kcal mol-1

List of websites with codes (for researchers)

John Burkardt's page from FSU 
      This page contains following links/information.

This site present solutions to the same task in so many different possible languages.


Numerical Recipes in C, Second Edition (1992)

This is an obsolete version of the recent edition book on the same topic. But, still useful. This contains C recipes to solve numerical problems.

Recent, much expanded, and improved Third Edition (2007) in C++ is available.


Prof. Gregory Poyla's web page.






A list of database sites for a computational science, quantum chemistry, computational materials science, theoretical condensed matter researchers

Presently, there are a number of sites where you can get the structure information of new materials. Following is a list of such websites.

  1. Materials Project (LBNL) (check for its API)
  2. Nomad
  3. CSIRO Graphene Database (Graphene Nanoflakes)

A related post: Notes on machine learning

Notes on Machine Learning (from RandomMatrix.blogspot.com)

Terminating single and multiple jobs in cluster

Before this post, see the qstat post related to this.

If your job is running, 'R' will be displayed in status coloumn. For some reason, if you want to stop all the jobs from 456...460 (! or a large number of jobs submitted)

You can use
qdel 456, 457, 458, 459, 460

or simply, you can use
qdel {456..460}

You can terminate any job running or in queue using qdel.


To delete a group of files with similar tag, use

qstat | grep optscf | cut -d. -f1 | xargs qdel

This will kill all the jobs with the job name optscf


Now another question is "How to terminate or kill a job which is in que without job ID?

This some times happens and you should be aware of how to do this.




Note: Here is a list of important things you should know before using HPC cluster. Hope it helps.


You may be interested in these posts

Error in image file conversion: convert-im6.q16: not authorized `test.eps' @ error/constitute.c/WriteImage/1037.

This error is because of the vulnerability. This allows remote execution of code using image formats. So, some Linux distributions by defaul...