Pages

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 .     




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