Skip to content

Commit

Permalink
Rename orbital to medium
Browse files Browse the repository at this point in the history
  • Loading branch information
numaryu committed Nov 27, 2024
1 parent d6121b5 commit 971d228
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 43 deletions.
74 changes: 37 additions & 37 deletions src/class_orbital.f90
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
module class_orbital
module class_medium
implicit none
private

public :: orbital
public :: medium

type orbital
type medium
private
! name of medium
character (len=100), public :: name = 'unknown'
Expand Down Expand Up @@ -59,43 +59,43 @@ module class_orbital
procedure :: calculate_stopping_power
procedure :: calculate_degradation
procedure :: calculate_yield
end type orbital
end type medium

! declare constructor
interface orbital
module procedure init_orbital
end interface orbital
interface medium
module procedure init_medium
end interface medium

contains

type(orbital) function init_orbital(norbital, name, file_medium, number_density)
type(medium) function init_medium(norbital, name, file_medium, number_density)
integer, intent(in) :: norbital
character (len=*), intent(in) :: name
character (len=*), intent(in) :: file_medium
real, intent(in) :: number_density

init_orbital%number = norbital
init_orbital%name = name
init_orbital%number_density = number_density

if (.not.associated(init_orbital%energy_ionize)) allocate(init_orbital%energy_ionize(norbital))
if (.not.associated(init_orbital%energy_kinetic)) allocate(init_orbital%energy_kinetic(norbital))
if (.not.associated(init_orbital%energy_singlet)) allocate(init_orbital%energy_singlet(norbital))
if (.not.associated(init_orbital%energy_triplet)) allocate(init_orbital%energy_triplet(norbital))
if (.not.associated(init_orbital%number_electrons)) allocate(init_orbital%number_electrons(norbital))

if (.not.associated(init_orbital%yield_ionize)) allocate(init_orbital%yield_ionize(norbital))
if (.not.associated(init_orbital%gvalue_ionize)) allocate(init_orbital%gvalue_ionize(norbital))
if (.not.associated(init_orbital%yield_singlet)) allocate(init_orbital%yield_singlet(norbital))
if (.not.associated(init_orbital%gvalue_singlet)) allocate(init_orbital%gvalue_singlet(norbital))
if (.not.associated(init_orbital%yield_triplet)) allocate(init_orbital%yield_triplet(norbital))
if (.not.associated(init_orbital%gvalue_triplet)) allocate(init_orbital%gvalue_triplet(norbital))

call read_params(init_orbital, norbital, file_medium)
end function init_orbital
init_medium%number = norbital
init_medium%name = name
init_medium%number_density = number_density

if (.not.associated(init_medium%energy_ionize)) allocate(init_medium%energy_ionize(norbital))
if (.not.associated(init_medium%energy_kinetic)) allocate(init_medium%energy_kinetic(norbital))
if (.not.associated(init_medium%energy_singlet)) allocate(init_medium%energy_singlet(norbital))
if (.not.associated(init_medium%energy_triplet)) allocate(init_medium%energy_triplet(norbital))
if (.not.associated(init_medium%number_electrons)) allocate(init_medium%number_electrons(norbital))

if (.not.associated(init_medium%yield_ionize)) allocate(init_medium%yield_ionize(norbital))
if (.not.associated(init_medium%gvalue_ionize)) allocate(init_medium%gvalue_ionize(norbital))
if (.not.associated(init_medium%yield_singlet)) allocate(init_medium%yield_singlet(norbital))
if (.not.associated(init_medium%gvalue_singlet)) allocate(init_medium%gvalue_singlet(norbital))
if (.not.associated(init_medium%yield_triplet)) allocate(init_medium%yield_triplet(norbital))
if (.not.associated(init_medium%gvalue_triplet)) allocate(init_medium%gvalue_triplet(norbital))

call read_params(init_medium, norbital, file_medium)
end function init_medium

subroutine destroy(self)
type(orbital), intent(in out) :: self
type(medium), intent(in out) :: self
if (associated(self%energy_ionize)) nullify(self%energy_ionize)
if (associated(self%energy_kinetic)) nullify(self%energy_kinetic)
if (associated(self%energy_singlet)) nullify(self%energy_singlet)
Expand All @@ -114,7 +114,7 @@ end subroutine destroy

subroutine read_params(self, norbital, file)
use mod_file_utils, only: get_unused_unit
class(orbital) :: self
class(medium) :: self
integer, intent(in) :: norbital
character (len=*), intent(in) :: file

