Posts

Showing posts from 2015

Coloured terminal output from Fortran

I was just curious to print some of the error messages from fortran code in different color. So I ended up with this suggestion after doing little bit google search - print *, 'Test color print -> '//achar(27)//'[31m Red'//achar(27)//'[0m.' Color codes are: [90m=dark grey [30m=black [91m=peach [31m=red [92m=light green [32m=green [93m=light yellow [33m=yellow [94m=light blue [34m=blue [95m=pink [35m=purple [96m=light aqua [36m=aqua [97m=pearl white

Zero padded integer in BASH

Let say we are trying to print 01 We can do that, using the following command i=1 a=`printf "%0*d\n" 2 $i` If we echo the ${a} variable, we will see the desired formatted integer i.e. 01

MDP files in GROMACS

Molecular dynamics parameters file For energy minimization: em.mdp For NVT simulations: nvt.mdp For NPT simulations: npt.mdp

Create Binary Mixture in GROMACS

BINARY MIXTURE Let say someone is interested to study some protein molecules in Water-Ethanol binary mixture. Now the question is how to create binary solvent like this? In Gromacs genbox is very powerful in this context. If ratio does not matter, then one can use the following command genbox_d -cp ethanol.gro -cs spc216.gro -p topol.top -o water_ethanol.gro -box a b c The above commands will fill the simulation box with ethanol and water molecules with random numbers of water molecules and number of ethanol molecules presents in the ethanol.gro file. However, if one is intend to create some exact number percentage of ethanol-water mixture, the following method will be very useful Water-Ethanol binary mixture of defined % Create a .pdb file of single ethanol molecule. (It is very easy, just google it out or create .pdb from software like pymol, prodrg etc., if .gro file is there, no need to create the .pdb file). Convert that .pdb file to .gro file by executing any one of the fol

Add missing GPG keys

GPG errors: W: GPG error: http://ppa.launchpad.net jaunty Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 6D975C4791E7EE5E W: A error occurred during the signature verification. The repository is not updated and the previous index files will be used.GPG error: http://ppa.launchpad.net jaunty Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 5A9BF3BB4E5E17B5 W: GPG error: http://ppa.launchpad.net jaunty Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 7FB8BEE0A1F196A8 The fix for this is to re-download the keys using the hexidecimal numbers given in the error. Open a terminal and run the following command sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys hexadeciaml-number-shows=in-error The output should look like this: " gpg: requesting key hexadecimal-output from hkp server keyserver.u

Get the nth positional argument in bash?

Positional argument can be obtained in bash by creating the following file #!/bin/bash n=2 echo ${!n} Running that file in the following way:  ./file.sh sun mon tue wed will print mon The next one also gives the same result  eval echo \${$n}

Recurssive incement of variable in bash

var = $ (( var + 1 )) or (( var = var + 1 )) or (( var += 1 )) or (( var ++)) or let "var=var+1" or let "var+=1" or let "var++"

Log out open remote SSH session

Kill forgotten ssh login pkill -9 -t pts/0