-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain_jon.f90
157 lines (108 loc) · 5.47 KB
/
main_jon.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
156
157
program main
use read_write
use pair_dist
use mod_check_min
use mod_angles
use options_main
implicit none
integer :: natoms, bins
integer, dimension(:), allocatable :: numIons, atomtype
real*8, dimension(:,:), allocatable :: coor
real*8 :: rmax, V_mean
integer :: N_species, N_file
integer, allocatable :: neighbor_list(:,:,:,:), N_neighbor(:,:), &
neighbor_order_list(:,:,:), &
cont_pdf(:,:,:), cont_adf(:,:,:), &
mat_neighbor(:,:), mat_pairs(:,:)
real*8, allocatable :: mat_rcut(:,:), mat_pdf(:,:,:,:), mat_adf(:,:,:,:), &
tot_pdf(:,:,:), tot_pdf_compute_neigh(:,:,:), &
contribution_pdf(:,:,:,:), contribution_adf(:,:,:,:), tot_adf(:,:,:), &
mean_pdf(:,:,:), sigma_pdf(:,:,:), mean_adf(:,:,:), sigma_adf(:,:,:)
character(len=2), allocatable :: species(:)
character(13) :: trjfile
logical :: compute_first_neighbor, plot_results, compute_deviations, check_constraints
integer :: ext
real*8 :: max_sigma_angle
integer :: inunit, outunit
open(unit = 1, action = "read", status = "old", file = "input")
read(1,*) trjfile
read(1,*) N_species
allocate(species(N_species))
read(1,*) species(:)
read(1,*) rmax
read(1,*) bins
read(1,*) ext
read(1,*)
read(1,*) compute_first_neighbor
read(1,*) plot_results
read(1,*) compute_deviations
read(1,*)
read(1,*) check_constraints
read(1,*) max_sigma_angle
close(unit = 1)
species = (/ "Si", "O " /)
inunit = 123
outunit = 234
call atom_number(trjfile,natoms)
allocate(coor(natoms,3),atomtype(natoms), numions(N_species), N_neighbor(natoms,N_species))
allocate(mat_neighbor(N_species, N_species),mat_rcut(N_species, N_species))
if (.not. check_constraints) then
! 1. READ TRAJECTORY AND COMPUTE RADIAL DISTRIBUTION FUNCTIONS
! ------------------------------------------------------------
open(unit=inunit,file=trjfile,status='old',action='read')
open(unit=outunit,file="output",status='replace',action='write')
!print*, "0"
if (compute_first_neighbor) then
mat_neighbor = 0
mat_rcut = 0.0
allocate(tot_pdf_compute_neigh(N_species,N_species,bins))
call get_mat_rcut_neighbor(inunit, outunit, natoms, N_species, bins, Rmax, &
N_file, mat_neighbor, mat_rcut, tot_pdf_compute_neigh)
else
call get_N_file(inunit, outunit, natoms, N_file)
mat_neighbor = 6
!mat_pairs = 15
endif
!print*, "1"
! ------------------------------------------------------------
! 3. READ FIRST CONFIGURATION AND GET THE NEIGHBOR TAGS
! ------------------------------------------------------------
call get_neighbor_tags ( inunit, outunit, natoms, N_species, bins, ext, rmax, mat_neighbor, &
neighbor_order_list, mat_pdf, tot_pdf, contribution_pdf, cont_pdf, &
mat_adf, tot_adf, contribution_adf, cont_adf, &
numIons, atomtype )
!print*, "2"
! ------------------------------------------------------------
! 4. READ TRAJECTORY AND COMPUTE THE DISTRIBUTION OF EACH ANGLE
! ------------------------------------------------------------
call get_distributions_dist_angles ( inunit, outunit, N_file, natoms, N_species, bins, ext, rmax, mat_neighbor, &
neighbor_order_list, mat_pdf, tot_pdf, contribution_pdf, cont_pdf, &
mat_adf, tot_adf, contribution_adf, cont_adf, V_mean )
! ------------------------------------------------------------
!print*, "3"
! 5. COMPUTE THE STANDAR DEVIATION OF EACH RADIAL AND ANGLE DISTRIBUTION
! ------------------------------------------------------------
if (compute_deviations) then
call get_deviation_each_dist_angle(outunit, natoms, N_species, atomtype, numions, rmax, V_mean, ext, mat_neighbor, &
mat_pdf, mat_adf, sigma_pdf, sigma_adf)
endif
! ------------------------------------------------------------
!print*, "4"
call total_pdf(ext, V_mean, N_file, rmax, mat_pdf, mat_neighbor, neighbor_list, &
atomtype, numIons, contribution_pdf, tot_pdf, cont_pdf)
call total_adf(ext, mat_adf, mat_neighbor, neighbor_list, atomtype, numIons, contribution_adf, tot_adf, cont_adf)
call get_deviation_contribution(outunit, natoms, N_species, numions, rmax, V_mean, ext, mat_neighbor, &
contribution_pdf, contribution_adf)
call dist_distr2pdf(ext, natoms, N_species, mat_neighbor, rmax, V_mean, numions, atomtype, contribution_pdf, tot_pdf)
if (compute_first_neighbor) then
call write_plot_contribution_total(outunit, N_species, mat_neighbor, ext, rmax, V_mean, numions, plot_results, &
contribution_pdf, tot_pdf_compute_neigh, contribution_adf, tot_adf)
else
call write_plot_contribution_total(outunit, N_species, mat_neighbor, ext, rmax, V_mean, numions, plot_results, &
contribution_pdf, tot_pdf, contribution_adf, tot_adf)
endif
close(unit=outunit)
else
call compute_number_constraints(max_sigma_angle)
endif
end program