The Elk Code
spiralsc.f90
Go to the documentation of this file.
1 
2 ! Copyright (C) 2012 S. Sharma, J. K. Dewhurst and E. K. U. Gross.
3 ! This file is distributed under the terms of the GNU General Public License.
4 ! See the file COPYING for license details.
5 
6 subroutine spiralsc
7 use modmain
8 use modmpi
9 use moddelf
10 implicit none
11 ! local variables
12 integer nq,iq,jq
13 ! store original parameters
14 avec0(:,:)=avec(:,:)
15 natoms0(:)=natoms(:)
16 atposl0(:,:,:)=atposl(:,:,:)
17 bfcmt00(:,:,:)=bfcmt0(:,:,:)
18 mommtfix0(:,:,:)=mommtfix(:,:,:)
20 ngridk0(:)=ngridk
21 ! initialise universal variables
22 call init0
23 ! initialise q-point dependent variables
24 call init2
25 ! store original parameters
26 atposc0(:,:,:)=atposc(:,:,:)
27 10 continue
28 call sstask(80,filext)
29 ! if nothing more to do then restore input parameters and return
30 if (iqss == 0) then
31  filext='.OUT'
32  natoms(:)=natoms0(:)
33  avec(:,:)=avec0(:,:)
34  atposl(:,:,:)=atposl0(:,:,:)
35  bfcmt0(:,:,:)=bfcmt00(:,:,:)
36  mommtfix(:,:,:)=mommtfix0(:,:,:)
38  ngridk(:)=ngridk0(:)
39  return
40 end if
41 ! spiral dry run: just generate empty SS files
42 if (task == 352) goto 10
43 if (mp_mpi) write(*,'("Info(spiralsc): working on ",A)') 'SS'//trim(filext)
44 ! determine k-point grid size from radkpt
45 autokpt=.true.
46 ! generate the spin-spiral supercell
47 call genscss
48 ! initialise or read the charge density and potentials from file
49 trdstate=(task == 351)
50 ! run the ground-state calculation
51 call gndstate
52 if (mp_mpi) then
53  write(80,'(I6,T20," : number of unit cells in supercell")') nscss
54  write(80,'(G18.10,T20," : total energy per unit cell")') engytot/dble(nscss)
55  write(80,*)
56  write(80,'("q-point in lattice and Cartesian coordinates :")')
57  write(80,'(3G18.10)') vql(:,iqss)
58  write(80,'(3G18.10)') vqc(:,iqss)
59  write(80,'(G18.10,T20," : length of q-vector")') qc(iqss)
60  write(80,*)
61  nq=nint(dble(nqptnr)*wqpt(iqss))
62  write(80,'(I6,T20," : number of equivalent q-points")') nq
63  write(80,'("Equivalent q-points in lattice and Cartesian coordinates :")')
64  do iq=1,nqptnr
65  jq=ivqiq(ivq(1,iq),ivq(2,iq),ivq(3,iq))
66  if (jq == iqss) then
67  write(80,'(3G18.10)') vql(:,iq)
68  write(80,'(3G18.10)') vqc(:,iq)
69  write(80,*)
70  end if
71  end do
72  close(80)
73 end if
74 ! delete the eigenvector files
75 call delfiles(evec=.true.)
76 ! synchronise MPI processes
77 call mpi_barrier(mpicom,ierror)
78 goto 10
79 end subroutine
80 
real(8), dimension(3, maxatoms, maxspecies) bfcmt0
Definition: modmain.f90:277
subroutine gndstate
Definition: gndstate.f90:10
real(8), dimension(:), allocatable qc
Definition: modmain.f90:552
character(256) filext
Definition: modmain.f90:1301
real(8), dimension(3, maxatoms, maxspecies) atposl0
Definition: modmain.f90:51
integer task
Definition: modmain.f90:1299
logical mp_mpi
Definition: modmpi.f90:17
logical autokpt
Definition: modmain.f90:447
integer, dimension(:,:), allocatable ivq
Definition: modmain.f90:532
integer iqss
Definition: modmain.f90:299
subroutine spiralsc
Definition: spiralsc.f90:7
subroutine genscss
Definition: genscss.f90:7
integer, dimension(3) ngridk0
Definition: modmain.f90:451
real(8), dimension(3, maxatoms, maxspecies) atposl
Definition: modmain.f90:51
real(8), dimension(:,:), allocatable vqc
Definition: modmain.f90:550
real(8) engytot
Definition: modmain.f90:985
subroutine sstask(fnum, fext)
Definition: sstask.f90:7
real(8), dimension(3, 3) avec
Definition: modmain.f90:12
subroutine init2
Definition: init2.f90:7
integer, dimension(3) ngridk
Definition: modmain.f90:451
real(8), dimension(:,:), allocatable vql
Definition: modmain.f90:548
real(8), dimension(3, maxatoms, maxspecies) mommtfix0
Definition: modmain.f90:261
real(8), dimension(3, maxatoms, maxspecies) mommtfix
Definition: modmain.f90:261
integer, dimension(:,:,:), allocatable ivqiq
Definition: modmain.f90:534
real(8), dimension(3, 3) avec0
Definition: modmain.f90:12
integer nqptnr
Definition: modmain.f90:530
integer, dimension(maxspecies) natoms
Definition: modmain.f90:36
subroutine delfiles(evec, devec, eval, occ, pmat, epsi)
Definition: moddelf.f90:25
integer nscss
Definition: modmain.f90:301
Definition: modmpi.f90:6
real(8), dimension(3, maxatoms, maxspecies) bfcmt00
Definition: modmain.f90:277
logical trdstate
Definition: modmain.f90:685
subroutine init0
Definition: init0.f90:10
real(8), dimension(:), allocatable wqpt
Definition: modmain.f90:554
real(8), dimension(3, maxatoms, maxspecies) atposc
Definition: modmain.f90:54
real(8), dimension(3, maxatoms, maxspecies) atposc0
Definition: modmain.f90:54
integer, dimension(maxspecies) natoms0
Definition: modmain.f90:36
integer mpicom
Definition: modmpi.f90:11
integer ierror
Definition: modmpi.f90:19
logical autokpt0
Definition: modmain.f90:447