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, &
66
69 type subspace_t
70 private
71 integer :: method
72 contains
73 procedure :: init => subspace_init
74 end type subspace_t
75
76
77contains
78
80 subroutine subspace_init(this, namespace, st)
81 class(subspace_t), intent(out) :: this
82 type(namespace_t), intent(in) :: namespace
83 type(states_elec_t), intent(in) :: st
84
85 integer :: default
86
87 push_sub(subspace_init)
88
89 !%Variable SubspaceDiagonalization
90 !%Type integer
91 !%Default standard
92 !%Section SCF::Eigensolver
93 !%Description
94 !% Selects the method to perform subspace diagonalization. The
95 !% default is <tt>standard</tt>, unless states parallelization is used,
96 !% when the default is <tt>scalapack</tt>.
97 !% Note that this variable is not parsed in the case of the evolution eigensolver.
98 !%Option none 0
99 !% No subspace diagonalization. WARNING: this will generally give incorrect results.
100 !%Option standard 1
101 !% The standard routine. Can be used with domain parallelization but not
102 !% state parallelization.
103 !%Option scalapack 3
104 !% State-parallelized version using ScaLAPACK. (Requires that
105 !% Octopus was compiled with ScaLAPACK support.)
106 !%End
107
108 default = option__subspacediagonalization__standard
109
110#ifdef HAVE_SCALAPACK
111 if (st%parallel_in_states) default = option__subspacediagonalization__scalapack
112#endif
113
114 call parse_variable(namespace, 'SubspaceDiagonalization', default, this%method)
115
116 if (.not. varinfo_valid_option('SubspaceDiagonalization', this%method)) then
117 call messages_input_error(namespace, 'SubspaceDiagonalization')
118 end if
119
120 call messages_print_var_option('SubspaceDiagonalization', this%method, namespace=namespace)
121
122 ! some checks for ingenious users
123 if (this%method == option__subspacediagonalization__scalapack) then
124#ifndef HAVE_MPI
125 message(1) = 'The scalapack subspace diagonalization can only be used with MPI parallelization.'
126 call messages_fatal(1, only_root_writes = .true., namespace=namespace)
127#else
128#ifndef HAVE_SCALAPACK
129 message(1) = 'The scalapack subspace diagonalization requires scalapack.'
130 call messages_fatal(1, only_root_writes = .true., namespace=namespace)
131#endif
132 if (st%dom_st_mpi_grp%size == 1) then
133 message(1) = 'The scalapack subspace diagonalization is designed to be used with domain or state parallelization.'
134 call messages_warning(1, namespace=namespace)
135 end if
136
137 if (st%d%kpt%parallel) then
138 message(1) = 'Currently the scalapack subspace diagonalization does not use k-point parallelization.'
139 call messages_warning(1, namespace=namespace)
140 end if
141#endif
142 end if
143
144 pop_sub(subspace_init)
145 end subroutine subspace_init
146
147#include "undef.F90"
148#include "real.F90"
149#include "subspace_inc.F90"
150
151#include "undef.F90"
152#include "complex.F90"
153#include "subspace_inc.F90"
154
155end module subspace_oct_m
156
157!! Local Variables:
158!! mode: f90
159!! coding: utf-8
160!! 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:176
subroutine, public zsubspace_diag_hamiltonian(namespace, mesh, st, hm, ik, hmss, overlap)
Diagonalises the Hamiltonian in the subspace defined by the states.
Definition: subspace.F90:946
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:300
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:771
subroutine, public dsubspace_diag_hamiltonian(namespace, mesh, st, hm, ik, hmss, overlap)
Diagonalises the Hamiltonian in the subspace defined by the states.
Definition: subspace.F90:475
int true(void)