(git:419edc0)
Loading...
Searching...
No Matches
topology.F
Go to the documentation of this file.
1!--------------------------------------------------------------------------------------------------!
2! CP2K: A general program to perform molecular dynamics simulations !
3! Copyright 2000-2025 CP2K developers group <https://cp2k.org> !
4! !
5! SPDX-License-Identifier: GPL-2.0-or-later !
6!--------------------------------------------------------------------------------------------------!
7
8! **************************************************************************************************
9!> \brief Control for reading in different topologies and coordinates
10!> \par History
11!> none
12! **************************************************************************************************
16 USE cell_methods, ONLY: cell_create,&
17 read_cell,&
19 USE cell_types, ONLY: cell_retain,&
21 USE colvar_types, ONLY: colvar_p_type,&
30 USE input_constants, ONLY: &
40 USE kinds, ONLY: default_path_length,&
42 dp
53 USE string_table, ONLY: id2str,&
54 s2s,&
55 str2id
78 USE topology_psf, ONLY: idm_psf,&
92#include "./base/base_uses.f90"
93
94 IMPLICIT NONE
95
96 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'topology'
97
98 PRIVATE
99
100! *** Public parameters ***
101 PUBLIC :: topology_control, &
103
104CONTAINS
105
106! **************************************************************************************************
107!> \brief ...
108!> \param atomic_kind_set ...
109!> \param particle_set ...
110!> \param molecule_kind_set ...
111!> \param molecule_set ...
112!> \param colvar_p ...
113!> \param gci ...
114!> \param root_section ...
115!> \param para_env ...
116!> \param qmmm ...
117!> \param qmmm_env ...
118!> \param force_env_section ...
119!> \param subsys_section ...
120!> \param use_motion_section ...
121!> \param exclusions ...
122!> \param elkind ...
123! **************************************************************************************************
124 SUBROUTINE topology_control(atomic_kind_set, particle_set, molecule_kind_set, &
125 molecule_set, colvar_p, gci, root_section, para_env, qmmm, qmmm_env, &
126 force_env_section, subsys_section, use_motion_section, exclusions, elkind)
127
128 TYPE(atomic_kind_type), DIMENSION(:), POINTER :: atomic_kind_set
129 TYPE(particle_type), DIMENSION(:), POINTER :: particle_set
130 TYPE(molecule_kind_type), DIMENSION(:), POINTER :: molecule_kind_set
131 TYPE(molecule_type), DIMENSION(:), POINTER :: molecule_set
132 TYPE(colvar_p_type), DIMENSION(:), POINTER :: colvar_p
133 TYPE(global_constraint_type), POINTER :: gci
134 TYPE(section_vals_type), POINTER :: root_section
135 TYPE(mp_para_env_type), POINTER :: para_env
136 LOGICAL, INTENT(IN), OPTIONAL :: qmmm
137 TYPE(qmmm_env_mm_type), OPTIONAL, POINTER :: qmmm_env
138 TYPE(section_vals_type), POINTER :: force_env_section, subsys_section
139 LOGICAL, INTENT(IN) :: use_motion_section
140 TYPE(exclusion_type), DIMENSION(:), OPTIONAL, &
141 POINTER :: exclusions
142 LOGICAL, INTENT(IN), OPTIONAL :: elkind
143
144 CHARACTER(LEN=*), PARAMETER :: routinen = 'topology_control'
145
146 INTEGER :: handle, iw, iw2
147 LOGICAL :: binary_coord_read, el_as_kind, explicit, &
148 my_qmmm
149 TYPE(cp_logger_type), POINTER :: logger
150 TYPE(section_vals_type), POINTER :: cell_section, constraint_section, &
151 topology_section
153
154 NULLIFY (logger)
155 logger => cp_get_default_logger()
156 CALL timeset(routinen, handle)
157 NULLIFY (cell_section, constraint_section, topology_section)
158
159 cell_section => section_vals_get_subs_vals(subsys_section, "CELL")
160 IF (use_motion_section) THEN
161 constraint_section => section_vals_get_subs_vals(root_section, "MOTION%CONSTRAINT")
162 END IF
163 topology_section => section_vals_get_subs_vals(subsys_section, "TOPOLOGY")
164 iw = cp_print_key_unit_nr(logger, subsys_section, "PRINT%TOPOLOGY_INFO", &
165 extension=".mmLog")
166 my_qmmm = .false.
167 IF (PRESENT(qmmm) .AND. PRESENT(qmmm_env)) my_qmmm = qmmm
168
169 IF (PRESENT(elkind)) THEN
170 CALL section_vals_val_get(topology_section, "USE_ELEMENT_AS_KIND", explicit=explicit)
171 IF (explicit) THEN
172 CALL section_vals_val_get(topology_section, "USE_ELEMENT_AS_KIND", l_val=el_as_kind)
173 ELSE
174 el_as_kind = elkind
175 END IF
176 ELSE
177 CALL section_vals_val_get(topology_section, "USE_ELEMENT_AS_KIND", l_val=el_as_kind)
178 END IF
179
180 ! 1. Initialize the topology structure type
182
183 ! 2. Get the cell info
184 CALL read_cell(topology%cell, topology%cell_ref, cell_section=cell_section, &
185 para_env=para_env)
186 CALL write_cell(topology%cell, subsys_section, tag="CELL_TOP")
187 CALL setup_cell_muc(topology%cell_muc, topology%cell, subsys_section)
188
189 ! 3. Read in the topology section in the input file if any
190 CALL read_topology_section(topology, topology_section)
191
192 ! 4. Read in the constraints section
193 CALL read_constraints_section(topology, colvar_p, constraint_section)
194
195 ! 5. Read in the coordinates
196 CALL read_binary_coordinates(topology, root_section, para_env, subsys_section, &
197 binary_coord_read)
198 IF (.NOT. binary_coord_read) THEN
199 CALL coordinate_control(topology, root_section, para_env, subsys_section)
200 END IF
201
202 ! 6. Read in or generate the molecular connectivity
203 CALL connectivity_control(topology, para_env, my_qmmm, qmmm_env, subsys_section, &
204 force_env_section)
205
206 IF (el_as_kind) THEN
207 ! redefine atom names with the name of the element
208 topology%atom_info%id_atmname(:) = topology%atom_info%id_element(:)
209 END IF
210
211 ! 7. Pack everything into the molecular types
212 CALL topology_connectivity_pack(molecule_kind_set, molecule_set, &
213 topology, subsys_section)
214
215 ! 8. Set up the QM/MM linkage (if any)
216 ! This part takes care of the molecule in which QM atoms were defined.
217 ! Preliminary setup for QM/MM link region
218 IF (my_qmmm) THEN
219 CALL qmmm_connectivity_control(molecule_set, qmmm_env, subsys_section)
220 END IF
221
222 ! 9. Pack everything into the atomic types
223 IF (my_qmmm) THEN
224 CALL topology_coordinate_pack(particle_set, atomic_kind_set, &
225 molecule_kind_set, molecule_set, &
226 topology, my_qmmm, qmmm_env, subsys_section, &
227 force_env_section=force_env_section, exclusions=exclusions)
228 ELSE
229 CALL topology_coordinate_pack(particle_set, atomic_kind_set, &
230 molecule_kind_set, molecule_set, &
231 topology, subsys_section=subsys_section, &
232 force_env_section=force_env_section, exclusions=exclusions)
233 END IF
234
235 !10. Post-Process colvar definitions (if needed)
236 CALL topology_post_proc_colvar(colvar_p, particle_set)
237
238 !11. Deal with the constraint stuff if requested
239 IF (my_qmmm) THEN
240 CALL topology_constraint_pack(molecule_kind_set, molecule_set, &
241 topology, qmmm_env, particle_set, root_section, subsys_section, &
242 gci)
243 ELSE
244 CALL topology_constraint_pack(molecule_kind_set, molecule_set, &
245 topology, particle_set=particle_set, input_file=root_section, &
246 subsys_section=subsys_section, gci=gci)
247 END IF
248
249 !12. Dump the topology informations
250 iw2 = cp_print_key_unit_nr(logger, subsys_section, "TOPOLOGY%DUMP_PDB", &
251 file_status="REPLACE", extension=".pdb")
252 IF (iw2 > 0) THEN
253 CALL write_coordinate_pdb(iw2, topology, subsys_section)
254 END IF
255 CALL cp_print_key_finished_output(iw2, logger, subsys_section, &
256 "TOPOLOGY%DUMP_PDB")
257 iw2 = cp_print_key_unit_nr(logger, subsys_section, "TOPOLOGY%DUMP_PSF", &
258 file_status="REPLACE", extension=".psf")
259 IF (iw2 > 0) THEN
260 CALL write_topology_psf(iw2, topology, subsys_section, force_env_section)
261 END IF
262 CALL cp_print_key_finished_output(iw2, logger, subsys_section, &
263 "TOPOLOGY%DUMP_PSF")
264
265 !13. Cleanup the topology structure type
267 CALL timestop(handle)
268 CALL cp_print_key_finished_output(iw, logger, subsys_section, &
269 "PRINT%TOPOLOGY_INFO")
270 END SUBROUTINE topology_control
271
272! **************************************************************************************************
273!> \brief 1. If reading in from external file, make sure its there first
274!> 2. Generate the connectivity if no information to be read in
275!> \param topology ...
276!> \param para_env ...
277!> \param qmmm ...
278!> \param qmmm_env ...
279!> \param subsys_section ...
280!> \param force_env_section ...
281!> \par History
282!> none
283!> \author IKUO 08.01.2003
284! **************************************************************************************************
285 SUBROUTINE connectivity_control(topology, para_env, qmmm, qmmm_env, subsys_section, &
286 force_env_section)
287
288 TYPE(topology_parameters_type), INTENT(INOUT) :: topology
289 TYPE(mp_para_env_type), POINTER :: para_env
290 LOGICAL, INTENT(in), OPTIONAL :: qmmm
291 TYPE(qmmm_env_mm_type), OPTIONAL, POINTER :: qmmm_env
292 TYPE(section_vals_type), POINTER :: subsys_section, force_env_section
293
294 CHARACTER(len=*), PARAMETER :: routinen = 'connectivity_control'
295 INTEGER, PARAMETER :: map0 = ichar("0"), map9 = ichar("9")
296
297 CHARACTER(len=default_string_length) :: element0, my_element
298 CHARACTER(len=default_string_length), &
299 ALLOCATABLE, DIMENSION(:) :: elements
300 INTEGER :: handle, handle2, i, id, itmp, iw, j, k
301 LOGICAL :: check, my_qmmm, use_mm_map_first
302 TYPE(cp_logger_type), POINTER :: logger
303
304 NULLIFY (logger)
305 logger => cp_get_default_logger()
306 iw = cp_print_key_unit_nr(logger, subsys_section, "PRINT%TOPOLOGY_INFO", &
307 extension=".mmLog")
308 CALL timeset(routinen, handle)
309
310 my_qmmm = .false.
311 IF (PRESENT(qmmm) .AND. PRESENT(qmmm_env)) my_qmmm = qmmm
312
313 ! 1. Read in the connectivity information (if this is the case)
314 SELECT CASE (topology%conn_type)
316 ! Do nothing for the time being.. after we check element and proceed with the workflow..
317 CASE DEFAULT
318 ! Prepare arrays
320
321 ! Read connectivity from file
322 CALL read_topology_conn(topology, topology%conn_type, topology%conn_file_name, &
323 para_env, subsys_section)
324
325 ! Post process of PSF and AMBER information
326 SELECT CASE (topology%conn_type)
328 CALL psf_post_process(topology, subsys_section)
329 END SELECT
330 END SELECT
331
332 ! 2. In case element was autoassigned let's keep up2date the element name
333 ! with the atom_name
334 IF (topology%aa_element) THEN
335 check = SIZE(topology%atom_info%id_element) == SIZE(topology%atom_info%id_atmname)
336 cpassert(check)
337 topology%atom_info%id_element = topology%atom_info%id_atmname
338 END IF
339
340 ! 3. Check for the element name..
341 CALL timeset(routinen//"_check_element_name", handle2)
342 ! Fix element name
343
344 ! we will only translate names if we actually have a connectivity file given
345 SELECT CASE (topology%conn_type)
347 use_mm_map_first = .true.
348 CASE DEFAULT
349 use_mm_map_first = .false.
350 END SELECT
351 CALL create_ff_map("AMBER")
352 CALL create_ff_map("CHARMM")
353 CALL create_ff_map("GROMOS")
354
355 ALLOCATE (elements(SIZE(topology%atom_info%id_element)))
356 DO i = 1, SIZE(elements)
357 elements(i) = id2str(topology%atom_info%id_element(i))
358 END DO
359
360 DO i = 1, topology%natoms
361 IF (elements(i) == "__DEF__") cycle
362 ! If present an underscore let's skip all that over the underscore
363 id = index(elements(i), "_") - 1
364 IF (id == -1) id = len_trim(elements(i))
365 ! Many atomic kind have been defined as ELEMENT+LETTER+NUMBER
366 ! the number at the end can vary arbitrarily..
367 ! Let's check all ELEMENT+LETTER skipping the number.. we should
368 ! identify in any case the element
369 DO j = id, 1, -1
370 itmp = ichar(elements(i) (j:j))
371 IF ((itmp < map0) .OR. (itmp > map9)) EXIT
372 END DO
373 element0 = elements(i) (1:j)
374 ! ALWAYS check for elements..
375 CALL check_subsys_element(element0, id2str(topology%atom_info%id_atmname(i)), my_element, &
376 subsys_section, use_mm_map_first)
377 ! Earn time fixing same element labels for same atoms
378 element0 = elements(i)
379 DO k = i, topology%natoms
380 IF (element0 == id2str(topology%atom_info%id_element(k))) THEN
381 topology%atom_info%id_element(k) = str2id(s2s(my_element))
382 elements(k) = "__DEF__"
383 END IF
384 END DO
385 END DO
386 DEALLOCATE (elements)
387 CALL destroy_ff_map("GROMOS")
388 CALL destroy_ff_map("CHARMM")
389 CALL destroy_ff_map("AMBER")
390 CALL timestop(handle2)
391
392 ! 4. Generate the connectivity information otherwise
393 SELECT CASE (topology%conn_type)
394 CASE (do_conn_generate)
395 CALL topology_set_atm_mass(topology, subsys_section)
396 CALL topology_generate_bond(topology, para_env, subsys_section)
397 IF (topology%reorder_atom) THEN
398 ! If we generate connectivity we can save memory reordering the molecules
399 ! in this case once a first connectivity has been created we match according
400 ! molecule names provided in the PDB and reorder the connectivity according to that.
401 CALL topology_reorder_atoms(topology, qmmm, qmmm_env, subsys_section, &
402 force_env_section)
403 CALL topology_set_atm_mass(topology, subsys_section)
404 CALL topology_generate_bond(topology, para_env, subsys_section)
405 END IF
406 CALL topology_generate_bend(topology, subsys_section)
407 CALL topology_generate_ub(topology, subsys_section)
408 CALL topology_generate_dihe(topology, subsys_section)
409 CALL topology_generate_impr(topology, subsys_section)
410 CALL topology_generate_onfo(topology, subsys_section)
412 CALL topology_set_atm_mass(topology, subsys_section)
413 CALL topology_generate_bend(topology, subsys_section)
414 CALL topology_generate_ub(topology, subsys_section)
415 CALL topology_generate_dihe(topology, subsys_section)
416 CALL topology_generate_impr(topology, subsys_section)
417 CALL topology_generate_onfo(topology, subsys_section)
418 END SELECT
419
420 ! 5. Handle multiple unit_cell - Update atoms_info
421 CALL topology_muc(topology, subsys_section)
422
423 ! 6. Handle multiple unit_cell - Update conn_info
424 CALL topology_conn_multiple(topology, subsys_section)
425
426 ! 7. Generate Molecules
427 CALL topology_generate_molecule(topology, my_qmmm, qmmm_env, subsys_section)
428 IF (topology%molecules_check) CALL topology_molecules_check(topology, subsys_section)
429
430 ! 8. Modify for QM/MM
431 IF (my_qmmm) THEN
432 CALL qmmm_coordinate_control(topology, qmmm_env, subsys_section)
433 END IF
434 CALL timestop(handle)
435 CALL cp_print_key_finished_output(iw, logger, subsys_section, &
436 "PRINT%TOPOLOGY_INFO")
437
438 END SUBROUTINE connectivity_control
439
440! **************************************************************************************************
441!> \brief Reads connectivity from file
442!> \param topology ...
443!> \param conn_type ...
444!> \param conn_file_name ...
445!> \param para_env ...
446!> \param subsys_section ...
447!> \author Teodoro Laino [tlaino] - 10.2009
448! **************************************************************************************************
449 RECURSIVE SUBROUTINE read_topology_conn(topology, conn_type, conn_file_name, para_env, &
450 subsys_section)
451
452 TYPE(topology_parameters_type), INTENT(INOUT) :: topology
453 INTEGER, INTENT(IN) :: conn_type
454 CHARACTER(LEN=default_path_length), INTENT(IN) :: conn_file_name
455 TYPE(mp_para_env_type), POINTER :: para_env
456 TYPE(section_vals_type), POINTER :: subsys_section
457
458 CHARACTER(len=default_path_length) :: filename
459 INTEGER :: i_rep, imol, loc_conn_type, n_rep, nmol
460 TYPE(section_vals_type), POINTER :: section
461
462 NULLIFY (section)
463
464 SELECT CASE (conn_type)
465 CASE (do_conn_mol_set)
466 section => section_vals_get_subs_vals(subsys_section, "TOPOLOGY%MOL_SET")
467 section => section_vals_get_subs_vals(section, "MOLECULE")
468 CALL section_vals_get(section, n_repetition=n_rep)
469 DO i_rep = 1, n_rep
470 CALL section_vals_val_get(section, "NMOL", i_val=nmol, i_rep_section=i_rep)
471 CALL section_vals_val_get(section, "CONN_FILE_NAME", c_val=filename, i_rep_section=i_rep)
472 CALL section_vals_val_get(section, "CONN_FILE_FORMAT", i_val=loc_conn_type, i_rep_section=i_rep)
473
474 SELECT CASE (loc_conn_type)
476 DO imol = 1, nmol
477 CALL read_topology_conn(topology, loc_conn_type, filename, para_env, subsys_section)
478 END DO
479 CASE DEFAULT
480 CALL cp_abort(__location__, &
481 "MOL_SET feature implemented only for PSF/UPSF, G87/G96 and AMBER "// &
482 "connectivity type.")
483 END SELECT
484 END DO
485 IF (SIZE(topology%atom_info%id_molname) /= topology%natoms) &
486 CALL cp_abort(__location__, &
487 "Number of atoms in connectivity control is larger than the "// &
488 "number of atoms in coordinate control. check coordinates and "// &
489 "connectivity. ")
490
491 ! Merge defined structures
492 section => section_vals_get_subs_vals(subsys_section, "TOPOLOGY%MOL_SET%MERGE_MOLECULES")
493 CALL idm_psf(topology, section, subsys_section)
494
496 CALL read_topology_gromos(conn_file_name, topology, para_env, subsys_section)
498 CALL read_topology_psf(conn_file_name, topology, para_env, subsys_section, conn_type)
499 CASE (do_conn_amb7)
500 CALL read_connectivity_amber(conn_file_name, topology, para_env, subsys_section)
501 END SELECT
502
503 END SUBROUTINE read_topology_conn
504
505! **************************************************************************************************
506!> \brief 1. If reading in from external file, make sure its there first
507!> 2. Read in the coordinates from the corresponding locations
508!> \param topology ...
509!> \param root_section ...
510!> \param para_env ...
511!> \param subsys_section ...
512!> \par History
513!> - Teodoro Laino [tlaino] - University of Zurich 10.2008
514!> adding support for AMBER coordinates
515!> \author IKUO 08.11.2003
516! **************************************************************************************************
517 SUBROUTINE coordinate_control(topology, root_section, para_env, subsys_section)
518
519 TYPE(topology_parameters_type), INTENT(INOUT) :: topology
520 TYPE(section_vals_type), POINTER :: root_section
521 TYPE(mp_para_env_type), POINTER :: para_env
522 TYPE(section_vals_type), POINTER :: subsys_section
523
524 CHARACTER(len=*), PARAMETER :: routinen = 'coordinate_control'
525
526 CHARACTER(LEN=default_string_length) :: message
527 INTEGER :: handle, handle2, istat, iw
528 LOGICAL :: found, save_mem
529 TYPE(cp_logger_type), POINTER :: logger
530 TYPE(section_vals_type), POINTER :: global_section
531
532 NULLIFY (logger)
533 logger => cp_get_default_logger()
534 iw = cp_print_key_unit_nr(logger, subsys_section, "PRINT%TOPOLOGY_INFO", &
535 extension=".mmLog")
536 CALL timeset(routinen, handle)
537
538 NULLIFY (global_section)
539 global_section => section_vals_get_subs_vals(root_section, "GLOBAL")
540 CALL section_vals_val_get(global_section, "SAVE_MEM", l_val=save_mem)
541
542 !-----------------------------------------------------------------------------
543 !-----------------------------------------------------------------------------
544 ! 1. If reading in from external file, make sure its there first
545 !-----------------------------------------------------------------------------
546 IF (topology%coordinate) THEN
547 INQUIRE (file=topology%coord_file_name, exist=found, iostat=istat)
548 IF (istat /= 0) THEN
549 WRITE (unit=message, fmt="(A,I0,A)") &
550 "An error occurred inquiring the file <"// &
551 trim(topology%coord_file_name)//"> (IOSTAT = ", istat, ")"
552 cpabort(trim(message))
553 END IF
554 IF (.NOT. found) THEN
555 CALL cp_abort(__location__, &
556 "Coordinate file <"//trim(topology%coord_file_name)// &
557 "> not found.")
558 END IF
559 END IF
560 !-----------------------------------------------------------------------------
561 !-----------------------------------------------------------------------------
562 ! 2. Read in the coordinates from the corresponding locations
563 !-----------------------------------------------------------------------------
564 CALL timeset(routinen//"_READ_COORDINATE", handle2)
565 SELECT CASE (topology%coord_type)
566 CASE (do_coord_off)
567 ! Do nothing.. we will parse later from the &COORD section..
568 CASE (do_coord_g96)
569 CALL read_coordinate_g96(topology, para_env, subsys_section)
570 CASE (do_coord_crd)
571 CALL read_coordinate_crd(topology, para_env, subsys_section)
572 CASE (do_coord_pdb)
573 CALL read_coordinate_pdb(topology, para_env, subsys_section)
574 CASE (do_coord_xyz)
575 CALL read_coordinate_xyz(topology, para_env, subsys_section)
576 CASE (do_coord_cif)
577 CALL read_coordinate_cif(topology, para_env, subsys_section)
578 CASE (do_coord_xtl)
579 CALL read_coordinate_xtl(topology, para_env, subsys_section)
580 CASE (do_coord_cp2k)
581 CALL read_coordinate_cp2k(topology, para_env, subsys_section)
582 CASE DEFAULT
583 ! We should never reach this point..
584 cpabort("")
585 END SELECT
586
587 ! Parse &COORD section and in case overwrite
588 IF (topology%coord_type /= do_coord_cp2k) THEN
589 CALL read_atoms_input(topology, overwrite=(topology%coord_type /= do_coord_off), &
590 subsys_section=subsys_section, save_mem=save_mem)
591 END IF
592 CALL section_vals_val_set(subsys_section, "TOPOLOGY%NUMBER_OF_ATOMS", &
593 i_val=topology%natoms)
594 CALL timestop(handle2)
595 ! Check on atom numbers
596 IF (topology%natoms <= 0) &
597 cpabort("No atomic coordinates have been found! ")
598 CALL timestop(handle)
599 CALL cp_print_key_finished_output(iw, logger, subsys_section, &
600 "PRINT%TOPOLOGY_INFO")
601 END SUBROUTINE coordinate_control
602
603! **************************************************************************************************
604!> \brief ...
605!> \param colvar_p ...
606!> \param particle_set ...
607!> \par History
608!> none
609!> \author Teodoro Laino [tlaino] - 07.2007
610! **************************************************************************************************
611 SUBROUTINE topology_post_proc_colvar(colvar_p, particle_set)
612
613 TYPE(colvar_p_type), DIMENSION(:), POINTER :: colvar_p
614 TYPE(particle_type), DIMENSION(:), POINTER :: particle_set
615
616 INTEGER :: i, j
617
618 IF (ASSOCIATED(colvar_p)) THEN
619 DO i = 1, SIZE(colvar_p)
620 IF (colvar_p(i)%colvar%type_id == combine_colvar_id) THEN
621 DO j = 1, SIZE(colvar_p(i)%colvar%combine_cvs_param%colvar_p)
622 CALL post_process_colvar(colvar_p(i)%colvar%combine_cvs_param%colvar_p(j)%colvar, particle_set)
623 END DO
624 CALL colvar_setup(colvar_p(i)%colvar)
625 ELSE
626 CALL post_process_colvar(colvar_p(i)%colvar, particle_set)
627 END IF
628 END DO
629 END IF
630 END SUBROUTINE topology_post_proc_colvar
631
632! **************************************************************************************************
633!> \brief Setup the cell used for handling properly the multiple_unit_cell option
634!> \param cell_muc ...
635!> \param cell ...
636!> \param subsys_section ...
637!> \author Teodoro Laino [tlaino] - 06.2009
638! **************************************************************************************************
639 SUBROUTINE setup_cell_muc(cell_muc, cell, subsys_section)
640
641 TYPE(cell_type), POINTER :: cell_muc, cell
642 TYPE(section_vals_type), POINTER :: subsys_section
643
644 INTEGER, DIMENSION(:), POINTER :: multiple_unit_cell
645 REAL(kind=dp), DIMENSION(3, 3) :: hmat_ref
646
647 cpassert(.NOT. ASSOCIATED(cell_muc))
648
649 CALL section_vals_val_get(subsys_section, "CELL%MULTIPLE_UNIT_CELL", &
650 i_vals=multiple_unit_cell)
651 IF (any(multiple_unit_cell /= 1)) THEN
652 ! Restore the original cell
653 hmat_ref(:, 1) = cell%hmat(:, 1)/multiple_unit_cell(1)
654 hmat_ref(:, 2) = cell%hmat(:, 2)/multiple_unit_cell(2)
655 hmat_ref(:, 3) = cell%hmat(:, 3)/multiple_unit_cell(3)
656 ! Create the MUC cell
657 CALL cell_create(cell_muc, hmat=hmat_ref, periodic=cell%perd, tag="CELL_UC")
658 CALL write_cell(cell_muc, subsys_section)
659 ELSE
660 ! If a multiple_unit_cell was not requested just point to the original cell
661 CALL cell_retain(cell)
662 cell_muc => cell
663 END IF
664
665 END SUBROUTINE setup_cell_muc
666
667END MODULE topology
Define the atomic kind types and their sub types.
subroutine, public read_atoms_input(topology, overwrite, subsys_section, save_mem)
...
Definition atoms_input.F:70
Handles all functions related to the CELL.
recursive subroutine, public read_cell(cell, cell_ref, use_ref_cell, cell_section, check_for_ref, para_env)
...
subroutine, public write_cell(cell, subsys_section, tag)
Write the cell parameters to the output unit.
subroutine, public cell_create(cell, hmat, periodic, tag)
allocates and initializes a cell
Handles all functions related to the CELL.
Definition cell_types.F:15
subroutine, public cell_retain(cell)
retains the given cell (see doc/ReferenceCounting.html)
Definition cell_types.F:542
Initialize the collective variables types.
integer, parameter, public combine_colvar_id
subroutine, public colvar_setup(colvar)
Finalize the setup of the collective variable.
evaluations of colvar for internal coordinates schemes
subroutine, public post_process_colvar(colvar, particles)
Complete the description of the COORDINATION colvar when defined using KINDS.
various routines to log and control the output. The idea is that decisions about where to log should ...
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,...
an exclusion type
collects all constants needed in input so that they can be used without circular dependencies
integer, parameter, public do_conn_g87
integer, parameter, public do_coord_crd
integer, parameter, public do_coord_xtl
integer, parameter, public do_conn_psf_u
integer, parameter, public do_conn_off
integer, parameter, public do_conn_user
integer, parameter, public do_coord_cif
integer, parameter, public do_conn_amb7
integer, parameter, public do_conn_psf
integer, parameter, public do_conn_generate
integer, parameter, public do_conn_mol_set
integer, parameter, public do_conn_g96
integer, parameter, public do_coord_pdb
integer, parameter, public do_coord_xyz
integer, parameter, public do_coord_off
integer, parameter, public do_coord_g96
integer, parameter, public do_coord_cp2k
Routines to read the binary restart file of CP2K.
subroutine, public read_binary_coordinates(topology, root_section, para_env, subsys_section, binary_file_read)
Read the input section &COORD from an external file written in binary format.
objects that represent the structure of input sections and the data contained in an input section
subroutine, public section_vals_val_set(section_vals, keyword_name, i_rep_section, i_rep_val, val, l_val, i_val, r_val, c_val, l_vals_ptr, i_vals_ptr, r_vals_ptr, c_vals_ptr)
sets the requested value
recursive type(section_vals_type) function, pointer, public section_vals_get_subs_vals(section_vals, subsection_name, i_rep_section, can_return_null)
returns the values of the requested subsection
subroutine, public section_vals_get(section_vals, ref_count, n_repetition, n_subs_vals_rep, section, explicit)
returns various attributes about the section_vals
subroutine, public section_vals_val_get(section_vals, keyword_name, i_rep_section, i_rep_val, n_rep_val, val, l_val, i_val, r_val, c_val, l_vals, i_vals, r_vals, c_vals, explicit)
returns the requested value
Defines the basic variable types.
Definition kinds.F:23
integer, parameter, public dp
Definition kinds.F:34
integer, parameter, public default_string_length
Definition kinds.F:57
integer, parameter, public default_path_length
Definition kinds.F:58
Interface to the message passing library MPI.
Contains the mapping ATOM_KIND -> ELEMENT for the most common cases in CHARMM and AMBER This should a...
subroutine, public create_ff_map(ff_type)
Initialize arrays for mapping KINDS <-> ELEMENTS for major elements in AMBER and CHARMM.
subroutine, public destroy_ff_map(ff_type)
Deallocates the arrays used for mapping.
Define the molecule kind structure types and the corresponding functionality.
Define the data structure for the molecule information.
Define the data structure for the particle information.
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
Handles all functions used to read and interpret AMBER coordinates and topology files.
subroutine, public read_coordinate_crd(topology, para_env, subsys_section)
Reads the ‘coord’ version generated by the PARM or LEaP programs, as well as the ‘restrt’ version,...
subroutine, public read_connectivity_amber(filename, topology, para_env, subsys_section)
Read AMBER topology file (.top) : At this level we parse only the connectivity info the ....
Handles CIF (Crystallographic Information File) files.
subroutine, public read_coordinate_cif(topology, para_env, subsys_section)
Performs the real task of reading the proper information from the CIF file.
Collection of subroutine needed for topology related things.
subroutine, public topology_conn_multiple(topology, subsys_section)
Handles the multiple unit cell option for the connectivity.
subroutine, public topology_connectivity_pack(molecule_kind_set, molecule_set, topology, subsys_section)
topology connectivity pack
Collection of subroutine needed for topology related things.
subroutine, public topology_constraint_pack(molecule_kind_set, molecule_set, topology, qmmm_env, particle_set, input_file, subsys_section, gci)
Pack in all the information needed for the constraints.
Collection of subroutine needed for topology related things.
subroutine, public topology_coordinate_pack(particle_set, atomic_kind_set, molecule_kind_set, molecule_set, topology, qmmm, qmmm_env, subsys_section, force_env_section, exclusions, ignore_outside_box)
Take info readin from different file format and stuff it into compatible data structure in cp2k.
subroutine, public read_coordinate_cp2k(topology, para_env, subsys_section)
Read the CP2K &COORD section from an external file, i.e. read atomic coordinates and molecule/residue...
Collection of subroutine needed for topology related things.
subroutine, public topology_generate_impr(topology, subsys_section)
Using a list of bends, generate a list of impr.
subroutine, public topology_generate_onfo(topology, subsys_section)
Using a list of torsion, generate a list of onfo.
subroutine, public topology_generate_bend(topology, subsys_section)
Using a list of bonds, generate a list of bends.
subroutine, public topology_generate_molecule(topology, qmmm, qmmm_env, subsys_section)
Use information from bond list to generate molecule. (ie clustering)
subroutine, public topology_generate_dihe(topology, subsys_section)
Generate a list of torsions from bonds.
subroutine, public topology_generate_ub(topology, subsys_section)
The list of Urey-Bradley is equal to the list of bends.
subroutine, public topology_generate_bond(topology, para_env, subsys_section)
Use info from periodic table and assumptions to generate bonds.
subroutine, public read_coordinate_g96(topology, para_env, subsys_section)
...
subroutine, public read_topology_gromos(file_name, topology, para_env, subsys_section)
Read GROMOS topology file.
Reads the input sections "topology".
subroutine, public read_topology_section(topology, topology_section)
reads the input section topology
subroutine, public read_constraints_section(topology, colvar_p, constraint_section)
Read all the distance parameters. Put them in the constraint_distance array.
Handles the multiple unit cell option regarding atomic coordinates.
subroutine, public topology_muc(topology, subsys_section)
Handles the multiple_unit_cell for the atomic coordinates..
Handles PDB files.
subroutine, public write_coordinate_pdb(file_unit, topology, subsys_section)
...
subroutine, public read_coordinate_pdb(topology, para_env, subsys_section)
...
Functionality to read in PSF topologies and convert it into local data structures.
subroutine, public read_topology_psf(filename, topology, para_env, subsys_section, psf_type)
Read PSF topology file Teodoro Laino - Introduced CHARMM31 EXT PSF standard format.
subroutine, public idm_psf(topology, section, subsys_section)
Input driven modification (IDM) of PSF defined structures.
subroutine, public write_topology_psf(file_unit, topology, subsys_section, force_env_section)
Teodoro Laino - 01.2006 Write PSF topology file in the CHARMM31 EXT standard format.
subroutine, public psf_post_process(topology, subsys_section)
Post processing of PSF informations.
subroutine, public deallocate_topology(topology)
Just DEALLOCATE all the stuff
subroutine, public pre_read_topology(topology)
Deallocate possibly allocated arrays before reading topology.
subroutine, public init_topology(topology)
Just NULLIFY and zero all the stuff
Collection of subroutine needed for topology related things.
subroutine, public topology_molecules_check(topology, subsys_section)
Check and verify that all molecules of the same kind are bonded the same.
subroutine, public topology_reorder_atoms(topology, qmmm, qmmm_env_mm, subsys_section, force_env_section)
...
subroutine, public topology_set_atm_mass(topology, subsys_section)
Use info from periodic table and set atm_mass.
subroutine, public check_subsys_element(element_in, atom_name_in, element_out, subsys_section, use_mm_map_first)
Check and returns the ELEMENT label.
Handles XTL (Molecular Simulations, Inc (MSI)) files.
subroutine, public read_coordinate_xtl(topology, para_env, subsys_section)
Performs the real task of reading the proper information from the XTL file.
subroutine, public read_coordinate_xyz(topology, para_env, subsys_section)
...
Control for reading in different topologies and coordinates.
Definition topology.F:13
subroutine, public topology_control(atomic_kind_set, particle_set, molecule_kind_set, molecule_set, colvar_p, gci, root_section, para_env, qmmm, qmmm_env, force_env_section, subsys_section, use_motion_section, exclusions, elkind)
...
Definition topology.F:127
subroutine, public connectivity_control(topology, para_env, qmmm, qmmm_env, subsys_section, force_env_section)
If reading in from external file, make sure its there first
Definition topology.F:287
Provides all information about an atomic kind.
Type defining parameters related to the simulation cell.
Definition cell_types.F:55
type of a logger, at the moment it contains just a print level starting at which level it should be l...
A type used to store lists of exclusions and onfos.
stores all the informations relevant to an mpi environment