Line data Source code
1 : ! ***********************************************************************
2 : !
3 : ! Copyright (C) 2013-2019 The MESA Team
4 : !
5 : ! This program is free software: you can redistribute it and/or modify
6 : ! it under the terms of the GNU Lesser General Public License
7 : ! as published by the Free Software Foundation,
8 : ! either version 3 of the License, or (at your option) any later version.
9 : !
10 : ! This program is distributed in the hope that it will be useful,
11 : ! but WITHOUT ANY WARRANTY; without even the implied warranty of
12 : ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 : ! See the GNU Lesser General Public License for more details.
14 : !
15 : ! You should have received a copy of the GNU Lesser General Public License
16 : ! along with this program. If not, see <https://www.gnu.org/licenses/>.
17 : !
18 : ! ***********************************************************************
19 :
20 : module op_load_master
21 :
22 : use const_def, only: dp
23 :
24 : implicit none
25 :
26 : private
27 : public :: load_op_master
28 :
29 : logical :: loaded_op_master = .false.
30 :
31 : contains
32 :
33 0 : subroutine load_op_master(emesh_data_for_op_mono_path, iz, ite, jne, epatom, amamu, sig, eumesh, ierr)
34 :
35 : character(len=*), intent(in) :: emesh_data_for_op_mono_path
36 :
37 : integer, intent(inout) :: ierr
38 : integer, pointer, intent(out) :: iz(:), ite(:), jne(:)
39 : real(dp), pointer, intent(out) :: sig(:, :, :)
40 : real(dp), pointer, intent(out):: epatom(:, :), amamu(:), eumesh(:, :, :)
41 :
42 : integer :: n, m, ke
43 : CHARACTER(LEN=72) :: FMT
44 : integer :: nel, nptot, np
45 : parameter(nel=17, nptot=10000, np=1648) ! number of elements and number of u-mesh points
46 0 : real(dp), allocatable :: amamu_f(:, :)
47 0 : integer, allocatable :: iz_f(:, :)
48 :
49 0 : if (loaded_op_master) return
50 :
51 0 : allocate (iz_f(nel, np), iz(nel), ite(np), jne(np), stat=ierr)
52 0 : allocate (sig(nel, np, nptot), stat=ierr)
53 0 : allocate (epatom(nel, np), amamu_f(nel, np), amamu(nel), eumesh(nel, np, nptot), stat=ierr)
54 :
55 0 : FMT = '(i2,1x,i3,1x,i3,1x,F14.10,1x,F14.10,10000(1x,E12.6E3),10000(1x,E13.6E3))'
56 :
57 0 : write (*, *) 'Opening file...'
58 0 : open (1, file=emesh_data_for_op_mono_path, form='formatted', action='read')
59 0 : write (*, *) 'Loading OP mono data...'
60 :
61 0 : do ke = 1, nel
62 0 : do n = 1, np
63 0 : read (1, FMT)iz_f(ke,n),ite(n),jne(n),epatom(ke,n),amamu_f(ke,n),(sig(ke,n,m), m=1,nptot),(eumesh(ke,n,m), m=1,nptot)
64 : end do
65 : end do
66 :
67 0 : close (1)
68 :
69 0 : do ke = 1, nel
70 0 : amamu(ke) = amamu_f(ke, 1)
71 0 : iz(ke) = iz_f(ke, 1)
72 : end do
73 :
74 0 : write (*, *) 'OP mono data loaded.'
75 0 : ierr = 0
76 0 : loaded_op_master = .true.
77 :
78 0 : end subroutine load_op_master
79 :
80 : end module op_load_master
|