diff --git a/scripts/generate_h_apply.py b/scripts/generate_h_apply.py index 4c0401c9..9ac2f817 100755 --- a/scripts/generate_h_apply.py +++ b/scripts/generate_h_apply.py @@ -93,7 +93,9 @@ class H_apply(object): """ s["size_max"] = str(1024*128) - s["copy_buffer"] = "call copy_h_apply_buffer_to_wf" + s["copy_buffer"] = """call copy_H_apply_buffer_to_wf + SOFT_TOUCH psi_det psi_coef N_det +""" s["printout_now"] = """write(output_Dets,*) & 100.*float(i_generator)/float(N_det_generators), '% in ', wall_1-wall_0, 's'""" self.data = s @@ -216,7 +218,8 @@ class H_apply(object): self.data["params_post"] += ", select_max(min(i_generator,size(select_max,1)))" self.data["size_max"] = str(1024*128) self.data["copy_buffer"] = """ - call copy_h_apply_buffer_to_wf + call copy_H_apply_buffer_to_wf + SOFT_TOUCH psi_det psi_coef N_det selection_criterion_min = min(selection_criterion_min, maxval(select_max))*0.1d0 selection_criterion = selection_criterion_min call write_double(output_Dets,selection_criterion,'Selection criterion') diff --git a/src/Dets/H_apply.irp.f b/src/Dets/H_apply.irp.f index 72d3dd36..a16698ec 100644 --- a/src/Dets/H_apply.irp.f +++ b/src/Dets/H_apply.irp.f @@ -98,6 +98,7 @@ subroutine copy_H_apply_buffer_to_wf BEGIN_DOC ! Copies the H_apply buffer to psi_coef. You need to touch psi_det, psi_coef and N_det ! after calling this function. +! After calling this subroutine, N_det, psi_det and psi_coef need to be touched END_DOC integer(bit_kind), allocatable :: buffer_det(:,:,:) double precision, allocatable :: buffer_coef(:,:) @@ -173,7 +174,6 @@ subroutine copy_H_apply_buffer_to_wf H_apply_buffer(j)%N_det = 0 !$OMP END PARALLEL call normalize(psi_coef,N_det) - SOFT_TOUCH psi_det psi_coef N_det end diff --git a/src/Dets/H_apply_template.f b/src/Dets/H_apply_template.f index 3a95424c..50cc5434 100644 --- a/src/Dets/H_apply_template.f +++ b/src/Dets/H_apply_template.f @@ -382,6 +382,7 @@ subroutine $subroutine($params_main) nmax = mod( N_det_generators,nproc ) + !$ call omp_init_lock(lck) call start_progress(N_det_generators,'Selection (norm)',0.d0) call wall_time(wall_0) @@ -440,7 +441,6 @@ subroutine $subroutine($params_main) deallocate( mask ) - !$ call omp_init_lock(lck) !$OMP PARALLEL DEFAULT(SHARED) & !$OMP PRIVATE(i_generator,wall_1,wall_0,ispin,k,mask,iproc) call wall_time(wall_0) diff --git a/src/Perturbation/selection.irp.f b/src/Perturbation/selection.irp.f index 96f0e876..274e44af 100644 --- a/src/Perturbation/selection.irp.f +++ b/src/Perturbation/selection.irp.f @@ -194,8 +194,19 @@ subroutine make_s2_eigenfunction endif deallocate(d,det_buffer) - call copy_H_apply_buffer_to_wf + double precision :: c(N_states), e_2_pert(N_states), H_pert_diag(N_states) + + call copy_H_apply_buffer_to_wf +! do i=1,N_det +! if (psi_coef(i,1) == 0.d0) then +! call pt2_epstein_nesbet_2x2(psi_det(1,1,i),c,e_2_pert,H_pert_diag,N_int,N_det,N_states) +! do k=1,N_states +! psi_coef(i,k) = c(k) +! enddo +! endif +! enddo + SOFT_TOUCH N_det psi_coef psi_det ! !TODO DEBUG ! do i=1,N_det ! do j=i+1,N_det