Archive

Archive for the ‘Comandos Avanzados’ Category

seq

May 15th, 2013

Regla mnemotécnica

seqSequence

El comando seq escribe la secuencia de números enteros indicada entre un inicio y un final:

seq Inicio Final

o especificando el incremento

seq Inicio Incremento Final

 

Ejemplo1. Imprimir los números del 1 al 5:

 $ seq 1 5
1
2
3
4
5

 

Ejemplo 2. Imprimir la tabla del 8:

$ seq 0 8 80
0
8
16
24
...

 
Ejemplo 3. Imprimir una secuencia hacia atrás.

$ seq 3 -1 -2
3
2
1
0
-1
-1

 
 

Comandos Avanzados, Linux

Debuging example I

February 18th, 2013

 

Introduction

The debuging of a program allow us to find the errors written in the source code. The tool that we are going to illustrate is the GNU gdb debuger.

Example

A user is trying to to Bader analysis of a Wavefunction with the aimpac tool extreme using a wavefunction obtained with Gaussian 09. When running the extreme program he obtains the following error:

extreme wave
forrtl: severe (64): input conversion error, unit 10, file

so extreme is not working. In order to figure out what is going on we will debug de conde. To do so we must compile it with the –g option, as follows:

gfortran -g EXT94b.f -o extreme

Then we start debuging.

gdb ./extreme

Once it is running, we have to pass the argument (the wavefunction stored in the wave file) to  the program using:

set arg wave

and then run the programa:

run

Here is the whole sequence of the execution.

[cn0 7] ~ > gdb ./extreme
GNU gdb Fedora (6.8-27.el5)
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type “show copying”
and “show warranty” for details.
This GDB was configured as “x86_64-redhat-linux-gnu”…
(no debugging symbols found

(gdb) set arg wave
(gdb) run

Starting program: /home/pobmelat/extreme wave
At line 3689 of file EXT94b.f
Fortran runtime error: Bad value during floating point read
Program exited with code 02.
(gdb)

In the 3689 line of the EXT94b.f I read

C READ IN
C
READ (IWFN,109) TOTE,GAMMA

The READ statement is using 109 format, which is defined in line 3703:

109   FORMAT(17X,F20.12,18X,F13.8)

And, the TOTAL SCF ENERGY AND -V/T is writen as follows in the gaussian 09 generated WFN:

” TOTAL ENERGY =  -1263.592058754168 THE VIRIAL(-V/T)=   2.00956965"

The format of writing this line has changed in gaussian 09 to:

109   FORMAT(15X,F20.12,18X,F13.8)

I modified it, compiled it and extreme is working again.

 

 

Comandos Avanzados, Linux , , , , ,