-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSCFT_dump.f90
176 lines (103 loc) · 3.19 KB
/
SCFT_dump.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
144
145
146
147
148
149
150
151
152
153
154
155
subroutine SCFT_dump(converge)
USE nrtype,only :DP
USE global_para
USE mpi
USE control
USE constants
USE utility
USE mmpi
USE mpi_fftw3_operation
use wall
!USE fftw !user defined module
implicit none
logical,intent(in) :: converge
integer :: k,aaa,K_i,K_j,K_k
character(len=30)::aa
aaa=myid
write(aa,*) aaa
if(converge) then
if(myid==0) then
open(unit=41,file='error.dat',status='old',position='append')
write(41,*) n_iter,t1,t2
close(41)
open(unit=44,file='FreeEG.dat',status='old',position='append')
write(44,*) n_iter,FE_global,pff_global,tempEE_global
close(44)
open(unit=45,file='result.txt',status='replace')
write(45,*) "FREE_ENERGY",FE_global,pff_global,tempEE_global,fe_wall
write(45,*) "box size",SIDEx*dx,SIDEy*dy,SIDEz*dz
write(45,*) "ava density",density_ava
write(45,*) "converge",converge
close(45)
endif
open(unit=23,file= 'RHO_total' //trim(adjustl(aa)) // '.dat',status='replace')
! write(23,*) "local_x_start=",local_x_start
k=0
do K_i=0,local_nx-1
do k_j=0,SIDEy-1
# if defined (Dim3)
do K_k=0,SIDEz-1
write(23,'(3f10.6,3f12.8)') (K_i+local_x_start)*dx,K_j*dy,K_k*dz,RA(k),RB(k),R_wall_sum(k)
# else /* Dim3 */
write(23,'(2f10.6,3f12.8)') (K_i+local_x_start)*dx,K_j*dy,RA(k),RB(k),R_wall_sum(k)
# endif /* Dim3 */
k=k+1
enddo
enddo
# if defined (Dim3)
enddo
# endif /* Dim3 */
close(23)
else
if(myid==0) then
open(unit=41,file='error.dat',status='old',position='append')
write(41,*) n_iter,t1,t2
close(41)
endif
if(myid==0) then
open(unit=44,file='FreeEG.dat',status='old',position='append')
write(44,*) n_iter,FE_global,pff_global,tempEE_global,fe_wall
write(44,*) "dx,dy,dz",dx,dy,dz
write(44,*) "box size",SIDEx*dx,SIDEy*dy,SIDEz*dz
close(44)
endif
open(unit=23,file= 'RHO_total' //trim(adjustl(aa)) // '.dat',status='replace')
! write(23,*) "local_x_start=",local_x_start
k=0
do K_i=0,local_nx-1
do k_j=0,SIDEy-1
# if defined (Dim3)
do K_k=0,SIDEz-1
write(23,'(3f10.6,3f12.8)') (K_i+local_x_start)*dx,K_j*dy,K_k*dz,RA(k),RB(k),R_wall_sum(k)
# else /* Dim3 */
write(23,'(2f10.6,3f12.8)') (K_i+local_x_start)*dx,K_j*dy,RA(k),RB(k),R_wall_sum(k)
# endif /* Dim3 */
k=k+1
enddo
enddo
# if defined (Dim3)
enddo
# endif /* Dim3 */
close(23)
endif
end subroutine SCFT_dump
subroutine W_dump()
USE nrtype,only :DP
USE global_para
USE mpi
USE control
USE constants
USE utility
USE mmpi
implicit none
integer :: i,j,k,aaa
REAL*8 :: x,y,z
character(len=30)::aa
aaa=myid
write(aa,*) aaa
open(unit=23,file= 'W' //trim(adjustl(aa)) // '.dat',status='replace')
do K=0,LOCAL_SIZE-1
write(23,*) K,WA(K),WB(K)
enddo
close(23)
end subroutine W_dump