mqc_physical_fragment Module

Physical molecular fragment representation and geometry handling

Provides data structures and utilities for managing molecular fragments with atomic coordinates, electronic properties, and geometric operations. Bond connectivity type Single molecular fragment type Complete system geometry type System geometry initialization Extract fragment from system Build fragment from explicit atom indices (for intersections) Validate fragment has no overlapping atoms

Redistribute hydrogen cap gradients to original atoms Redistribute hydrogen cap Hessian to original atoms Redistribute hydrogen cap dipole derivatives to original atoms Unit conversion utilities Calculate minimal distance between monomers in a fragment


Uses

  • module~~mqc_physical_fragment~~UsesGraph module~mqc_physical_fragment mqc_physical_fragment module~mqc_cgto mqc_cgto module~mqc_physical_fragment->module~mqc_cgto module~mqc_elements mqc_elements module~mqc_physical_fragment->module~mqc_elements module~mqc_error mqc_error module~mqc_physical_fragment->module~mqc_error module~mqc_geometry mqc_geometry module~mqc_physical_fragment->module~mqc_geometry module~mqc_physical_constants mqc_physical_constants module~mqc_physical_fragment->module~mqc_physical_constants module~mqc_xyz_reader mqc_xyz_reader module~mqc_physical_fragment->module~mqc_xyz_reader pic_types pic_types module~mqc_physical_fragment->pic_types module~mqc_cgto->pic_types module~mqc_elements->pic_types pic_ascii pic_ascii module~mqc_elements->pic_ascii module~mqc_geometry->pic_types module~mqc_physical_constants->pic_types module~mqc_xyz_reader->module~mqc_error module~mqc_xyz_reader->module~mqc_geometry module~mqc_xyz_reader->pic_types

