Branch data Line data Source code
1 : : !!****p* ABINIT/conducti
2 : : !! NAME
3 : : !! conducti
4 : : !!
5 : : !! FUNCTION
6 : : !! This program computes the elements of the optical frequency dependent
7 : : !! conductivity tensor and the conductivity along the three principal axes
8 : : !! from the Kubo-Greenwood formula.
9 : : !!
10 : : !! COPYRIGHT
11 : : !! Copyright (C) 2006-2026 ABINIT group (FJ,SMazevet)
12 : : !! This file is distributed under the terms of the
13 : : !! GNU General Public License, see ~abinit/COPYING
14 : : !! or http://www.gnu.org/copyleft/gpl.txt .
15 : : !! For the initials of contributors, see ~abinit/doc/developers/contributors.txt .
16 : : !!
17 : : !! SOURCE
18 : :
19 : : #if defined HAVE_CONFIG_H
20 : : #include "config.h"
21 : : #endif
22 : :
23 : : #include "abi_common.h"
24 : :
25 : 10 : program conducti
26 : :
27 : 10 : use defs_basis
28 : : USE_MPI
29 : : use m_xmpi
30 : : use m_errors
31 : : #ifdef HAVE_MEM_PROFILING
32 : : use m_abicore
33 : : #endif
34 : : use m_conducti
35 : :
36 : : use m_io_tools, only : open_file
37 : : use m_time, only : timein
38 : : use m_fstrings, only : sjoin, itoa
39 : : use m_nctk, only : nctk_test_mpiio
40 : : use m_paw_optics,only : linear_optics_paw
41 : :
42 : : implicit none
43 : :
44 : : !Local variables-------------------------------
45 : : !scalars
46 : : integer,parameter :: master=0
47 : : integer :: incpaw,nproc,comm,inunt,my_rank,mpierr
48 : : real(dp) :: tcpu,tcpui,twall,twalli
49 : : character(len=fnlen) :: filnam,filnam_out
50 : : character(len=500) :: msg
51 : : !arrays
52 : : real(dp) :: tsec(2)
53 : : ! *********************************************************************************
54 : :
55 : : !Change communicator for I/O (mandatory!)
56 : 10 : call abi_io_redirect(new_io_comm=xmpi_world)
57 : :
58 : : !Start, MPI init, ...
59 : 10 : call xmpi_init()
60 : 10 : call timein(tcpui,twalli)
61 : :
62 : : !Initialize memory profiling if it is activated
63 : : !if a full abimem.mocc report is desired, set the argument of abimem_init to "2" instead of "0"
64 : : !note that abimem.mocc files can easily be multiple GB in size so don't use this option normally
65 : : #ifdef HAVE_MEM_PROFILING
66 : : call abimem_init(0)
67 : : #endif
68 : :
69 : : !Test if the netcdf library supports MPI-IO
70 : 10 : call nctk_test_mpiio(print_warning=.false.)
71 : :
72 : : !Extract MPI parallelization data
73 : 10 : comm = xmpi_world
74 : 10 : nproc = xmpi_comm_size(comm)
75 : 10 : my_rank = xmpi_comm_rank(comm)
76 : :
77 : : #if defined FC_NVHPC
78 : : if (nproc == -1) write(std_out, *)"NVHPC raises an internal compiler error that is fixed by this print statement."
79 : : #endif
80 : :
81 : : !Read some input data
82 [ + - ]: 10 : if (my_rank==master) then
83 : :
84 : : ! Read data file name
85 : 10 : write(std_out,'(a)')' Please, give the name of the data file ...'
86 : 10 : read(std_in, '(a)') filnam
87 [ + - ]: 10 : write(std_out,'(2a)')' The name of the data file is: ',trim(filnam)
88 : :
89 : : #if defined FC_NVHPC
90 : : if (nproc == -1) write(std_out, *)"NVHPC raises an internal compiler error that is fixed by this print statement."
91 : : #endif
92 : :
93 : : ! Read type of calculation
94 [ + - ]: 10 : if (open_file(filnam,msg,newunit=inunt,form='formatted')==0) then
95 : 10 : rewind(inunt)
96 : 10 : read(inunt,*) incpaw
97 : 10 : close(inunt)
98 : : else
99 : 0 : ABI_ERROR('Error opening data file!')
100 : : end if
101 : :
102 : : ! Read output file name
103 : 10 : write(std_out,'(a)')' Give the name of the output file ...'
104 : 10 : read(std_in, '(a)') filnam_out
105 : 10 : write(std_out,'(2a)')' The name of the output file is: ',filnam_out
106 : : end if
107 : :
108 : : !Broadcast input data
109 : 10 : call xmpi_bcast(incpaw,master,comm,mpierr)
110 : 10 : call xmpi_bcast(filnam,master,comm,mpierr)
111 : 10 : call xmpi_bcast(filnam_out,master,comm,mpierr)
112 : :
113 : : !Call main routine
114 : 2 : select case (incpaw)
115 : : case (1)
116 [ + - ]: 4 : if (my_rank==master) then
117 : 2 : call conducti_nc(filnam,filnam_out)
118 : : end if
119 : : case (2)
120 : 2 : call conducti_paw(filnam,filnam_out)
121 : : case (3)
122 [ # # ]: 0 : if (my_rank==master) then
123 : 0 : call linear_optics_paw(filnam,filnam_out)
124 : : end if
125 : : case (4)
126 : 2 : call conducti_paw(filnam,filnam_out)
127 : 2 : call conducti_paw_core(filnam,filnam_out,with_absorption=.true.,with_emissivity=.true.)
128 : : case (5)
129 : 4 : call conducti_paw_core(filnam,filnam_out,with_absorption=.true.)
130 : : case (6)
131 : 0 : call conducti_paw_core(filnam,filnam_out,with_absorption=.true.,with_emissivity=.true.)
132 : : case (42)
133 : 0 : call conducti_paw(filnam,filnam_out,varocc=1)
134 : : case default
135 [ + + - + : 10 : ABI_ERROR(sjoin("Wrong incpaw:", itoa(incpaw)))
+ - - - ]
136 : : end select
137 : :
138 : : !End, memory cleaning
139 : 10 : call timein(tcpu,twall)
140 : 10 : tsec(1)=tcpu-tcpui
141 : 10 : tsec(2)=twall-twalli
142 [ + - ]: 10 : if (my_rank==0) then
143 : : write(std_out, '(a,a,a,f13.1,a,f13.1)' ) &
144 : 10 : '-',ch10,'- Proc. 0 individual time (sec): cpu=',tsec(1),' wall=',tsec(2)
145 : : end if
146 : :
147 : 10 : call abinit_doctor("__conducti")
148 : 10 : call xmpi_end()
149 : :
150 : 0 : end program conducti
151 : : !!***
|