Pages

Setting path (How to do it)

Setting path is one of the most encountered problem for a beginner in Linux. Setting path is very simple.

To see what are present in the current path, type

echo $PATH
echo $LD_LIBRARY_PATH

To list these as a list

echo "${PATH//:/$'\n'}"
echo "${LD_LIBRARY_PATH//:/$'\n'}"

Now, come to our aim.

Go the the directory, where your directory is.
Type pwd to print the current working directory.

Now insert following line in .bashrc (or .profile) file

export PATH=$PATH:/path/to/dir

then
source ~/.bashrc





Schroedinger's equation



The famous theoretician Paul Dirac wrote in his paper published in 1929 as follows:

"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." (6 April 1929)

(to see a completely different perspective, read more is different by the theoretician P W Anderson "More is Different" article published in Science Magazine.


Schrodinger's equation is the equation of motion for the matter waves. Now, what is matter waves? Waves associated with the matter particles (eg. electron, proton, ect) are called matter waves. So, the equation of matter waves will describe the entire property of the matter waves. The solution to this wave equation will give you a function that is called "wave function". Wave function itself is a complex entity. It has been very difficult to define the meaning of the wave function. However, the square of the wave function (the product of the complex conjugate and the wave function which is termed as the probability density) gives the probability of finding the particle at a given location at a given time. Note that, the wave function does not have any interpretation, whereas its square has the physical interpretation. 

Why do we need Schrodinger's equation?

Can we describe the entire universe with Schrodinger's equation?
In principle, yes. The former director of the Perimeter Institue Niel Turok gave a fantastic public lecture on the topic "The Astonishing Simplicity of Everything". Watch the full talk here.



If we solve the Schrodinger's equation, we can get the wave function (solution to the Schrodinger's equation). In principle, this wave function contain all information about the system of interest. Note that to for the equation, we need the potential acting on the system/electron/particle.

The realistic problem that we can use Schrodinger's equation to solve is the hydrogen (or hydrogen-like atoms He+, Li2+, Be3+, B4+, C5+ ) atom where there is only one electron. We can solve the Schrodinger's equation for atoms (or molecules or solids) having more than one electron (not even He) accurately. This is technically named as analytical solution is not possible (or too difficult to solve). But, we need solution (we need wave function to calculate the properties of the atom/molecules/solids). Here comes the approximation techniques. We can use approximation techniques to solve Schrodinger's equation and get the properties that we are interested in.

The textbook problems we learn using Schrodinger's equation are:

  1. Free particle (potential=0)
  2. Potential step
  3. Finite potential well
  4. Infinite potential well
  5. Tunneling through the barrier
  6. Particle in a 1D box (linear molecules)
  7. Particle in a 3D box
  8. Simple harmonic motion
  9. Hydrogen atom model

A crucial development in this field is the formulation of Hohenberg-Kohn theorems. There are two theorems. These theorems the basis for the formulation of Kohn-Sham Density functional theory (see here in other post on this topic and in Wikipedia).

The Kohn-Sham density functional theory for which Walter Kohn (and John A Pople) has been awarded is based on those theorems. We saw that on solving the Schrodinger's equation, we get wave function. From this wave function, we can get the properties of the system (atom/molecule/solid). However, HK theorems proves that the density (which is a physical quantity and can be observed) is a fundamental variable from which we can get the energy (and hence all other properties).

Suppose we have N number of electrons in the system. The KS-DFT formalism reduces a complex N-electron problem in to N number of 1-electron Schrodinger-like equation. Note that we writ Schrodinger-like equation. Yes. Why? Because, we replace the actual potential in Schrodinger equation with an effective potential in KS-DFT. Wonderful. Right? But wait.

This simplification comes with a trouble (???). There is an important ingredient (exchange and correlation functional) which has been proven to exist but nobody (to this day) knows its mathematical form. The exchange and correlation functional is approximated and calculations are performed to predict the properties of materials (from gas to liquid to solids). Generally it works and give good results. However, many problems remain and these problems are attributed to the approximation of the important ingredient. To know more about the theory, see this post on "Density Functional Theory".


