[CPMD-list] cpmd2cube crosscompilation

Ari P Seitsonen Ari.P.Seitsonen at iki.fi
Sun Sep 12 16:49:52 CEST 2004


Dear Eric,

  If I also have understood correctly, you want to run CPMD on the NEC-SX6
and run 'cpmd2cube' on a single processor on the linux PC, is that
correct? I tried that (running on NEC-SX5 though, then on a linux PC with
SuSE 9.1 and PGI 5.1), and with the following modifications I managed to
get the HOMO of the water molecule correctly:

  1) Change the routine 'read_density_file' (in 'readwrites.F') to the
    version following below; the idea is to read the integers into
    INTEGER*8 variables - ehmm, there would be a nicer way in FORTRAN90, I
    admit, then copy the values to the origiran variables. I did this not
    to have to change all the libraries if using the compiler to switch
    all integers to 8-byte integers

  2) Use the option '-byteswapio' if compiling with PGI (something similar
    if using 'ifc'/'ifort')

  3) Run with the option '-double' (since the data is written into 16-byte
    complex in NEC)

Please keep us updated whether you manage to visualise the CPMD cube files
this or another way (now there's an option in CPMD to give cube files
instead of the unformatted files I thought), and please don't hesitate to
call for help if you don't manage.

  I still strongly advice all users of 'cpmd2cube' to apply the changes
provided by Axel Kohlmeyer!!

----------------------------------------------------------------------


!******************************************************************************

! read density/Wannier file

SUBROUTINE read_density_file ( fname_in, c0, singleprecision, atom, &
     ibrav, celldm, nr1, nr2, nr3, gcut, gcutw, nhg, key )
  
  IMPLICIT NONE
  
! Arguments
  CHARACTER ( LEN = * ) :: fname_in
  COMPLEX ( dbl ), DIMENSION ( : ), POINTER :: c0
  LOGICAL, INTENT ( IN ) :: singleprecision
  TYPE ( atom_type ), INTENT ( OUT ) :: atom
  INTEGER, INTENT ( OUT ) :: nhg, nr1, nr2, nr3, ibrav
  REAL ( dbl ), INTENT ( OUT ) :: celldm ( 6 ), gcut, gcutw
  INTEGER, INTENT ( IN ) :: key
  
! Locals
  INTEGER :: iochannel = 99
  INTEGER :: ia, sp, ig, allocstatus
  INTEGER*8 :: ibrav_read, nr1_read, nr2_read, nr3_read, nhg_read
  INTEGER*8 :: iatyp_read, nsp_read, na_read ( 1000 )
  COMPLEX ( sgl ), DIMENSION ( : ), ALLOCATABLE :: c0x
  
!------------------------------------------------------------------------------
  
  OPEN ( UNIT = iochannel, FILE = fname_in, &
       STATUS = "OLD", FORM = "UNFORMATTED" )
  
  READ ( iochannel ) ibrav_read
  ibrav = ibrav_read
  READ ( iochannel ) celldm
  READ ( iochannel ) nr1_read, nr2_read, nr3_read
  nr1 = nr1_read; nr2 = nr2_read; nr3 = nr3_read
  READ ( iochannel ) gcut, nhg_read, gcutw
  nhg = nhg_read
  READ ( iochannel ) nsp_read
  atom % nsp = nsp_read
  READ ( iochannel ) ( na_read ( sp ), sp = 1, atom % nsp )
  atom % na ( 1 : atom % nsp ) = na_read ( 1 : atom % nsp )
  
  atom % nat = 0
  DO sp = 1, atom % nsp
     atom % nat = atom % nat + atom % na ( sp )
     DO ia = 1, atom % na ( sp )
        READ ( iochannel ) &
             atom % tau0 ( 1, ia, sp ), atom % tau0 ( 2, ia, sp ), &
             atom % tau0 ( 3, ia, sp ), iatyp_read
        atom % iatyp ( sp ) = iatyp_read
     END DO
  END DO
  
! read in the density/wave function
  IF ( .NOT. ASSOCIATED ( c0 ) ) THEN
     ALLOCATE ( c0 ( nhg ), STAT = allocstatus )
     IF ( allocstatus /= 0 ) STOP "read_density_file, error allocating c0"
  END IF
  
  IF ( SIZE ( c0 ) /= nhg ) STOP "read_density_file, c0 incorrectly sized"
  
  IF ( singleprecision ) THEN
     
     ALLOCATE ( c0x ( nhg ), STAT = allocstatus )
     IF ( allocstatus /= 0 ) STOP "read_density_file, error allocating c0x"
     
     READ ( iochannel ) ( c0x ( ig ), ig = 1, nhg )
     
     c0 = c0x
     
     DEALLOCATE ( c0x, STAT = allocstatus )
     IF ( allocstatus /= 0 ) STOP "read_density_file, error deallocating c0x"
     
  ELSE
     
     READ ( iochannel ) ( c0 ( ig ), ig = 1, nhg )
     
  END IF
  
  CLOSE ( UNIT = iochannel )
  
