avoid division by zero for pair styles meam and meam/c

This commit is contained in:
Axel Kohlmeyer 2018-03-05 14:03:10 -05:00
parent 45555b017d
commit a1bdea1dd8
2 changed files with 18 additions and 6 deletions

View File

@ -72,9 +72,21 @@ c Complete the calculation of density
if( rho0(i) .gt. 0.0 ) then
if (ialloy.eq.1) then
t_ave(1,i) = t_ave(1,i)/tsq_ave(1,i)
t_ave(2,i) = t_ave(2,i)/tsq_ave(2,i)
t_ave(3,i) = t_ave(3,i)/tsq_ave(3,i)
if (tsq_ave(1,i) .ne. 0.0d0) then
t_ave(1,i) = t_ave(1,i)/tsq_ave(1,i)
else
t_ave(1,i) = 0.0d0
endif
if (tsq_ave(2,i) .ne. 0.0d0) then
t_ave(2,i) = t_ave(2,i)/tsq_ave(2,i)
else
t_ave(2,i) = 0.0d0
endif
if (tsq_ave(3,i) .ne. 0.0d0) then
t_ave(3,i) = t_ave(3,i)/tsq_ave(3,i)
else
t_ave(3,i) = 0.0d0
endif
else if (ialloy.eq.2) then
t_ave(1,i) = t1_meam(elti)
t_ave(2,i) = t2_meam(elti)

View File

@ -33,9 +33,9 @@ MEAM::meam_dens_final(int nlocal, int eflag_either, int eflag_global, int eflag_
if (rho0[i] > 0.0) {
if (this->ialloy == 1) {
t_ave[i][0] = t_ave[i][0] / tsq_ave[i][0];
t_ave[i][1] = t_ave[i][1] / tsq_ave[i][1];
t_ave[i][2] = t_ave[i][2] / tsq_ave[i][2];
t_ave[i][0] = (tsq_ave[i][0] != 0.0 ) ? t_ave[i][0] / tsq_ave[i][0] : 0.0;
t_ave[i][1] = (tsq_ave[i][1] != 0.0 ) ? t_ave[i][1] / tsq_ave[i][1] : 0.0;
t_ave[i][0] = (tsq_ave[i][2] != 0.0 ) ? t_ave[i][2] / tsq_ave[i][2] : 0.0;
} else if (this->ialloy == 2) {
t_ave[i][0] = this->t1_meam[elti];
t_ave[i][1] = this->t2_meam[elti];