Used by

  • module~~mqc_physical_fragment~~UsedByGraph module~mqc_physical_fragment mqc_physical_fragment module~mqc_calculation_interface mqc_calculation_interface module~mqc_calculation_interface->module~mqc_physical_fragment module~mqc_config_parser mqc_config_parser module~mqc_calculation_interface->module~mqc_config_parser module~mqc_config_adapter mqc_config_adapter module~mqc_config_adapter->module~mqc_physical_fragment module~mqc_config_adapter->module~mqc_config_parser module~mqc_config_parser->module~mqc_physical_fragment module~mqc_driver mqc_driver module~mqc_driver->module~mqc_physical_fragment module~mqc_driver->module~mqc_config_adapter module~mqc_driver->module~mqc_config_parser module~mqc_frag_utils mqc_frag_utils module~mqc_driver->module~mqc_frag_utils module~mqc_many_body_expansion mqc_many_body_expansion module~mqc_driver->module~mqc_many_body_expansion module~mqc_mbe mqc_mbe module~mqc_driver->module~mqc_mbe module~mqc_mbe_fragment_distribution_scheme mqc_mbe_fragment_distribution_scheme module~mqc_driver->module~mqc_mbe_fragment_distribution_scheme module~mqc_json_writer mqc_json_writer module~mqc_driver->module~mqc_json_writer module~mqc_finite_differences mqc_finite_differences module~mqc_finite_differences->module~mqc_physical_fragment module~mqc_frag_utils->module~mqc_physical_fragment module~mqc_gmbe_utils mqc_gmbe_utils module~mqc_frag_utils->module~mqc_gmbe_utils module~mqc_gmbe_fragment_distribution_scheme mqc_gmbe_fragment_distribution_scheme module~mqc_gmbe_fragment_distribution_scheme->module~mqc_physical_fragment module~mqc_gmbe_fragment_distribution_scheme->module~mqc_mbe_fragment_distribution_scheme module~mqc_gmbe_utils->module~mqc_physical_fragment module~mqc_many_body_expansion->module~mqc_physical_fragment module~mqc_many_body_expansion->module~mqc_config_adapter module~mqc_mbe->module~mqc_physical_fragment module~mqc_mbe->module~mqc_frag_utils module~mqc_mbe->module~mqc_gmbe_utils module~mqc_mbe_io mqc_mbe_io module~mqc_mbe->module~mqc_mbe_io module~mqc_mbe_fragment_distribution_scheme->module~mqc_physical_fragment module~mqc_mbe_fragment_distribution_scheme->module~mqc_config_adapter module~mqc_mbe_fragment_distribution_scheme->module~mqc_mbe module~mqc_mbe_fragment_distribution_scheme->module~mqc_mbe_io module~mqc_method_base mqc_method_base module~mqc_mbe_fragment_distribution_scheme->module~mqc_method_base module~mqc_method_factory mqc_method_factory module~mqc_mbe_fragment_distribution_scheme->module~mqc_method_factory module~mqc_mbe_io->module~mqc_physical_fragment module~mqc_method_base->module~mqc_physical_fragment module~mqc_method_dft mqc_method_dft module~mqc_method_dft->module~mqc_physical_fragment module~mqc_method_dft->module~mqc_method_base module~mqc_method_hf mqc_method_hf module~mqc_method_hf->module~mqc_physical_fragment module~mqc_method_hf->module~mqc_method_base module~mqc_method_mcscf mqc_method_mcscf module~mqc_method_mcscf->module~mqc_physical_fragment module~mqc_method_mcscf->module~mqc_method_base module~mqc_method_xtb mqc_method_xtb module~mqc_method_xtb->module~mqc_physical_fragment module~mqc_method_xtb->module~mqc_method_base proc~apply_distance_screening apply_distance_screening proc~apply_distance_screening->module~mqc_physical_fragment proc~apply_distance_screening->module~mqc_config_adapter proc~calculate_fragment_distances calculate_fragment_distances proc~calculate_fragment_distances->module~mqc_physical_fragment proc~compute_gmbe compute_gmbe proc~compute_gmbe->module~mqc_physical_fragment proc~compute_gmbe->module~mqc_config_parser proc~compute_gmbe->module~mqc_gmbe_utils proc~compute_polymer_atoms compute_polymer_atoms proc~compute_polymer_atoms->module~mqc_physical_fragment proc~fragment_should_be_screened fragment_should_be_screened proc~fragment_should_be_screened->module~mqc_physical_fragment proc~fragment_should_be_screened->module~mqc_config_adapter proc~generate_intersections generate_intersections proc~generate_intersections->module~mqc_physical_fragment proc~generate_k_way_intersections_for_level generate_k_way_intersections_for_level proc~generate_k_way_intersections_for_level->module~mqc_physical_fragment proc~generate_polymer_intersections generate_polymer_intersections proc~generate_polymer_intersections->module~mqc_physical_fragment proc~gmbe_enumerate_pie_terms gmbe_enumerate_pie_terms proc~gmbe_enumerate_pie_terms->module~mqc_physical_fragment proc~gmbe_pie_coordinator gmbe_pie_coordinator proc~gmbe_pie_coordinator->module~mqc_physical_fragment proc~map_fragment_to_system_dipole_derivatives map_fragment_to_system_dipole_derivatives proc~map_fragment_to_system_dipole_derivatives->module~mqc_physical_fragment proc~map_fragment_to_system_gradient map_fragment_to_system_gradient proc~map_fragment_to_system_gradient->module~mqc_physical_fragment proc~map_fragment_to_system_hessian map_fragment_to_system_hessian proc~map_fragment_to_system_hessian->module~mqc_physical_fragment proc~parse_connectivity_generic parse_connectivity_generic proc~parse_connectivity_generic->module~mqc_physical_fragment proc~process_intersection_derivatives process_intersection_derivatives proc~process_intersection_derivatives->module~mqc_physical_fragment proc~process_intersection_derivatives->module~mqc_config_parser proc~process_intersection_derivatives->module~mqc_gmbe_utils proc~serial_gmbe_pie_processor serial_gmbe_pie_processor proc~serial_gmbe_pie_processor->module~mqc_physical_fragment program~main main program~main->module~mqc_physical_fragment program~main->module~mqc_config_adapter program~main->module~mqc_config_parser program~main->module~mqc_driver module~mpi_fragment_work_smod mpi_fragment_work_smod module~mpi_fragment_work_smod->module~mqc_mbe_fragment_distribution_scheme module~mqc_config_parser_basic_sections mqc_config_parser_basic_sections module~mqc_config_parser_basic_sections->module~mqc_config_parser module~mqc_config_parser_calc_settings mqc_config_parser_calc_settings module~mqc_config_parser_calc_settings->module~mqc_config_parser module~mqc_config_parser_fragments mqc_config_parser_fragments module~mqc_config_parser_fragments->module~mqc_config_parser module~mqc_config_parser_molecules mqc_config_parser_molecules module~mqc_config_parser_molecules->module~mqc_config_parser module~mqc_config_parser_structure mqc_config_parser_structure module~mqc_config_parser_structure->module~mqc_config_parser module~mqc_hessian_distribution_scheme mqc_hessian_distribution_scheme module~mqc_hessian_distribution_scheme->module~mqc_mbe_fragment_distribution_scheme module~mqc_json_writer->module~mqc_mbe_io module~mqc_method_factory->module~mqc_method_base module~mqc_method_factory->module~mqc_method_dft module~mqc_method_factory->module~mqc_method_hf module~mqc_method_factory->module~mqc_method_mcscf module~mqc_method_factory->module~mqc_method_xtb module~mqc_serial_fragment_processor mqc_serial_fragment_processor module~mqc_serial_fragment_processor->module~mqc_mbe_fragment_distribution_scheme module~mqc_unfragmented_workflow mqc_unfragmented_workflow module~mqc_unfragmented_workflow->module~mqc_mbe_fragment_distribution_scheme proc~check_fragment_overlap check_fragment_overlap proc~check_fragment_overlap->module~mqc_config_parser proc~compute_energy_and_forces compute_energy_and_forces proc~compute_energy_and_forces->module~mqc_config_adapter proc~compute_energy_and_forces->module~mqc_driver proc~gmbe_run_distributed gmbe_context_t%gmbe_run_distributed proc~gmbe_run_distributed->module~mqc_gmbe_fragment_distribution_scheme proc~gmbe_run_distributed->module~mqc_mbe_fragment_distribution_scheme proc~gmbe_run_serial gmbe_context_t%gmbe_run_serial proc~gmbe_run_serial->module~mqc_gmbe_fragment_distribution_scheme proc~hessian_coordinator hessian_coordinator proc~hessian_coordinator->module~mqc_finite_differences proc~hessian_coordinator->module~mqc_method_base proc~hessian_coordinator->module~mqc_method_factory proc~hessian_worker hessian_worker proc~hessian_worker->module~mqc_finite_differences proc~hessian_worker->module~mqc_method_base proc~hessian_worker->module~mqc_method_factory proc~initialize_fragmented_system initialize_fragmented_system proc~initialize_fragmented_system->module~mqc_config_parser proc~mbe_run_distributed mbe_context_t%mbe_run_distributed proc~mbe_run_distributed->module~mqc_mbe_fragment_distribution_scheme proc~mbe_run_serial mbe_context_t%mbe_run_serial proc~mbe_run_serial->module~mqc_mbe_fragment_distribution_scheme proc~molecule_to_system_geometry molecule_to_system_geometry proc~molecule_to_system_geometry->module~mqc_config_parser proc~run_multi_molecule_calculations run_multi_molecule_calculations proc~run_multi_molecule_calculations->module~mqc_config_adapter proc~run_multi_molecule_calculations->module~mqc_config_parser proc~xtb_calc_hessian xtb_method_t%xtb_calc_hessian proc~xtb_calc_hessian->module~mqc_finite_differences

