[Pw_forum] modifying sumpdos.f90

Guido Fratesi fratesi at mater.unimib.it
Fri Sep 16 08:56:11 CEST 2011


Dear Maaly,

as a first and simple modification, you could change what is read from the 
file. The key line is the READ statement below, which puts the contents of 
column1 into egrid, of column2 into pdos(up) and column3 into pdos(dw) (if 
nspin==2) (from file sumpdos.f90).

          DO ie = 1, ngrid
             READ(10, *, IOSTAT=ios ) egrid(ie), pdos(ie, 1:nspin, ifile)
             IF (ios/=0) &
             CALL errore("sumpdos", "reading first line in "//trim(file(ifile)), ie )
          ENDDO


Learning Fortran would be of help by sure. Still, you might find more 
convenient to use some scripting to perform some simple yet very specific 
operations as the one you mention here. As an example, let me write below 
a bash script I recently used to sum the p_z-PDOS.

=========================

#!/bin/bash

n=0
prefix=YOUR_PREFIX

# loop over files to be summed
for file in $prefix.pdos_atm*\(p\) ; do
     n=$((n+1))
     echo "including file: " $file

#   get pz PDOS from file $file (spin-unpolarized: get 3rd column)
     awk '(NR>1) {print $3}' $file > pz_$n

done

# get energies (1st column)
awk '(NR>1) {print $1}' *.pdos_tot > en

# paste PDOS energies, sum, write results
paste en pz_* | awk '{tot=0; for (i=2;i<=NF;i++) {tot=tot+$i}; print $1, tot}' > $prefix.pdos_pz

# delete temporary files
rm pz_* en

=========================


On Wed, 14 Sep 2011, maaly wrote:

> Dear all,
>
>
> I need to modify sumpdos.f90 to sum  one of the pdos(up) and pdos(dwn)
> columns for selected atoms instead of summing ldos(up) and ldos(dwn)
> and i'm not that familiar with fortran, so it will be very great if any one
> can tell me how.
>
>
>
>
>
> Best regards,
>
> Maaly Ghariballah
> Graduate student
> Alneelain university,sudan
>

-- 
Guido Fratesi

Dipartimento di Scienza dei Materiali
Universita` degli Studi di Milano-Bicocca
via Cozzi 53, 20125 Milano, Italy

Phone: +39 02 6448 5183
email: fratesi at mater.unimib.it



More information about the users mailing list