TABLE OF CONTENTS


ABINIT/ddb_io_out [ Functions ]

[ Top ] [ Functions ]

NAME

 ddb_io_out

FUNCTION

 Open Derivative DataBase, then
 write Derivative DataBase preliminary information.
 Note: only one processor writes the DDB.

COPYRIGHT

 Copyright (C) 1999-2018 ABINIT group (XG,MT)
 This file is distributed under the terms of the
 GNU General Public License, see ~abinit/COPYING
 or http://www.gnu.org/copyleft/gpl.txt .
 For the initials of contributors, see ~abinit/doc/developers/contributors.txt .

INPUTS

 acell(3)=length scales of primitive translations (bohr)
 amu(mtypat)=mass of the atoms (atomic mass unit)
 dilatmx=the maximal dilatation factor
 character(len=fnlen) dscrpt:string that describe the output database
 ecut=kinetic energy planewave cutoff (hartree)
 ecutsm=smearing energy for plane wave kinetic energy (Ha)
 character(len=fnlen) filnam: name of output file
 intxc=control xc quadrature
 iscf=parameter controlling scf or non-scf choice
 ixc=exchange-correlation choice parameter
 kpt(3,mkpt)=k point set (reduced coordinates)
 kptnrm=normalisation of k points
 matom=maximum number of atoms
 mband=maximum number of bands
 mkpt=maximum number of special points
 msym=maximum number of symetries
 mtypat=maximum number of atom types
 natom=number of atoms in the unit cell
 nband(mkpt)=number of bands at each k point, for each polarization
 ngfft(18)=contain all needed information about 3D FFT,
        see ~abinit/doc/variables/vargs.htm#ngfft
 nkpt=number of k points
 nspden=number of spin-density components
 nspinor=number of spinorial components of the wavefunctions
 nsppol=1 for unpolarized, 2 for spin-polarized
 nsym=number of symmetry elements in space group
 ntypat=number of atom types
 occ(mband*mkpt)=occupation number for each band and k
 occopt=option for occupancies
 pawecutdg=cut-off for fine "double grid" used in PAW calculations (unused for NCPP)
 rprim(3,3)=dimensionless primitive translations in real space
 dfpt_sciss=scissor shift (Ha)
 spinat(3,matom)=initial spin of each atom, in unit of hbar/2
 symafm(msym)=(anti)ferromagnetic part of symmetry operations
 symrel(3,3,msym)=symmetry operations in real space
 tnons(3,msym)=nonsymmorphic translations for symmetry operations
 tolwfr=tolerance on largest wf residual
 tphysel="physical" electronic temperature with FD occupations
 tsmear=smearing width (or temperature) in Hartree
 typat(matom)=type of each atom
 unddb=unit number for output
 usepaw=flag for PAW
 vrsddb=6 digit integer giving date, in form yymmdd for month=mm(1-12),
  day=dd(1-31), and year=yy(90-99 for 1990 to 1999,00-89 for 2000 to 2089),
  of current DDB version.
 wtk(mkpt)=weight assigned to each k point
 xred(3,matom)=reduced atomic coordinates
 zion(mtypat)=valence charge of each type of atom
 znucl(mtypat)=atomic number of atom type

OUTPUT

  Only writing

PARENTS

      m_ddb_hdr

CHILDREN

      wrtout

SOURCE

 81 #if defined HAVE_CONFIG_H
 82 #include "config.h"
 83 #endif
 84 
 85 #include "abi_common.h"
 86 
 87 subroutine ddb_io_out (dscrpt,filnam,matom,mband,&
 88 &  mkpt,msym,mtypat,unddb,vrsddb,&
 89 &  acell,amu,dilatmx,ecut,ecutsm,intxc,iscf,ixc,kpt,kptnrm,&
 90 &  natom,nband,ngfft,nkpt,nspden,nspinor,nsppol,nsym,ntypat,occ,occopt,&
 91 &  pawecutdg,rprim,dfpt_sciss,spinat,symafm,symrel,tnons,tolwfr,tphysel,tsmear,&
 92 &  typat,usepaw,wtk,xred,zion,znucl)
 93 
 94 
 95  use defs_basis
 96  use m_profiling_abi
 97  use m_errors
 98 
 99  use m_io_tools,     only : open_file
