(git:374b731)
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-2024 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,&
28 USE input_constants, ONLY: &
38 USE kinds, ONLY: default_path_length,&
40 dp
51 USE string_table, ONLY: id2str,&
52 s2s,&
53 str2id
76 USE topology_psf, ONLY: idm_psf,&
90#include "./base/base_uses.f90"
91
92 IMPLICIT NONE
93
94 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'topology'
95
96 PRIVATE
97
98! *** Public parameters ***
99 PUBLIC :: topology_control, &
101
102CONTAINS
103
104! **************************************************************************************************
105!> \brief ...
106!> \param atomic_kind_set ...
107!> \param particle_set ...
108!> \param molecule_kind_set ...
109!> \param molecule_set ...
110!> \param colvar_p ...
111!> \param gci ...
112!> \param root_section ...
113!> \param para_env ...
114!> \param qmmm ...
115!> \param qmmm_env ...
116!> \param force_env_section ...
117!> \param subsys_section ...
118!> \param use_motion_section ...
119!> \param exclusions ...
120!> \param elkind ...
121! **************************************************************************************************
122 SUBROUTINE topology_control(atomic_kind_set, particle_set, molecule_kind_set, &
123 molecule_set, colvar_p, gci, root_section, para_env, qmmm, qmmm_env, &
124 force_env_section, subsys_section, use_motion_section, exclusions, elkind)
125
126 TYPE(atomic_kind_type), DIMENSION(:), POINTER :: atomic_kind_set
127 TYPE(particle_type), DIMENSION(:), POINTER :: particle_set
128 TYPE(molecule_kind_type), DIMENSION(:), POINTER :: molecule_kind_set
129 TYPE(molecule_type), DIMENSION(:), POINTER :: molecule_set
130 TYPE(colvar_p_type), DIMENSION(:), POINTER :: colvar_p
131 TYPE(global_constraint_type), POINTER :: gci
132 TYPE(section_vals_type), POINTER :: root_section
133 TYPE(mp_para_env_type), POINTER :: para_env
134 LOGICAL, INTENT(IN), OPTIONAL :: qmmm
135 TYPE(qmmm_env_mm_type), OPTIONAL, POINTER :: qmmm_env
136 TYPE(section_vals_type), POINTER :: force_env_section, subsys_section
137 LOGICAL, INTENT(IN) :: use_motion_section
138 TYPE(exclusion_type), DIMENSION(:), OPTIONAL, &
139 POINTER :: exclusions
140 LOGICAL, INTENT(IN), OPTIONAL :: elkind
141
142 CHARACTER(LEN=*), PARAMETER :: routinen = 'topology_control'
143
144 INTEGER :: handle, iw, iw2
145 LOGICAL :: binary_coord_read, el_as_kind, explicit, &
146 my_qmmm
147 TYPE(cp_logger_type), POINTER :: logger
148 TYPE(section_vals_type), POINTER :: cell_section, constraint_section, &
149 topology_section
151
152 NULLIFY (logger)
153 logger => cp_get_default_logger()
154 CALL timeset(routinen, handle)
155 NULLIFY (cell_section, constraint_section, topology_section)
156
157 cell_section => section_vals_get_subs_vals(subsys_section, "CELL")
158 IF (use_motion_section) THEN
159 constraint_section => section_vals_get_subs_vals(root_section, "MOTION%CONSTRAINT")
160 END IF
161 topology_section => section_vals_get_subs_vals(subsys_section, "TOPOLOGY")
162 iw = cp_print_key_unit_nr(logger, subsys_section, "PRINT%TOPOLOGY_INFO", &
163 extension=".mmLog")
164 my_qmmm = .false.
165 IF (PRESENT(qmmm) .AND. PRESENT(qmmm_env)) my_qmmm = qmmm
166
167 IF (PRESENT(elkind)) THEN
168 CALL section_vals_val_get(topology_section, "USE_ELEMENT_AS_KIND", explicit=explicit)
169 IF (explicit) THEN
170 CALL section_vals_val_get(topology_section, "USE_ELEMENT_AS_KIND", l_val=el_as_kind)
171 ELSE
172 el_as_kind = elkind
173 END IF
174 ELSE
175 CALL section_vals_val_get(topology_section, "USE_ELEMENT_AS_KIND", l_val=el_as_kind)
176 END IF
177
178 ! 1. Initialize the topology structure type
180
181 ! 2. Get the cell info
182 CALL read_cell(topology%cell, topology%cell_ref, cell_section=cell_section, &
183 para_env=para_env)
184 CALL write_cell(topology%cell, subsys_section, tag="CELL_TOP")
185 CALL setup_cell_muc(topology%cell_muc, topology%cell, subsys_section)
186
187 ! 3. Read in the topology section in the input file if any
188 CALL read_topology_section(topology, topology_section)
189
190 ! 4. Read in the constraints section
191 CALL read_constraints_section(topology, colvar_p, constraint_section)
192
193 ! 5. Read in the coordinates
194 CALL read_binary_coordinates(topology, root_section, para_env, subsys_section, &
195 binary_coord_read)
196 IF (.NOT. binary_coord_read) THEN
197 CALL coordinate_control(topology, root_section, para_env, subsys_section)
198 END IF
199
200 ! 6. Read in or generate the molecular connectivity
201 CALL connectivity_control(topology, para_env, my_qmmm, qmmm_env, subsys_section, &
202 force_env_section)
203
204 IF (el_as_kind) THEN
205 ! redefine atom names with the name of the element
206 topology%atom_info%id_atmname(:) = topology%atom_info%id_element(:)
207 END IF
208
209 ! 7. Pack everything into the molecular types
210 CALL topology_connectivity_pack(molecule_kind_set, molecule_set, &
211 topology, subsys_section)
212
213 ! 8. Set up the QM/MM linkage (if any)
214 ! This part takes care of the molecule in which QM atoms were defined.
215 ! Preliminary setup for QM/MM link region
216 IF (my_qmmm) THEN
217 CALL qmmm_connectivity_control(molecule_set, qmmm_env, subsys_section)
218 END IF
219
220 ! 9. Pack everything into the atomic types
221 IF (my_qmmm) THEN
222 CALL topology_coordinate_pack(particle_set, atomic_kind_set, &
223 molecule_kind_set, molecule_set, &
224 topology, my_qmmm, qmmm_env, subsys_section, &
225 force_env_section=force_env_section, exclusions=exclusions)
226 ELSE
227 CALL topology_coordinate_pack(particle_set, atomic_kind_set, &
228 molecule_kind_set, molecule_set, &
229 topology, subsys_section=subsys_section, &
230 force_env_section=force_env_section, exclusions=exclusions)
231 END IF
232
233 !10. Post-Process colvar definitions (if needed)
234 CALL topology_post_proc_colvar(colvar_p, particle_set)
235
236 !11. Deal with the constraint stuff if requested
237 IF (my_qmmm) THEN
238 CALL topology_constraint_pack(molecule_kind_set, molecule_set, &
239 topology, qmmm_env, particle_set, root_section, subsys_section, &
240 gci)
241 ELSE
242 CALL topology_constraint_pack(molecule_kind_set, molecule_set, &
243 topology, particle_set=particle_set, input_file=root_section, &
244 subsys_section=subsys_section, gci=gci)
245 END IF
246
247 !12. Dump the topology informations
248 iw2 = cp_print_key_unit_nr(logger, subsys_section, "TOPOLOGY%DUMP_PDB", &
249 file_status="REPLACE", extension=".pdb")
250 IF (iw2 > 0) THEN
251 CALL write_coordinate_pdb(iw2, topology, subsys_section)
252 END IF
253 CALL cp_print_key_finished_output(iw2, logger, subsys_section, &
254 "TOPOLOGY%DUMP_PDB")
255 iw2 = cp_print_key_unit_nr(logger, subsys_section, "TOPOLOGY%DUMP_PSF", &
256 file_status="REPLACE", extension=".psf")
257 IF (iw2 > 0) THEN
258 CALL write_topology_psf(iw2, topology, subsys_section, force_env_section)
259 END IF
260 CALL cp_print_key_finished_output(iw2, logger, subsys_section, &
261 "TOPOLOGY%DUMP_PSF")
262
263 !13. Cleanup the topology structure type
265 CALL timestop(handle)
266 CALL cp_print_key_finished_output(iw, logger, subsys_section, &
267 "PRINT%TOPOLOGY_INFO")
268 END SUBROUTINE topology_control
269
270! **************************************************************************************************
271!> \brief 1. If reading in from external file, make sure its there first
272!> 2. Generate the connectivity if no information to be read in
273!> \param topology ...
274!> \param para_env ...
275!> \param qmmm ...
276!> \param qmmm_env ...
277!> \param subsys_section ...
278!> \param force_env_section ...
279!> \par History
280!> none
281!> \author IKUO 08.01.2003
282! **************************************************************************************************
283 SUBROUTINE connectivity_control(topology, para_env, qmmm, qmmm_env, subsys_section, &
284 force_env_section)
285
286 TYPE(topology_parameters_type), INTENT(INOUT) :: topology
287 TYPE(mp_para_env_type), POINTER :: para_env
288 LOGICAL, INTENT(in), OPTIONAL :: qmmm
289 TYPE(qmmm_env_mm_type), OPTIONAL, POINTER :: qmmm_env
290 TYPE(section_vals_type), POINTER :: subsys_section, force_env_section
291
292 CHARACTER(len=*), PARAMETER :: routinen = 'connectivity_control'
293 INTEGER, PARAMETER :: map0 = ichar("0"), map9 = ichar("9")
294
295 CHARACTER(len=default_string_length) :: element0, my_element
296 CHARACTER(len=default_string_length), &
297 ALLOCATABLE, DIMENSION(:) :: elements
298 INTEGER :: handle, handle2, i, id, itmp, iw, j, k
299 LOGICAL :: check, my_qmmm, use_mm_map_first
300 TYPE(cp_logger_type), POINTER :: logger
301
302 NULLIFY (logger)
303 logger => cp_get_default_logger()
304 iw = cp_print_key_unit_nr(logger, subsys_section, "PRINT%TOPOLOGY_INFO", &
305 extension=".mmLog")
306 CALL timeset(routinen, handle)
307
308 my_qmmm = .false.
309 IF (PRESENT(qmmm) .AND. PRESENT(qmmm_env)) my_qmmm = qmmm
310
311 ! 1. Read in the connectivity information (if this is the case)
312 SELECT CASE (topology%conn_type)
314 ! Do nothing for the time being.. after we check element and proceed with the workflow..
315 CASE DEFAULT
316 ! Prepare arrays
318
319 ! Read connectivity from file
320 CALL read_topology_conn(topology, topology%conn_type, topology%conn_file_name, &
321 para_env, subsys_section)
322
323 ! Post process of PSF and AMBER information
324 SELECT CASE (topology%conn_type)
326 CALL psf_post_process(topology, subsys_section)
327 END SELECT
328 END SELECT
329
330 ! 2. In case element was autoassigned let's keep up2date the element name
331 ! with the atom_name
332 IF (topology%aa_element) THEN
333 check = SIZE(topology%atom_info%id_element) == SIZE(topology%atom_info%id_atmname)
334 cpassert(check)
335 topology%atom_info%id_element = topology%atom_info%id_atmname
336 END IF
337
338 ! 3. Check for the element name..
339 CALL timeset(routinen//"_check_element_name", handle2)
340 ! Fix element name
341
342 ! we will only translate names if we actually have a connectivity file given
343 SELECT CASE (topology%conn_type)
345 use_mm_map_first = .true.
346 CASE DEFAULT
347 use_mm_map_first = .false.
348 END SELECT
349 CALL create_ff_map("AMBER")
350 CALL create_ff_map("CHARMM")
351 CALL create_ff_map("GROMOS")
352
353 ALLOCATE (elements(SIZE(topology%atom_info%id_element)))
354 DO i = 1, SIZE(elements)
355 elements(i) = id2str(topology%atom_info%id_element(i))
356 END DO
357
358 DO i = 1, topology%natoms
359 IF (elements(i) == "__DEF__") cycle
360 ! If present an underscore let's skip all that over the underscore
361 id = index(elements(i), "_") - 1
362 IF (id == -1) id = len_trim(elements(i))
363 ! Many atomic kind have been defined as ELEMENT+LETTER+NUMBER
364 ! the number at the end can vary arbitrarily..
365 ! Let's check all ELEMENT+LETTER skipping the number.. we should
366 ! identify in any case the element
367 DO j = id, 1, -1
368 itmp = ichar(elements(i) (j:j))
369 IF ((itmp < map0) .OR. (itmp > map9)) EXIT
370 END DO
371 element0 = elements(i) (1:j)
372 ! ALWAYS check for elements..
373 CALL check_subsys_element(element0, id2str(topology%atom_info%id_atmname(i)), my_element, &
374 subsys_section, use_mm_map_first)
375 ! Earn time fixing same element labels for same atoms
376 element0 = elements(i)
377 DO k = i, topology%natoms
378 IF (element0 == id2str(topology%atom_info%id_element(k))) THEN
379 topology%atom_info%id_element(k) = str2id(s2s(my_element))
380 elements(k) = "__DEF__"
381 END IF
382 END DO
383 END DO
384 DEALLOCATE (elements)
385 CALL destroy_ff_map("GROMOS")
386 CALL destroy_ff_map("CHARMM")
387 CALL destroy_ff_map("AMBER")
388 CALL timestop(handle2)
389
390 ! 4. Generate the connectivity information otherwise
391 SELECT CASE (topology%conn_type)
392 CASE (do_conn_generate)
393 CALL topology_set_atm_mass(topology, subsys_section)
394 CALL topology_generate_bond(topology, para_env, subsys_section)
395 IF (topology%reorder_atom) THEN
396 ! If we generate connectivity we can save memory reordering the molecules
397 ! in this case once a first connectivity has been created we match according
398 ! molecule names provided in the PDB and reorder the connectivity according to that.
399 CALL topology_reorder_atoms(topology, qmmm, qmmm_env, subsys_section, &
400 force_env_section)
401 CALL topology_set_atm_mass(topology, subsys_section)
402 CALL topology_generate_bond(topology, para_env, subsys_section)
403 END IF
404 CALL topology_generate_bend(topology, subsys_section)
405 CALL topology_generate_ub(topology, subsys_section)
406 CALL topology_generate_dihe(topology, subsys_section)
407 CALL topology_generate_impr(topology, subsys_section)
408 CALL topology_generate_onfo(topology, subsys_section)
410 CALL topology_set_atm_mass(topology, subsys_section)
411 CALL topology_generate_bend(topology, subsys_section)
412 CALL topology_generate_ub(topology, subsys_section)
413 CALL topology_generate_dihe(topology, subsys_section)
414 CALL topology_generate_impr(topology, subsys_section)
415 CALL topology_generate_onfo(topology, subsys_section)
416 END SELECT
417
418 ! 5. Handle multiple unit_cell - Update atoms_info
419 CALL topology_muc(topology, subsys_section)
420
421 ! 6. Handle multiple unit_cell - Update conn_info
422 CALL topology_conn_multiple(topology, subsys_section)
423
424 ! 7. Generate Molecules
425 CALL topology_generate_molecule(topology, my_qmmm, qmmm_env, subsys_section)
426 IF (topology%molecules_check) CALL topology_molecules_check(topology, subsys_section)
427
428 ! 8. Modify for QM/MM
429 IF (my_qmmm) THEN
430 CALL qmmm_coordinate_control(topology, qmmm_env, subsys_section)
431 END IF
432 CALL timestop(handle)
433 CALL cp_print_key_finished_output(iw, logger, subsys_section, &
434 "PRINT%TOPOLOGY_INFO")
435
436 END SUBROUTINE connectivity_control
437
438! **************************************************************************************************
439!> \brief Reads connectivity from file
440!> \param topology ...
441!> \param conn_type ...
442!> \param conn_file_name ...
443!> \param para_env ...
444!> \param subsys_section ...
445!> \author Teodoro Laino [tlaino] - 10.2009
446! **************************************************************************************************
447 RECURSIVE SUBROUTINE read_topology_conn(topology, conn_type, conn_file_name, para_env, &
448 subsys_section)
449
450 TYPE(topology_parameters_type), INTENT(INOUT) :: topology
451 INTEGER, INTENT(IN) :: conn_type
452 CHARACTER(LEN=default_path_length), INTENT(IN) :: conn_file_name
453 TYPE(mp_para_env_type), POINTER :: para_env
454 TYPE(section_vals_type), POINTER :: subsys_section
455
456 CHARACTER(len=default_path_length) :: filename
457 INTEGER :: i_rep, imol, loc_conn_type, n_rep, nmol
458 TYPE(section_vals_type), POINTER :: section
459
460 NULLIFY (section)
461
462 SELECT CASE (conn_type)
463 CASE (do_conn_mol_set)
464 section => section_vals_get_subs_vals(subsys_section, "TOPOLOGY%MOL_SET")
465 section => section_vals_get_subs_vals(section, "MOLECULE")
466 CALL section_vals_get(section, n_repetition=n_rep)
467 DO i_rep = 1, n_rep
468 CALL section_vals_val_get(section, "NMOL", i_val=nmol, i_rep_section=i_rep)
469 CALL section_vals_val_get(section, "CONN_FILE_NAME", c_val=filename, i_rep_section=i_rep)
470 CALL section_vals_val_get(section, "CONN_FILE_FORMAT", i_val=loc_conn_type, i_rep_section=i_rep)
471
472 SELECT CASE (loc_conn_type)
474 DO imol = 1, nmol
475 CALL read_topology_conn(topology, loc_conn_type, filename, para_env, subsys_section)
476 END DO
477 CASE DEFAULT
478 CALL cp_abort(__location__, &
479 "MOL_SET feature implemented only for PSF/UPSF, G87/G96 and AMBER "// &
480 "connectivity type.")
481 END SELECT
482 END DO
483 IF (SIZE(topology%atom_info%id_molname) /= topology%natoms) &
484 CALL cp_abort(__location__, &
485 "Number of atoms in connectivity control is larger than the "// &
486 "number of atoms in coordinate control. check coordinates and "// &
487 "connectivity. ")
488
489 ! Merge defined structures
490 section => section_vals_get_subs_vals(subsys_section, "TOPOLOGY%MOL_SET%MERGE_MOLECULES")
491 CALL idm_psf(topology, section, subsys_section)
492
494 CALL read_topology_gromos(conn_file_name, topology, para_env, subsys_section)
496 CALL read_topology_psf(conn_file_name, topology, para_env, subsys_section, conn_type)
497 CASE (do_conn_amb7)
498 CALL read_connectivity_amber(conn_file_name, topology, para_env, subsys_section)
499 END SELECT
500
501 END SUBROUTINE read_topology_conn
502
503! **************************************************************************************************
504!> \brief 1. If reading in from external file, make sure its there first
505!> 2. Read in the coordinates from the corresponding locations
506!> \param topology ...
507!> \param root_section ...
508!> \param para_env ...
509!> \param subsys_section ...
510!> \par History
511!> - Teodoro Laino [tlaino] - University of Zurich 10.2008
512!> adding support for AMBER coordinates
513!> \author IKUO 08.11.2003
514! **************************************************************************************************
515 SUBROUTINE coordinate_control(topology, root_section, para_env, subsys_section)
516
517 TYPE(topology_parameters_type), INTENT(INOUT) :: topology
518 TYPE(section_vals_type), POINTER :: root_section
519 TYPE(mp_para_env_type), POINTER :: para_env
520 TYPE(section_vals_type), POINTER :: subsys_section
521
522 CHARACTER(len=*), PARAMETER :: routinen = 'coordinate_control'
523
524 CHARACTER(LEN=default_string_length) :: message
525 INTEGER :: handle, handle2, istat, iw
526 LOGICAL :: found, save_mem
527 TYPE(cp_logger_type), POINTER :: logger
528 TYPE(section_vals_type), POINTER :: global_section
529
530 NULLIFY (logger)
531 logger => cp_get_default_logger()
532 iw = cp_print_key_unit_nr(logger, subsys_section, "PRINT%TOPOLOGY_INFO", &
533 extension=".mmLog")
534 CALL timeset(routinen, handle)
535
536 NULLIFY (global_section)
537 global_section => section_vals_get_subs_vals(root_section, "GLOBAL")
538 CALL section_vals_val_get(global_section, "SAVE_MEM", l_val=save_mem)
539
540 !-----------------------------------------------------------------------------
541 !-----------------------------------------------------------------------------
542 ! 1. If reading in from external file, make sure its there first
543 !-----------------------------------------------------------------------------
544 IF (topology%coordinate) THEN
545 INQUIRE (file=topology%coord_file_name, exist=found, iostat=istat)
546 IF (istat /= 0) THEN
547 WRITE (unit=message, fmt="(A,I0,A)") &
548 "An error occurred inquiring the file <"// &
549 trim(topology%coord_file_name)//"> (IOSTAT = ", istat, ")"
550 cpabort(trim(message))
551 END IF
552 IF (.NOT. found) THEN
553 CALL cp_abort(__location__, &
554 "Coordinate file <"//trim(topology%coord_file_name)// &
555 "> not found.")
556 END IF
557 END IF
558 !-----------------------------------------------------------------------------
559 !-----------------------------------------------------------------------------
560 ! 2. Read in the coordinates from the corresponding locations
561 !-----------------------------------------------------------------------------
562 CALL timeset(routinen//"_READ_COORDINATE", handle2)
563 SELECT CASE (topology%coord_type)
564 CASE (do_coord_off)
565 ! Do nothing.. we will parse later from the &COORD section..
566 CASE (do_coord_g96)
567 CALL read_coordinate_g96(topology, para_env, subsys_section)
568 CASE (do_coord_crd)
569 CALL read_coordinate_crd(topology, para_env, subsys_section)
570 CASE (do_coord_pdb)
571 CALL read_coordinate_pdb(topology, para_env, subsys_section)
572 CASE (do_coord_xyz)
573 CALL read_coordinate_xyz(topology, para_env, subsys_section)
574 CASE (do_coord_cif)
575 CALL read_coordinate_cif(topology, para_env, subsys_section)
576 CASE (do_coord_xtl)
577 CALL read_coordinate_xtl(topology, para_env, subsys_section)
578 CASE (do_coord_cp2k)
579 CALL read_coordinate_cp2k(topology, para_env, subsys_section)
580 CASE DEFAULT
581 ! We should never reach this point..
582 cpabort("")
583 END SELECT
584
585 ! Parse &COORD section and in case overwrite
586 IF (topology%coord_type /= do_coord_cp2k) THEN
587 CALL read_atoms_input(topology, overwrite=(topology%coord_type /= do_coord_off), &
588 subsys_section=subsys_section, save_mem=save_mem)
589 END IF
590 CALL section_vals_val_set(subsys_section, "TOPOLOGY%NUMBER_OF_ATOMS", &
591 i_val=topology%natoms)
592 CALL timestop(handle2)
593 ! Check on atom numbers
594 IF (topology%natoms <= 0) &
595 cpabort("No atomic coordinates have been found! ")
596 CALL timestop(handle)
597 CALL cp_print_key_finished_output(iw, logger, subsys_section, &
598 "PRINT%TOPOLOGY_INFO")
599 END SUBROUTINE coordinate_control
600
601! **************************************************************************************************
602!> \brief ...
603!> \param colvar_p ...
604!> \param particle_set ...
605!> \par History
606!> none
607!> \author Teodoro Laino [tlaino] - 07.2007
608! **************************************************************************************************
609 SUBROUTINE topology_post_proc_colvar(colvar_p, particle_set)
610
611 TYPE(colvar_p_type), DIMENSION(:), POINTER :: colvar_p
612 TYPE(particle_type), DIMENSION(:), POINTER :: particle_set
613
614 INTEGER :: i
615
616 IF (ASSOCIATED(colvar_p)) THEN
617 DO i = 1, SIZE(colvar_p)
618 CALL post_process_colvar(colvar_p(i)%colvar, particle_set)
619 END DO
620 END IF
621 END SUBROUTINE topology_post_proc_colvar
622
623! **************************************************************************************************
624!> \brief Setup the cell used for handling properly the multiple_unit_cell option
625!> \param cell_muc ...
626!> \param cell ...
627!> \param subsys_section ...
628!> \author Teodoro Laino [tlaino] - 06.2009
629! **************************************************************************************************
630 SUBROUTINE setup_cell_muc(cell_muc, cell, subsys_section)
631
632 TYPE(cell_type), POINTER :: cell_muc, cell
633 TYPE(section_vals_type), POINTER :: subsys_section
634
635 INTEGER, DIMENSION(:), POINTER :: multiple_unit_cell
636 REAL(kind=dp), DIMENSION(3, 3) :: hmat_ref
637
638 cpassert(.NOT. ASSOCIATED(cell_muc))
639
640 CALL section_vals_val_get(subsys_section, "CELL%MULTIPLE_UNIT_CELL", &
641 i_vals=multiple_unit_cell)
642 IF (any(multiple_unit_cell /= 1)) THEN
643 ! Restore the original cell
644 hmat_ref(:, 1) = cell%hmat(:, 1)/multiple_unit_cell(1)
645 hmat_ref(:, 2) = cell%hmat(:, 2)/multiple_unit_cell(2)
646 hmat_ref(:, 3) = cell%hmat(:, 3)/multiple_unit_cell(3)
647 ! Create the MUC cell
648 CALL cell_create(cell_muc, hmat=hmat_ref, periodic=cell%perd, tag="CELL_UC")
649 CALL write_cell(cell_muc, subsys_section)
650 ELSE
651 ! If a multiple_unit_cell was not requested just point to the original cell
652 CALL cell_retain(cell)
653 cell_muc => cell
654 END IF
655
656 END SUBROUTINE setup_cell_muc
657
658END 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.
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:125
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:285
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