37 INTEGER :: nbuffer = 0
39 INTEGER :: nstored = 0
40 INTEGER :: last_status = 0
41 LOGICAL :: last_restart = .false.
42 LOGICAL :: use_combined_fock = .false.
43 REAL(kind=
dp) :: last_objective = 0.0_dp
45 REAL(kind=
dp) :: last_old_fock_weight = 0.0_dp
46 REAL(kind=
dp) :: diis_weight = 0.0_dp
47 TYPE(
dbcsr_p_type),
DIMENSION(:, :, :),
POINTER :: density => null()
49 TYPE(
dbcsr_p_type),
DIMENSION(:, :),
POINTER :: combined_fock => null()
50 INTEGER,
DIMENSION(:),
ALLOCATABLE :: generation
51 REAL(kind=
dp),
DIMENSION(:, :),
ALLOCATABLE :: pf_metric
52 REAL(kind=
dp),
DIMENSION(:),
ALLOCATABLE :: coefficients, state_energy
54 REAL(
dp),
ALLOCATABLE :: density_aux(:, :, :), fock_aux(:, :, :), combined_aux(:, :)
67 INTEGER,
INTENT(IN) :: nbuffer
69 buffer%nbuffer = max(nbuffer, 0)
72 buffer%last_status = 0
73 buffer%last_restart = .false.
74 buffer%use_combined_fock = .false.
75 buffer%last_objective = 0.0_dp
76 buffer%last_old_fock_weight = 0.0_dp
77 buffer%diis_weight = 0.0_dp
78 NULLIFY (buffer%density, buffer%fock, buffer%combined_fock)
92 buffer%last_status = 0
93 buffer%last_restart = .false.
94 buffer%use_combined_fock = .false.
95 buffer%last_objective = 0.0_dp
96 buffer%last_old_fock_weight = 0.0_dp
97 buffer%diis_weight = 0.0_dp
98 IF (
ALLOCATED(buffer%generation)) buffer%generation = 0
99 IF (
ALLOCATED(buffer%pf_metric)) buffer%pf_metric = 0.0_dp
100 IF (
ALLOCATED(buffer%coefficients)) buffer%coefficients = 0.0_dp
101 IF (
ALLOCATED(buffer%state_energy)) buffer%state_energy = huge(1.0_dp)
113 INTEGER :: icell, islot, ispin
115 IF (
ASSOCIATED(buffer%density))
THEN
116 DO icell = 1,
SIZE(buffer%density, 3)
117 DO ispin = 1,
SIZE(buffer%density, 2)
118 DO islot = 1,
SIZE(buffer%density, 1)
119 IF (
ASSOCIATED(buffer%density(islot, ispin, icell)%matrix))
THEN
125 DEALLOCATE (buffer%density)
128 IF (
ASSOCIATED(buffer%fock))
THEN
129 DO icell = 1,
SIZE(buffer%fock, 3)
130 DO ispin = 1,
SIZE(buffer%fock, 2)
131 DO islot = 1,
SIZE(buffer%fock, 1)
132 IF (
ASSOCIATED(buffer%fock(islot, ispin, icell)%matrix))
THEN
138 DEALLOCATE (buffer%fock)
141 IF (
ASSOCIATED(buffer%combined_fock))
THEN
142 DO icell = 1,
SIZE(buffer%combined_fock, 2)
143 DO ispin = 1,
SIZE(buffer%combined_fock, 1)
144 IF (
ASSOCIATED(buffer%combined_fock(ispin, icell)%matrix))
THEN
149 DEALLOCATE (buffer%combined_fock)
152 IF (
ALLOCATED(buffer%generation))
DEALLOCATE (buffer%generation)
153 IF (
ALLOCATED(buffer%pf_metric))
DEALLOCATE (buffer%pf_metric)
154 IF (
ALLOCATED(buffer%coefficients))
DEALLOCATE (buffer%coefficients)
155 IF (
ALLOCATED(buffer%state_energy))
DEALLOCATE (buffer%state_energy)
156 IF (
ALLOCATED(buffer%density_aux))
DEALLOCATE (buffer%density_aux, buffer%fock_aux, buffer%combined_aux)