Derived Types

type, public ::  bond_t

Bond definition with atom indices, order, and broken status

Read more…

Components

Type Visibility Attributes Name Initial
integer, public :: atom_i = 0

First atom index (0-indexed)

integer, public :: atom_j = 0

Second atom index (0-indexed)

logical, public :: is_broken = .false.

Whether this bond crosses fragment boundaries

integer, public :: order = 1

Bond order (1=single, 2=double, 3=triple)

type, public ::  physical_fragment_t

Physical molecular fragment with atomic coordinates and properties

Read more…

Components

Type Visibility Attributes Name Initial
type(molecular_basis_type), public, allocatable :: basis

Gaussian basis functions

integer, public, allocatable :: cap_replaces_atom(:)

Original atom index that each cap replaces (size: n_caps)

integer, public :: charge = 0

Net molecular charge (electrons)

real(kind=dp), public, allocatable :: coordinates(:,:)

Cartesian coordinates (3, n_atoms) in Bohr

real(kind=dp), public :: distance = 0.0_dp

Minimal atomic distance between monomers in fragment (Angstrom, 0 for monomers)

integer, public, allocatable :: element_numbers(:)

Atomic numbers (Z values)

integer, public, allocatable :: local_to_global(:)

Map fragment atom index to system atom index (size: n_atoms - n_caps)

