85 molecule_kind_set, molecule_set, topology, qmmm, qmmm_env, &
86 subsys_section, force_env_section, exclusions, ignore_outside_box)
92 LOGICAL,
INTENT(IN),
OPTIONAL :: qmmm
97 LOGICAL,
INTENT(IN),
OPTIONAL :: ignore_outside_box
99 CHARACTER(len=*),
PARAMETER :: routinen =
'topology_coordinate_pack'
101 CHARACTER(LEN=default_string_length) :: atmname, err
102 INTEGER :: atom_i, atom_j, counter, dim0, dim1, &
103 dim2, dim3, first, handle, handle2, i, &
104 iatom, ikind, iw, j, k, last, &
105 method_name_id, n, natom
106 INTEGER,
DIMENSION(:),
POINTER :: iatomlist, id_element, id_work, kind_of, &
107 list, list2, molecule_list, &
109 INTEGER,
DIMENSION(:, :),
POINTER :: pairs
110 LOGICAL :: autogen, check, disable_exclusion_lists, do_center, explicit, found, &
111 my_ignore_outside_box, my_qmmm, present_12_excl_ei_list, present_12_excl_vdw_list
112 REAL(kind=
dp) :: bounds(2, 3), cdims(3), dims(3), qeff, &
114 REAL(kind=
dp),
DIMENSION(:),
POINTER :: charge, cpoint, mass
115 TYPE(
array1_list_type),
DIMENSION(:),
POINTER :: ex_bend_list, ex_bond_list, &
116 ex_bond_list_ei, ex_bond_list_vdw, &
119 TYPE(
atom_type),
DIMENSION(:),
POINTER :: atom_list
131 extension=
".subsysLog")
133 CALL timeset(routinen, handle)
136 IF (
PRESENT(qmmm) .AND.
PRESENT(qmmm_env)) my_qmmm = qmmm
144 CALL timeset(routinen//
'_1', handle2)
146 NULLIFY (id_work, mass, id_element, charge)
149 ALLOCATE (id_element(
topology%natoms))
152 IF (iw > 0)
WRITE (iw, *)
"molecule_kind_set ::",
SIZE(molecule_kind_set)
153 DO i = 1,
SIZE(molecule_kind_set)
154 j = molecule_kind_set(i)%molecule_list(1)
155 molecule => molecule_set(j)
156 molecule_kind => molecule_set(j)%molecule_kind
157 IF (iw > 0)
WRITE (iw, *)
"molecule number ::", j,
" has molecule kind number ::", i
159 natom=natom, atom_list=atom_list)
161 first_atom=first, last_atom=last)
162 IF (iw > 0)
WRITE (iw, *)
"boundaries of molecules (first, last) ::", first, last
164 IF (.NOT. any(id_work(1:counter) == atom_list(j)%id_name))
THEN
165 counter = counter + 1
166 id_work(counter) = atom_list(j)%id_name
167 mass(counter) = atom_info%atm_mass(first + j - 1)
168 id_element(counter) = atom_info%id_element(first + j - 1)
169 charge(counter) = atom_info%atm_charge(first + j - 1)
170 IF (iw > 0)
WRITE (iw,
'(7X,A,1X,A5,F10.5,5X,A2,5X,F10.5)') &
171 "NEW ATOMIC KIND",
id2str(id_work(counter)), mass(counter),
id2str(id_element(counter)), charge(counter)
175 IF ((id_work(k) == atom_list(j)%id_name) .AND. (charge(k) == atom_info%atm_charge(first + j - 1)))
THEN
180 IF (.NOT. found)
THEN
181 counter = counter + 1
182 id_work(counter) = atom_list(j)%id_name
183 mass(counter) = atom_info%atm_mass(first + j - 1)
184 id_element(counter) = atom_info%id_element(first + j - 1)
185 charge(counter) = atom_info%atm_charge(first + j - 1)
186 IF (iw > 0)
WRITE (iw,
'(7X,A,1X,A5,F10.5,5X,A2,5X,F10.5)') &
187 "NEW ATOMIC KIND",
id2str(id_work(counter)), mass(counter),
id2str(id_element(counter)), charge(counter)
193 ALLOCATE (atom_info%id_atom_names(
topology%natom_type))
195 atom_info%id_atom_names(k) = id_work(k)
202 WRITE (iw,
'(5X,A,I3)')
"Total Number of Atomic Kinds = ",
topology%natom_type
204 CALL timestop(handle2)
210 CALL timeset(routinen//
'_2', handle2)
211 NULLIFY (atomic_kind_set)
212 ALLOCATE (atomic_kind_set(
topology%natom_type))
213 CALL timestop(handle2)
219 CALL timeset(routinen//
'_3', handle2)
220 NULLIFY (particle_set)
222 CALL timestop(handle2)
228 CALL timeset(routinen//
'_4', handle2)
230 atomic_kind => atomic_kind_set(i)
234 name=
id2str(atom_info%id_atom_names(i)), &
235 element_symbol=
id2str(id_element(i)), &
238 WRITE (iw,
'(A,I5,A,I5,4A)')
"Atomic Kind n.:", i,
" out of:",
topology%natom_type, &
239 " name: ", trim(
id2str(atom_info%id_atom_names(i))),
" element: ", &
240 trim(
id2str(id_element(i)))
244 DEALLOCATE (id_element)
245 CALL timestop(handle2)
251 CALL timeset(routinen//
'_5', handle2)
253 ALLOCATE (natom_of_kind(
topology%natom_type))
258 IF ((atom_info%id_atom_names(i) == atom_info%id_atmname(j)) .AND. (charge(i) == atom_info%atm_charge(j)))
THEN
259 natom_of_kind(i) = natom_of_kind(i) + 1
260 IF (kind_of(j) == 0) kind_of(j) = i
264 IF (any(kind_of == 0))
THEN
266 IF (kind_of(i) == 0)
THEN
267 WRITE (err,
"(1X,I5)") i
270 CALL cp_abort(__location__, &
271 "Two molecules have been defined as identical molecules but atoms "// &
272 "mismatch charges! Check these atoms:"//trim(err))
274 CALL timestop(handle2)
280 CALL timeset(routinen//
'_6', handle2)
282 atomic_kind => atomic_kind_set(i)
284 ALLOCATE (iatomlist(natom_of_kind(i)))
287 IF (kind_of(j) == i)
THEN
288 counter = counter + 1
289 iatomlist(counter) = j
293 WRITE (iw,
'(A,I6,A)')
" Atomic kind ", i,
" contains particles"
294 DO j = 1,
SIZE(iatomlist)
295 IF (mod(j, 5) == 0)
THEN
296 WRITE (iw,
'(I12)') iatomlist(j)
298 WRITE (iw,
'(I12)', advance=
"NO") iatomlist(j)
304 natom=natom_of_kind(i), &
306 DEALLOCATE (iatomlist)
308 DEALLOCATE (natom_of_kind)
309 CALL timestop(handle2)
316 "TOPOLOGY%CENTER_COORDINATES%_SECTION_PARAMETERS_", l_val=do_center)
317 CALL timeset(routinen//
'_7a', handle2)
318 bounds(1, 1) = minval(atom_info%r(1, :))
319 bounds(2, 1) = maxval(atom_info%r(1, :))
321 bounds(1, 2) = minval(atom_info%r(2, :))
322 bounds(2, 2) = maxval(atom_info%r(2, :))
324 bounds(1, 3) = minval(atom_info%r(3, :))
325 bounds(2, 3) = maxval(atom_info%r(3, :))
327 dims = bounds(2, :) - bounds(1, :)
332 WRITE (iw,
'(A,3F12.6)')
"System sizes: ", dims,
"Cell sizes (diagonal): ", cdims
336 IF (
topology%cell%perd(i) == 0)
THEN
337 check = check .AND. (dims(i) < cdims(i))
340 my_ignore_outside_box = .false.
341 IF (
PRESENT(ignore_outside_box)) my_ignore_outside_box = ignore_outside_box
342 IF (.NOT. my_ignore_outside_box .AND. .NOT. check)
THEN
343 CALL cp_abort(__location__, &
344 "A non-periodic calculation has been requested but the system size "// &
345 "exceeds the cell size in at least one of the non-periodic directions!")
349 "TOPOLOGY%CENTER_COORDINATES%CENTER_POINT", explicit=explicit)
352 "TOPOLOGY%CENTER_COORDINATES%CENTER_POINT", r_vals=cpoint)
357 dims = (bounds(2, :) + bounds(1, :))/2.0_dp - vec
361 CALL timestop(handle2)
362 CALL timeset(routinen//
'_7b', handle2)
366 WRITE (iw, *)
"atom number :: ", i,
"kind number ::", ikind
368 particle_set(i)%atomic_kind => atomic_kind_set(ikind)
369 particle_set(i)%r(:) = atom_info%r(:, i) - dims
370 particle_set(i)%atom_index = i
372 CALL timestop(handle2)
381 CALL timeset(routinen//
'_89', handle2)
384 l_val=disable_exclusion_lists)
385 IF ((method_name_id ==
do_fist) .AND. (.NOT. disable_exclusion_lists))
THEN
386 cpassert(
PRESENT(exclusions))
389 ALLOCATE (exclusions(natom))
391 NULLIFY (exclusions(i)%list_exclude_vdw)
392 NULLIFY (exclusions(i)%list_exclude_ei)
393 NULLIFY (exclusions(i)%list_onfo)
396 ALLOCATE (ex_bond_list(natom))
398 ALLOCATE (ex_bond_list(i)%array1(0))
401 IF (
ASSOCIATED(conn_info%bond_a))
THEN
402 n =
SIZE(conn_info%bond_a)
407 NULLIFY (ex_bond_list_vdw, ex_bond_list_ei)
411 present_12_excl_vdw_list = .false.
412 IF (explicit) present_12_excl_vdw_list = .true.
413 IF (present_12_excl_vdw_list)
THEN
414 ALLOCATE (ex_bond_list_vdw(natom))
416 ALLOCATE (ex_bond_list_vdw(i)%array1(0))
418 CALL setup_exclusion_list(exclude_section,
"BOND", ex_bond_list, ex_bond_list_vdw, &
421 ex_bond_list_vdw => ex_bond_list
426 present_12_excl_ei_list = .false.
427 IF (explicit) present_12_excl_ei_list = .true.
428 IF (present_12_excl_ei_list)
THEN
429 ALLOCATE (ex_bond_list_ei(natom))
431 ALLOCATE (ex_bond_list_ei(i)%array1(0))
433 CALL setup_exclusion_list(exclude_section,
"BOND", ex_bond_list, ex_bond_list_ei, &
436 ex_bond_list_ei => ex_bond_list
442 ALLOCATE (ex_bend_list(natom))
444 ALLOCATE (ex_bend_list(i)%array1(0))
449 ALLOCATE (pairs(0, 2))
452 DO i = 1,
SIZE(ex_bond_list(iatom)%array1)
454 atom_i = ex_bond_list(iatom)%array1(i)
457 atom_j = ex_bond_list(iatom)%array1(j)
462 DO counter = 1,
SIZE(ex_bond_list(atom_i)%array1)
463 IF (ex_bond_list(atom_i)%array1(counter) == atom_j)
THEN
471 IF (
SIZE(pairs, dim=1) <= n)
THEN
482 IF (
ASSOCIATED(conn_info%theta_a))
THEN
483 n =
SIZE(conn_info%theta_a)
489 ALLOCATE (ex_onfo_list(natom))
491 ALLOCATE (ex_onfo_list(i)%array1(0))
496 ALLOCATE (pairs(0, 2))
499 DO i = 1,
SIZE(ex_bond_list(iatom)%array1)
501 atom_i = ex_bond_list(iatom)%array1(i)
502 DO j = 1,
SIZE(ex_bend_list(iatom)%array1)
504 atom_j = ex_bend_list(iatom)%array1(j)
507 IF (atom_i == atom_j) cycle
510 DO counter = 1,
SIZE(ex_bond_list(atom_i)%array1)
511 IF (ex_bond_list(atom_i)%array1(counter) == atom_j)
THEN
519 DO counter = 1,
SIZE(ex_bend_list(atom_i)%array1)
520 IF (ex_bend_list(atom_i)%array1(counter) == atom_j)
THEN
528 IF (
SIZE(pairs, dim=1) <= n)
THEN
539 IF (
ASSOCIATED(conn_info%onfo_a))
THEN
540 n =
SIZE(conn_info%onfo_a)
546 DO iatom = 1,
SIZE(particle_set)
563 NULLIFY (
list, wlist)
564 ALLOCATE (wlist(dim3))
565 wlist(dim0:dim0) = iatom
566 IF (dim1 > dim0) wlist(dim0 + 1:dim1) = ex_bond_list_vdw(iatom)%array1
567 IF (dim2 > dim1) wlist(dim1 + 1:dim2) = ex_bend_list(iatom)%array1
568 IF (dim3 > dim2) wlist(dim2 + 1:dim3) = ex_onfo_list(iatom)%array1
570 DO i = 1,
SIZE(wlist) - 1
571 IF (wlist(i) == 0) cycle
572 DO j = i + 1,
SIZE(wlist)
573 IF (wlist(j) == wlist(i)) wlist(j) = 0
576 dim3 =
SIZE(wlist) - count(wlist == 0)
577 ALLOCATE (
list(dim3))
579 DO i = 1,
SIZE(wlist)
580 IF (wlist(i) == 0) cycle
588 (.NOT. present_12_excl_ei_list) .AND. (.NOT. present_12_excl_vdw_list))
THEN
608 ALLOCATE (wlist(dim3))
609 wlist(dim0:dim0) = iatom
610 IF (dim1 > dim0) wlist(dim0 + 1:dim1) = ex_bond_list_ei(iatom)%array1
611 IF (dim2 > dim1) wlist(dim1 + 1:dim2) = ex_bend_list(iatom)%array1
612 IF (dim3 > dim2) wlist(dim2 + 1:dim3) = ex_onfo_list(iatom)%array1
614 DO i = 1,
SIZE(wlist) - 1
615 IF (wlist(i) == 0) cycle
616 DO j = i + 1,
SIZE(wlist)
617 IF (wlist(j) == wlist(i)) wlist(j) = 0
620 dim3 =
SIZE(wlist) - count(wlist == 0)
621 ALLOCATE (list2(dim3))
623 DO i = 1,
SIZE(wlist)
624 IF (wlist(i) == 0) cycle
633 exclusions(iatom)%list_exclude_vdw =>
list
634 exclusions(iatom)%list_exclude_ei => list2
637 ALLOCATE (exclusions(iatom)%list_onfo(
SIZE(ex_onfo_list(iatom)%array1)))
639 exclusions(iatom)%list_onfo = ex_onfo_list(iatom)%array1
641 IF (
ASSOCIATED(
list))
THEN
642 WRITE (iw, *)
"exclusion list_vdw :: ", &
643 "atom num :", iatom,
"exclusion list ::", &
647 IF (
ASSOCIATED(list2))
THEN
648 WRITE (iw, *)
"exclusion list_ei :: ", &
649 "atom num :", iatom,
"exclusion list ::", &
653 IF (
ASSOCIATED(exclusions(iatom)%list_onfo))
THEN
654 WRITE (iw, *)
"onfo list :: ", &
655 "atom num :", iatom,
"onfo list ::", &
656 exclusions(iatom)%list_onfo
662 DEALLOCATE (ex_onfo_list(i)%array1)
664 DEALLOCATE (ex_onfo_list)
667 DEALLOCATE (ex_bend_list(i)%array1)
669 DEALLOCATE (ex_bend_list)
671 IF (present_12_excl_ei_list)
THEN
673 DEALLOCATE (ex_bond_list_ei(i)%array1)
675 DEALLOCATE (ex_bond_list_ei)
677 NULLIFY (ex_bond_list_ei)
679 IF (present_12_excl_vdw_list)
THEN
681 DEALLOCATE (ex_bond_list_vdw(i)%array1)
683 DEALLOCATE (ex_bond_list_vdw)
685 NULLIFY (ex_bond_list_vdw)
688 DEALLOCATE (ex_bond_list(i)%array1)
690 DEALLOCATE (ex_bond_list)
692 CALL timestop(handle2)
697 CALL timeset(routinen//
'_10', handle2)
699 IF (method_name_id ==
do_fist)
THEN
700 DO i = 1,
SIZE(atomic_kind_set)
701 atomic_kind => atomic_kind_set(i)
704 NULLIFY (fist_potential)
707 CALL set_atomic_kind(atomic_kind=atomic_kind, fist_potential=fist_potential)
711 CALL timestop(handle2)
717 CALL timeset(routinen//
'_11', handle2)
718 DO i = 1,
SIZE(molecule_kind_set)
719 molecule_kind => molecule_kind_set(i)
721 natom=natom, molecule_list=molecule_list, &
723 molecule => molecule_set(molecule_list(1))
725 first_atom=first, last_atom=last)
727 DO k = 1,
SIZE(atomic_kind_set)
728 atomic_kind => atomic_kind_set(k)
730 IF (method_name_id ==
do_fist)
THEN
731 CALL get_atomic_kind(atomic_kind=atomic_kind, fist_potential=fist_potential)
733 IF ((
id2str(atom_list(j)%id_name) == atmname) .AND. (qeff == atom_info%atm_charge(first + j - 1)))
THEN
734 atom_list(j)%atomic_kind => atomic_kind_set(k)
738 IF (
id2str(atom_list(j)%id_name) == atmname)
THEN
739 atom_list(j)%atomic_kind => atomic_kind_set(k)
747 CALL timestop(handle2)
749 CALL timestop(handle)
751 "PRINT%TOPOLOGY_INFO/UTIL_INFO")
subroutine, public get_molecule_kind(molecule_kind, atom_list, bond_list, bend_list, ub_list, impr_list, opbend_list, colv_list, fixd_list, g3x3_list, g4x6_list, vsite_list, torsion_list, shell_list, name, mass, charge, kind_number, natom, nbend, nbond, nub, nimpr, nopbend, nconstraint, nconstraint_fixd, nfixd, ncolv, ng3x3, ng4x6, nvsite, nfixd_restraint, ng3x3_restraint, ng4x6_restraint, nvsite_restraint, nrestraints, nmolecule, nsgf, nshell, ntorsion, molecule_list, nelectron, nelectron_alpha, nelectron_beta, bond_kind_set, bend_kind_set, ub_kind_set, impr_kind_set, opbend_kind_set, torsion_kind_set, molname_generated)
Get informations about a molecule kind.
subroutine, public set_molecule_kind(molecule_kind, name, mass, charge, kind_number, molecule_list, atom_list, nbond, bond_list, nbend, bend_list, nub, ub_list, nimpr, impr_list, nopbend, opbend_list, ntorsion, torsion_list, fixd_list, ncolv, colv_list, ng3x3, g3x3_list, ng4x6, nfixd, g4x6_list, nvsite, vsite_list, ng3x3_restraint, ng4x6_restraint, nfixd_restraint, nshell, shell_list, nvsite_restraint, bond_kind_set, bend_kind_set, ub_kind_set, torsion_kind_set, impr_kind_set, opbend_kind_set, nelectron, nsgf, molname_generated)
Set the components of a molecule kind.