Octopus
subspace.F90
Go to the documentation of this file.
1!! Copyright (C) 2002-2006 M. Marques, A. Castro, A. Rubio, G. Bertsch
2!!
3!! This program is free software; you can redistribute it and/or modify
4!! it under the terms of the GNU General Public License as published by
5!! the Free Software Foundation; either version 2, or (at your option)
6!! any later version.
7!!
8!! This program is distributed in the hope that it will be useful,
9!! but WITHOUT ANY WARRANTY; without even the implied warranty of
10!! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11!! GNU General Public License for more details.
12!!
13!! You should have received a copy of the GNU General Public License
14!! along with this program; if not, write to the Free Software
15!! Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
16!! 02110-1301, USA.
17!!
18
19#include "global.h"
20
21module subspace_oct_m
22 use accel_oct_m
24 use batch_oct_m
26 use blas_oct_m
27 use blacs_oct_m
29 use debug_oct_m
30#ifdef HAVE_ELPA
31 use elpa
32#endif
33 use global_oct_m
36 use, intrinsic :: iso_fortran_env
39 use math_oct_m
40 use mesh_oct_m
44 use parser_oct_m
45 use pblas_oct_m
52 use types_oct_m
55
56 implicit none
57
58 private
59
60 public :: &
61 subspace_t, &
64
67 type subspace_t
68 private
69 integer :: method
70 contains
71 procedure :: init => subspace_init
72 end type subspace_t
73
74
75contains
76
78 subroutine subspace_init(this, namespace, st)
79 class(subspace_t), intent(out) :: this
80 type(namespace_t), intent(in) :: namespace
81 type(states_elec_t), intent(in) :: st
82
83 integer :: default
84
85 push_sub(subspace_init)
86
87 !%Variable SubspaceDiagonalization
88 !%Type integer
89 !%Default standard
90 !%Section SCF::Eigensolver
91 !%Description
92 !% Selects the method to perform subspace diagonalization. The
93 !% default is <tt>standard</tt>, unless states parallelization is used,
94 !% when the default is <tt>scalapack</tt>.
95 !% Note that this variable is not parsed in the case of the evolution eigensolver.
96 !%Option none 0
97 !% No subspace diagonalization. WARNING: this will generally give incorrect results.
98 !%Option standard 1
99 !% The standard routine. Can be used with domain parallelization but not
100 !% state parallelization.
101 !%Option scalapack 3
102 !% State-parallelized version using ScaLAPACK. (Requires that
103 !% Octopus was compiled with ScaLAPACK support.)
104 !%End
105
106 default = option__subspacediagonalization__standard
107
108#ifdef HAVE_SCALAPACK
109 if (st%parallel_in_states) default = option__subspacediagonalization__scalapack
110#endif
111
112 call parse_variable(namespace, 'SubspaceDiagonalization', default, this%method)
113
114 if (.not. varinfo_valid_option('SubspaceDiagonalization', this%method)) then
115 call messages_input_error(namespace, 'SubspaceDiagonalization')
116 end if
117
118 call messages_print_var_option('SubspaceDiagonalization', this%method, namespace=namespace)
119
120 ! some checks for ingenious users
121 if (this%method == option__subspacediagonalization__scalapack) then
122#ifndef HAVE_MPI
123 message(1) = 'The scalapack subspace diagonalization can only be used with MPI parallelization.'
124 call messages_fatal(1, only_root_writes = .true., namespace=namespace)
125#else
126#ifndef HAVE_SCALAPACK
127 message(1) = 'The scalapack subspace diagonalization requires scalapack.'
128 call messages_fatal(1, only_root_writes = .true., namespace=namespace)
129#endif
130 if (st%dom_st_mpi_grp%size == 1) then
131 message(1) = 'The scalapack subspace diagonalization is designed to be used with domain or state parallelization.'
132 call messages_warning(1, namespace=namespace)
133 end if
134
135 if (st%d%kpt%parallel) then
136 message(1) = 'Currently the scalapack subspace diagonalization does not use k-point parallelization.'
137 call messages_warning(1, namespace=namespace)
138 end if
139#endif
140 end if
141
142 pop_sub(subspace_init)
143 end subroutine subspace_init
144
145#include "undef.F90"
146#include "real.F90"
147#include "subspace_inc.F90"
148
149#include "undef.F90"
150#include "complex.F90"
151#include "subspace_inc.F90"
152
153end module subspace_oct_m
154
155!! Local Variables:
156!! mode: f90
157!! coding: utf-8
158!! End:
This module implements batches of mesh functions.
Definition: batch.F90:135
This module implements common operations on batches of mesh functions.
Definition: batch_ops.F90:118
This module contains interfaces for BLACS routines Interfaces are from http:
Definition: blacs.F90:27
This module provides the BLACS processor grid.
This module contains interfaces for BLAS routines You should not use these routines directly....
Definition: blas.F90:120
This module is intended to contain "only mathematical" functions and procedures.
Definition: math.F90:117
This module defines functions over batches of mesh functions.
Definition: mesh_batch.F90:118
This module defines the meshes, which are used in Octopus.
Definition: mesh.F90:120
subroutine, public messages_warning(no_lines, all_nodes, namespace)
Definition: messages.F90:525
character(len=256), dimension(max_lines), public message
to be output by fatal, warning
Definition: messages.F90:162
subroutine, public messages_fatal(no_lines, only_root_writes, namespace)
Definition: messages.F90:410
subroutine, public messages_input_error(namespace, var, details, row, column)
Definition: messages.F90:691
This module contains interfaces for ScaLAPACK routines Interfaces are from http:
Definition: scalapack.F90:133
This module provides routines for communicating states when using states parallelization.
subroutine subspace_init(this, namespace, st)
Initialize Subspace type.
Definition: subspace.F90:174
subroutine, public dsubspace_diag(this, namespace, mesh, st, hm, ik, eigenval, diff, nonortho)
Diagonalises the Hamiltonian in the subspace defined by the states.
Definition: subspace.F90:298
subroutine, public zsubspace_diag(this, namespace, mesh, st, hm, ik, eigenval, diff, nonortho)
Diagonalises the Hamiltonian in the subspace defined by the states.
Definition: subspace.F90:769
int true(void)