integer, public :: multiplicity = 1

Spin multiplicity (2S+1)

integer, public :: n_atoms

Number of atoms in this fragment

integer, public :: n_caps = 0

Number of hydrogen caps added (always at end of atom list)

integer, public :: nelec = 0

Total number of electrons

Type-Bound Procedures

procedure, public :: compute_nelec => fragment_compute_nelec

Calculate electron count

procedure, public :: destroy => fragment_destroy

Memory cleanup

procedure, public :: set_basis => fragment_set_basis

Assign basis set

type, public ::  system_geometry_t

Complete molecular system geometry for fragment-based calculations

Read more…

Components

Type Visibility Attributes Name Initial
integer, public :: atoms_per_monomer

Atoms in each monomer (0 if variable-sized)

type(bond_t), public, allocatable :: bonds(:)

Bond connectivity (for H-capping broken bonds)

integer, public :: charge

Net molecular charge (electrons)

real(kind=dp), public, allocatable :: coordinates(:,:)

All coordinates (3, total_atoms) in Bohr

integer, public, allocatable :: element_numbers(:)

Atomic numbers for all atoms

integer, public, allocatable :: fragment_atoms(:,:)

Atom indices for each fragment (max_frag_size, n_monomers), 0-indexed

integer, public, allocatable :: fragment_charges(:)

Charge for each fragment (n_monomers)

integer, public, allocatable :: fragment_multiplicities(:)

Multiplicity for each fragment (n_monomers)

integer, public, allocatable :: fragment_sizes(:)

Number of atoms in each fragment (n_monomers)

integer, public :: multiplicity

Spin multiplicity (2S+1)

integer, public :: n_monomers

Number of monomer units in system

integer, public :: total_atoms

Total number of atoms

Type-Bound Procedures

procedure, public :: destroy => system_destroy

Memory cleanup


Functions

public pure function calculate_monomer_distance(sys_geom, monomer_indices) result(min_distance)

Calculate minimal atomic distance between monomers in a fragment For single monomer (size 1), returns 0.0 For multi-monomer fragments, returns minimal distance between atoms in different monomers Result is in Angstrom

Arguments

Type IntentOptional Attributes Name
type(system_geometry_t), intent(in) :: sys_geom
integer, intent(in) :: monomer_indices(:)

Return Value real(kind=dp)

public pure elemental function to_angstrom(bohr_value) result(angstrom_value)

Convert coordinate from Bohr to Angstrom

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(in) :: bohr_value

Return Value real(kind=dp)

public pure elemental function to_bohr(angstrom_value) result(bohr_value)

Convert coordinate from Angstrom to Bohr

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(in) :: angstrom_value

Return Value real(kind=dp)


Subroutines

public subroutine build_fragment_from_atom_list(sys_geom, atom_indices, n_atoms, fragment, error, bonds)

Build a fragment from explicit atom list (for GMBE intersection fragments)

Read more…

Arguments

Type IntentOptional Attributes Name
type(system_geometry_t), intent(in) :: sys_geom
integer, intent(in) :: atom_indices(:)

0-indexed atom indices

integer, intent(in) :: n_atoms

Number of atoms in list

type(physical_fragment_t), intent(out) :: fragment
type(error_t), intent(out) :: error
type(bond_t), intent(in), optional :: bonds(:)

Connectivity for capping

public subroutine build_fragment_from_indices(sys_geom, monomer_indices, fragment, error, bonds)

Build a fragment on-the-fly from monomer indices with hydrogen capping for broken bonds

Read more…

Arguments

