Prince Gollapalli

Resources

Refer my github page for few useful scripts for vasp output analysis. https://github.com/princego

Atomistic Modeling of Materials for getting started with basic DFT calculations and linux basics.

Bilbao Crystallographic Server for database for space groups and wyckoff positions information

Useful Materials Databases

Materials Project | NOMAD Encyclopedia | AFLOW


Linux Basics

Remotely Accessing a Linux Machine via Secure Shell (SSH)

Linux and Mac Users

Open your terminal and enter ssh username@hostname

Windows Users

Install MobaXterm or Putty softwares, and SSH to login

Passwordless login using ssh

In your local computer (for linx and mac users only), type ssh-keygen, then type ssh-copy-id username@hostname


Working with Directories (Folders)

Once you login, you’ll be taken to your home directory (folder). Always press Enter key after entering a command. If the directory name is too long, you need not type in full directory name, instead type first few letters then press tab key. Directory name will be auto filled.

Decription Command
List contents in the directory ls
Present working directory pwd
Create a new directory mkdir directoryname Don't use space in between for long directories, use _ instead
Go inside a directory cd directoryname
Switch to home directory from any directory cd or cd ~/
Go back to previous directory cd ..
Go back to two directories cd ../..
Go to subdirectory cd directory/subdirectory/
Rename a directory mv old_name new_name
Delete a file rm filename
Delete a directory/folder rm -r directoryname
Move directory to a new location mv directoryname path_to_new_location
Check total disk space occupied df -h
Search for a directory starts with dir find . -type d | grep dir*

Working with Files (vi editor)

Here I am showing the commands for inbuild vi editor. You can use the favourite editor of your choice.

Decription Command
Create a new file vi filename
To start editing the new file or old file i then you'll go to insert mode. i.e., you can start editing.
Write changes to the file :w
To quit the file :q
To write changes to the file and quit :wq
Save file without making changes :q!
Delete a file rm filename
Go to the last line G
Go to first line :1 or gg
Jump to line 25 :25 or 25G
Move to end of a line $
Move one page forward ctrl+f
Move one page backward ctrl+b
Delete 10 lines from the current line 10dd
Delete 1 to 10 lines/rows :1,10d
Delete from line 10 to the end :10,$d
Open multiple files vi -O file1 file 2
Switch between multiple files opened [to move to the file on right side] Ctrl+w rightarrow
Search for a file starts with fil find . -type f | grep fil*
Compress an individual file to .gz gzip filename
Search and compress a specific filename to .gz find . -type f -name "FILENAME" -exec gzip -f {} \;
unzip a .gz file gzip -d filename.gz
view the contents in a tar.gz file without extracting tar -tf filename.tar.gz
Remove lines from file1_big which are in file2_small grep -v -x -f file2_small file1_big > file3_available
print a sequence of 1 to 10 numbers seq 10 > sysNum
Print only col2 and 3 from a csv file awk -F "," '{print $2","$3}' file.csv > file_new.csv
Sum of column of numbers in a file paste -sd+ int_freq | bc

Transfer folders/files

Command line interface

If you are tranferring files, after scp, -r is not required. To know the path, type pwd in your terminal

Copy directories from local to remote computer scp -r fullpath/ user@hostname:/fullpath/
Copy directories from remote to local computer scp -r user@hostname:/fullpath/ /fullpath_in_local_computer
Copy directories from remote computer to another remote computer scp -r user1@hostname1:/fullpath/ user2@hostname2:/fullpath/

Graphical interface

Linux

Go to connect to server and type sftp://username@servername. Now you can drag and drop the files. Alternatively, you can use Filezilla.

Mac

Use Forklift from App Store or use Filezilla.

Windows

Open MobaXterm software, go to Session, go to SFTP and login. Alternatively, you can use Filezilla.


Sample submission script

#!/bin/bash
#PBS -o out
## Merge output and error files
#PBS -j oe
#PBS -k eod
#PBS -l walltime=00:59:59
## Select n nodes, each with n CPUs
#PBS -l select=1:ncpus=12
tpdir=`echo $PBS_JOBID | cut -f 1 -d .`
tempdir=$HOME/scratch/job$tpdir
mkdir -p $tempdir
cd $tempdir
cp -R $PBS_O_WORKDIR/* .
mpirun -n 12 vasp_std > log
echo "`date '+%m/%d/%y %H:%M:%S' ` $PBS_O_WORKDIR" >> ~/joblog.txt
mv ../job$tpdir $PBS_O_WORKDIR/.

grep

grep command helps us to print the line when it finds the character you have entered. The syntax is grep character filename. If you are looking for long words, which has space in between, use " "
grep ! log
grep "total energy" log


chmod

4-read, 2-write, 1-execute. For example, chmod 755 filename has three digits 7(4+2+1), 5(4+1), 5(4+1). The first digit corresponds to the user, second and third corresponds to the group and others. 755 means the user can read, write, and execute, group and others can only read and execute a file.


awk

Print 5th column awk '{print $5}' filename
Comma seperated values (csv) for 1st three columns awk '{print $1","$2","$3}' filename >file.csv
Print last row awk 'END{print}' filename

General Commands

Adds 0.5 0.5 0.5 to line 5 of the file POSCAR sed -i '5i 0.5 0.5 0.5' POSCAR

Python

Deactivate python base environemnt on login conda config --set auto_activate_base false

MatLab

Exporting figure in tiff format with 600 dpi resolution exportgraphics(gcf,'eigenval.tiff', 'Resolution', 600)
Exporting figure as pdf exportgraphics(gcf,'figure.pdf')
Deletes every 25th row from a matrix A(25:25:end,:) = []

k-point resolution

(2*pi)/(a*kpoints along a), where a is the lattice distance.


FCC (111) surface in VESTA

To create FCC supercell along (111) plane, enter the below values in the transformation matrix vertically, a1=[-0.5 0.5 0], b1=[-0.5 -0.5 1], c1=[1 1 1]
Now the new directions are will be a=[1 1 0], b=[1 1 2] and c=[1 1 1]