Hyperwebster: A dictionary made of infinite words and all of the texts, poems, everything written and ye to writeen (Paradoxes series #1)

If we create words from the alpaphet A....Z , like
A
AA
AAA.......A

B
BB
BBB........B
.
.
.
Z
ZZ
ZZZ........Z

Then, 

AB
AAB
...
AAA.....B

and then finally

.
.
.
......Z

If we create such words, this dictionary would contain everything written so far and future words, books, all of the text-worlds.

A mind blowing idea.

(need update)

Check R is installed or not

To check whether R is installed or not, type

$R

or type

$which R

or you can use

$type R


List of numerical libraries used in Quantum Chemistry / Computational Materials Science codes

The speed of a quantum chemical calculation often depends on how efficient the used numerical libraries are. Here is a list of numerical libraries that are widely used in various scientific codes.

C Program based
FFTW
GNU Scientific Libarary
Intel MKL (includes BLAS, LAPACK, ScaLAPACK, FFT, etc)

C++ Program based
Armadillo
LAPACK++
Intel MKL

Fortran Program based
LAPACK
LINPACK
Netlib

Python Program based
NumPy
SciPy
ScientificPython
SymPy



sed tutorial

The stream line editor 'sed' and the 'AWK' are the simple and highly useful languages for processing text files.

Here are some of the tips and tricks to use "sed". Later, I will post on AWK usage.

sed -n '/matchingWord/p' foo.txt

[Note that this is similar to: grep "matchingWord" foo.txt which seems to be very simple for this task. But for many instances, 'sed' may do more.]

sed -i -e 's/match/replacingText/g' hello.txt
Here, the line containing 'match' will be replaced with 'replacingText.

-e : just displays the outcome but don't change the file
-i : change the file (writes in the file)
s  : substitute
g  : is for global substitution. If need only first match, remove g.

Last one is the file name.

You can use this to a bunch of files. 

sed -i -e 's/match/replacingText/g' file*.txt


To delete lines with match pattern

sed -i '/pattern/d' FileName

To replace ":" with " " 

The sed expression s/:/ /g replaces every ":" with a "space".
That is sed substitutes an empty space for every ":" character globally in the file


Sometimes, there may be a need to remove (which is better than replacing a line which contain special characters)

To remove use following onliner

sed '/pattern to match/d' ./filename
To modify the file itself

sed -i '/pattern to match/d' ./filename


Replace the second line (or nth line, first line, third line, etc) using sed:

sed -i '2s/.*/0 5/' c*.in








For other posts like this, see
AWK


For more see following links:
https://stackoverflow.com/a/5410784/6628192




Using "tmux" for managing multiple screens

TMUX (tmux) is a fantastic tool for doing multitasks in terminal. For a programmer and researchers whose work involves coding, tmux is an essential tool.

In Ubuntu Linux, it can be installed by apt command.

To install from source code, download the package from this GitHub link.

Here are the important commands to use tmux.

tmux
tmux attach
ctrl + B   (the default prefix for tmux)
prefix + c   "Creates a window"
prefix + ,   To name/rename the panel
prefix + $  To name/rename the session
prefix + % vertical split
prefix + "   horizontal split
prefix + d   detach
prefix + d   ? to list all shortcuts
prefix + --> arrow : moves cursor to the right pane
prefix + <-- arrow : moves cursor to the left pane

To resize the panel size, prefix + Right /Lef/Down/Up arrow (i.e. --> or <--)
(Note that prefix followed by right/left arrow will move the cursor to the right/left pane)

It is also possible to restart entire tmux session after the restart. For this you need to use
tmux resurrect command. More on this later.

You can also see:
https://github.com/ssthurai/tmux-resurrect
https://github.com/ssthurai/tmux-continuum
For more commands, see this GitHub page on tmux.




Linux Onliners


To copy multiple files to multiple-different names
for f in *.txt ; do cp -p "$f" " ${f/text/texttobereplaced"; done

To copy a single file to multiple files 
for file in foo*.txt; do cp singlefile "$file" ; done
Note: Here, you have to create the files using touch.


To check the total size of a list of files in a directory
du -ch *.out | tail -n 1


To find all the instances of files with specific extension and delete all of them (recursively).
Before deleting, check all the files that will be deleted
find . -name "*.bak" -type f
Now, to if you are sure that these are the files to delete, run following command.
find . -name "*.bak" -type f -delete



Reference
Ask Ubuntu


How to disable the sound when using terminal in Windows 10?

How to disable the annoying notification sound when we do something wrong in the terminal (in Windows)?

Here is the simple way.

On the task bar, right click on the sound icon.

Select Open Volume Mixer. Here, click on the sound icon to disable the sound (like here)





How to hide (white out) some portions in a pdf file

How to hide (white out) some portions in a pdf file before printing?

We may have come across following situation.

You may want to print a research article or any file (which is in .pdf format).

But it may have a lot of pictures that may completely empty your cartridge. You may want to print other portions without this image. Also you may want hide certain portion of the text when you take print out.

Of course. You can do these with the Acrobat Reader (from Adobe)
But, How to do these in the free version of the Adobe Reader?

Here is a simple way.


  1. Open the file in Adobe Reader
  2. Go to Edit --> Paste
  3. A rectangular box will appear (with some text which is typed by you recently)
  4. Adjust the corners/sides of the box so that it hides entire Figure/portion that you want to hide
  5. You may delete the text or you may type some text inside this box
  6. You can also change the color of the outline by right clicking on the box and changing the property.


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...