1! ---
2! Copyright (C) 1996-2016	The SIESTA group
3!  This file is distributed under the terms of the
4!  GNU General Public License: see COPYING in the top directory
5!  or http://www.gnu.org/copyleft/gpl.txt .
6! See Docs/Contributors.txt for a list of contributors.
7! ---
8MODULE siesta_options
9
10#ifdef SIESTA__FLOOK
11  use flook, only : luaState
12#endif
13
14  implicit none
15
16  integer, parameter, private :: dp = selected_real_kind(10,100)
17
18  PUBLIC
19  save
20
21  ! Compatibility options
22  ! -- pre 4.0 DM and H flow logic
23  logical :: compat_pre_v4_DM_H      ! General switch
24  logical :: mix_after_convergence ! Mix DM or H even after convergence
25  logical :: recompute_H_after_scf ! Update H while computing forces
26
27  ! -- pre 4.0 coordinate output logic -- to be implemented
28  logical :: compat_pre_v4_dynamics      ! General switch
29
30
31  logical :: mix_scf_first ! Mix first SCF step?
32  logical :: mix_scf_first_force ! Mix first SCF step? and force it!
33  logical :: mix_charge    ! New: mix fourier components of rho
34  logical :: mixH          ! Mix H instead of DM
35  logical :: h_setup_only  ! H Setup only
36  logical :: chebef        ! Compute the chemical potential in ordern?
37  logical :: dumpcharge    ! Write electron density?
38  logical :: fire_mix      ! SCF mixing with FIRE method
39  logical :: fixspin       ! Keep the total spin fixed?
40  logical :: init_anti_ferro ! Antiferro spin ordering in initdm?
41  logical :: initdmaux     ! Re-initialize DM when auxiliary supercell changes?
42  logical :: allow_dm_reuse! Allow re-use of the previous geometry DM ? (with possible extrapolation)
43  logical :: allow_dm_extrapolation ! Allow the extrapolation of previous geometries' DM ?
44  logical :: change_kgrid_in_md ! Allow k-point grid to change in MD calculations
45  logical :: use_aux_cell  ! Force the use of the auxiliary cell
46  logical :: negl          ! Neglect hamiltonian matrix elements without overlap?
47  logical :: noeta         ! Use computed chemical potential instead of eta in ordern?
48  integer :: diag_wfs_cache! WFS cache used in diagonalization routine (0=none, 1=cdf)
49  logical :: outlng        ! Long output in the output file?
50  logical :: pulfile       ! Use file to store Pulay info in pulayx? (Obsolete)
51  logical :: RelaxCellOnly ! Relax only lattice vectors, not atomic coordinates
52  logical :: RemoveIntraMolecularPressure   ! Remove molecular virial contribution to p
53  logical :: savehs        ! Write file with Hamiltonian electrostatic potential?
54  logical :: savevh        ! Write file with Hartree electrostatic potential?
55  logical :: savevna       ! Write file with neutral-atom potential?
56  logical :: savevt        ! Write file with total effective potential?
57  logical :: savedrho      ! Write file with diff. between SCF and atomic density?
58  logical :: saverho       ! Write file with electron density?
59  logical :: saverhoxc     ! Write file with electron density including nonlinear core correction?
60  logical :: savepsch      ! Write file with ionic (local pseudopotential) charge?
61  logical :: savetoch      ! Write file with total charge?
62  logical :: savebader     ! Write file with charge for Bader analysis?
63  logical :: usesaveddata  ! Default for UseSavedData flag
64  logical :: usesavecg     ! Use continuation file for CG geometry relaxation?
65  logical :: usesavelwf    ! Use continuation file for Wannier functions?
66  logical :: usesavedm     ! Use cont. file for density matrix?
67  logical :: usesavedmloc  ! Temporary to keep usesavedm value
68  logical :: usesavexv     ! Use cont. file for atomic positions and velocities?
69  logical :: usesavezm     ! Use cont. file for Z-matrix?
70  logical :: writeig       ! Write eigenvalues?
71  logical :: writbk        ! Write k vectors of bands?
72  logical :: writmd
73  logical :: writpx        ! Write atomic coordinates at every geometry step?
74  logical :: writb         ! Write band eigenvalues?
75  logical :: writec        ! Write atomic coordinates at every geometry step?
76  logical :: write_coop    ! Write information for COOP/COHP analysis ?
77  logical :: save_ORB_INDX ! Write orbital information to ORB_INDX file ?
78
79  ! Create graphviz information to visualize connectivity graph
80  integer :: write_GRAPHVIZ
81!----------------------------------------------------
82! Wannier90 interface
83!
84  logical :: w90_processing   ! Will we call the interface with Wannier90
85  logical :: w90_write_mmn    ! Write the Mmn matrix for the interface with Wannier
86  logical :: w90_write_amn    ! Write the Amn matrix for the interface with Wannier
87  logical :: w90_write_eig    ! Write the eigenvalues or the interface with Wannier
88  logical :: w90_write_unk    ! Write the unks for the interface with Wannier
89  logical :: hasnobup         ! Is the number of bands with spin up for
90                              !   wannierization defined?
91  logical :: hasnobdown       ! Is the number of bands with spin down for
92                              !   wannierization defined?
93  logical :: hasnob           ! Is the number of bands for wannierization defined?
94                              !   (for non spin-polarized calculations).
95  integer :: nobup            ! Number of bands with spin up for wannierization
96  integer :: nobdown          ! Number of bands with spin down for wannierization
97  integer :: nob              ! Number of bands for wannierization
98                              !   (for non spin-polarized calculations).
99
100!----------------------------------------------------
101  logical :: writef        ! Write atomic forces at every geometry step?
102  logical :: writek        ! Write the k vectors of the BZ integration mesh?
103  logical :: writic        ! Write the initial atomic ccordinates?
104  logical :: varcel        ! Change unit cell during relaxation or dynamics?
105  logical :: do_pdos       ! Compute the projected density of states?
106  logical :: write_tshs_history ! Write the MD track of Hamiltonian and overlap matrices in transiesta format
107  logical :: write_hs_history ! Write the MD track of Hamiltonian and overlap matrices
108  logical :: writedm       ! Write file with density matrix?
109  logical :: write_dm_at_end_of_cycle ! Write DM at end of SCF cycle? (converged or not)
110  logical :: writeH        ! Write file with Hamiltonian? (in "DM" format)
111  logical :: write_H_at_end_of_cycle ! Write H at end of SCF cycle?
112  logical :: writedm_cdf   ! Write file with density matrix in netCDF form?
113#ifdef NCDF_4
114  logical :: write_cdf     ! Write file with all information attached
115  integer :: cdf_comp_lvl  ! The compression level of the Netcdf-4 file
116  logical :: cdf_w_parallel  ! Allows writing NetCDF files in parallel
117  logical :: cdf_r_parallel  ! Allows reading NetCDF files in parallel, parallel read does not impose the same requirements as w_parallel
118#endif
119  logical :: writedm_cdf_history   ! Write file with SCF history of DM in netCDF form?
120  logical :: writedmhs_cdf ! Write file with DM_in, H, DM_out, and S in netCDF form?
121  logical :: writedmhs_cdf_history   ! Write file with SCF history in netCDF form?
122  logical :: read_charge_cdf   ! Read charge density from file in netCDF form?
123  logical :: read_deformation_charge_cdf   ! Read deformation charge density from file in netCDF form?
124!
125  logical :: save_initial_charge_density ! Just save the initial charge density used
126  logical :: analyze_charge_density_only ! Exit dhscf after processing charge
127
128  logical :: atmonly       ! Set up pseudoatom information only?
129  logical :: harrisfun     ! Use Harris functional?
130  logical :: muldeb        ! Write Mulliken populations at every SCF step?
131  logical :: spndeb        ! Write spin-polarization information at every SCF step?
132  logical :: orbmoms       ! Write orbital moments?
133
134  ! Convergence options
135  logical :: converge_FreeE   ! free Energy conv. to finish SCF iteration?
136  real(dp):: tolerance_FreeE  ! Free-energy tolerance
137  logical :: converge_Eharr   ! to finish SCF iteration?
138  real(dp):: tolerance_Eharr  ! Harris tolerance
139  logical :: converge_EDM     ! to finish SCF iteration?
140  real(dp):: tolerance_EDM    ! Tolerance in change of EDM elements to finish SCF iteration
141  logical :: converge_DM      ! to finish SCF iteration?
142  real(dp):: dDtol            ! Tolerance in change of DM elements to finish SCF iteration
143  logical :: converge_H       ! to finish SCF iteration?
144  real(dp):: dHtol            ! Tolerance in change of H elements to finish SCF iteration
145
146  logical :: broyden_optim ! Use Broyden method to optimize geometry?
147  logical :: fire_optim    ! Use FIRE method to optimize geometry?
148  logical :: struct_only   ! Output initial structure only?
149  logical :: use_struct_file ! Read structural information from a special file?
150  logical :: bornz          ! Calculate Born polarization charges?
151  logical :: SCFMustConverge ! Do we have to converge for each SCF calculation?
152  logical :: GeometryMustConverge ! Do we *have to* converge the relaxation?
153  logical :: want_domain_decomposition ! Use domain decomposition for orbitals
154  logical :: want_spatial_decomposition ! Use spatial decomposition for orbitals
155  logical :: hirshpop        ! Perform Hirshfeld population analysis?
156  logical :: voropop         ! Perform Voronoi population analysis?
157  logical :: partial_charges_at_every_geometry
158  logical :: partial_charges_at_every_scf_step
159  logical :: monitor_forces_in_scf ! Compute forces and stresses at every step
160
161  logical :: minim_calc_eigenvalues ! Use diagonalization at the end of each MD step to find eigenvalues for OMM
162
163  integer :: ia1           ! Atom index
164  integer :: ia2           ! Atom index
165  integer :: ianneal       ! Annealing option read in redata and passed to anneal
166  integer :: idyn          ! Geommetry relaxation/dynamics option
167  integer :: ifinal        ! Last geommetry iteration step for some types of dynamics
168  integer :: ioptlwf       ! Order-N functional option read in redata used in ordern
169  integer :: iquench       ! Quenching option, read in redata, used in dynamics routines
170  integer :: isolve        ! Option to find density matrix: 0=>diag, 1=>order-N
171  integer :: istart        ! First geommetry iteration step for certain types of dynamics
172  integer :: DM_history_depth ! Number of previous density matrices used in extrapolation and reuse
173  integer :: maxsav        ! Number of previous density matrices used in Pulay mixing
174  integer :: broyden_maxit ! Max. iterations in Broyden geometry relaxation
175  integer :: mullipop      ! Option for Mulliken population level of detail
176  integer :: ncgmax        ! Max. number of conjugate gradient steps in order-N minim.
177  integer :: nkick         ! Period between 'kick' steps in SCF iteration
178  integer :: nmove         ! Number of geometry iterations
179  integer :: nscf          ! Number of SCF iteration steps
180  integer :: min_nscf      ! Minimum number of SCF iteration steps
181  integer :: pmax
182  integer :: neigwanted    ! Wanted number of eigenstates (per k point)
183  integer :: level         ! Option for allocation report level of detail
184  integer :: call_diagon_default    ! Default number of SCF steps for which to use diagonalization before OMM
185  integer :: call_diagon_first_step ! Number of SCF steps for which to use diagonalization before OMM (first MD step)
186
187  real(dp) :: beta          ! Inverse temperature for Chebishev expansion.
188  real(dp) :: bulkm         ! Bulk modulus
189  real(dp) :: charnet       ! Net electric charge
190  real(dp) :: rijmin        ! Min. permited interatomic distance without warning
191  real(dp) :: dm_normalization_tol    ! Threshold for DM normalization mismatch error
192  logical  :: normalize_dm_during_scf ! Whether we normalize the DM
193  real(dp) :: dt            ! Time step in dynamics
194  real(dp) :: dx            ! Atomic displacement used to calculate Hessian matrix
195  real(dp) :: dxmax         ! Max. atomic displacement allowed during geom. relaxation
196  real(dp) :: eta(2)        ! Chemical-potential param. Read by redata used in ordern
197  real(dp) :: etol          ! Relative tol. in CG minim, read by redata, used in ordern
198  real(dp) :: ftol          ! Force tolerance to stop geometry relaxation
199  real(dp) :: g2cut         ! Required planewave cutoff of real-space integration mesh
200  real(dp) :: mn            ! Mass of Nose thermostat
201  real(dp) :: mpr           ! Mass of Parrinello-Rahman variables
202  real(dp) :: occtol        ! Occupancy threshold to build DM
203  real(dp) :: rcoor         ! Cutoff radius of Localized Wave Functions in ordern
204  real(dp) :: rcoorcp       ! Cutoff radius to find Fermi level by projection in ordern
205  real(dp) :: rmax_bonds    ! Cutoff length for bond definition
206  real(dp) :: strtol        ! Stress tolerance in relaxing the unit cell
207  real(dp) :: taurelax      ! Relaxation time to reach desired T and P in anneal
208  real(dp) :: temp
209  real(dp) :: tempinit      ! Initial ionic temperature read in redata
210  real(dp) :: threshold     ! Min. size of arrays printed by alloc_report
211  real(dp) :: tp            ! Target pressure. Read in redata. Used in dynamics routines
212  real(dp) :: total_spin    ! Total spin used in spin-polarized calculations
213  real(dp) :: tt            ! Target temperature. Read in redata. Used in dynamics rout.
214  real(dp) :: wmix          ! Mixing weight for DM in SCF iteration
215  real(dp) :: wmixkick       ! Mixing weight for DM in special 'kick' SCF steps
216
217  ! Matrix element compatibility variable
218  integer :: matel_NRTAB = 1024
219
220  character(len=164) :: sname   ! System name, used to initialise read
221
222  integer,  parameter :: SOLVE_DIAGON = 0
223  integer,  parameter :: SOLVE_ORDERN = 1
224  integer,  parameter :: SOLVE_TRANSI = 2
225  integer,  parameter :: SOLVE_MINIM  = 3
226  integer,  parameter :: SOLVE_PEXSI  = 4
227  integer,  parameter :: MATRIX_WRITE = 5
228
229#ifdef SIESTA__FLOOK
230  ! LUA-handle
231  type(luaState) :: LUA
232#endif
233
234END MODULE siesta_options
235