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 | Intent | Optional | 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 |
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