error_add_context Subroutine

private pure subroutine error_add_context(this, location)

Add a call location to the stack trace Typically called when propagating errors upward

Example: call some_routine(…, error) if (error%has_error()) then call error%add_context(“mqc_mbe:compute_energy”) return end if

Type Bound

error_t

Arguments

Type IntentOptional Attributes Name
class(error_t), intent(inout) :: this
character(len=*), intent(in) :: location

Called by

proc~~error_add_context~~CalledByGraph proc~error_add_context error_t%error_add_context proc~build_fragment_from_atom_list build_fragment_from_atom_list proc~build_fragment_from_atom_list->proc~error_add_context proc~build_fragment_from_indices build_fragment_from_indices proc~build_fragment_from_indices->proc~error_add_context proc~build_mbe_lookup_table build_mbe_lookup_table proc~build_mbe_lookup_table->proc~error_add_context proc~build_molecular_basis build_molecular_basis proc~build_molecular_basis->proc~error_add_context proc~parse_element_basis parse_element_basis proc~build_molecular_basis->proc~parse_element_basis proc~config_to_system_geometry config_to_system_geometry proc~config_to_system_geometry->proc~error_add_context proc~geometry_to_system_fragmented geometry_to_system_fragmented proc~config_to_system_geometry->proc~geometry_to_system_fragmented proc~molecule_to_system_geometry molecule_to_system_geometry proc~config_to_system_geometry->proc~molecule_to_system_geometry proc~do_fragment_work do_fragment_work proc~do_fragment_work->proc~error_add_context proc~initialize_fragmented_system initialize_fragmented_system proc~initialize_fragmented_system->proc~error_add_context proc~initialize_system_geometry initialize_system_geometry proc~initialize_system_geometry->proc~error_add_context proc~read_xyz_file read_xyz_file proc~initialize_system_geometry->proc~read_xyz_file proc~parse_element_basis->proc~error_add_context proc~parse_fragment parse_fragment proc~parse_fragment->proc~error_add_context proc~parse_fragmentation_section parse_fragmentation_section proc~parse_fragmentation_section->proc~error_add_context proc~parse_fragments_generic parse_fragments_generic proc~parse_fragments_generic->proc~error_add_context proc~parse_fragments_generic->proc~parse_fragment proc~parse_molecules_section parse_molecules_section proc~parse_molecules_section->proc~error_add_context proc~parse_single_molecule parse_single_molecule proc~parse_molecules_section->proc~parse_single_molecule proc~parse_single_molecule->proc~error_add_context proc~parse_molecule_fragments parse_molecule_fragments proc~parse_single_molecule->proc~parse_molecule_fragments proc~read_mqc_file read_mqc_file proc~read_mqc_file->proc~error_add_context interface~parse_fragmentation_section parse_fragmentation_section proc~read_mqc_file->interface~parse_fragmentation_section interface~parse_molecules_section parse_molecules_section proc~read_mqc_file->interface~parse_molecules_section interface~parse_fragments_section parse_fragments_section proc~read_mqc_file->interface~parse_fragments_section proc~read_xyz_file->proc~error_add_context proc~run_multi_molecule_calculations run_multi_molecule_calculations proc~run_multi_molecule_calculations->proc~error_add_context proc~run_multi_molecule_calculations->proc~config_to_system_geometry interface~do_fragment_work do_fragment_work interface~do_fragment_work->proc~do_fragment_work interface~parse_fragmentation_section->proc~parse_fragmentation_section interface~parse_fragments_generic parse_fragments_generic interface~parse_fragments_generic->proc~parse_fragments_generic interface~parse_molecules_section->proc~parse_molecules_section proc~compute_gmbe compute_gmbe proc~compute_gmbe->proc~build_fragment_from_indices proc~process_intersection_derivatives process_intersection_derivatives proc~compute_gmbe->proc~process_intersection_derivatives proc~compute_mbe compute_mbe proc~compute_mbe->proc~build_mbe_lookup_table proc~map_fragment_to_system_dipole_derivatives map_fragment_to_system_dipole_derivatives proc~compute_mbe->proc~map_fragment_to_system_dipole_derivatives proc~map_fragment_to_system_gradient map_fragment_to_system_gradient proc~compute_mbe->proc~map_fragment_to_system_gradient proc~map_fragment_to_system_hessian map_fragment_to_system_hessian proc~compute_mbe->proc~map_fragment_to_system_hessian proc~compute_mbe_dipole_derivatives compute_mbe_dipole_derivatives proc~compute_mbe->proc~compute_mbe_dipole_derivatives proc~compute_mbe_gradient compute_mbe_gradient proc~compute_mbe->proc~compute_mbe_gradient proc~compute_mbe_hessian compute_mbe_hessian proc~compute_mbe->proc~compute_mbe_hessian proc~geometry_to_system_fragmented->proc~initialize_fragmented_system proc~gmbe_pie_coordinator gmbe_pie_coordinator proc~gmbe_pie_coordinator->proc~build_fragment_from_atom_list proc~map_fragment_to_system_dipole_derivatives->proc~build_fragment_from_indices proc~map_fragment_to_system_gradient->proc~build_fragment_from_indices proc~map_fragment_to_system_hessian->proc~build_fragment_from_indices proc~molecule_to_system_geometry->proc~initialize_fragmented_system proc~node_worker node_worker proc~node_worker->proc~build_fragment_from_atom_list proc~node_worker->proc~build_fragment_from_indices proc~node_worker->interface~do_fragment_work proc~process_intersection_derivatives->proc~build_fragment_from_atom_list proc~serial_fragment_processor serial_fragment_processor proc~serial_fragment_processor->proc~build_fragment_from_indices proc~serial_fragment_processor->interface~do_fragment_work proc~serial_fragment_processor->proc~compute_mbe proc~serial_gmbe_pie_processor serial_gmbe_pie_processor proc~serial_gmbe_pie_processor->proc~build_fragment_from_atom_list proc~serial_gmbe_pie_processor->interface~do_fragment_work program~main main program~main->proc~config_to_system_geometry program~main->proc~read_mqc_file program~main->proc~run_multi_molecule_calculations interface~node_worker node_worker interface~node_worker->proc~node_worker interface~serial_fragment_processor serial_fragment_processor interface~serial_fragment_processor->proc~serial_fragment_processor proc~compute_mbe_dipole_derivatives->proc~map_fragment_to_system_dipole_derivatives proc~compute_mbe_gradient->proc~map_fragment_to_system_gradient proc~compute_mbe_hessian->proc~map_fragment_to_system_hessian proc~global_coordinator global_coordinator proc~global_coordinator->proc~compute_mbe proc~gmbe_run_distributed gmbe_context_t%gmbe_run_distributed proc~gmbe_run_distributed->proc~gmbe_pie_coordinator proc~gmbe_run_distributed->interface~node_worker proc~gmbe_run_serial gmbe_context_t%gmbe_run_serial proc~gmbe_run_serial->proc~serial_gmbe_pie_processor proc~parse_fragments_section parse_fragments_section proc~parse_fragments_section->interface~parse_fragments_generic proc~parse_molecule_fragments->interface~parse_fragments_generic proc~unfragmented_calculation unfragmented_calculation proc~unfragmented_calculation->interface~do_fragment_work interface~global_coordinator global_coordinator interface~global_coordinator->proc~global_coordinator interface~parse_fragments_section->proc~parse_fragments_section interface~unfragmented_calculation unfragmented_calculation interface~unfragmented_calculation->proc~unfragmented_calculation proc~mbe_run_distributed mbe_context_t%mbe_run_distributed proc~mbe_run_distributed->interface~node_worker proc~mbe_run_distributed->interface~global_coordinator proc~mbe_run_serial mbe_context_t%mbe_run_serial proc~mbe_run_serial->interface~serial_fragment_processor proc~run_unfragmented_calculation run_unfragmented_calculation proc~run_unfragmented_calculation->interface~unfragmented_calculation

Source Code

   pure subroutine error_add_context(this, location)
      !! Add a call location to the stack trace
      !! Typically called when propagating errors upward
      !!
      !! Example:
      !!   call some_routine(..., error)
      !!   if (error%has_error()) then
      !!      call error%add_context("mqc_mbe:compute_energy")
      !!      return
      !!   end if
      class(error_t), intent(inout) :: this
      character(len=*), intent(in) :: location

      if (this%stack_depth < MAX_STACK_DEPTH) then
         this%stack_depth = this%stack_depth + 1
         this%call_stack(this%stack_depth) = location
      end if
      ! If stack is full, silently ignore (could print warning in non-pure version)
   end subroutine error_add_context