run_unfragmented_calculation Subroutine

private subroutine run_unfragmented_calculation(world_comm, sys_geom, config, result_out, json_data)

Handle unfragmented calculation (nlevel=0)

For single-molecule mode: Only rank 0 runs (validates single rank) For multi-molecule mode: ALL ranks can run (each with their own molecule) For Hessian calculations with multiple ranks: Uses distributed parallelization If result_out is present, returns result instead of writing JSON

Arguments

Type IntentOptional Attributes Name
type(comm_t), intent(in) :: world_comm

Global MPI communicator

type(system_geometry_t), intent(in) :: sys_geom

Complete system geometry

type(driver_config_t), intent(in) :: config

Driver configuration (includes method_config, calc_type, etc.)

type(calculation_result_t), intent(out), optional :: result_out

Optional result output

type(json_output_data_t), intent(out), optional :: json_data

JSON output data


Calls

proc~~run_unfragmented_calculation~~CallsGraph proc~run_unfragmented_calculation run_unfragmented_calculation info info proc~run_unfragmented_calculation->info interface~distributed_unfragmented_hessian distributed_unfragmented_hessian proc~run_unfragmented_calculation->interface~distributed_unfragmented_hessian interface~unfragmented_calculation unfragmented_calculation proc~run_unfragmented_calculation->interface~unfragmented_calculation proc~calc_type_to_string calc_type_to_string proc~run_unfragmented_calculation->proc~calc_type_to_string to_char to_char proc~run_unfragmented_calculation->to_char verbose verbose proc~run_unfragmented_calculation->verbose proc~distributed_unfragmented_hessian distributed_unfragmented_hessian interface~distributed_unfragmented_hessian->proc~distributed_unfragmented_hessian proc~unfragmented_calculation unfragmented_calculation interface~unfragmented_calculation->proc~unfragmented_calculation barrier barrier proc~distributed_unfragmented_hessian->barrier interface~hessian_coordinator hessian_coordinator proc~distributed_unfragmented_hessian->interface~hessian_coordinator interface~hessian_worker hessian_worker proc~distributed_unfragmented_hessian->interface~hessian_worker proc~unfragmented_calculation->info proc~unfragmented_calculation->to_char cart_disp cart_disp proc~unfragmented_calculation->cart_disp configuration configuration proc~unfragmented_calculation->configuration eigenvalues eigenvalues proc~unfragmented_calculation->eigenvalues error error proc~unfragmented_calculation->error fc_mdyne fc_mdyne proc~unfragmented_calculation->fc_mdyne force_constants force_constants proc~unfragmented_calculation->force_constants frequencies frequencies proc~unfragmented_calculation->frequencies interface~do_fragment_work do_fragment_work proc~unfragmented_calculation->interface~do_fragment_work ir_intensities ir_intensities proc~unfragmented_calculation->ir_intensities proc~check_duplicate_atoms check_duplicate_atoms proc~unfragmented_calculation->proc~check_duplicate_atoms proc~compute_thermochemistry compute_thermochemistry proc~unfragmented_calculation->proc~compute_thermochemistry proc~compute_vibrational_analysis compute_vibrational_analysis proc~unfragmented_calculation->proc~compute_vibrational_analysis proc~compute_vibrational_frequencies compute_vibrational_frequencies proc~unfragmented_calculation->proc~compute_vibrational_frequencies proc~energy_total energy_t%energy_total proc~unfragmented_calculation->proc~energy_total proc~error_get_full_trace error_t%error_get_full_trace proc~unfragmented_calculation->proc~error_get_full_trace proc~error_get_message error_t%error_get_message proc~unfragmented_calculation->proc~error_get_message proc~error_has_error error_t%error_has_error proc~unfragmented_calculation->proc~error_has_error proc~fragment_compute_nelec physical_fragment_t%fragment_compute_nelec proc~unfragmented_calculation->proc~fragment_compute_nelec proc~print_vibrational_analysis print_vibrational_analysis proc~unfragmented_calculation->proc~print_vibrational_analysis proc~result_destroy calculation_result_t%result_destroy proc~unfragmented_calculation->proc~result_destroy projected_hessian projected_hessian proc~unfragmented_calculation->projected_hessian reduced_masses reduced_masses proc~unfragmented_calculation->reduced_masses proc~do_fragment_work do_fragment_work interface~do_fragment_work->proc~do_fragment_work proc~hessian_coordinator hessian_coordinator interface~hessian_coordinator->proc~hessian_coordinator proc~hessian_worker hessian_worker interface~hessian_worker->proc~hessian_worker proc~check_duplicate_atoms->to_char proc~check_duplicate_atoms->error proc~element_number_to_symbol element_number_to_symbol proc~check_duplicate_atoms->proc~element_number_to_symbol proc~error_set error_t%error_set proc~check_duplicate_atoms->proc~error_set proc~compute_electronic_entropy compute_electronic_entropy proc~compute_thermochemistry->proc~compute_electronic_entropy proc~compute_moments_of_inertia compute_moments_of_inertia proc~compute_thermochemistry->proc~compute_moments_of_inertia proc~compute_partition_functions compute_partition_functions proc~compute_thermochemistry->proc~compute_partition_functions proc~compute_rotational_constants compute_rotational_constants proc~compute_thermochemistry->proc~compute_rotational_constants proc~compute_rotational_thermo compute_rotational_thermo proc~compute_thermochemistry->proc~compute_rotational_thermo proc~compute_translational_thermo compute_translational_thermo proc~compute_thermochemistry->proc~compute_translational_thermo proc~compute_vibrational_thermo compute_vibrational_thermo proc~compute_thermochemistry->proc~compute_vibrational_thermo proc~compute_zpe compute_zpe proc~compute_thermochemistry->proc~compute_zpe proc~compute_vibrational_analysis->proc~compute_vibrational_frequencies proc~compute_cartesian_displacements compute_cartesian_displacements proc~compute_vibrational_analysis->proc~compute_cartesian_displacements proc~compute_force_constants compute_force_constants proc~compute_vibrational_analysis->proc~compute_force_constants proc~compute_ir_intensities compute_ir_intensities proc~compute_vibrational_analysis->proc~compute_ir_intensities proc~compute_reduced_masses compute_reduced_masses proc~compute_vibrational_analysis->proc~compute_reduced_masses proc~compute_vibrational_frequencies->error pic_syev pic_syev proc~compute_vibrational_frequencies->pic_syev proc~mass_weight_hessian mass_weight_hessian proc~compute_vibrational_frequencies->proc~mass_weight_hessian proc~project_translation_rotation project_translation_rotation proc~compute_vibrational_frequencies->proc~project_translation_rotation warning warning proc~compute_vibrational_frequencies->warning proc~mp2_total mp2_energy_t%mp2_total proc~energy_total->proc~mp2_total proc~error_get_full_trace->proc~error_has_error proc~print_vibrational_analysis->info proc~print_vibrational_analysis->proc~compute_thermochemistry proc~print_vibrational_analysis->proc~element_number_to_symbol proc~print_thermochemistry print_thermochemistry proc~print_vibrational_analysis->proc~print_thermochemistry proc~print_vibrational_analysis->warning proc~result_reset calculation_result_t%result_reset proc~result_destroy->proc~result_reset proc~element_mass element_mass proc~compute_cartesian_displacements->proc~element_mass proc~compute_ir_intensities->proc~element_mass proc~compute_moments_of_inertia->to_char proc~compute_moments_of_inertia->pic_syev proc~compute_moments_of_inertia->warning proc~compute_moments_of_inertia->proc~element_mass proc~compute_reduced_masses->proc~element_mass proc~compute_zpe->to_char proc~compute_zpe->warning proc~do_fragment_work->proc~calc_type_to_string proc~do_fragment_work->to_char proc~do_fragment_work->configuration proc~do_fragment_work->proc~error_set calc_energy calc_energy proc~do_fragment_work->calc_energy calc_gradient calc_gradient proc~do_fragment_work->calc_gradient calc_hessian calc_hessian proc~do_fragment_work->calc_hessian proc~create_method create_method proc~do_fragment_work->proc~create_method proc~energy_reset energy_t%energy_reset proc~do_fragment_work->proc~energy_reset proc~error_add_context error_t%error_add_context proc~do_fragment_work->proc~error_add_context proc~print_fragment_xyz print_fragment_xyz proc~do_fragment_work->proc~print_fragment_xyz proc~hessian_coordinator->info proc~hessian_coordinator->to_char proc~hessian_coordinator->cart_disp proc~hessian_coordinator->configuration proc~hessian_coordinator->error proc~hessian_coordinator->fc_mdyne proc~hessian_coordinator->force_constants proc~hessian_coordinator->ir_intensities proc~hessian_coordinator->proc~compute_thermochemistry proc~hessian_coordinator->proc~compute_vibrational_analysis proc~hessian_coordinator->proc~compute_vibrational_frequencies proc~hessian_coordinator->proc~energy_total proc~hessian_coordinator->proc~fragment_compute_nelec proc~hessian_coordinator->proc~print_vibrational_analysis proc~hessian_coordinator->proc~result_destroy proc~hessian_coordinator->reduced_masses proc~hessian_coordinator->calc_gradient get_elapsed_time get_elapsed_time proc~hessian_coordinator->get_elapsed_time iprobe iprobe proc~hessian_coordinator->iprobe irecv irecv proc~hessian_coordinator->irecv isend isend proc~hessian_coordinator->isend proc~hessian_coordinator->proc~create_method proc~finite_diff_dipole_derivatives finite_diff_dipole_derivatives proc~hessian_coordinator->proc~finite_diff_dipole_derivatives proc~finite_diff_hessian_from_gradients finite_diff_hessian_from_gradients proc~hessian_coordinator->proc~finite_diff_hessian_from_gradients proc~populate_unfragmented_json_data populate_unfragmented_json_data proc~hessian_coordinator->proc~populate_unfragmented_json_data proc~populate_vibrational_json_data populate_vibrational_json_data proc~hessian_coordinator->proc~populate_vibrational_json_data recv recv proc~hessian_coordinator->recv start start proc~hessian_coordinator->start vib_freqs vib_freqs proc~hessian_coordinator->vib_freqs proc~hessian_worker->to_char proc~hessian_worker->error proc~hessian_worker->proc~error_get_message proc~hessian_worker->proc~fragment_compute_nelec proc~hessian_worker->proc~result_destroy abort_comm abort_comm proc~hessian_worker->abort_comm proc~hessian_worker->calc_gradient proc~hessian_worker->irecv proc~hessian_worker->isend proc~copy_and_displace_geometry copy_and_displace_geometry proc~hessian_worker->proc~copy_and_displace_geometry proc~hessian_worker->proc~create_method send send proc~hessian_worker->send proc~mass_weight_hessian->proc~element_mass proc~print_thermochemistry->info pic_gesvd pic_gesvd proc~project_translation_rotation->pic_gesvd proc~project_translation_rotation->proc~element_mass proc~result_reset->proc~energy_reset proc~error_clear error_t%error_clear proc~result_reset->proc~error_clear

