Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions source/mixture.f90
Original file line number Diff line number Diff line change
Expand Up @@ -728,6 +728,8 @@ subroutine mixture_get_valence(self, vm, vp)
! Loop over the species
vm = 0.0d0; vp = 0.0d0
do i = 1, ne
! "E" is a pseudo-element used for ionized bookkeeping, not a real atom.
if (self%element_names(i) == 'E') cycle
v = get_atom_valence(self%element_names(i))
if (v < 0.0d0) then
vm(i) = vm(i) + v
Expand Down
17 changes: 17 additions & 0 deletions source/mixture_test.pf
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,23 @@ contains

end subroutine

@test
subroutine test_get_valence_ignores_electron
type(Mixture) :: mix
real(dp) :: vm(2), vp(2)
real(dp), parameter :: tol = 1.d-14

mix = Mixture(all_thermo, ['N2 ', 'N2+', 'N ', 'N+ ', 'e- '], ions=.true.)
call mix%get_valence(vm, vp)

@assertEqual('N', mix%element_names(1))
@assertEqual('E', mix%element_names(2))
@assertTrue(abs(vm(1)) <= tol)
@assertTrue(abs(vp(1)) <= tol)
@assertTrue(abs(vm(2)) <= tol)
@assertTrue(abs(vp(2)) <= tol)
end subroutine

@test
subroutine test_sort_condensed

Expand Down
Loading