-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathm_init.f90
143 lines (124 loc) · 2.89 KB
/
m_init.f90
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
!---------------------------------------------------------------------------
! MELQUIADES: Metropolis Monte Carlo Program !
!---------------------------------------------------------------------------
!bop
!
! !Module: m_init
!
! !Description: This module contains routines for initializing the variables
!and activating the Linked-Cell List
!\\
!\\
! !Interface:
!
module m_init
!
! !Uses:
!
use m_kind
use m_simtype
use m_boxtype
use m_constants
use m_cutoffs
use m_cells
use m_precells
use m_zeros
use m_longs
use m_unit ! Unit to average file
implicit none
!
! !Public member functions:
!
public :: r_thermo
!
! !Revision history:
! 06Aug 2015 Asdrubal Lozada
!
!eop
!----------------------------------------------------------------------
contains
!
!bop
!
! !Iroutine: r_thermo
!
! !Description: This routine modifies the thermodynamic
!parameters to an appropiate scale and initializes the Linked-Cells List.
!\\
!\\
! !Interface:
!
subroutine r_thermo( edge, t, y, x)
implicit none
!
! !Input parameters:
!
type(simulation), intent(inout) :: y
type(box), pointer :: x
type(temporary), intent(inout) :: t
real(rkind), dimension(:), intent(out) :: edge
real(rkind) :: one
character(len=30) :: rkval
!
! !Revision history:
! 06Aug 2015 Asdrubal Lozada
! 02Nov 2015 Asdrubal Lozada
!
!eop
!----------------------------------------------------------------------
! Local variables
integer :: i
y%m_vol = x%m_edge(1) * x%m_edge(2) * x%m_edge(3)
y%m_voli = 1.0_rkind / y%m_vol
y%m_dens = real(y%m_mxmol,rkind) * y%m_voli
y%m_weight = 0.0_rkind
do i = 1, y%m_ntf
y%m_weight = y%m_weight + real(x%m_mass(i)*x%m_nmol(i),rkind)
end do
y%m_densi = (y%m_weight * y%m_voli) * d_con
!
write(rkval,'(e20.14)') y%m_densi
write(*,'(" Initial density : ",a20," g/cm**3 ")') adjustl(rkval)
!
!
!boc
y%m_temper = y%m_temper + c_k
y%m_beta = 1.0_rkind / (kB * y%m_temper)
y%m_ppcon = y%m_press * pv_conv
!eoc
edge(1) = x%m_edge(1)
edge(2) = x%m_edge(2)
edge(3) = x%m_edge(3)
call r_cuts( y, x )
call r_long ( y, x )
call r_neighs( y )
call r_intcell( y, x )
if(.not.y%m_solute) then
call r_headinit( y, x )
call r_linkscell( y, x )
end if
if( y%m_solute ) then
call r_headinit2( y, x )
call r_linkscell2( y, x )
call r_headinit3( y, x )
call r_linkscell3( y, x )
end if
call r_cero( t )
!-------------
! Open file to average
if( y%m_averag ) then
open(inaver, file='average', status='unknown', form='formatted')
read(inaver,'(a)')
read(inaver,*) y%m_eold
close(inaver)
end if
! Open file to correlation
if( y%m_corr ) then
open(incorr,file='correlation',status='unknown', form='formatted')
read(incorr,'(a)')
read(incorr,*) y%m_varold
close(incorr)
end if
!-------------
end subroutine r_thermo
end module m_init