28#include "./base/base_uses.f90"
32 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'qmmm_topology_util'
54 CHARACTER(len=*),
PARAMETER :: routinen =
'qmmm_coordinate_control'
56 CHARACTER(LEN=default_string_length) :: prefix_lnk
57 INTEGER :: handle, iatm, iw
58 LOGICAL :: qmmm_index_in_range
61 CALL timeset(routinen, handle)
65 extension=
".subsysLog")
66 IF (iw > 0)
WRITE (iw, *)
" Entering qmmm_coordinate_control"
70 cpassert(
SIZE(qmmm_env%qm_atom_index) /= 0)
71 qmmm_index_in_range = (maxval(qmmm_env%qm_atom_index) <=
SIZE(
topology%atom_info%id_atmname)) &
72 .AND. (minval(qmmm_env%qm_atom_index) > 0)
73 cpassert(qmmm_index_in_range)
74 DO iatm = 1,
SIZE(qmmm_env%qm_atom_index)
75 topology%atom_info%id_atmname(qmmm_env%qm_atom_index(iatm)) = &
77 topology%atom_info%id_resname(qmmm_env%qm_atom_index(iatm)) = &
83 IF (
ASSOCIATED(qmmm_env%mm_link_atoms))
THEN
84 DO iatm = 1,
SIZE(qmmm_env%mm_link_atoms)
85 prefix_lnk =
"_LNK000"
86 WRITE (prefix_lnk(5:),
'(I20)') iatm
88 topology%atom_info%id_atmname(qmmm_env%mm_link_atoms(iatm)) = &
90 topology%atom_info%id_resname(qmmm_env%mm_link_atoms(iatm)) = &
95 IF (iw > 0)
WRITE (iw, *)
" Exiting qmmm_coordinate_control"
97 "PRINT%TOPOLOGY_INFO/UTIL_INFO")
111 qmmm_env, subsys_section)
117 CHARACTER(len=*),
PARAMETER :: routinen =
'qmmm_connectivity_control'
119 INTEGER :: first_atom, handle, i, imolecule, iw, &
120 last_atom, natom, output_unit, &
122 INTEGER,
DIMENSION(:),
POINTER :: qm_atom_index, qm_molecule_index
123 LOGICAL :: detected_link
128 NULLIFY (qm_atom_index, qm_molecule_index, molecule, molecule_kind)
129 detected_link = .false.
133 extension=
".subsysLog")
134 CALL timeset(routinen, handle)
136 qm_atom_index => qmmm_env%qm_atom_index
137 DO imolecule = 1,
SIZE(molecule_set)
138 IF (iw > 0)
WRITE (iw, *)
"Entering molecule number ::", imolecule
139 molecule => molecule_set(imolecule)
140 CALL get_molecule(molecule, molecule_kind=molecule_kind, &
141 first_atom=first_atom, last_atom=last_atom)
142 IF (any(qm_atom_index >= first_atom .AND. qm_atom_index <= last_atom)) &
143 qm_mol_num = qm_mol_num + 1
146 ALLOCATE (qm_molecule_index(qm_mol_num))
148 DO imolecule = 1,
SIZE(molecule_set)
149 IF (iw > 0)
WRITE (iw, *)
"Entering molecule number ::", imolecule
150 molecule => molecule_set(imolecule)
151 CALL get_molecule(molecule, molecule_kind=molecule_kind, &
152 first_atom=first_atom, last_atom=last_atom)
153 natom = last_atom - first_atom + 1
154 IF (any(qm_atom_index >= first_atom .AND. qm_atom_index <= last_atom))
THEN
155 qm_mol_num = qm_mol_num + 1
160 detected_link = .false.
161 DO i = first_atom, last_atom
162 IF (.NOT. any(qm_atom_index == i)) detected_link = .true.
164 IF (detected_link)
THEN
165 IF (iw > 0)
WRITE (iw, fmt=
'(A)', advance=
"NO")
" QM/MM link detected..."
166 IF (.NOT. qmmm_env%qmmm_link)
THEN
167 IF (iw > 0)
WRITE (iw, fmt=
'(A)')
" Missing LINK section in input file!"
168 WRITE (output_unit,
'(T2,"QMMM_CONNECTIVITY|",A)') &
169 " ERROR in the QM/MM connectivity. A QM/MM LINK was detected but", &
170 " no LINK section was provided in the Input file!", &
171 " This very probably can be identified as an error in the specified QM", &
172 " indexes or in a missing LINK section. Check your structure!"
176 qm_molecule_index(qm_mol_num) = imolecule
179 IF (
ASSOCIATED(qmmm_env%qm_molecule_index))
DEALLOCATE (qmmm_env%qm_molecule_index)
180 qmmm_env%qm_molecule_index => qm_molecule_index
181 IF (iw > 0)
WRITE (iw, *)
" QM molecule index ::", qm_molecule_index
183 "PRINT%TOPOLOGY_INFO/UTIL_INFO")
184 CALL timestop(handle)
various routines to log and control the output. The idea is that decisions about where to log should ...
integer function, public cp_logger_get_default_io_unit(logger)
returns the unit nr for the ionode (-1 on all other processors) skips as well checks if the procs cal...
type(cp_logger_type) function, pointer, public cp_get_default_logger()
returns the default logger
routines to handle the output, The idea is to remove the decision of wheter to output and what to out...
integer function, public cp_print_key_unit_nr(logger, basis_section, print_key_path, extension, middle_name, local, log_filename, ignore_should_output, file_form, file_position, file_action, file_status, do_backup, on_file, is_new_file, mpi_io, fout)
...
subroutine, public cp_print_key_finished_output(unit_nr, logger, basis_section, print_key_path, local, ignore_should_output, on_file, mpi_io)
should be called after you finish working with a unit obtained with cp_print_key_unit_nr,...
Defines the basic variable types.
integer, parameter, public default_string_length
Define the molecule kind structure types and the corresponding functionality.
Define the data structure for the molecule information.
subroutine, public get_molecule(molecule, molecule_kind, lmi, lci, lg3x3, lg4x6, lcolv, first_atom, last_atom, first_shell, last_shell)
Get components from a molecule data set.
subroutine, public qmmm_coordinate_control(topology, qmmm_env, subsys_section)
Modifies the atom_infoid_atmname.
subroutine, public qmmm_connectivity_control(molecule_set, qmmm_env, subsys_section)
Set up the connectivity for QM/MM calculations.
generates a unique id number for a string (str2id) that can be used two compare two strings....
character(len=default_string_length) function, public s2s(str)
converts a string in a string of default_string_length
integer function, public str2id(str)
returns a unique id for a given string, and stores the string for later retrieval using the id.
character(len=default_string_length) function, public id2str(id)
returns the string associated with a given id
Utilities for string manipulations.
subroutine, public compress(string, full)
Eliminate multiple space characters in a string. If full is .TRUE., then all spaces are eliminated.
Control for reading in different topologies and coordinates.
type of a logger, at the moment it contains just a print level starting at which level it should be l...