Find the response of g to delta-fn field perturbations and store at the row level
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(fieldmat_type), | intent(inout) | :: | self | |||
class(pc_type), | intent(in) | :: | pc |
subroutine fm_populate(self, pc)
use run_parameters, only: has_phi, has_apar, has_bpar
use fields_arrays, only: phi, apar, bpar, phinew, aparnew, bparnew
use dist_fn_arrays, only: g
use kt_grids, only: kwork_filter
use array_utils, only: zero_array
implicit none
class(fieldmat_type), intent(inout) :: self
class(pc_type), intent(in) :: pc
integer :: ifl, pts_remain, ik, is
if(self%no_populate) return
!First initialise everything to 0
call zero_array(g)
call zero_array(phi) ; call zero_array(phinew)
call zero_array(apar) ; call zero_array(aparnew)
call zero_array(bpar) ; call zero_array(bparnew)
!Initialise field counter
ifl=0
!Do phi
if(has_phi) then
!Set the number of points left
pts_remain=self%npts-self%nbound
!Increment the field counter
ifl=ifl+1
!Reset the filter array
kwork_filter=.false.
!Reset the init state arrays
self%kyb%initdone=.false.
do ik=1,self%naky
self%kyb(ik)%supercells%initdone=.false.
do is=1,self%kyb(ik)%nsupercell
self%kyb(ik)%supercells(is)%initialised=.false.
enddo
enddo
!Now loop over all points and initialise
do while(pts_remain>0)
call self%init_next_field_points(phinew,pts_remain,kwork_filter,ifl,pc)
enddo
endif
!Do apar
if(has_apar) then
!Set the number of points left
pts_remain=self%npts-self%nbound
!Increment the field counter
ifl=ifl+1
!Reset the filter array
kwork_filter=.false.
!Reset the init state arrays
self%kyb%initdone=.false.
do ik=1,self%naky
self%kyb(ik)%supercells%initdone=.false.
do is=1,self%kyb(ik)%nsupercell
self%kyb(ik)%supercells(is)%initialised=.false.
enddo
enddo
!Now loop over all points and initialise
do while(pts_remain>0)
call self%init_next_field_points(aparnew,pts_remain,kwork_filter,ifl,pc)
enddo
endif
!Do bpar
if(has_bpar) then
!Set the number of points left
pts_remain=self%npts-self%nbound
!Increment the field counter
ifl=ifl+1
!Reset the filter array
kwork_filter=.false.
!Reset the init state arrays
self%kyb%initdone=.false.
do ik=1,self%naky
self%kyb(ik)%supercells%initdone=.false.
do is=1,self%kyb(ik)%nsupercell
self%kyb(ik)%supercells(is)%initialised=.false.
enddo
enddo
!Now loop over all points and initialise
do while(pts_remain>0)
call self%init_next_field_points(bparnew,pts_remain,kwork_filter,ifl,pc)
enddo
endif
!Reset the filter array
kwork_filter=.false.
end subroutine fm_populate