Pages

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.


What do different color of the files mean in Linux

When you list using 'ls' command in Linux terminal, you may see different color for different files. Each color represent a different format as follow. You can change the color by editing ~/.bashrc file which will be discussed in detail.
  • Blue: Directory
  • Green: Executable or recognized data file
  • Sky Blue: Symbolic link file
  • Yellow with black background: Device
  • Pink: Graphic image file
  • Red: Archive file
  • Red with black background: Broken link

For more details, see this post in Stack Exchange site Unix & Linux.

Intel MKL Libraries (Some Notes)



Most of the clusters architectures are Intel based. The Intel compiler (Ifort) is present in such machines. The Intel MKL library, which stands for Math Kernal Library is a numeical library which is highly useful for Scientists and Engineers.


How to check the Intel architecture (32 bit or 64 bit processor))?

move to $MKL_ROOT/lib/
$MKL_ROOT is usually /opt/lib/intel/MKL/

If you see ia32_lin directory, it is a 32 bit
If you see intel64_lin directory, it is a 64-bit.

IA-32 or compatible
<mkl directory>/lib/ia32_lin
Intel® 64 or compatible
<mkl directory>/lib/intel64_lin

What is the path of the library library files? 

To see just type

which ifort (or the compiler name)

Now the path will be displayed.

/clusterName/intel/Compiler/mkl/..../ifort

Here,

/clusterName/intel/Compiler/mkl/ is mostly set as $MKL_ROOT directory.

so echo $MKL_ROOT will display the path to that directory.

It is very much important to connect these libraries when necessary (while compiling codes)

Intel MKL library also has its ion FFTW3 library which resides inside the */mkl/fftw/ directroy.

This directory contains fftw3.f which is necessary for compiling codes like VASP.

The vasp also needs library files such as libfftw3xf_lintel.a. By default, these are are not compiled. These library files (uncompiled) are present inside /fftw/interfaces/ directory. If you want libfftw3xf_intel.a, you need to go to /mkl/interfaces/fftw3xf/ directory and then need to make using the makefile present there.




To run jobs in specific node in a HPC cluster

Some time, you may want to run a job in a specific folder. For example, to check if all the nodes are working properly after restarting the cluster.

1. Use #PBS -Wall to mention the name

A simplest way is to run as many number of jobs as that of the node at the same time (which can take some time to complete) and use

qstat -n 

to see whether all the nodes are used for the calculation.

To see all the nodes in a cluster, use
pbsnodes -a

cluster
     Mom = headnodename.companyname
     ntype = PBS
     state = free
     pcpus = 24
     resources_available.arch = linux
     resources_available.host = cluster
     resources_available.mem = 264417884kb
     resources_available.ncpus = 24
     resources_available.vnode = cluster
     resources_assigned.accelerator_memory = 0kb
     resources_assigned.mem = 0kb
     resources_assigned.naccelerators = 0
     resources_assigned.ncpus = 0
     resources_assigned.netwins = 0
     resources_assigned.vmem = 0kb
     resv_enable = True
     sharing = default_shared

cn1
     Mom = cn2.aracluster
     ntype = PBS
     state = free
     pcpus = 24
     resources_available.arch = linux
     resources_available.host = cn2
     resources_available.mem = 264424324kb
     resources_available.ncpus = 24
     resources_available.vnode = cn2
     resources_assigned.accelerator_memory = 0kb
     resources_assigned.mem = 0kb
     resources_assigned.naccelerators = 0
     resources_assigned.ncpus = 0
     resources_assigned.netwins = 0
     resources_assigned.vmem = 0kb
     resv_enable = True
     sharing = default_shared

cn2
     Mom = cn1.aracluster
     ntype = PBS
     state = free
     pcpus = 24
     resources_available.arch = linux
     resources_available.host = cn1
     resources_available.mem = 264424336kb
     resources_available.ncpus = 24
     resources_available.vnode = cn1
     resources_assigned.accelerator_memory = 0kb
     resources_assigned.mem = 0kb
     resources_assigned.naccelerators = 0
     resources_assigned.ncpus = 0
     resources_assigned.netwins = 0
     resources_assigned.vmem = 0kb
     resv_enable = True
     sharing = default_shared

Here, cn1, cn2 are the nodenames. The first one 'cluster' is the name of the head node.

Mentions these names in the #PBS option. For example,

#PBS -l nodes=cn1;ncpus=4

This option will run 4 cpus from cn1 node in the cluster.

=======================================================
You can use

cat /etc/hosts

to display the nodenames.

Click here to go back to "Important things to before you work on HPC cluster"


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