114 |
|
integer :: alloc_stat |
115 |
|
integer :: current |
116 |
|
integer,pointer :: Matchlist(:) => null() |
117 |
< |
type (EAMtype), pointer :: makeEamtype => null() |
117 |
> |
|
118 |
|
status = 0 |
119 |
|
|
120 |
+ |
write(*,*) "Adding new eamtype: ",eam_ident |
121 |
|
!! Assume that atypes has already been set and get the total number of types in atypes |
122 |
|
!! Also assume that every member of atypes is a EAM model. |
123 |
|
|
133 |
|
current = EAMList%currentAddition |
134 |
|
|
135 |
|
|
136 |
< |
call allocate_EAMType(eam_nrho,eam_nr,makeEamtype,stat=alloc_stat) |
136 |
> |
call allocate_EAMType(eam_nrho,eam_nr,EAMList%EAMParams(current),stat=alloc_stat) |
137 |
|
if (alloc_stat /= 0) then |
138 |
|
status = -1 |
139 |
|
return |
140 |
|
end if |
140 |
– |
makeEamtype => EAMList%EAMParams(current) |
141 |
|
|
142 |
|
! this is a possible bug, we assume a correspondence between the vector atypes and |
143 |
|
! EAMAtypes |
147 |
|
EAMList%EAMParams(current)%eam_nrho = eam_nrho |
148 |
|
EAMList%EAMParams(current)%eam_drho = eam_drho |
149 |
|
EAMList%EAMParams(current)%eam_nr = eam_nr |
150 |
+ |
EAMList%EAMParams(current)%eam_dr = eam_dr |
151 |
|
EAMList%EAMParams(current)%eam_rcut = rcut |
152 |
|
EAMList%EAMParams(current)%eam_Z_r = eam_Z_r |
153 |
|
EAMList%EAMParams(current)%eam_rho_r = eam_rho_r |
164 |
|
integer :: alloc_stat |
165 |
|
integer :: number_r, number_rho |
166 |
|
|
167 |
+ |
if (EAMList%currentAddition == 0) then |
168 |
+ |
call handleError("init_EAM_FF","No members in EAMList") |
169 |
+ |
status = -1 |
170 |
+ |
return |
171 |
+ |
end if |
172 |
|
|
173 |
|
|
174 |
+ |
|
175 |
|
do i = 1, EAMList%currentAddition |
169 |
– |
|
170 |
– |
EAMList%EAMParams(i)%eam_rvals(1:EAMList%EAMParams(i)%eam_nr) = & |
171 |
– |
real(EAMList%EAMParams(i)%eam_nr,kind=dp)* & |
172 |
– |
EAMList%EAMParams(i)%eam_dr |
176 |
|
|
177 |
< |
EAMList%EAMParams(i)%eam_rhovals(1:EAMList%EAMParams(i)%eam_nrho) = & |
175 |
< |
real(EAMList%EAMParams(i)%eam_nrho,kind=dp)* & |
176 |
< |
EAMList%EAMParams(i)%eam_drho |
177 |
> |
! Build array of r values |
178 |
|
|
179 |
+ |
do j = 1,EAMList%EAMParams(i)%eam_nr |
180 |
+ |
EAMList%EAMParams(i)%eam_rvals(j) = & |
181 |
+ |
real(j-1,kind=dp)* & |
182 |
+ |
EAMList%EAMParams(i)%eam_dr |
183 |
+ |
end do |
184 |
+ |
! Build array of rho values |
185 |
+ |
do j = 1,EAMList%EAMParams(i)%eam_nrho |
186 |
+ |
EAMList%EAMParams(i)%eam_rhovals(j) = & |
187 |
+ |
real(j-1,kind=dp)* & |
188 |
+ |
EAMList%EAMParams(i)%eam_drho |
189 |
+ |
end do |
190 |
|
! convert from eV to kcal / mol: |
191 |
|
EAMList%EAMParams(i)%eam_F_rho = EAMList%EAMParams(i)%eam_F_rho * 23.06054E0_DP |
192 |
|
|
193 |
|
! precompute the pair potential and get it into kcal / mol: |
194 |
< |
EAMList%EAMParams(i)%eam_phi_r = 0.0E0_DP |
194 |
> |
EAMList%EAMParams(i)%eam_phi_r(1) = 0.0E0_DP |
195 |
|
do j = 2, EAMList%EAMParams(i)%eam_nr |
196 |
|
EAMList%EAMParams(i)%eam_phi_r(j) = (EAMList%EAMParams(i)%eam_Z_r(j)**2)/EAMList%EAMParams(i)%eam_rvals(j) |
197 |
|
EAMList%EAMParams(i)%eam_phi_r(j) = EAMList%EAMParams(i)%eam_phi_r(j)*331.999296E0_DP |
198 |
|
enddo |
199 |
|
end do |
200 |
+ |
|
201 |
|
|
202 |
|
do i = 1, EAMList%currentAddition |
203 |
|
number_r = EAMList%EAMParams(i)%eam_nr |
220 |
|
EAMList%EAMParams(i)%eam_phi_r_pp, & |
221 |
|
0.0E0_DP, 0.0E0_DP, 'N') |
222 |
|
enddo |
223 |
< |
|
223 |
> |
|
224 |
> |
|
225 |
|
current_rcut_max = EAMList%EAMParams(1)%eam_rcut |
226 |
|
!! find the smallest rcut for any eam atype |
227 |
|
do i = 2, EAMList%currentAddition |
385 |
|
subroutine allocate_EAMType(eam_n_rho,eam_n_r,thisEAMType,stat) |
386 |
|
integer, intent(in) :: eam_n_rho |
387 |
|
integer, intent(in) :: eam_n_r |
388 |
< |
type (EAMType), pointer :: thisEAMType |
388 |
> |
type (EAMType) :: thisEAMType |
389 |
|
integer, optional :: stat |
390 |
|
integer :: alloc_stat |
391 |
|
|