52 #include "./base/base_uses.f90"
56 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'topology_psf'
80 CHARACTER(LEN=*),
INTENT(IN) :: filename
82 TYPE(mp_para_env_type),
POINTER :: para_env
83 TYPE(section_vals_type),
POINTER :: subsys_section
84 INTEGER,
INTENT(IN) :: psf_type
86 CHARACTER(len=*),
PARAMETER :: routinen =
'read_topology_psf'
88 CHARACTER(LEN=2*default_string_length) :: psf_format
89 CHARACTER(LEN=3) :: c_int
90 CHARACTER(LEN=default_string_length) :: dummy_field, field, label, strtmp1, &
92 INTEGER :: handle, i, iatom, ibond, idum, index_now, iphi, itheta, iw, natom, natom_prev, &
93 nbond, nbond_prev, nphi, nphi_prev, ntheta, ntheta_prev, output_unit
97 TYPE(cp_logger_type),
POINTER :: logger
98 TYPE(cp_parser_type) :: parser
104 extension=
".subsysLog")
105 CALL timeset(routinen, handle)
111 IF (
ASSOCIATED(atom_info%id_molname)) natom_prev =
SIZE(atom_info%id_molname)
115 IF (.NOT. found)
THEN
116 IF (output_unit > 0)
THEN
117 WRITE (output_unit,
'(A)')
"ERROR| Missing PSF specification line"
122 CALL parser_get_object(parser, field)
123 SELECT CASE (field(1:3))
127 psf_format =
'(I8,1X,A4,I5,1X,A4,1X,A4,1X,A4,1X,2G14.6,I8)'
132 psf_format =
'(I10,T12,A7,T21,I8,T30,A7,T39,A6,T47,A6,T53,F10.6,T69,F8.3,T88,I1)'
135 cpabort(
"PSF_INFO| "//field(1:3)//
" :: not available for UPSF format!")
138 cpabort(
"PSF_INFO| "//field(1:3)//
" :: Unimplemented keyword in CP2K PSF/UPSF format!")
141 IF (iw > 0)
WRITE (iw,
'(T2,A)')
'PSF_INFO| Parsing the NATOM section'
147 IF (.NOT. found)
THEN
148 IF (iw > 0)
WRITE (iw,
'(T2,A)')
'PSF_INFO| No NATOM section '
151 CALL parser_get_object(parser, natom)
152 IF (natom_prev + natom >
topology%natoms) &
153 CALL cp_abort(__location__, &
154 "Number of atoms in connectivity control is larger than the "// &
155 "number of atoms in coordinate control. check coordinates and "// &
157 IF (iw > 0)
WRITE (iw,
'(T2,A,'//trim(c_int)//
')')
'PSF_INFO| NATOM = ', natom
159 CALL reallocate(atom_info%id_molname, 1, natom_prev + natom)
160 CALL reallocate(atom_info%resid, 1, natom_prev + natom)
161 CALL reallocate(atom_info%id_resname, 1, natom_prev + natom)
162 CALL reallocate(atom_info%id_atmname, 1, natom_prev + natom)
163 CALL reallocate(atom_info%atm_charge, 1, natom_prev + natom)
164 CALL reallocate(atom_info%atm_mass, 1, natom_prev + natom)
168 index_now = iatom + natom_prev
170 READ (parser%input_line, fmt=*, err=9) i, &
172 atom_info%resid(index_now), &
176 atom_info%atm_charge(index_now), &
177 atom_info%atm_mass(index_now)
178 atom_info%id_molname(index_now) =
str2id(
s2s(strtmp1))
179 atom_info%id_resname(index_now) =
str2id(
s2s(strtmp2))
180 atom_info%id_atmname(index_now) =
str2id(
s2s(strtmp3))
184 index_now = iatom + natom_prev
186 READ (parser%input_line, fmt=psf_format) &
189 atom_info%resid(index_now), &
193 atom_info%atm_charge(index_now), &
194 atom_info%atm_mass(index_now), &
196 atom_info%id_molname(index_now) =
str2id(
s2s(strtmp1))
197 atom_info%id_resname(index_now) =
str2id(
s2s(strtmp2))
198 atom_info%id_atmname(index_now) =
str2id(
s2s(adjustl(strtmp3)))
207 IF (
ASSOCIATED(conn_info%bond_a)) nbond_prev =
SIZE(conn_info%bond_a)
209 IF (iw > 0)
WRITE (iw,
'(T2,A)')
'PSF_INFO| Parsing the NBOND section'
210 IF (iw > 0)
WRITE (iw,
'(T2,A,I8)')
'PSF_INFO| Previous number of allocated BOND: ', nbond_prev
213 IF (.NOT. found)
THEN
214 IF (iw > 0)
WRITE (iw,
'(T2,A)')
'PSF_INFO| No NBOND section '
217 CALL parser_get_object(parser, nbond)
218 IF (iw > 0)
WRITE (iw,
'(T2,A,'//trim(c_int)//
')')
'PSF_INFO| NBOND = ', nbond
220 CALL reallocate(conn_info%bond_a, 1, nbond_prev + nbond)
221 CALL reallocate(conn_info%bond_b, 1, nbond_prev + nbond)
224 DO ibond = 1, nbond, 4
226 index_now = nbond_prev + ibond - 1
227 READ (parser%input_line, fmt=*, err=9) (conn_info%bond_a(index_now + i), &
228 conn_info%bond_b(index_now + i), &
229 i=1, min(4, (nbond - ibond + 1)))
232 DO ibond = 1, nbond, 4
234 index_now = nbond_prev + ibond - 1
235 READ (parser%input_line, fmt=
'(8'//trim(c_int)//
')') &
236 (conn_info%bond_a(index_now + i), &
237 conn_info%bond_b(index_now + i), &
238 i=1, min(4, (nbond - ibond + 1)))
241 IF (any(conn_info%bond_a(nbond_prev + 1:) <= 0) .OR. &
242 any(conn_info%bond_a(nbond_prev + 1:) > natom) .OR. &
243 any(conn_info%bond_b(nbond_prev + 1:) <= 0) .OR. &
244 any(conn_info%bond_b(nbond_prev + 1:) > natom))
THEN
245 cpabort(
"topology_read, invalid bond")
247 conn_info%bond_a(nbond_prev + 1:) = conn_info%bond_a(nbond_prev + 1:) + natom_prev
248 conn_info%bond_b(nbond_prev + 1:) = conn_info%bond_b(nbond_prev + 1:) + natom_prev
254 IF (
ASSOCIATED(conn_info%theta_a)) ntheta_prev =
SIZE(conn_info%theta_a)
256 IF (iw > 0)
WRITE (iw,
'(T2,A)')
'PSF_INFO| Parsing the NTHETA section'
257 IF (iw > 0)
WRITE (iw,
'(T2,A,I8)')
'PSF_INFO| Previous number of allocated THETA: ', ntheta_prev
260 IF (.NOT. found)
THEN
261 IF (iw > 0)
WRITE (iw,
'(T2,A)')
'PSF_INFO| No NTHETA section '
264 CALL parser_get_object(parser, ntheta)
265 IF (iw > 0)
WRITE (iw,
'(T2,A,'//trim(c_int)//
')')
'PSF_INFO| NTHETA = ', ntheta
267 CALL reallocate(conn_info%theta_a, 1, ntheta_prev + ntheta)
268 CALL reallocate(conn_info%theta_b, 1, ntheta_prev + ntheta)
269 CALL reallocate(conn_info%theta_c, 1, ntheta_prev + ntheta)
272 DO itheta = 1, ntheta, 3
274 index_now = ntheta_prev + itheta - 1
275 READ (parser%input_line, fmt=*, err=9) (conn_info%theta_a(index_now + i), &
276 conn_info%theta_b(index_now + i), &
277 conn_info%theta_c(index_now + i), &
278 i=1, min(3, (ntheta - itheta + 1)))
281 DO itheta = 1, ntheta, 3
283 index_now = ntheta_prev + itheta - 1
284 READ (parser%input_line, fmt=
'(9'//trim(c_int)//
')') &
285 (conn_info%theta_a(index_now + i), &
286 conn_info%theta_b(index_now + i), &
287 conn_info%theta_c(index_now + i), &
288 i=1, min(3, (ntheta - itheta + 1)))
291 conn_info%theta_a(ntheta_prev + 1:) = conn_info%theta_a(ntheta_prev + 1:) + natom_prev
292 conn_info%theta_b(ntheta_prev + 1:) = conn_info%theta_b(ntheta_prev + 1:) + natom_prev
293 conn_info%theta_c(ntheta_prev + 1:) = conn_info%theta_c(ntheta_prev + 1:) + natom_prev
299 IF (
ASSOCIATED(conn_info%phi_a)) nphi_prev =
SIZE(conn_info%phi_a)
301 IF (iw > 0)
WRITE (iw,
'(T2,A)')
'PSF_INFO| Parsing the NPHI section'
302 IF (iw > 0)
WRITE (iw,
'(T2,A,I8)')
'PSF_INFO| Previous number of allocated PHI: ', nphi_prev
305 IF (.NOT. found)
THEN
306 IF (iw > 0)
WRITE (iw,
'(T2,A)')
'PSF_INFO| No NPHI section '
309 CALL parser_get_object(parser, nphi)
310 IF (iw > 0)
WRITE (iw,
'(T2,A,'//trim(c_int)//
')')
'PSF_INFO| NPHI = ', nphi
312 CALL reallocate(conn_info%phi_a, 1, nphi_prev + nphi)
313 CALL reallocate(conn_info%phi_b, 1, nphi_prev + nphi)
314 CALL reallocate(conn_info%phi_c, 1, nphi_prev + nphi)
315 CALL reallocate(conn_info%phi_d, 1, nphi_prev + nphi)
320 index_now = nphi_prev + iphi - 1
321 READ (parser%input_line, fmt=*, err=9) (conn_info%phi_a(index_now + i), &
322 conn_info%phi_b(index_now + i), &
323 conn_info%phi_c(index_now + i), &
324 conn_info%phi_d(index_now + i), &
325 i=1, min(2, (nphi - iphi + 1)))
330 index_now = nphi_prev + iphi - 1
331 READ (parser%input_line, fmt=
'(8'//trim(c_int)//
')') &
332 (conn_info%phi_a(index_now + i), &
333 conn_info%phi_b(index_now + i), &
334 conn_info%phi_c(index_now + i), &
335 conn_info%phi_d(index_now + i), &
336 i=1, min(2, (nphi - iphi + 1)))
339 conn_info%phi_a(nphi_prev + 1:) = conn_info%phi_a(nphi_prev + 1:) + natom_prev
340 conn_info%phi_b(nphi_prev + 1:) = conn_info%phi_b(nphi_prev + 1:) + natom_prev
341 conn_info%phi_c(nphi_prev + 1:) = conn_info%phi_c(nphi_prev + 1:) + natom_prev
342 conn_info%phi_d(nphi_prev + 1:) = conn_info%phi_d(nphi_prev + 1:) + natom_prev
348 IF (
ASSOCIATED(conn_info%impr_a)) nphi_prev =
SIZE(conn_info%impr_a)
350 IF (iw > 0)
WRITE (iw,
'(T2,A)')
'PSF_INFO| Parsing the NIMPHI section'
351 IF (iw > 0)
WRITE (iw,
'(T2,A,I8)')
'PSF_INFO| Previous number of allocated IMPHI: ', nphi_prev
354 IF (.NOT. found)
THEN
355 IF (iw > 0)
WRITE (iw,
'(T2,A)')
'PSF_INFO| No NIMPHI section '
358 CALL parser_get_object(parser, nphi)
359 IF (iw > 0)
WRITE (iw,
'(T2,A,'//trim(c_int)//
')')
'PSF_INFO| NIMPR = ', nphi
361 CALL reallocate(conn_info%impr_a, 1, nphi_prev + nphi)
362 CALL reallocate(conn_info%impr_b, 1, nphi_prev + nphi)
363 CALL reallocate(conn_info%impr_c, 1, nphi_prev + nphi)
364 CALL reallocate(conn_info%impr_d, 1, nphi_prev + nphi)
369 index_now = nphi_prev + iphi - 1
370 READ (parser%input_line, fmt=*, err=9) (conn_info%impr_a(index_now + i), &
371 conn_info%impr_b(index_now + i), &
372 conn_info%impr_c(index_now + i), &
373 conn_info%impr_d(index_now + i), &
374 i=1, min(2, (nphi - iphi + 1)))
379 index_now = nphi_prev + iphi - 1
380 READ (parser%input_line, fmt=
'(8'//trim(c_int)//
')') &
381 (conn_info%impr_a(index_now + i), &
382 conn_info%impr_b(index_now + i), &
383 conn_info%impr_c(index_now + i), &
384 conn_info%impr_d(index_now + i), &
385 i=1, min(2, (nphi - iphi + 1)))
388 conn_info%impr_a(nphi_prev + 1:) = conn_info%impr_a(nphi_prev + 1:) + natom_prev
389 conn_info%impr_b(nphi_prev + 1:) = conn_info%impr_b(nphi_prev + 1:) + natom_prev
390 conn_info%impr_c(nphi_prev + 1:) = conn_info%impr_c(nphi_prev + 1:) + natom_prev
391 conn_info%impr_d(nphi_prev + 1:) = conn_info%impr_d(nphi_prev + 1:) + natom_prev
395 CALL timestop(handle)
397 "PRINT%TOPOLOGY_INFO/PSF_INFO")
401 IF (output_unit > 0)
THEN
402 WRITE (output_unit,
'(T2,A)') &
403 "PSF_INFO| Error while reading PSF using the unformatted PSF reading option!", &
404 "PSF_INFO| Try using PSF instead of UPSF."
407 cpabort(
"Error while reading PSF data!")
418 TYPE(section_vals_type),
POINTER :: subsys_section
420 CHARACTER(len=*),
PARAMETER :: routinen =
'psf_post_process'
422 INTEGER :: handle, i, iatom, ibond, ionfo, iw, &
423 jatom, n, natom, nbond, nonfo, nphi, &
428 TYPE(cp_logger_type),
POINTER :: logger
433 extension=
".subsysLog")
434 CALL timeset(routinen, handle)
443 IF (
ASSOCIATED(atom_info%id_molname)) natom =
SIZE(atom_info%id_molname)
444 IF (
ASSOCIATED(conn_info%bond_a)) nbond =
SIZE(conn_info%bond_a)
445 IF (
ASSOCIATED(conn_info%c_bond_a)) i =
SIZE(conn_info%c_bond_a)
447 iatom = conn_info%bond_a(ibond)
448 jatom = conn_info%bond_b(ibond)
450 IF ((atom_info%id_molname(iatom) /= atom_info%id_molname(jatom)) .OR. &
451 (atom_info%resid(iatom) /= atom_info%resid(jatom)) .OR. &
452 (atom_info%id_resname(iatom) /= atom_info%id_resname(jatom)))
THEN
453 IF (iw > 0)
WRITE (iw,
'(T2,A,2I6)')
"PSF_INFO| PARA_RES, bond between molecules atom ", &
456 CALL reallocate(conn_info%c_bond_a, 1, i)
457 CALL reallocate(conn_info%c_bond_b, 1, i)
458 conn_info%c_bond_a(i) = iatom
459 conn_info%c_bond_b(i) = jatom
462 IF (atom_info%id_molname(iatom) /= atom_info%id_molname(jatom))
THEN
471 IF (
ASSOCIATED(conn_info%theta_a)) ntheta =
SIZE(conn_info%theta_a)
472 CALL reallocate(conn_info%ub_a, 1, ntheta)
473 CALL reallocate(conn_info%ub_b, 1, ntheta)
474 CALL reallocate(conn_info%ub_c, 1, ntheta)
475 conn_info%ub_a(:) = conn_info%theta_a(:)
476 conn_info%ub_b(:) = conn_info%theta_b(:)
477 conn_info%ub_c(:) = conn_info%theta_c(:)
483 IF (
ASSOCIATED(conn_info%phi_a)) nphi =
SIZE(conn_info%phi_a)
484 CALL reallocate(conn_info%onfo_a, 1, nphi)
485 CALL reallocate(conn_info%onfo_b, 1, nphi)
486 conn_info%onfo_a(1:) = conn_info%phi_a(1:)
487 conn_info%onfo_b(1:) = conn_info%phi_d(1:)
489 ALLOCATE (ex_bond_list(natom))
491 ALLOCATE (ex_bond_list(i)%array1(0))
494 IF (
ASSOCIATED(conn_info%bond_a)) n =
SIZE(conn_info%bond_a)
495 CALL reorder_structure(ex_bond_list, conn_info%bond_a, conn_info%bond_b, n)
497 ALLOCATE (ex_bend_list(natom))
499 ALLOCATE (ex_bend_list(i)%array1(0))
502 IF (
ASSOCIATED(conn_info%theta_a)) n =
SIZE(conn_info%theta_a)
503 CALL reorder_structure(ex_bend_list, conn_info%theta_a, conn_info%theta_c, n)
506 IF (any(ex_bond_list(conn_info%onfo_a(ionfo))%array1 == conn_info%onfo_b(ionfo)) .OR. &
507 any(ex_bend_list(conn_info%onfo_a(ionfo))%array1 == conn_info%onfo_b(ionfo))) cycle
509 conn_info%onfo_a(nonfo) = conn_info%onfo_a(ionfo)
510 conn_info%onfo_b(nonfo) = conn_info%onfo_b(ionfo)
514 DEALLOCATE (ex_bend_list(i)%array1)
516 DEALLOCATE (ex_bend_list)
519 DEALLOCATE (ex_bond_list(i)%array1)
521 DEALLOCATE (ex_bond_list)
523 ALLOCATE (ex_bond_list(natom))
525 ALLOCATE (ex_bond_list(i)%array1(0))
528 IF (
ASSOCIATED(conn_info%onfo_a)) n = nonfo
529 CALL reorder_structure(ex_bond_list, conn_info%onfo_a, conn_info%onfo_b, n)
532 DO ionfo = 1,
SIZE(ex_bond_list(i)%array1)
533 IF (count(ex_bond_list(i)%array1 == ex_bond_list(i)%array1(ionfo)) /= 1)
THEN
534 ex_bond_list(i)%array1(ionfo) = 0
536 IF (ex_bond_list(i)%array1(ionfo) <= i) cycle
538 conn_info%onfo_a(nonfo) = i
539 conn_info%onfo_b(nonfo) = ex_bond_list(i)%array1(ionfo)
544 DEALLOCATE (ex_bond_list(i)%array1)
546 DEALLOCATE (ex_bond_list)
547 CALL reallocate(conn_info%onfo_a, 1, nonfo)
548 CALL reallocate(conn_info%onfo_b, 1, nonfo)
550 CALL timestop(handle)
552 "PRINT%TOPOLOGY_INFO/PSF_INFO")
562 SUBROUTINE idm_psf(topology, section, subsys_section)
564 TYPE(section_vals_type),
POINTER :: section, subsys_section
566 CHARACTER(len=*),
PARAMETER :: routinen =
'idm_psf'
568 INTEGER :: handle, i, iend, iend1, istart, istart1, &
569 item, iw, j, mol_id, n_rep, natom, &
570 nbond, nimpr, noe, nphi, ntheta
571 INTEGER,
DIMENSION(:),
POINTER :: tag_mols, tmp, wrk
576 TYPE(cp_logger_type),
POINTER :: logger
577 TYPE(section_vals_type),
POINTER :: subsection
582 extension=
".subsysLog")
583 CALL timeset(routinen, handle)
589 IF (
ASSOCIATED(atom_info%id_molname)) natom =
SIZE(atom_info%id_molname)
591 IF (
ASSOCIATED(conn_info%bond_a)) nbond =
SIZE(conn_info%bond_a)
593 IF (
ASSOCIATED(conn_info%theta_a)) ntheta =
SIZE(conn_info%theta_a)
595 IF (
ASSOCIATED(conn_info%phi_a)) nphi =
SIZE(conn_info%phi_a)
597 IF (
ASSOCIATED(conn_info%impr_a)) nimpr =
SIZE(conn_info%impr_a)
603 CALL reallocate(conn_info%bond_a, 1, n_rep + nbond)
604 CALL reallocate(conn_info%bond_b, 1, n_rep + nbond)
607 conn_info%bond_a(nbond + i) = tmp(1)
608 conn_info%bond_b(nbond + i) = tmp(2)
611 ALLOCATE (ex_bond_list(natom))
612 ALLOCATE (tag_mols(natom))
613 ALLOCATE (wrk(natom))
615 ALLOCATE (ex_bond_list(j)%array1(0))
617 CALL reorder_structure(ex_bond_list, conn_info%bond_a, conn_info%bond_b, nbond + n_rep)
622 IF (tag_mols(i) /= -1) cycle
627 IF (iw > 0)
WRITE (iw,
'(T2,A,I8)')
'PSF_INFO| Number of molecules detected after merging: ', mol_id
629 CALL sort(tag_mols, natom, wrk)
633 IF (tag_mols(i) == item) cycle
635 noe = iend - istart + 1
636 istart1 = minval(wrk(istart:iend))
637 iend1 = maxval(wrk(istart:iend))
638 cpassert(iend1 - istart1 + 1 == noe)
639 atom_info%id_molname(istart1:iend1) =
str2id(
s2s(
"MOL"//cp_to_string(item)))
644 noe = iend - istart + 1
645 istart1 = minval(wrk(istart:iend))
646 iend1 = maxval(wrk(istart:iend))
647 cpassert(iend1 - istart1 + 1 == noe)
648 atom_info%id_molname(istart1:iend1) =
str2id(
s2s(
"MOL"//cp_to_string(item)))
651 DEALLOCATE (ex_bond_list(i)%array1)
653 DEALLOCATE (ex_bond_list)
654 DEALLOCATE (tag_mols)
662 CALL reallocate(conn_info%theta_a, 1, n_rep + ntheta)
663 CALL reallocate(conn_info%theta_b, 1, n_rep + ntheta)
664 CALL reallocate(conn_info%theta_c, 1, n_rep + ntheta)
667 conn_info%theta_a(ntheta + i) = tmp(1)
668 conn_info%theta_b(ntheta + i) = tmp(2)
669 conn_info%theta_c(ntheta + i) = tmp(3)
677 CALL reallocate(conn_info%phi_a, 1, n_rep + nphi)
678 CALL reallocate(conn_info%phi_b, 1, n_rep + nphi)
679 CALL reallocate(conn_info%phi_c, 1, n_rep + nphi)
680 CALL reallocate(conn_info%phi_d, 1, n_rep + nphi)
683 conn_info%phi_a(nphi + i) = tmp(1)
684 conn_info%phi_b(nphi + i) = tmp(2)
685 conn_info%phi_c(nphi + i) = tmp(3)
686 conn_info%phi_d(nphi + i) = tmp(4)
694 CALL reallocate(conn_info%impr_a, 1, n_rep + nimpr)
695 CALL reallocate(conn_info%impr_b, 1, n_rep + nimpr)
696 CALL reallocate(conn_info%impr_c, 1, n_rep + nimpr)
697 CALL reallocate(conn_info%impr_d, 1, n_rep + nimpr)
700 conn_info%impr_a(nimpr + i) = tmp(1)
701 conn_info%impr_b(nimpr + i) = tmp(2)
702 conn_info%impr_c(nimpr + i) = tmp(3)
703 conn_info%impr_d(nimpr + i) = tmp(4)
707 CALL timestop(handle)
709 "PRINT%TOPOLOGY_INFO/PSF_INFO")
722 INTEGER,
INTENT(IN) :: file_unit
724 TYPE(section_vals_type),
POINTER :: subsys_section, force_env_section
726 CHARACTER(len=*),
PARAMETER :: routinen =
'write_topology_psf'
728 CHARACTER(LEN=2*default_string_length) :: psf_format
729 CHARACTER(LEN=default_string_length) :: c_int, my_tag1, my_tag2, my_tag3, record
730 CHARACTER(LEN=default_string_length), &
731 DIMENSION(:),
POINTER :: charge_atm
732 INTEGER :: handle, i, iw, j, my_index, nchg
733 LOGICAL :: explicit, ldum
734 REAL(kind=
dp),
DIMENSION(:),
POINTER :: charge_inp, charges
737 TYPE(cp_logger_type),
POINTER :: logger
738 TYPE(section_vals_type),
POINTER :: print_key, tmp_section
744 extension=
".subsysLog")
745 CALL timeset(routinen, handle)
752 charges = atom_info%atm_charge
754 NULLIFY (tmp_section)
758 ALLOCATE (charge_atm(nchg))
759 ALLOCATE (charge_inp(nchg))
762 record =
id2str(atom_info%id_atmname(j))
766 IF (record == charge_atm(i))
THEN
767 charges(j) = charge_inp(i)
772 DEALLOCATE (charge_atm)
773 DEALLOCATE (charge_inp)
777 IF (charges(j) .EQ. -huge(0.0_dp)) charges(j) = -99.0_dp
780 extension=
".psf", my_local=.false.)
783 psf_format =
'(I10,T12,A,T21,I0,T30,A,T39,A,T47,A,T53,F10.6,T69,F8.3,T88,I1)'
784 IF (iw > 0)
WRITE (iw,
'(T2,A)') &
785 "PSF_WRITE| Writing out PSF file with CHARMM31 EXTErnal format: ", trim(record)
787 WRITE (file_unit, fmt=
'(A)')
"PSF EXT"
788 WRITE (file_unit, fmt=
'(A)')
""
789 WRITE (file_unit, fmt=
'('//trim(c_int)//
',A)') 1,
" !NTITLE"
790 WRITE (file_unit, fmt=
'(A)')
" CP2K generated DUMP of connectivity"
791 WRITE (file_unit, fmt=
'(A)')
""
793 WRITE (file_unit, fmt=
'('//trim(c_int)//
',A)')
topology%natoms,
" !NATOM"
796 my_tag1 =
id2str(atom_info%id_molname(i))
797 my_tag2 =
id2str(atom_info%id_resname(i))
798 my_tag3 =
id2str(atom_info%id_atmname(i))
802 WRITE (file_unit, fmt=psf_format) &
810 atom_info%atm_mass(i), &
813 IF ((atom_info%map_mol_num(i) /= atom_info%map_mol_num(i - 1)) .OR. &
814 (atom_info%map_mol_res(i) /= atom_info%map_mol_res(i - 1))) my_index = my_index + 1
815 my_tag1 =
id2str(atom_info%id_molname(i))
816 my_tag2 =
id2str(atom_info%id_resname(i))
817 my_tag3 =
id2str(atom_info%id_atmname(i))
821 WRITE (file_unit, fmt=psf_format) &
829 atom_info%atm_mass(i), &
832 WRITE (file_unit, fmt=
'(/)')
835 WRITE (file_unit, fmt=
'('//trim(c_int)//
',A)')
SIZE(conn_info%bond_a),
" !NBOND"
836 DO i = 1,
SIZE(conn_info%bond_a), 4
838 DO WHILE ((j < 4) .AND. ((i + j) <=
SIZE(conn_info%bond_a)))
839 WRITE (file_unit, fmt=
'(2('//trim(c_int)//
'))', advance=
"NO") &
840 conn_info%bond_a(i + j), conn_info%bond_b(i + j)
843 WRITE (file_unit, fmt=
'(/)', advance=
"NO")
845 WRITE (file_unit, fmt=
'(/)')
847 WRITE (file_unit, fmt=
'('//trim(c_int)//
',A)')
SIZE(conn_info%theta_a),
" !NTHETA"
848 DO i = 1,
SIZE(conn_info%theta_a), 3
850 DO WHILE ((j < 3) .AND. ((i + j) <=
SIZE(conn_info%theta_a)))
851 WRITE (file_unit, fmt=
'(3('//trim(c_int)//
'))', advance=
"NO") &
852 conn_info%theta_a(i + j), conn_info%theta_b(i + j), &
853 conn_info%theta_c(i + j)
856 WRITE (file_unit, fmt=
'(/)', advance=
"NO")
858 WRITE (file_unit, fmt=
'(/)')
860 WRITE (file_unit, fmt=
'('//trim(c_int)//
',A)')
SIZE(conn_info%phi_a),
" !NPHI"
861 DO i = 1,
SIZE(conn_info%phi_a), 2
863 DO WHILE ((j < 2) .AND. ((i + j) <=
SIZE(conn_info%phi_a)))
864 WRITE (file_unit, fmt=
'(4('//trim(c_int)//
'))', advance=
"NO") &
865 conn_info%phi_a(i + j), conn_info%phi_b(i + j), &
866 conn_info%phi_c(i + j), conn_info%phi_d(i + j)
869 WRITE (file_unit, fmt=
'(/)', advance=
"NO")
871 WRITE (file_unit, fmt=
'(/)')
873 WRITE (file_unit, fmt=
'('//trim(c_int)//
',A)')
SIZE(conn_info%impr_a),
" !NIMPHI"
874 DO i = 1,
SIZE(conn_info%impr_a), 2
876 DO WHILE ((j < 2) .AND. ((i + j) <=
SIZE(conn_info%impr_a)))
877 WRITE (file_unit, fmt=
'(4('//trim(c_int)//
'))', advance=
"NO") &
878 conn_info%impr_a(i + j), conn_info%impr_b(i + j), &
879 conn_info%impr_c(i + j), conn_info%impr_d(i + j)
882 WRITE (file_unit, fmt=
'(/)', advance=
"NO")
884 WRITE (file_unit, fmt=
'(/)')
886 WRITE (file_unit, fmt=
'('//trim(c_int)//
',A)') 0,
" !NDON"
887 WRITE (file_unit, fmt=
'(/)')
888 WRITE (file_unit, fmt=
'('//trim(c_int)//
',A)') 0,
" !NACC"
889 WRITE (file_unit, fmt=
'(/)')
890 WRITE (file_unit, fmt=
'('//trim(c_int)//
',A)') 0,
" !NNB"
891 WRITE (file_unit, fmt=
'(/)')
894 "PRINT%TOPOLOGY_INFO/PSF_INFO")
895 CALL timestop(handle)
various routines to log and control the output. The idea is that decisions about where to log should ...
integer function, public cp_logger_get_default_io_unit(logger)
returns the unit nr for the ionode (-1 on all other processors) skips as well checks if the procs cal...
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)
...
character(len=default_path_length) function, public cp_print_key_generate_filename(logger, print_key, middle_name, extension, my_local)
Utility function that returns a unit number to write the print key. Might open a file with a unique f...
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,...
Utility routines to read data from files. Kept as close as possible to the old parser because.
subroutine, public parser_get_next_line(parser, nline, at_end)
Read the next input line and broadcast the input information. Skip (nline-1) lines and skip also all ...
character(len=3) function, public parser_test_next_token(parser, string_length)
Test next input object.
subroutine, public parser_search_string(parser, string, ignore_case, found, line, begin_line, search_from_begin_of_file)
Search a string pattern in a file defined by its logical unit number "unit". A case sensitive search ...
Utility routines to read data from files. Kept as close as possible to the old parser because.
subroutine, public parser_release(parser)
releases the parser
subroutine, public parser_create(parser, file_name, unit_nr, para_env, end_section_label, separator_chars, comment_char, continuation_char, quote_char, section_char, parse_white_lines, initial_variables, apply_preprocessing)
Start a parser run. Initial variables allow to @SET stuff before opening the file.
Defines the basic variable types.
integer, parameter, public dp
integer, parameter, public default_string_length
Utility routines for the memory handling.
Interface to the message passing library MPI.
logical function, public qmmm_ff_precond_only_qm(id1, id2, id3, id4, is_link)
This function handles the atom names and modifies the "_QM_" prefix, in order to find the parameters ...
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
Utilities for string manipulations.
elemental subroutine, public uppercase(string)
Convert all lower case characters in a string to upper case.
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.
Collection of subroutine needed for topology related things.
recursive subroutine, public tag_molecule(icheck, bond_list, i, my_mol)
gives back a mapping of molecules.. icheck needs to be initialized with -1
Control for reading in different topologies and coordinates.
All kind of helpful little routines.