Convert mqc_config_t geometry to system_geometry_t For unfragmented calculations (nfrag=0), treats entire system as single unit For fragmented calculations, currently assumes monomer-based fragmentation If molecule_index is provided, uses that specific molecule from multi-molecule mode
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(mqc_config_t), | intent(in) | :: | mqc_config | |||
| type(system_geometry_t), | intent(out) | :: | sys_geom | |||
| type(error_t), | intent(out) | :: | error | |||
| integer, | intent(in), | optional | :: | molecule_index |
Which molecule to use (for multi-molecule mode) |
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer, | private | :: | i | ||||
| logical, | private | :: | use_angstrom |
subroutine config_to_system_geometry(mqc_config, sys_geom, error, molecule_index) !! Convert mqc_config_t geometry to system_geometry_t !! For unfragmented calculations (nfrag=0), treats entire system as single unit !! For fragmented calculations, currently assumes monomer-based fragmentation !! If molecule_index is provided, uses that specific molecule from multi-molecule mode type(mqc_config_t), intent(in) :: mqc_config type(system_geometry_t), intent(out) :: sys_geom type(error_t), intent(out) :: error integer, intent(in), optional :: molecule_index !! Which molecule to use (for multi-molecule mode) integer :: i logical :: use_angstrom ! Determine units use_angstrom = .true. if (allocated(mqc_config%units)) then if (trim(mqc_config%units) == 'bohr') then use_angstrom = .false. end if end if ! Handle multi-molecule vs single molecule mode if (present(molecule_index)) then ! Multi-molecule mode: extract specific molecule if (molecule_index < 1 .or. molecule_index > mqc_config%nmol) then call error%set(ERROR_VALIDATION, "Invalid molecule_index in multi-molecule mode") return end if call molecule_to_system_geometry(mqc_config%molecules(molecule_index), & sys_geom, use_angstrom, mqc_config%allow_overlapping_fragments, error) else ! Single molecule mode (backward compatible) ! Check if geometry is loaded if (mqc_config%geometry%natoms == 0) then call error%set(ERROR_VALIDATION, "No geometry loaded in mqc_config") return end if if (mqc_config%nfrag == 0) then ! Unfragmented calculation: entire system is one "monomer" call geometry_to_system_unfragmented(mqc_config%geometry, sys_geom, use_angstrom) sys_geom%charge = mqc_config%charge sys_geom%multiplicity = mqc_config%multiplicity else ! Fragmented calculation with explicit fragments call geometry_to_system_fragmented(mqc_config, sys_geom, use_angstrom, error) if (error%has_error()) then call error%add_context("mqc_config_adapter:config_to_system_geometry") return end if end if end if end subroutine config_to_system_geometry