Line data Source code
1 : module m_writeout
2 : use m_types_solver
3 : private
4 : type, extends(t_solver):: t_solver_debugout
5 : contains
6 : procedure :: solve_gev => diag_writeout !solver for generalized eigenvalue problem
7 : end type
8 : public :: t_solver_debugout, get_solver_debugout
9 : contains
10 104 : function get_solver_debugout() result(solver)
11 : type(t_solver_debugout), pointer::solver
12 104 : allocate (solver)
13 104 : solver%name = "debugout"
14 104 : solver%available = .true.
15 104 : solver%parallel = .true.
16 104 : solver%serial = .true.
17 104 : solver%generalized = .true.
18 104 : solver%standard = .false.
19 104 : solver%single_precision = .false.
20 104 : solver%transform = .false.
21 104 : solver%GPU = .false.
22 104 : end function
23 :
24 0 : subroutine diag_writeout(self, hmat, smat, ne, eig, zmat, ikpt)
25 : !Dummy diver: does not solve actual eigenvalue problem but simply returns a set of orthogonal vectors.
26 : !Could be useful for performance testing workloads in which we do not want to look at the diagonalization.
27 : ! A Cholesky decomp is still done to be able to do a back transform so that the resulting vector are orthonormal
28 : ! with respect to overlapp matrix.
29 :
30 : use m_types_mat
31 : use m_judft
32 : use m_io_matrix
33 : use m_types_mpimat
34 : #ifdef CPP_MPI
35 : use mpi
36 : #endif
37 :
38 : implicit none
39 : class(t_solver_debugout) :: self
40 : class(t_mat), intent(INOUT) :: hmat, smat
41 : integer, intent(INOUT) :: ne
42 : class(t_mat), allocatable, intent(OUT) :: zmat
43 : real, intent(OUT) :: eig(:)
44 : integer, intent(IN) :: ikpt
45 :
46 : !small subroutine that does only wite the matrix to a file
47 : integer:: i, ii, irank, ierr, matsize
48 : character(len=20)::filename
49 : #ifdef CPP_MPI
50 0 : call MPI_COMM_RANK(MPI_COMM_WORLD, irank, ierr)
51 : #else
52 : irank = 0
53 : #endif
54 :
55 : select type (hmat)
56 : type is (t_mpimat)
57 0 : matsize = hmat%global_size1
58 : class default
59 0 : matsize = hmat%matsize1
60 : end select
61 : !First write binary file
62 : #ifdef CPP_HDF
63 0 : i = open_matrix(hmat%l_real, matsize, 2, 2, "hs_mat")
64 : #else
65 : i = open_matrix(hmat%l_real, hmat%matsize1, 1, 2, "hs_mat")
66 : #endif
67 0 : call write_matrix(hmat, 1, i)
68 0 : call write_matrix(smat, 2, i)
69 0 : call close_matrix(i)
70 :
71 : !Now the formatted matrix
72 0 : write (filename, "(a,i0)") "hmat", irank
73 0 : open (999, file=trim(filename))
74 0 : write (filename, "(a,i0)") "smat", irank
75 0 : open (998, file=trim(filename))
76 0 : do i = 1, hmat%matsize2
77 0 : do ii = 1, hmat%matsize1
78 0 : if (hmat%l_real) then
79 0 : write (999, "(2i6,f15.6)") ii, i, hmat%data_r(ii, i)
80 0 : write (998, "(2i6,f15.6)") ii, i, smat%data_r(ii, i)
81 : else
82 0 : write (999, "(2i6,2f15.6)") ii, i, hmat%data_c(ii, i)
83 0 : write (998, "(2i6,2f15.6)") ii, i, smat%data_c(ii, i)
84 : end if
85 : end do
86 : end do
87 0 : close (999)
88 0 : close (998)
89 : #ifdef CPP_MPI
90 0 : call MPI_BARRIER(MPI_COMM_WORLD, ierr)
91 : #endif
92 0 : call judft_error("STOP in eigen_diag:debug_diag")
93 0 : end subroutine diag_writeout
94 0 : end module m_writeout
|