Type IntentOptional Attributes Name
type(system_geometry_t), intent(in) :: sys_geom
integer, intent(in) :: monomer_indices(:)
type(physical_fragment_t), intent(out) :: fragment
type(error_t), intent(out) :: error
type(bond_t), intent(in), optional :: bonds(:)

Connectivity information for capping

public subroutine check_duplicate_atoms(fragment, error)

Validate that fragment has no spatially overlapping atoms Checks if any two atoms are too close together (< 0.01 Bohr) This catches bugs in geometry construction or fragment building

Arguments

Type IntentOptional Attributes Name
type(physical_fragment_t), intent(in) :: fragment
type(error_t), intent(out) :: error

public subroutine initialize_system_geometry(full_geom_file, monomer_file, sys_geom, error)

Read full geometry and monomer template, initialize system_geometry_t

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: full_geom_file
character(len=*), intent(in) :: monomer_file
type(system_geometry_t), intent(out) :: sys_geom
type(error_t), intent(out) :: error

public subroutine redistribute_cap_dipole_derivatives(fragment, fragment_dipole_derivs, system_dipole_derivs)

Redistribute hydrogen cap dipole derivatives to original atoms

Read more…

Arguments

Type IntentOptional Attributes Name
type(physical_fragment_t), intent(in) :: fragment
real(kind=dp), intent(in) :: fragment_dipole_derivs(:,:)

(3, 3*n_atoms_fragment)

real(kind=dp), intent(inout) :: system_dipole_derivs(:,:)

(3, 3*n_atoms_system)

public subroutine redistribute_cap_gradients(fragment, fragment_gradient, system_gradient)

Redistribute hydrogen cap gradients to original atoms

Read more…

Arguments

Type IntentOptional Attributes Name
type(physical_fragment_t), intent(in) :: fragment
real(kind=dp), intent(in) :: fragment_gradient(:,:)

(3, n_atoms_fragment)

real(kind=dp), intent(inout) :: system_gradient(:,:)

(3, n_atoms_system)

public subroutine redistribute_cap_hessian(fragment, fragment_hessian, system_hessian)

Redistribute hydrogen cap Hessian to original atoms

Read more…

Arguments

Type IntentOptional Attributes Name
type(physical_fragment_t), intent(in) :: fragment
real(kind=dp), intent(in) :: fragment_hessian(:,:)

(3n_atoms_fragment, 3n_atoms_fragment)

real(kind=dp), intent(inout) :: system_hessian(:,:)

(3n_atoms_system, 3n_atoms_system)

private subroutine add_hydrogen_caps(atoms_in_fragment, bonds, sys_geom, fragment, base_atom_count)

Add hydrogen caps to fragment for broken bonds Caps are placed at the position of the atom outside the fragment

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: atoms_in_fragment(:)

0-indexed atom indices in fragment

type(bond_t), intent(in) :: bonds(:)
type(system_geometry_t), intent(in) :: sys_geom
type(physical_fragment_t), intent(inout) :: fragment
integer, intent(in) :: base_atom_count

Number of non-cap atoms

private subroutine count_hydrogen_caps(atoms_in_fragment, bonds, n_caps)

Count how many hydrogen caps are needed for a fragment A cap is needed when exactly one atom of a broken bond is in the fragment

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: atoms_in_fragment(:)

0-indexed atom indices in fragment

type(bond_t), intent(in), optional :: bonds(:)
integer, intent(out) :: n_caps

private subroutine fragment_compute_nelec(this)

Compute number of electrons from atomic numbers and charge

Arguments

Type IntentOptional Attributes Name
class(physical_fragment_t), intent(inout) :: this

private subroutine fragment_destroy(this)

Clean up allocated memory in physical_fragment_t

Arguments

Type IntentOptional Attributes Name
class(physical_fragment_t), intent(inout) :: this

private subroutine fragment_set_basis(this, basis)

Set the basis set for this fragment

Arguments

Type IntentOptional Attributes Name
class(physical_fragment_t), intent(inout) :: this
type(molecular_basis_type), intent(in) :: basis

private subroutine system_destroy(this)

Clean up allocated memory in system_geometry_t

Arguments

Type IntentOptional Attributes Name
class(system_geometry_t), intent(inout) :: this