[Pw_forum] A small bug of QE when nat >= 100, and the solution

Gabriele Sclauzero sclauzer at sissa.it
Tue Mar 15 10:39:18 CET 2011


Il giorno 14/mar/2011, alle ore 21.54, juan sotelo ha scritto:

> It seems the problem could be solved by creating a fortran-format on
> the fly, e.g.,
> =====
> program foo
> ! hints from    http://www.sdsc.edu/~tkaiser/f90.html
>      implicit none
>      character (len=30)fstr   ! create a format on the fly
>      integer n_dgts, na, nb
>      na = 30000
>      nb = 1000000
>      n_dgts = floor(log10(abs(real(max(na,nb)))))+1
>      !create a format on the fly
>      write(fstr,'("(2i",i4,")")')n_dgts+1
>      write(*,fstr) na, nb
> end program
> =====
> Output:
>   30000 1000000

This is a nice trick, but I'm not sure that all compilers will accept it. I remember complaints about the fact that the format string should be either a constant string or a pointer to a format line.
Just for information, on which compilers have you tried?

Thanks,


GS



§ Gabriele Sclauzero, EPFL SB ITP CSEA
   PH H2 462, Station 3, CH-1015 Lausanne

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.quantum-espresso.org/pipermail/users/attachments/20110315/e74236cd/attachment.html>


More information about the users mailing list