Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
!***********************************************************************
!
!
SUBROUTINE sys_init
!
!
!***********************************************************************
!
!
! Subroutine to initialize the state of the system.
!
!
!=======================================================================
USE fly_h
implicit none
INCLUDE 'mpif.h'
INTEGER :: i
INTEGER*8 :: bnf,nb_mod
REAL(KIND=8) :: c0a,c1a,c0b,c1b
!=======================================================================
! Begin timing.
! -------------
c0b=MPI_WTIME() !initialize time counter for the routine
!-----------------------------------------------------------------------
! Open data files, read input parameters and initial system state,
! and initialize system parameters.
!-----------------------------------------------------------------------
CALL read_params ! reading stat_pars and dyn_pars files !**QUI e' il problema.. ma dove?
!-----------------------------------------------------------------------
! Open out_32.tab file: List of programmed output (in redshift value)
! and initialize system parameters.
!-----------------------------------------------------------------------
CALL read_redsh ! reading out32.tab
!-----------------------------------------------------------------------
! Set the number of bodies locally residing
!-----------------------------------------------------------------------
nb_mod=nbodies
bnf=nb_mod-(nb_mod/npes)*npes !MOD
IF(bnf.EQ.0) THEN
nb_res_loc=nb_mod/npes
ELSE
nb_mod=nb_mod+(npes-bnf)
nb_res_loc=nb_mod/npes
nb_res_loc(npes)=nb_res_loc(npes)-(npes-bnf)
ENDIF
IF(me.eq.0) THEN
write(uterm,*)'--------- Number of local bodies in each PE ---------'
DO i=1,N_PES
write(uterm,100)'PE=',i-1,' Number of Bodies =', nb_res_loc(i)
ENDDO
write(uterm,*)'-----------------------------------------------------'
ENDIF
100 FORMAT(a,I4,a,I9)
!-----------------------------------------------------------------------
! Upload bodies
!-----------------------------------------------------------------------
c0a=MPI_WTIME() !bodies reading timer start
IF(inasc.eq.'A') THEN
IF(me.eq.0) THEN
write(uterm,*)'ASCII DATA INPUT'
call flush(uterm)
ENDIF
CALL read_b_asc !read bodies from ascii file
ENDIF
IF(inasc.eq.'B') THEN
IF(me.eq.0) THEN
write(uterm,*)'BINARY DATA INPUT'
call flush(uterm)
ENDIF
CALL read_b_bin !read bodies from binary file
ENDIF
IF(inasc.eq.'S' .or. inasc.eq.'T'.or.inasc.eq.'R') THEN
IF(me.eq.0) THEN
write(uterm,*)'SIMULATED DATA INPUT'
call flush(uterm)
ENDIF
CALL read_s_bin !simulated input particles
ENDIF
c1a=MPI_WTIME()-c0a !bodies reading timer stop
IF(me.EQ.0) THEN
write(uterm,*)'TIME TO READ BODIES =',c1a
call flush(uterm)
ENDIF
CALL MPI_BARRIER(MPI_COMM_WORLD,ierror)
!-----------------------------------------------------------------------
! Initial parameters configuration
!-----------------------------------------------------------------------
CALL init_pars
!-----------------------------------------------------------------------
! Initial ewald tables configuration
!-----------------------------------------------------------------------
c0a=MPI_WTIME()
CALL init_ew
c1a=MPI_WTIME()-c0a
IF(me.EQ.0) THEN
write(uterm,*)'TIME TO READ EWALD=',c1a
call flush(uterm)
ENDIF
!-----------------------------------------------------------------------
! Leapfrog correct positions.
!-----------------------------------------------------------------------
IF (tstep.EQ.0) CALL init_pos
!-----------------------------------------------------------------------
! Set all body positions in the box.
!-----------------------------------------------------------------------
IF (tstep.EQ.0) call reset_pos
c1b=MPI_WTIME()-c0b
IF(me.EQ.0) THEN
write(uterm,*)'TIME TO INITIALIZE SYSTEM=',c1b
call flush(uterm)
ENDIF
RETURN
END