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
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) .EQ. 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
203 CALL timestop(handle2)
209 CALL timeset(routinen//
'_2', handle2)
210 NULLIFY (atomic_kind_set)
211 ALLOCATE (atomic_kind_set(
topology%natom_type))
212 CALL timestop(handle2)
218 CALL timeset(routinen//
'_3', handle2)
219 NULLIFY (particle_set)
221 CALL timestop(handle2)
227 CALL timeset(routinen//
'_4', handle2)
229 atomic_kind => atomic_kind_set(i)
233 name=
id2str(atom_info%id_atom_names(i)), &
234 element_symbol=
id2str(id_element(i)), &
237 WRITE (iw,
'(A,I5,A,I5,4A)')
"Atomic Kind n.:", i,
" out of:",
topology%natom_type, &
238 " name: ", trim(
id2str(atom_info%id_atom_names(i))),
" element: ", &
239 trim(
id2str(id_element(i)))
243 DEALLOCATE (id_element)
244 CALL timestop(handle2)
250 CALL timeset(routinen//
'_5', handle2)
252 ALLOCATE (natom_of_kind(
topology%natom_type))
257 IF ((atom_info%id_atom_names(i) == atom_info%id_atmname(j)) .AND. (charge(i) == atom_info%atm_charge(j)))
THEN
258 natom_of_kind(i) = natom_of_kind(i) + 1
259 IF (kind_of(j) == 0) kind_of(j) = i
263 IF (any(kind_of == 0))
THEN
265 IF (kind_of(i) == 0)
THEN
266 WRITE (*, *) i, kind_of(i)
267 WRITE (*, *)
"Two molecules have been defined as identical molecules but atoms mismatch charges!"
272 CALL timestop(handle2)
278 CALL timeset(routinen//
'_6', handle2)
280 atomic_kind => atomic_kind_set(i)
282 ALLOCATE (iatomlist(natom_of_kind(i)))
285 IF (kind_of(j) == i)
THEN
286 counter = counter + 1
287 iatomlist(counter) = j
291 WRITE (iw,
'(A,I6,A)')
" Atomic kind ", i,
" contains particles"
292 DO j = 1,
SIZE(iatomlist)
293 IF (mod(j, 5) .EQ. 0)
THEN
294 WRITE (iw,
'(I12)') iatomlist(j)
296 WRITE (iw,
'(I12)', advance=
"NO") iatomlist(j)
302 natom=natom_of_kind(i), &
304 DEALLOCATE (iatomlist)
306 DEALLOCATE (natom_of_kind)
307 CALL timestop(handle2)
314 "TOPOLOGY%CENTER_COORDINATES%_SECTION_PARAMETERS_", l_val=do_center)
315 CALL timeset(routinen//
'_7a', handle2)
316 bounds(1, 1) = minval(atom_info%r(1, :))
317 bounds(2, 1) = maxval(atom_info%r(1, :))
319 bounds(1, 2) = minval(atom_info%r(2, :))
320 bounds(2, 2) = maxval(atom_info%r(2, :))
322 bounds(1, 3) = minval(atom_info%r(3, :))
323 bounds(2, 3) = maxval(atom_info%r(3, :))
325 dims = bounds(2, :) - bounds(1, :)
330 WRITE (iw,
'(A,3F12.6)')
"System sizes: ", dims,
"Cell sizes (diagonal): ", cdims
334 IF (
topology%cell%perd(i) == 0)
THEN
335 check = check .AND. (dims(i) < cdims(i))
338 my_ignore_outside_box = .false.
339 IF (
PRESENT(ignore_outside_box)) my_ignore_outside_box = ignore_outside_box
340 IF (.NOT. my_ignore_outside_box .AND. .NOT. check) &
341 CALL cp_abort(__location__, &
342 "A non-periodic calculation has been requested but the system size "// &
343 "exceeds the cell size in at least one of the non-periodic directions!")
346 "TOPOLOGY%CENTER_COORDINATES%CENTER_POINT", explicit=explicit)
349 "TOPOLOGY%CENTER_COORDINATES%CENTER_POINT", r_vals=cpoint)
354 dims = (bounds(2, :) + bounds(1, :))/2.0_dp - vec
358 CALL timestop(handle2)
359 CALL timeset(routinen//
'_7b', handle2)
363 WRITE (iw, *)
"atom number :: ", i,
"kind number ::", ikind
365 particle_set(i)%atomic_kind => atomic_kind_set(ikind)
366 particle_set(i)%r(:) = atom_info%r(:, i) - dims
367 particle_set(i)%atom_index = i
369 CALL timestop(handle2)
378 CALL timeset(routinen//
'_89', handle2)
381 l_val=disable_exclusion_lists)
382 IF ((method_name_id ==
do_fist) .AND. (.NOT. disable_exclusion_lists))
THEN
383 cpassert(
PRESENT(exclusions))
386 ALLOCATE (exclusions(natom))
388 NULLIFY (exclusions(i)%list_exclude_vdw)
389 NULLIFY (exclusions(i)%list_exclude_ei)
390 NULLIFY (exclusions(i)%list_onfo)
393 ALLOCATE (ex_bond_list(natom))
395 ALLOCATE (ex_bond_list(i)%array1(0))
398 IF (
ASSOCIATED(conn_info%bond_a))
THEN
399 n =
SIZE(conn_info%bond_a)
404 NULLIFY (ex_bond_list_vdw, ex_bond_list_ei)
408 present_12_excl_vdw_list = .false.
409 IF (explicit) present_12_excl_vdw_list = .true.
410 IF (present_12_excl_vdw_list)
THEN
411 ALLOCATE (ex_bond_list_vdw(natom))
413 ALLOCATE (ex_bond_list_vdw(i)%array1(0))
415 CALL setup_exclusion_list(exclude_section,
"BOND", ex_bond_list, ex_bond_list_vdw, &
418 ex_bond_list_vdw => ex_bond_list
423 present_12_excl_ei_list = .false.
424 IF (explicit) present_12_excl_ei_list = .true.
425 IF (present_12_excl_ei_list)
THEN
426 ALLOCATE (ex_bond_list_ei(natom))
428 ALLOCATE (ex_bond_list_ei(i)%array1(0))
430 CALL setup_exclusion_list(exclude_section,
"BOND", ex_bond_list, ex_bond_list_ei, &
433 ex_bond_list_ei => ex_bond_list
439 ALLOCATE (ex_bend_list(natom))
441 ALLOCATE (ex_bend_list(i)%array1(0))
446 ALLOCATE (pairs(0, 2))
449 DO i = 1,
SIZE(ex_bond_list(iatom)%array1)
451 atom_i = ex_bond_list(iatom)%array1(i)
454 atom_j = ex_bond_list(iatom)%array1(j)
459 DO counter = 1,
SIZE(ex_bond_list(atom_i)%array1)
460 IF (ex_bond_list(atom_i)%array1(counter) == atom_j)
THEN
468 IF (
SIZE(pairs, dim=1) <= n)
THEN
479 IF (
ASSOCIATED(conn_info%theta_a))
THEN
480 n =
SIZE(conn_info%theta_a)
486 ALLOCATE (ex_onfo_list(natom))
488 ALLOCATE (ex_onfo_list(i)%array1(0))
493 ALLOCATE (pairs(0, 2))
496 DO i = 1,
SIZE(ex_bond_list(iatom)%array1)
498 atom_i = ex_bond_list(iatom)%array1(i)
499 DO j = 1,
SIZE(ex_bend_list(iatom)%array1)
501 atom_j = ex_bend_list(iatom)%array1(j)
504 IF (atom_i == atom_j) cycle
507 DO counter = 1,
SIZE(ex_bond_list(atom_i)%array1)
508 IF (ex_bond_list(atom_i)%array1(counter) == atom_j)
THEN
516 DO counter = 1,
SIZE(ex_bend_list(atom_i)%array1)
517 IF (ex_bend_list(atom_i)%array1(counter) == atom_j)
THEN
525 IF (
SIZE(pairs, dim=1) <= n)
THEN
536 IF (
ASSOCIATED(conn_info%onfo_a))
THEN
537 n =
SIZE(conn_info%onfo_a)
543 DO iatom = 1,
SIZE(particle_set)
560 NULLIFY (
list, wlist)
561 ALLOCATE (wlist(dim3))
562 wlist(dim0:dim0) = iatom
563 IF (dim1 > dim0) wlist(dim0 + 1:dim1) = ex_bond_list_vdw(iatom)%array1
564 IF (dim2 > dim1) wlist(dim1 + 1:dim2) = ex_bend_list(iatom)%array1
565 IF (dim3 > dim2) wlist(dim2 + 1:dim3) = ex_onfo_list(iatom)%array1
567 DO i = 1,
SIZE(wlist) - 1
568 IF (wlist(i) == 0) cycle
569 DO j = i + 1,
SIZE(wlist)
570 IF (wlist(j) == wlist(i)) wlist(j) = 0
573 dim3 =
SIZE(wlist) - count(wlist == 0)
574 ALLOCATE (
list(dim3))
576 DO i = 1,
SIZE(wlist)
577 IF (wlist(i) == 0) cycle
585 (.NOT. present_12_excl_ei_list) .AND. (.NOT. present_12_excl_vdw_list))
THEN
605 ALLOCATE (wlist(dim3))
606 wlist(dim0:dim0) = iatom
607 IF (dim1 > dim0) wlist(dim0 + 1:dim1) = ex_bond_list_ei(iatom)%array1
608 IF (dim2 > dim1) wlist(dim1 + 1:dim2) = ex_bend_list(iatom)%array1
609 IF (dim3 > dim2) wlist(dim2 + 1:dim3) = ex_onfo_list(iatom)%array1
611 DO i = 1,
SIZE(wlist) - 1
612 IF (wlist(i) == 0) cycle
613 DO j = i + 1,
SIZE(wlist)
614 IF (wlist(j) == wlist(i)) wlist(j) = 0
617 dim3 =
SIZE(wlist) - count(wlist == 0)
618 ALLOCATE (list2(dim3))
620 DO i = 1,
SIZE(wlist)
621 IF (wlist(i) == 0) cycle
630 exclusions(iatom)%list_exclude_vdw =>
list
631 exclusions(iatom)%list_exclude_ei => list2
634 ALLOCATE (exclusions(iatom)%list_onfo(
SIZE(ex_onfo_list(iatom)%array1)))
636 exclusions(iatom)%list_onfo = ex_onfo_list(iatom)%array1
638 IF (
ASSOCIATED(
list)) &
639 WRITE (iw, *)
"exclusion list_vdw :: ", &
640 "atom num :", iatom,
"exclusion list ::", &
643 IF (
ASSOCIATED(list2)) &
644 WRITE (iw, *)
"exclusion list_ei :: ", &
645 "atom num :", iatom,
"exclusion list ::", &
648 IF (
ASSOCIATED(exclusions(iatom)%list_onfo)) &
649 WRITE (iw, *)
"onfo list :: ", &
650 "atom num :", iatom,
"onfo list ::", &
651 exclusions(iatom)%list_onfo
656 DEALLOCATE (ex_onfo_list(i)%array1)
658 DEALLOCATE (ex_onfo_list)
661 DEALLOCATE (ex_bend_list(i)%array1)
663 DEALLOCATE (ex_bend_list)
665 IF (present_12_excl_ei_list)
THEN
667 DEALLOCATE (ex_bond_list_ei(i)%array1)
669 DEALLOCATE (ex_bond_list_ei)
671 NULLIFY (ex_bond_list_ei)
673 IF (present_12_excl_vdw_list)
THEN
675 DEALLOCATE (ex_bond_list_vdw(i)%array1)
677 DEALLOCATE (ex_bond_list_vdw)
679 NULLIFY (ex_bond_list_vdw)
682 DEALLOCATE (ex_bond_list(i)%array1)
684 DEALLOCATE (ex_bond_list)
686 CALL timestop(handle2)
691 CALL timeset(routinen//
'_10', handle2)
693 IF (method_name_id ==
do_fist)
THEN
694 DO i = 1,
SIZE(atomic_kind_set)
695 atomic_kind => atomic_kind_set(i)
698 NULLIFY (fist_potential)
701 CALL set_atomic_kind(atomic_kind=atomic_kind, fist_potential=fist_potential)
705 CALL timestop(handle2)
711 CALL timeset(routinen//
'_11', handle2)
712 DO i = 1,
SIZE(molecule_kind_set)
713 molecule_kind => molecule_kind_set(i)
715 natom=natom, molecule_list=molecule_list, &
717 molecule => molecule_set(molecule_list(1))
719 first_atom=first, last_atom=last)
721 DO k = 1,
SIZE(atomic_kind_set)
722 atomic_kind => atomic_kind_set(k)
724 IF (method_name_id ==
do_fist)
THEN
725 CALL get_atomic_kind(atomic_kind=atomic_kind, fist_potential=fist_potential)
727 IF ((
id2str(atom_list(j)%id_name) == atmname) .AND. (qeff == atom_info%atm_charge(first + j - 1)))
THEN
728 atom_list(j)%atomic_kind => atomic_kind_set(k)
732 IF (
id2str(atom_list(j)%id_name) == atmname)
THEN
733 atom_list(j)%atomic_kind => atomic_kind_set(k)
741 CALL timestop(handle2)
743 CALL timestop(handle)
745 "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.