Posts

VMD TIPS

LOAD MULTIPLE TRAJECTORIES IN VMD set filelist [glob *.pdb] foreach file $filelist {mol new $file waitfor all}  

Mac - OS and VIM Tips

Mac - OS and VIM Tips To get the desired feature edit ~/.vimrc file Enable text color filetype plugin indent on  syntax on Jump to beginning/end of a line using Shift Home/End  :map <ESC>[H <Home>  :map <ESC>[F <End>  :imap <ESC>[H <C-O><Home>  :imap <ESC>[F <C-O><End>  :cmap <ESC>[H <Home>  :cmap <ESC>[F <End> Jump from one word to another using the option + forward arrow and backword arrow combinations  :map <ESC>f el  :imap <ESC>b <C-o>b  :imap <ESC>f <C-o>el  :cmap <ESC>f el

Fortran code for sorting a data array

This program can be used to sort a set of data array either in ascending or descending order. program sort_data implicit none integer, parameter :: array_length = 100 integer :: i, count double precision, dimension(1:array_length) :: data double precision :: temp logical :: not_sorted open(unit=1, file='data.input', action='read', status='old') read(1,*) (data(i), i=1, array_length) not_sorted = .TRUE. do while (not_sorted)      count = 0      do i = 1, state - 1           temp = data(i) ! if one needs to get ascending order need to change here .LT. to .GT.          if (data(i) .LT. data(i + 1)) then             data(i) = data(i+1)             data(i+1) = temp             count = count          else             count = count + 1         ...

Bash Shell Scripting for file handling

Add two single column file side by side Of same length   awk 'NR==FNR{_[NR]=$0;next}{print $1,$2,_[FNR]}' file2 file1 Of different length awk 'NR==FNR { a[c=FNR]=$0; next }{ printf "%-8s \t %s\n", a[FNR], $0 } END { for(i=FNR+1;i<=c;i++) print a[i] }' file2 file1 Cut n-th column of a file to separate file   awk < infile '{print $n}' > outfile

VIM-Search-TIPS

Image
Search and replace globally :%s/search-string/replace-string/g Search and replace within a range of particular row and column :1,4 /\%1cYYY/ZZZ/g   Search using case sensitive string /abCdEf\C          "Case sensitive /abCdEf\c          "Case insensitive Search and replace interactively :%s/search-string/replace-string/gc

Printf and awk

AWK cat input | awk '{printf "%9.6f %9.6f %9.6f\n", $1, $2, $3}' > output

Handle large statically allocated data in fortran (> 2GB)

Typical error occurs in this case fortranfile.f:someline numbe: relocation truncated to fit: R_X86_64_PC32 against `.bss' fortranfile.f:someline numbe: additional relocation overflows omitted from the output Solution: Compile the fortran file with the following option -mcmodel medium -shared-intel Source Link: Intel Forum