Called by

proc~~run_unfragmented_calculation~~CalledByGraph proc~run_unfragmented_calculation run_unfragmented_calculation proc~run_calculation run_calculation proc~run_calculation->proc~run_unfragmented_calculation proc~compute_energy_and_forces compute_energy_and_forces proc~compute_energy_and_forces->proc~run_calculation proc~run_multi_molecule_calculations run_multi_molecule_calculations proc~run_multi_molecule_calculations->proc~run_calculation program~main main program~main->proc~run_calculation program~main->proc~run_multi_molecule_calculations

Source Code

   subroutine run_unfragmented_calculation(world_comm, sys_geom, config, result_out, json_data)
      !! Handle unfragmented calculation (nlevel=0)
      !!
      !! For single-molecule mode: Only rank 0 runs (validates single rank)
      !! For multi-molecule mode: ALL ranks can run (each with their own molecule)
      !! For Hessian calculations with multiple ranks: Uses distributed parallelization
      !! If result_out is present, returns result instead of writing JSON
      type(comm_t), intent(in) :: world_comm  !! Global MPI communicator
      type(system_geometry_t), intent(in) :: sys_geom  !! Complete system geometry
      type(driver_config_t), intent(in) :: config  !! Driver configuration (includes method_config, calc_type, etc.)
      type(calculation_result_t), intent(out), optional :: result_out  !! Optional result output
      type(json_output_data_t), intent(out), optional :: json_data  !! JSON output data

      ! For Hessian calculations with multiple ranks, use distributed approach
      if (config%calc_type == CALC_TYPE_HESSIAN .and. world_comm%size() > 1) then
         if (world_comm%rank() == 0) then
            call logger%info(" ")
            call logger%info("Running distributed unfragmented Hessian calculation")
            call logger%info("  MPI ranks: "//to_char(world_comm%size()))
            call logger%info(" ")
         end if
         call distributed_unfragmented_hessian(world_comm, sys_geom, config, json_data)
         return
      end if

      ! Check if this is multi-molecule mode or single-molecule mode
      ! In multi-molecule mode, each rank processes its own molecule
      ! In single-molecule mode, only rank 0 should work
      if (world_comm%size() == 1 .or. world_comm%rank() == 0) then
         ! Either single-rank calculation, or rank 0 in multi-rank setup
         call logger%info(" ")
         call logger%info("Running unfragmented calculation")
         call logger%info("  Calculation type: "//calc_type_to_string(config%calc_type))
         call logger%info(" ")
         call unfragmented_calculation(sys_geom, config, result_out, json_data)
      else if (sys_geom%total_atoms > 0) then
         ! Multi-molecule mode: non-zero rank with a molecule
         call logger%verbose("Rank "//to_char(world_comm%rank())//": Running unfragmented calculation")
         call unfragmented_calculation(sys_geom, config, result_out, json_data)
      end if

   end subroutine run_unfragmented_calculation