90 #include "./base/base_uses.f90"
94 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'topology'
123 molecule_set, colvar_p, gci, root_section, para_env, qmmm, qmmm_env, &
124 force_env_section, subsys_section, use_motion_section, exclusions, elkind)
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
142 CHARACTER(LEN=*),
PARAMETER :: routinen =
'topology_control'
144 INTEGER :: handle, iw, iw2
145 LOGICAL :: binary_coord_read, el_as_kind, explicit, &
147 TYPE(cp_logger_type),
POINTER :: logger
148 TYPE(section_vals_type),
POINTER :: cell_section, constraint_section, &
154 CALL timeset(routinen, handle)
155 NULLIFY (cell_section, constraint_section, topology_section)
158 IF (use_motion_section)
THEN
165 IF (
PRESENT(qmmm) .AND.
PRESENT(qmmm_env)) my_qmmm = qmmm
167 IF (
PRESENT(elkind))
THEN
196 IF (.NOT. binary_coord_read)
THEN
197 CALL coordinate_control(
topology, root_section, para_env, subsys_section)
223 molecule_kind_set, molecule_set, &
224 topology, my_qmmm, qmmm_env, subsys_section, &
225 force_env_section=force_env_section, exclusions=exclusions)
228 molecule_kind_set, molecule_set, &
229 topology, subsys_section=subsys_section, &
230 force_env_section=force_env_section, exclusions=exclusions)
234 CALL topology_post_proc_colvar(colvar_p, particle_set)
239 topology, qmmm_env, particle_set, root_section, subsys_section, &
243 topology, particle_set=particle_set, input_file=root_section, &
244 subsys_section=subsys_section, gci=gci)
249 file_status=
"REPLACE", extension=
".pdb")
256 file_status=
"REPLACE", extension=
".psf")
265 CALL timestop(handle)
267 "PRINT%TOPOLOGY_INFO")
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
292 CHARACTER(len=*),
PARAMETER :: routinen =
'connectivity_control'
293 INTEGER,
PARAMETER :: map0 = ichar(
"0"), map9 = ichar(
"9")
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
306 CALL timeset(routinen, handle)
309 IF (
PRESENT(qmmm) .AND.
PRESENT(qmmm_env)) my_qmmm = qmmm
321 para_env, subsys_section)
333 check =
SIZE(
topology%atom_info%id_element) ==
SIZE(
topology%atom_info%id_atmname)
339 CALL timeset(routinen//
"_check_element_name", handle2)
345 use_mm_map_first = .true.
347 use_mm_map_first = .false.
353 ALLOCATE (elements(
SIZE(
topology%atom_info%id_element)))
354 DO i = 1,
SIZE(elements)
359 IF (elements(i) ==
"__DEF__") cycle
361 id = index(elements(i),
"_") - 1
362 IF (id == -1) id = len_trim(elements(i))
368 itmp = ichar(elements(i) (j:j))
369 IF ((itmp < map0) .OR. (itmp > map9))
EXIT
371 element0 = elements(i) (1:j)
374 subsys_section, use_mm_map_first)
376 element0 = elements(i)
380 elements(k) =
"__DEF__"
384 DEALLOCATE (elements)
388 CALL timestop(handle2)
432 CALL timestop(handle)
434 "PRINT%TOPOLOGY_INFO")
447 RECURSIVE SUBROUTINE read_topology_conn(topology, conn_type, conn_file_name, para_env, &
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
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
462 SELECT CASE (conn_type)
470 CALL section_vals_val_get(section,
"CONN_FILE_FORMAT", i_val=loc_conn_type, i_rep_section=i_rep)
472 SELECT CASE (loc_conn_type)
475 CALL read_topology_conn(
topology, loc_conn_type, filename, para_env, subsys_section)
478 CALL cp_abort(__location__, &
479 "MOL_SET feature implemented only for PSF/UPSF, G87/G96 and AMBER "// &
480 "connectivity type.")
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 "// &
501 END SUBROUTINE read_topology_conn
515 SUBROUTINE coordinate_control(topology, root_section, para_env, subsys_section)
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
522 CHARACTER(len=*),
PARAMETER :: routinen =
'coordinate_control'
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
534 CALL timeset(routinen, handle)
536 NULLIFY (global_section)
545 INQUIRE (file=
topology%coord_file_name, exist=found, iostat=istat)
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))
552 IF (.NOT. found)
THEN
553 CALL cp_abort(__location__, &
554 "Coordinate file <"//trim(
topology%coord_file_name)// &
562 CALL timeset(routinen//
"_READ_COORDINATE", handle2)
588 subsys_section=subsys_section, save_mem=save_mem)
592 CALL timestop(handle2)
595 cpabort(
"No atomic coordinates have been found! ")
596 CALL timestop(handle)
598 "PRINT%TOPOLOGY_INFO")
599 END SUBROUTINE coordinate_control
609 SUBROUTINE topology_post_proc_colvar(colvar_p, particle_set)
611 TYPE(colvar_p_type),
DIMENSION(:),
POINTER :: colvar_p
612 TYPE(particle_type),
DIMENSION(:),
POINTER :: particle_set
616 IF (
ASSOCIATED(colvar_p))
THEN
617 DO i = 1,
SIZE(colvar_p)
621 END SUBROUTINE topology_post_proc_colvar
630 SUBROUTINE setup_cell_muc(cell_muc, cell, subsys_section)
632 TYPE(cell_type),
POINTER :: cell_muc, cell
633 TYPE(section_vals_type),
POINTER :: subsys_section
635 INTEGER,
DIMENSION(:),
POINTER :: multiple_unit_cell
636 REAL(kind=
dp),
DIMENSION(3, 3) :: hmat_ref
638 cpassert(.NOT.
ASSOCIATED(cell_muc))
641 i_vals=multiple_unit_cell)
642 IF (any(multiple_unit_cell /= 1))
THEN
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)
648 CALL cell_create(cell_muc, hmat=hmat_ref, periodic=cell%perd, tag=
"CELL_UC")
656 END SUBROUTINE setup_cell_muc
Define the atomic kind types and their sub types.
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.
subroutine, public cell_retain(cell)
retains the given cell (see doc/ReferenceCounting.html)
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,...
Defines the basic variable types.
integer, parameter, public dp
integer, parameter, public default_string_length
integer, parameter, public default_path_length
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.
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..
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.
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)
...
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