Skip to content

Commit

Permalink
Merge pull request #19 from benmagruder/bugfix
Browse files Browse the repository at this point in the history
Fixed bug that gives pressure=NaN when a species has phi=0
  • Loading branch information
dmorse committed May 4, 2022
2 parents b9409d7 + 48d9f7f commit c01e82f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/scf_mod.fp.f90
Original file line number Diff line number Diff line change
Expand Up @@ -872,10 +872,14 @@ subroutine free_energy(N, rho, omega, phi_chain, mu_chain, &
if (present(pressure)) then
pressure = -f_Helmholtz
do i = 1, N_chain
pressure = pressure + mu_chain(i)*phi_chain(i)/chain_length(i)
if ( phi_chain(i) > 1.0E-8) then
pressure = pressure + mu_chain(i)*phi_chain(i)/chain_length(i)
end if
end do
do i = 1, N_solvent
pressure = pressure + mu_solvent(i)*phi_solvent(i)/solvent_size(i)
if ( phi_solvent(i) > 1.0E-8) then
pressure = pressure + mu_solvent(i)*phi_solvent(i)/solvent_size(i)
end if
end do
end if

Expand Down

0 comments on commit c01e82f

Please sign in to comment.