END SUBROUTINE read_density_file

!******************************************************************************

----------------------------------

    Greetings,

       apsi

-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-
 Ari Paavo Seitsonen / Ari.P.Seitsonen at iki.fi / http://www.iki.fi/~apsi/
 Tel +41 1 635 44 97 / Fax +41 1 635 68 38 / GSM +41 79 719 09 35      
 Anschrift: Physikalisch Chemisches Institut (PCI), Universität Zürich (UniZh)
 Indirizzo: Winterthurerstrasse 190, CH-8057 Zürich
 Address:   Schweiz / Svizzera / Suisse / Svizra / Switzerland

On Fri, 10 Sep 2004, Eric VERFAILLIE wrote:

> Hello,
> I have done some calculation on Wannier functions on SiO2 on a NEC-SX6 with cross
> compilation (modification of earth simulator makefile). I hadn't got any problem but the
> binary format of WANNIER_1* files can't be read on linux PC whith cpm2cube even with the
> F_UFMTENDIAN variable.
> 
> My system is too big to be run on a single processor.
> 
> I tried to cross compil cpmd2cube but with any results.
> 
> Is there any solutions.
> 
> i know that i can compil cpmd with -conversion big_endian but it doesn't work on cross
> compilation.
> i have done a F90 program in order to know if 
> F_UFMTENDIAN work and it does
> 
> 
> program essai
> real   cc4
> real   cc8
> real   c4
> real   c8
> c4 = 456.456
> c8 = 789.789
> 
> !  prepare little endian representation of data
> 
> open(11,file='lit.tmp',form='unformatted')
> write(11) c8
> write(11) c4
> close(11)
> 
> !  prepare big endian representation of data
> 
> open(10,file='big.tmp',form='unformatted')
> write(10) c8
> write(10) c4
> close(10)
> 
> !  read big endian data and operate with them on
> !  little endian machine
> 
> open(100,file='big.tmp',form='unformatted')
> read(100) cc8
> read(100) cc4
> 
> write (1,*) cc8,cc4
> !    Any operation with data, which have been read
> 
> !    . . .
> close(100)
> stop
> end program essai
> 
> 
> with F_UFMTENDIAN=10,100
> i've got
> od -t x4 lit.tmp
> 0000000 04000000 7f724544 04000000 04000000
> 0000020 5e3ae443 04000000
> 0000030
> od -t x4 big.tmp
> 0000000 00000004 4445727f 00000004 00000004
> 0000020 43e43a5e 00000004
> 0000030
> 
> and even with that i can't read the WANNIER_1* files with cpmd2cube whith or not
> convertion in big_endian during compilation.
> 
> 
> Regards
> VERFAILLIE ERIC
> 
> 
> 
> 
> =====
> Si ce n'est pas strictement nécessaire.
> S'il vous plaît, évitez de m'envoyer des pièces jointes au format Word ou PowerPoint.
> Voir http://www.fsf.org/philosophy/no-word-attachments.fr.html
> Please avoid sending me Word or PowerPoint attachments.
> See http://www.fsf.org/philosophy/no-word-attachments.html
> 
> 
> 
> 01001101001011100010000001010110011001010111001001100110
> 01100001011010010110110001101100011010010110010100100000
> 010001010111001001101001011000110000110100001010
> 
> 0111100101101111011101010010011101110010011001010010000001110111
> 0110010101101100011000110110111101101101011001010000110100001010
> 
> 
> 	
> 
> 	
> 		
> Vous manquez d’espace pour stocker vos mails ? 
> Yahoo! Mail vous offre GRATUITEMENT 100 Mo !
> Créez votre Yahoo! Mail sur http://fr.benefits.yahoo.com/
> 
> Le nouveau Yahoo! Messenger est arrivé ! Découvrez toutes les nouveautés pour dialoguer instantanément avec vos amis. A télécharger gratuitement sur http://fr.messenger.yahoo.com
> _______________________________________________
> CPMD-list mailing list
> CPMD-list at cpmd.org
> http://cpmd.org/mailman/listinfo/cpmd-list
> 



More information about the CPMD-list mailing list