100 
101 !This section has been created automatically by the script Abilint (TD).
102 !Do not modify the following lines by hand.
103 #undef ABI_FUNC
104 #define ABI_FUNC 'ddb_io_out'
105  use interfaces_14_hidewrite
106 !End of the abilint section
107 
108  implicit none
109 
110 !Arguments -------------------------------
111 !scalars
112  integer,intent(in) :: matom,mband,mkpt,msym,mtypat,unddb,vrsddb
113  integer,intent(in) :: intxc,iscf,ixc,natom,nkpt,nspden,nspinor,nsppol,nsym
114  integer,intent(in) :: ntypat,occopt,usepaw
115  real(dp),intent(in) :: dilatmx,ecut,ecutsm,kptnrm,pawecutdg,dfpt_sciss,tolwfr,tphysel
116  real(dp),intent(in) :: tsmear
117  character(len=fnlen),intent(in) :: dscrpt,filnam
118 !arrays
119  integer,intent(in) :: nband(mkpt*nsppol),ngfft(18),symafm(msym),symrel(3,3,msym)
120  integer,intent(in) :: typat(matom)
121  real(dp),intent(in) :: acell(3),amu(mtypat),kpt(3,mkpt),occ(mband*mkpt*nsppol)
122  real(dp),intent(in) :: rprim(3,3),spinat(3,matom),tnons(3,msym),wtk(mkpt)
123  real(dp),intent(in) :: xred(3,matom),zion(mtypat),znucl(mtypat)
124 
125 !Local variables -------------------------
126 !Set routine version number here:
127 !scalars
128  integer,parameter :: vrsio8=100401,vrsio8_old=010929,vrsio8_old_old=990527
129  integer :: bantot,ii,ij,ikpt,iline,im,ierr
130  character(len=500) :: message
131 !arrays
132  character(len=9) :: name(9)
133 
134 ! *********************************************************************
135 
136  DBG_ENTER("COLL")
137 
138 
139 !Check ioddb8 version number (vrsio8) against mkddb version number
140 !(vrsddb)
141  if (vrsio8/=vrsddb) then
142    write(message, '(a,a,a,i10,a,a,i10,a)' )&
143 &   ' ddb_io_out: WARNING -',ch10,&
144 &   '  The input/output DDB version number=',vrsio8,ch10,&
145 &   '  is not equal to the DDB version number=',vrsddb,'.'
146    call wrtout(std_out,message,'COLL')
147  end if
148 
149 !Open the output derivative database.
150 !(version 2.1. : changed because of a bug in a Perl script
151 !should set up a name checking procedure, with change of name
152 !like for the output file)
153  ierr = open_file(filnam,message,unit=unddb,status='unknown',form='formatted')
154  if (ierr /= 0) then
155    MSG_ERROR(message)
156  end if
157 
158 !Write the heading
159  write(unddb, '(/,a,/,a,i10,/,/,a,a,/)' ) &
160 & ' **** DERIVATIVE DATABASE ****    ',&
161 & '+DDB, Version number',vrsddb,' ',trim(dscrpt)
162 
163 !Write the descriptive data
164 !1. usepaw
165  write(unddb, '(1x,a9,i10)' )'   usepaw',usepaw
166 !2. natom
167  write(unddb, '(1x,a9,i10)' )'    natom',natom
168 !3. nkpt
169  write(unddb, '(1x,a9,i10)' )'     nkpt',nkpt
170 !4. nsppol
171  write(unddb, '(1x,a9,i10)' )'   nsppol',nsppol
172 !5. nsym
173  write(unddb, '(1x,a9,i10)' )'     nsym',nsym
174 !6. ntypat
175  write(unddb, '(1x,a9,i10)' )'   ntypat',ntypat
176 !7. occopt
177  write(unddb, '(1x,a9,i10)' )'   occopt',occopt
178 !8. nband
179  if(occopt==2)then
180    im=12
181    name(1)='    nband'
182    do iline=1,(nkpt+11)/12
183      if(iline==(nkpt+11)/12)im=nkpt-12*(iline-1)
184      write(unddb, '(1x,a9,5x,12i5)' )name(1),&
185 &     (nband((iline-1)*12+ii),ii=1,im)
186      name(1)='         '
187    end do
188    bantot=0
189    do ikpt=1,nkpt
190      bantot=bantot+nband(ikpt)
191    end do
192  else
193    write(unddb, '(1x,a9,i10)' )'    nband',nband(1)
194    bantot=nkpt*nband(1)
195  end if
196 
197 !9. acell
198  write(unddb, '(1x,a9,3d22.14)' )'    acell',acell
199 !10. amu
200  im=3
201  name(1)='      amu'
202  do iline=1,(ntypat+2)/3
203    if(iline==(ntypat+2)/3)im=ntypat-3*(iline-1)
204    write (unddb, '(1x,a9,3d22.14)' )name(1),&
205 &   (amu((iline-1)*3+ii),ii=1,im)
206    name(1)='         '
207  end do
208 !11. dilatmx
209  write(unddb, '(1x,a9,d22.14)' )'  dilatmx',dilatmx
210 !12. ecut
211  write(unddb, '(1x,a9,d22.14)' )'     ecut',ecut
212 !12b. pawecutdg (PAW)
213  if (usepaw==1) then
214    write(unddb, '(1x,a9,d22.14)' )'pawecutdg',pawecutdg
215  end if
216 !13. ecutsm
217  write(unddb, '(1x,a9,d22.14)' )'   ecutsm',ecutsm
218 !14. intxc
219  write(unddb, '(1x,a9,i10)' )'    intxc',intxc
220 !15. iscf
221  write(unddb, '(1x,a9,i10)' )'     iscf',iscf
222 !16. ixc
223  write(unddb, '(1x,a9,i10)' )'      ixc',ixc
224 !17. kpt
225  name(1)='      kpt'
226  do iline=1,nkpt
227    write (unddb, '(1x,a9,3d22.14)' )name(1),&
228 &   (kpt(ii,iline),ii=1,3)
229    name(1)='      '
230  end do
231 !18. kptnrm
232  write(unddb, '(1x,a9,d22.14)' )'   kptnrm',kptnrm
233 !19. ngfft
234  write(unddb, '(1x,a9,5x,3i5)' )'    ngfft',ngfft(1:3)
235 !20. nspden
236  write(unddb, '(1x,a9,i10)' )'   nspden',nspden
237 !21. nspinor
238  write(unddb, '(1x,a9,i10)' )'  nspinor',nspinor
239 !22. occ
240  if(occopt==2)then
241    im=3
242    name(1)='      occ'
243    do iline=1,(bantot+2)/3
244      if(iline==(bantot+2)/3)im=bantot-3*(iline-1)
245      write(unddb, '(1x,a9,3d22.14)' )name(1),&
246 &     (occ((iline-1)*3+ii),ii=1,im)
247      name(1)='         '
248    end do
249  else
250    im=3
251    name(1)='      occ'
252    do iline=1,(nband(1)+2)/3
253      if(iline==(nband(1)+2)/3)im=nband(1)-3*(iline-1)
254      write(unddb, '(1x,a9,3d22.14)' )name(1),&
255 &     (occ((iline-1)*3+ii),ii=1,im)
256      name(1)='         '
257    end do
258  end if
259 !23. rprim
260  name(1)='    rprim'
261  do iline=1,3
262    write(unddb, '(1x,a9,3d22.14)' )name(1),&
263 &   (rprim(ii,iline),ii=1,3)
264    name(1)='      '
265  end do
266 !24. dfpt_sciss
267  write(unddb, '(1x,a11,d22.14)' )' dfpt_sciss',dfpt_sciss
268 !25. spinat
269  name(1)='   spinat'
270  do iline=1,natom
271    write(unddb, '(1x,a9,3d22.14)' )name(1),&
272 &   (spinat(ii,iline),ii=1,3)
273    name(1)='         '
274  end do
275 !26. symafm
276  im=12
277  name(1)='   symafm'
278  do iline=1,(nsym+11)/12
279    if(iline==(nsym+11)/12)im=nsym-12*(iline-1)
280    write(unddb, '(1x,a9,5x,12i5)' )name(1),&
281 &   (symafm((iline-1)*12+ii),ii=1,im)
282    name(1)='         '
283  end do
284 !27. symrel
285  name(1)='   symrel'
286  do iline=1,nsym
287    write(unddb, '(1x,a9,5x,9i5)' )name(1),&
288 &   ((symrel(ii,ij,iline),ii=1,3),ij=1,3)
289    name(1)='         '
290  end do
291 !28. tnons
292  name(1)='    tnons'
293  do iline=1,nsym
294    write(unddb, '(1x,a9,3d22.14)' )name(1),&
295 &   (tnons(ii,iline),ii=1,3)
296    name(1)='         '
297  end do
298 !29. tolwfr
299  write(unddb, '(1x,a9,d22.14)' )'   tolwfr',tolwfr
300 !30. tphysel
301  write(unddb, '(1x,a9,d22.14)' )'  tphysel',tphysel
302 !31. tsmear
303  write(unddb, '(1x,a9,d22.14)' )'   tsmear',tsmear
304 !32. typat
305  im=12
306  name(1)='    typat'
307  do iline=1,(natom+11)/12
308    if(iline==(natom+11)/12)im=natom-12*(iline-1)
309    write(unddb, '(1x,a9,5x,12i5)' )name(1),&
310 &   (typat((iline-1)*12+ii),ii=1,im)
311    name(1)='         '
312  end do
313 !33. wtk
314  name(1)='      wtk'
315  im=3
316  do iline=1,(nkpt+2)/3
317    if(iline==(nkpt+2)/3)im=nkpt-3*(iline-1)
318    write(unddb, '(1x,a9,3d22.14)' )name(1),&
319 &   (wtk((iline-1)*3+ii),ii=1,im)
320    name(1)='         '
321  end do
322 !34. xred
323  name(1)='     xred'
324  do iline=1,natom
325    write(unddb, '(1x,a9,3d22.14)' )name(1),&
326 &   (xred(ii,iline),ii=1,3)
327    name(1)='         '
328  end do
329 !35. znucl
330  name(1)='    znucl'
331  im=3
332  do iline=1,(ntypat+2)/3
333    if(iline==(ntypat+2)/3)im=ntypat-3*(iline-1)
334    write(unddb, '(1x,a9,3d22.14)' )name(1),&
335 &   (znucl((iline-1)*3+ii),ii=1,im)
336    name(1)='         '
337  end do
338 !36. zion
339  name(1)='     zion'
340  im=3
341  do iline=1,(ntypat+2)/3
342    if(iline==(ntypat+2)/3)im=ntypat-3*(iline-1)
343    write(unddb, '(1x,a9,3d22.14)' )name(1),&
344 &   (zion((iline-1)*3+ii),ii=1,im)
345    name(1)='         '
346  end do
347 
348  DBG_EXIT("COLL")
349 
350 end subroutine ddb_io_out