Expand Down Expand Up @@ -142,7 +142,7 @@ subroutine read_params(self, norbital, file)
end subroutine read_params

subroutine init_orbital_vars(self, ngrid, ngeneration)
class(orbital) :: self
class(medium) :: self
integer, intent(in) :: ngrid, ngeneration
if (.not.associated(self%stop_power_orbital)) allocate(self%stop_power_orbital(self%number, ngrid))
self%stop_power_orbital = 0.0
Expand Down Expand Up @@ -195,7 +195,7 @@ subroutine init_orbital_vars(self, ngrid, ngeneration)
end subroutine init_orbital_vars

subroutine finish_orbital_vars(self)
class(orbital) :: self
class(medium) :: self
if (associated(self%stop_power_orbital)) nullify(self%stop_power_orbital)
if (associated(self%stop_power)) nullify(self%stop_power)

Expand Down Expand Up @@ -225,7 +225,7 @@ end subroutine finish_orbital_vars

subroutine calculate_stopping_power(self, egrid)
use class_grid, only: grid
class(orbital) :: self
class(medium) :: self
class(grid), intent(in) :: egrid
integer :: io, ie
integer :: ne1, ne2, ne3
Expand Down Expand Up @@ -279,7 +279,7 @@ subroutine calculate_stopping_power(self, egrid)
end subroutine calculate_stopping_power

real function integrate_E_sigma(self, type, io, energy, range_min, range_max)
class(orbital) :: self
class(medium) :: self
character (len=*) :: type
integer, intent(in) :: io
real, intent(in) :: energy
Expand Down Expand Up @@ -363,7 +363,7 @@ recursive subroutine calculate_degradation(self, egrid, mediamix, ngen)
use mod_constants, only: bb
use class_grid, only: grid
use class_mixture, only: mixture
class(orbital) :: self
class(medium) :: self
class(grid), intent(in) :: egrid
class(mixture), intent(in) :: mediamix
integer, intent(in) :: ngen
Expand Down Expand Up @@ -441,7 +441,7 @@ end subroutine calculate_degradation
subroutine calculate_yield(self, egrid, mediamix)
use class_grid, only: grid
use class_mixture, only: mixture
class(orbital) :: self
class(medium) :: self
class(grid), intent(in) :: egrid
class(mixture), intent(in) :: mediamix
integer :: io, ie
Expand Down Expand Up @@ -584,7 +584,7 @@ subroutine calculate_yield(self, egrid, mediamix)
end subroutine calculate_yield

real function integrate_sigma(self, type, io, energy, range_min, range_max)
class(orbital) :: self
class(medium) :: self
character (len=*) :: type
integer, intent(in) :: io
real, intent(in) :: energy
Expand Down Expand Up @@ -660,4 +660,4 @@ end function indefinite_sigma_Eexc

end function integrate_sigma

end module class_orbital
end module class_medium
12 changes: 6 additions & 6 deletions src/class_work.f90
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module class_work
use class_orbital, only: orbital
use class_medium, only: medium
use class_grid, only: grid
use class_mixture, only: mixture
implicit none
Expand All @@ -20,7 +20,7 @@ module class_work
type subwork
character (len=100) :: name
integer :: nmedia, ngeneration
type(orbital), pointer :: medium(:) => null()
type(medium), pointer :: medium(:) => null()
type(grid) :: egrid
type(mixture) :: mediamix
end type subwork
Expand Down Expand Up @@ -131,13 +131,13 @@ subroutine init_subwork(worker)
worker%nmedia = nmedia
if (.not.associated(worker%medium)) allocate(worker%medium(nmedia))

call init_orbital(worker)
call init_medium(worker)
call init_grid(worker)
call init_mixture(worker)

end subroutine init_subwork

subroutine init_orbital(worker)
subroutine init_medium(worker)
use mod_file_utils, only: get_unused_unit, unit_stdin, unit_stdout
type(subwork), intent(in out) :: worker
integer :: unit
Expand Down Expand Up @@ -172,11 +172,11 @@ subroutine init_orbital(worker)
close(unit)
write(unit_stdout, param_orbital)

worker%medium(imedia) = orbital(norbital, name, &
worker%medium(imedia) = medium(norbital, name, &
file_medium(imedia), number_density(imedia))
end do

end subroutine init_orbital
end subroutine init_medium

subroutine init_grid(worker)
use mod_file_utils, only: get_unused_unit, unit_stdin, unit_stdout
Expand Down

0 comments on commit 971d228

Please sign in to comment.