Pages

Showing posts with label my scripts. Show all posts
Showing posts with label my scripts. Show all posts

List of Scripts (HPC and Research)


To get the output geometry of a *.out file (Q-Chem)

Using rev, column commands

grep "  B  " lda_bnr_2_n_ring_03_geo_restricted_singlet.out | tail -n6 | awk 'BEGIN {OFS=" ";} {print $1, $3, $5}' | rev | column -t | rev

Using AWK 

grep "  B  " lda_bnr_2_n_ring_03_geo_restricted_singlet.out | tail -n6 | awk 'BEGIN {OFS="
 ";} {print $1, $3, $5}'

To extract the geometry from a *.out file ($f) and paste in a ea/ip file (and insert $molecule at the beginning)

#!/usr/bin/env bash
for f in *.out; do
    for g in ea*.in; do
        n=$(((ls $f) | cut -d_ -f6))
        t=$((2 * $n ))
        grep "  B  " $f | tail -${t} | awk 'BEGIN {OFS=" ";} {print $1, $4, $5, $6}' | rev | column -t | rev > xyz.xyz
        sed -i '1i -1 2' xyz.xyz
        sed -i '1i $molecule' xyz.xyz
        echo '$end' >> xyz.xyz
        cat xyz.xyz ./input_ea.in > $g
     done
done
ClusterHOme$ ./script_ea_input.sh
./script_ea_input.sh: line 4: (ls lda_bnr_2_n_ring_05_geo_restricted_singlet.out) | cut -d_ -f6: syntax error: invalid arithmetic operator (error token is ".out) | cut -d_ -f6")

========================================
Using two for loops:

for i in *.out; do 
    for j in *.in; do 
       what/you/want/to/do 
    done
done


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