diff --git a/src/distribution_methods.F b/src/distribution_methods.F index 2f35079945..6fa10da380 100644 --- a/src/distribution_methods.F +++ b/src/distribution_methods.F @@ -118,13 +118,13 @@ CONTAINS nmolecule_kind, nparticle_kind, npe, nsgf, output_unit INTEGER, ALLOCATABLE, DIMENSION(:) :: nmolecule_local, & nparticle_local, work, & - workload, workload_old + workload_count, workload_fill INTEGER, DIMENSION(:), POINTER :: molecule_list LOGICAL :: found, heap_error TYPE(cp_1d_i_p_type), ALLOCATABLE, & DIMENSION(:) :: local_molecule TYPE(cp_logger_type), POINTER :: logger - TYPE(heap_t) :: bin_heap + TYPE(heap_t) :: bin_heap_count, bin_heap_fill TYPE(molecule_kind_type), POINTER :: molecule_kind CALL timeset(routineN,handle) @@ -135,15 +135,15 @@ CONTAINS mype = logger%para_env%mepos + 1 npe = logger%para_env%num_pe - ALLOCATE (workload(npe),STAT=istat) + ALLOCATE (workload_count(npe),STAT=istat) IF (istat /= 0) CALL stop_memory(routineN,moduleN,__LINE__,& "workload",npe*int_size) - workload(:) = 0 + workload_count(:) = 0 - ALLOCATE (workload_old(npe),STAT=istat) + ALLOCATE (workload_fill(npe),STAT=istat) IF (istat /= 0) CALL stop_memory(routineN,moduleN,__LINE__,& "workload_old",npe*int_size) - workload_old(:) = 0 + workload_fill(:) = 0 nmolecule_kind = SIZE(molecule_kind_set) @@ -163,6 +163,24 @@ CONTAINS "nparticle_local",nparticle_kind*int_size) nparticle_local(:) = 0 + nbins=npe + + CALL heap_new (bin_heap_count, nbins, heap_error) + CALL cp_assert (.NOT. heap_error, cp_fatal_level, cp_internal_error,& + routineN, "Error creating heap.", error=error) + CALL heap_fill (bin_heap_count,& + (/(bin,bin=1,nbins)/), workload_count , heap_error) + CALL cp_assert (.NOT. heap_error, cp_fatal_level, cp_internal_error,& + routineN, "Error initially filling the heap.", error=error) + + CALL heap_new (bin_heap_fill, nbins, heap_error) + CALL cp_assert (.NOT. heap_error, cp_fatal_level, cp_internal_error,& + routineN, "Error creating heap.", error=error) + CALL heap_fill (bin_heap_fill,& + (/(bin,bin=1,nbins)/), workload_fill , heap_error) + CALL cp_assert (.NOT. heap_error, cp_fatal_level, cp_internal_error,& + routineN, "Error initially filling the heap.", error=error) + DO imolecule_kind=1,nmolecule_kind molecule_kind => molecule_kind_set(imolecule_kind) @@ -181,56 +199,34 @@ CONTAINS ! *** functions which depends on the method *** nload = MAX(natom,nsgf) - nmolecule = SIZE(molecule_list) -! *** Save current estimated work load *** - - workload_old(:) = workload(:) - ! *** Get the number of local molecules of the current molecule kind *** - nbins=npe - CALL heap_new (bin_heap, nbins, heap_error) - CALL cp_assert (.NOT. heap_error, cp_fatal_level, cp_internal_error,& - routineN, "Error creating heap.", error=error) - CALL heap_fill (bin_heap,& - (/(bin,bin=1,nbins)/), workload , heap_error) - CALL cp_assert (.NOT. heap_error, cp_fatal_level, cp_internal_error,& - routineN, "Error initially filling the heap.", error=error) - DO imolecule=1,nmolecule - CALL heap_get_first (bin_heap, bin, bin_price, found, heap_error) + CALL heap_get_first (bin_heap_count, bin, bin_price, found, heap_error) CALL cp_assert (.NOT. heap_error, cp_fatal_level, cp_internal_error,& routineN, "Error getting topmost heap element.", error=error) CALL cp_assert (found, cp_fatal_level, cp_internal_error,& routineN, "No topmost heap element found.", error=error) ipe = bin - CALL cp_assert (bin_price==workload(ipe), cp_fatal_level, cp_internal_error,& + CALL cp_assert (bin_price==workload_count(ipe), cp_fatal_level, cp_internal_error,& routineN, "inconsistent heap", error=error) - workload(ipe) = workload(ipe) + nload + workload_count(ipe) = workload_count(ipe) + nload IF (ipe == mype) THEN nmolecule_local(imolecule_kind) = nmolecule_local(imolecule_kind) + 1 END IF - bin_price = workload(ipe) - CALL heap_reset_first (bin_heap, bin_price, heap_error) + bin_price = workload_count(ipe) + CALL heap_reset_first (bin_heap_count, bin_price, heap_error) CALL cp_assert (.NOT. heap_error, cp_warning_level, cp_internal_error,& routineN, "Error setting price of top heap element.", error=error) END DO - CALL heap_release (bin_heap, heap_error) - CALL cp_assert (.NOT. heap_error, cp_warning_level, cp_internal_error,& - routineN, "Error releasing heap.", error=error) - -! *** Reset work load *** - - workload(:) = workload_old(:) ! *** Distribute the molecules *** - n = nmolecule_local(imolecule_kind) IF (n > 0) THEN @@ -245,28 +241,18 @@ CONTAINS END IF imolecule_local = 0 - - nbins=npe - CALL heap_new (bin_heap, nbins, heap_error) - CALL cp_assert (.NOT. heap_error, cp_fatal_level, cp_internal_error,& - routineN, "Error creating heap.", error=error) - CALL heap_fill (bin_heap,& - (/(bin,bin=1,nbins)/), workload , heap_error) - CALL cp_assert (.NOT. heap_error, cp_fatal_level, cp_internal_error,& - routineN, "Error initially filling the heap.", error=error) - DO imolecule=1,nmolecule - CALL heap_get_first (bin_heap, bin, bin_price, found, heap_error) + CALL heap_get_first (bin_heap_fill, bin, bin_price, found, heap_error) CALL cp_assert (.NOT. heap_error, cp_fatal_level, cp_internal_error,& routineN, "Error getting topmost heap element.", error=error) CALL cp_assert (found, cp_fatal_level, cp_internal_error,& routineN, "No topmost heap element found.", error=error) ipe = bin - CALL cp_assert (bin_price==workload(ipe), cp_fatal_level, cp_internal_error,& + CALL cp_assert (bin_price==workload_fill(ipe), cp_fatal_level, cp_internal_error,& routineN, "inconsistent heap", error=error) - workload(ipe) = workload(ipe) + nload + workload_fill(ipe) = workload_fill(ipe) + nload IF (ipe == mype) THEN imolecule_local = imolecule_local + 1 molecule_a = molecule_list(imolecule) @@ -279,18 +265,24 @@ CONTAINS nparticle_local(kind_a) = nparticle_local(kind_a) + 1 END DO END IF - bin_price = workload(ipe) - CALL heap_reset_first (bin_heap, bin_price, heap_error) + bin_price = workload_fill(ipe) + CALL heap_reset_first (bin_heap_fill, bin_price, heap_error) CALL cp_assert (.NOT. heap_error, cp_warning_level, cp_internal_error,& routineN, "Error setting price of top heap element.", error=error) END DO - CALL heap_release (bin_heap, heap_error) - CALL cp_assert (.NOT. heap_error, cp_warning_level, cp_internal_error,& - routineN, "Error releasing heap.", error=error) - END DO + CALL cp_assert (ALL(workload_fill.EQ.workload_count), cp_fatal_level, cp_internal_error,& + routineN, "Inconsistent heaps encountered", error=error) + + CALL heap_release (bin_heap_count, heap_error) + CALL cp_assert (.NOT. heap_error, cp_warning_level, cp_internal_error,& + routineN, "Error releasing heap.", error=error) + CALL heap_release (bin_heap_fill, heap_error) + CALL cp_assert (.NOT. heap_error, cp_warning_level, cp_internal_error,& + routineN, "Error releasing heap.", error=error) + ! *** Create the local molecule structure *** CALL distribution_1d_create(local_molecules,& @@ -437,11 +429,11 @@ CONTAINS END IF ! *** Release work storage *** - DEALLOCATE (workload,STAT=istat) + DEALLOCATE (workload_count,STAT=istat) IF (istat /= 0) CALL stop_memory(routineN,moduleN,__LINE__,& "workload") - DEALLOCATE (workload_old,STAT=istat) + DEALLOCATE (workload_fill,STAT=istat) IF (istat /= 0) CALL stop_memory(routineN,moduleN,__LINE__,& "workload_old") diff --git a/tests/Fist/regtest-12/TEST_FILES_RESET b/tests/Fist/regtest-12/TEST_FILES_RESET index f2e3c0bf2e..a5cb935786 100644 --- a/tests/Fist/regtest-12/TEST_FILES_RESET +++ b/tests/Fist/regtest-12/TEST_FILES_RESET @@ -208,3 +208,5 @@ water32_hbonds_3.inp water32_hbonds_4.inp # Si_tersoff.inp +# +Si_tersoff.inp diff --git a/tests/Fist/regtest-7/TEST_FILES_RESET b/tests/Fist/regtest-7/TEST_FILES_RESET index a0b299fea7..388e5a2e50 100644 --- a/tests/Fist/regtest-7/TEST_FILES_RESET +++ b/tests/Fist/regtest-7/TEST_FILES_RESET @@ -449,3 +449,7 @@ UO2-2x2x2-geo_opt-cg.inp UO2-2x2x2-cs-geo_opt-cg.inp # UO2-4x4x4-fixd.inp +# +UO2-4x4x4-core-shell-debug.inp +# +UO2-4x4x4-autofit.inp diff --git a/tests/Fist/regtest-opt/TEST_FILES_RESET b/tests/Fist/regtest-opt/TEST_FILES_RESET index 05819d45fe..6f8cfe22c4 100644 --- a/tests/Fist/regtest-opt/TEST_FILES_RESET +++ b/tests/Fist/regtest-opt/TEST_FILES_RESET @@ -46,3 +46,21 @@ cs_cell_opt_cg_2pnt_geo_opt_lbfgs.inp cs_cell_opt_lbfgs_geo_opt_lbfgs.inp # mc_cs_geo_opt_lbfgs.inp +# +cell_opt_direct_lbfgs.inp +# +cell_opt_bfgs_geo_opt_lbfgs.inp +# +cell_opt_cg_2pnt_geo_opt_lbfgs.inp +# +cell_opt_lbfgs_geo_opt_lbfgs.inp +# +cs_cell_opt_direct_cg_gold.inp +# +cs_cell_opt_bfgs_geo_opt_lbfgs.inp +# +cs_cell_opt_cg_2pnt_geo_opt_cg_2pnt.inp +# +cs_cell_opt_cg_2pnt_geo_opt_lbfgs.inp +# +cs_cell_opt_lbfgs_geo_opt_lbfgs.inp diff --git a/tests/Fist/regtest/TEST_FILES_RESET b/tests/Fist/regtest/TEST_FILES_RESET index c633d81c2c..09a86e953b 100644 --- a/tests/Fist/regtest/TEST_FILES_RESET +++ b/tests/Fist/regtest/TEST_FILES_RESET @@ -627,3 +627,15 @@ deca_ala_avg2.inp water_charge_no_array_pme.inp # water_charge_array_pme.inp +# +multipole_ch_dip.dbg_f_real.inp +# +multipole_charge.dbg_f_real.inp +# +multipole_dip_qu.dbg_f_real.inp +# +multipole_dip_qu.dbg_f_rec.inp +# +multipole_dipole.dbg_f_real.inp +# +multipole_quadrupole.dbg_f_real.inp diff --git a/tests/SE/regtest/TEST_FILES_RESET b/tests/SE/regtest/TEST_FILES_RESET index 5ead37987c..967932a9e7 100644 --- a/tests/SE/regtest/TEST_FILES_RESET +++ b/tests/SE/regtest/TEST_FILES_RESET @@ -829,3 +829,5 @@ st.inp h2po4.inp # ice-scp-ewald.inp +# +ice-scp-ewald.inp diff --git a/tests/optimize_input/regtest-1/TEST_FILES_RESET b/tests/optimize_input/regtest-1/TEST_FILES_RESET index 8e4acd24f4..d066b9b3ec 100644 --- a/tests/optimize_input/regtest-1/TEST_FILES_RESET +++ b/tests/optimize_input/regtest-1/TEST_FILES_RESET @@ -3,3 +3,5 @@ driver-restart.inp driver.inp driver-restart.inp driver-restart.inp +# +driver-restart.inp