write_local_spin_stats Subroutine

public subroutine write_local_spin_stats(initial)

Arguments

Type IntentOptional Attributes Name
logical, intent(in), optional :: initial

Contents


Source Code

    subroutine write_local_spin_stats(initial)
        logical, intent(in), optional :: initial

        type(write_state_t), save :: state
        logical, save :: inited = .false.
        integer :: i

        if (present(initial)) then
            state%init = initial
        else
            state%init = .false.
        end if

        if (iProcIndex == root .and. .not. inited) then
            state%funit = get_free_unit()
            call init_local_spin_output(state%funit)
            inited = .true.
        end if

        if (iProcIndex == root) then
            if (state%init .or. state%prepend) then
                write(state%funit, '("#")', advance='no')
                state%prepend = state%init

            elseif (.not. state%prepend) then
                write(state%funit, '(" ")', advance = 'no')
            end if

            state%cols = 0
            state%cols_mc = 0
            state%mc_out = tMCOutput

            call stats_out(state, .false., iter + PreviousCycles, 'Iter.')
            do i = 1, nSpatOrbs
                call stats_out(state, .false., all_local_spin(i) / &
                    (real(StepsSft,dp) * sum(all_norm_psi_squared) / real(inum_runs, dp)), 'Local Spin')
            end do


            write(state%funit, *)
            call neci_flush(state%funit)
        end if

    end subroutine write_local_spin_stats