update_reference_space Subroutine

public subroutine update_reference_space(tPopPresent)

Arguments

Type IntentOptional Attributes Name
logical, intent(in) :: tPopPresent

Contents


Source Code

    subroutine update_reference_space(tPopPresent)
        use adi_data, only: tReadRefs
        use LoggingData, only: ref_filename
        implicit none
        logical, intent(in) :: tPopPresent
        integer :: nRead
        logical :: tGen

        if (tAdiActive) then
            ! If we actually did something
            tGen = .false.
            ! First, generate the reference space of nRefs determinants from the population (if present)
            if (tPopPresent) then
                call generate_ref_space()
                tGen = .true.
                if (.not. tReadRefs) &
                    call print_reference_notification(1, nRefs, "Superinitiators from population")
            end if

            if (tReadRefs) then
                ! Then, add the references from the file
                call read_in_refs(ref_filename, nRead)
                ! If we added references, note this (this means that the nRefs was not
                ! specified and is taken from the file)
                if (nRead > nRefs) nRefs = nRead
                tGen = .true.

                ! Print the read-in references
                call print_reference_notification(1, nRead, "Read in superinitiators")
                call print_reference_notification(nRead + 1, nRefs, "Superinitiators from population")
            end if
            ! Then, add the product references
            if (.not. tGen) then
                ! If we did not do anything, only take one reference
                call reallocate_ilutRefAdi(1)
                ilutRefAdi(:, 1) = ilutRef(:, 1)
                nRefs = 1
                call print_reference_notification(1, 1, &
                                                  "Using only the reference determinant as superinitiator")
            end if

            call fill_adi_caches()

            if (nRefs > 0) tSetupSIs = .true.
            tReferenceChanged = .true.
            call reset_coherence_counter()
        end if

    end subroutine update_reference_space