46 #include "./base/base_uses.f90"
50 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'topology_amber'
51 REAL(KIND=
dp),
PARAMETER,
PRIVATE :: amber_conv_factor = 20.4550_dp, &
52 amber_conv_charge = 18.2223_dp
53 INTEGER,
PARAMETER,
PRIVATE :: buffer_size = 1
59 INTERFACE rd_amber_section
60 MODULE PROCEDURE rd_amber_section_i1, rd_amber_section_c1, rd_amber_section_r1, &
61 rd_amber_section_i3, rd_amber_section_i4, rd_amber_section_i5
102 TYPE(mp_para_env_type),
POINTER :: para_env
103 TYPE(section_vals_type),
POINTER :: subsys_section
105 CHARACTER(len=*),
PARAMETER :: routinen =
'read_coordinate_crd'
107 CHARACTER(LEN=default_string_length) :: string
108 INTEGER :: handle, iw, j, natom
109 LOGICAL :: my_end, setup_velocities
110 REAL(kind=
dp),
DIMENSION(:, :),
POINTER :: velocity
112 TYPE(cp_logger_type),
POINTER :: logger
113 TYPE(cp_parser_type) :: parser
114 TYPE(section_vals_type),
POINTER :: velocity_section
116 NULLIFY (logger, velocity)
119 extension=
".subsysLog")
120 CALL timeset(routinen, handle)
123 IF (iw > 0)
WRITE (iw, *)
" Reading in CRD file ", trim(
topology%coord_file_name)
126 IF (iw > 0)
WRITE (iw,
'(T2,A)')
'CRD_INFO| Parsing the TITLE section'
132 IF (iw > 0)
WRITE (iw,
'(T2,A)')
'CRD_INFO| '//trim(string)
136 CALL parser_get_object(parser, natom)
138 IF (iw > 0)
WRITE (iw,
'(T2,A,I0)')
'CRD_INFO| Number of atoms: ', natom
139 CALL reallocate(atom_info%id_molname, 1, natom)
140 CALL reallocate(atom_info%id_resname, 1, natom)
141 CALL reallocate(atom_info%resid, 1, natom)
142 CALL reallocate(atom_info%id_atmname, 1, natom)
143 CALL reallocate(atom_info%r, 1, 3, 1, natom)
144 CALL reallocate(atom_info%atm_mass, 1, natom)
145 CALL reallocate(atom_info%atm_charge, 1, natom)
146 CALL reallocate(atom_info%occup, 1, natom)
147 CALL reallocate(atom_info%beta, 1, natom)
148 CALL reallocate(atom_info%id_element, 1, natom)
155 DO j = 1, natom - mod(natom, 2), 2
157 READ (parser%input_line, *) atom_info%r(1, j), atom_info%r(2, j), atom_info%r(3, j), &
158 atom_info%r(1, j + 1), atom_info%r(2, j + 1), atom_info%r(3, j + 1)
161 atom_info%id_atmname(j) =
str2id(
s2s(
"__UNDEF__"))
162 atom_info%id_molname(j) =
str2id(
s2s(
"__UNDEF__"))
163 atom_info%id_resname(j) =
str2id(
s2s(
"__UNDEF__"))
164 atom_info%id_element(j) =
str2id(
s2s(
"__UNDEF__"))
165 atom_info%resid(j) = huge(0)
166 atom_info%atm_mass(j) = huge(0.0_dp)
167 atom_info%atm_charge(j) = -huge(0.0_dp)
172 atom_info%id_atmname(j + 1) =
str2id(
s2s(
"__UNDEF__"))
173 atom_info%id_molname(j + 1) =
str2id(
s2s(
"__UNDEF__"))
174 atom_info%id_resname(j + 1) =
str2id(
s2s(
"__UNDEF__"))
175 atom_info%id_element(j + 1) =
str2id(
s2s(
"__UNDEF__"))
176 atom_info%resid(j + 1) = huge(0)
177 atom_info%atm_mass(j + 1) = huge(0.0_dp)
178 atom_info%atm_charge(j + 1) = -huge(0.0_dp)
179 atom_info%r(1, j + 1) =
cp_unit_to_cp2k(atom_info%r(1, j + 1),
"angstrom")
180 atom_info%r(2, j + 1) =
cp_unit_to_cp2k(atom_info%r(2, j + 1),
"angstrom")
181 atom_info%r(3, j + 1) =
cp_unit_to_cp2k(atom_info%r(3, j + 1),
"angstrom")
186 IF ((my_end) .AND. (j /= natom - mod(natom, 2) + 1))
THEN
188 cpabort(
"Error while reading CRD file. Unexpected end of file.")
189 ELSE IF (mod(natom, 2) /= 0)
THEN
192 READ (parser%input_line, *) atom_info%r(1, j), atom_info%r(2, j), atom_info%r(3, j)
195 atom_info%id_atmname(j) =
str2id(
s2s(
"__UNDEF__"))
196 atom_info%id_molname(j) =
str2id(
s2s(
"__UNDEF__"))
197 atom_info%id_resname(j) =
str2id(
s2s(
"__UNDEF__"))
198 atom_info%id_element(j) =
str2id(
s2s(
"__UNDEF__"))
199 atom_info%resid(j) = huge(0)
200 atom_info%atm_mass(j) = huge(0.0_dp)
201 atom_info%atm_charge(j) = -huge(0.0_dp)
211 cpwarn(
"No VELOCITY or BOX information found in CRD file. ")
214 CALL reallocate(velocity, 1, 3, 1, natom)
215 DO j = 1, natom - mod(natom, 2), 2
217 READ (parser%input_line, *) velocity(1, j), velocity(2, j), velocity(3, j), &
218 velocity(1, j + 1), velocity(2, j + 1), velocity(3, j + 1)
223 velocity(1:3, j) = velocity(1:3, j)*amber_conv_factor
225 velocity(1, j + 1) =
cp_unit_to_cp2k(velocity(1, j + 1),
"angstrom*ps^-1")
226 velocity(2, j + 1) =
cp_unit_to_cp2k(velocity(2, j + 1),
"angstrom*ps^-1")
227 velocity(3, j + 1) =
cp_unit_to_cp2k(velocity(3, j + 1),
"angstrom*ps^-1")
228 velocity(1:3, j + 1) = velocity(1:3, j + 1)*amber_conv_factor
232 setup_velocities = .true.
233 IF ((my_end) .AND. (j /= natom - mod(natom, 2) + 1))
THEN
235 CALL cp_warn(__location__, &
236 "No VELOCITY information found in CRD file. Ignoring BOX information. "// &
237 "Please provide the BOX information directly from the main CP2K input! ")
238 setup_velocities = .false.
239 ELSE IF (mod(natom, 2) /= 0)
THEN
242 READ (parser%input_line, *) velocity(1, j), velocity(2, j), velocity(3, j)
247 velocity(1:3, j) = velocity(1:3, j)*amber_conv_factor
251 IF (setup_velocities)
THEN
256 DEALLOCATE (velocity)
260 cpwarn(
"BOX information missing in CRD file. ")
263 CALL cp_warn(__location__, &
264 "BOX information found in CRD file. They will be ignored. "// &
265 "Please provide the BOX information directly from the main CP2K input!")
269 "PRINT%TOPOLOGY_INFO/CRD_INFO")
270 CALL timestop(handle)
286 CHARACTER(LEN=*),
INTENT(IN) :: filename
288 TYPE(mp_para_env_type),
POINTER :: para_env
289 TYPE(section_vals_type),
POINTER :: subsys_section
291 CHARACTER(len=*),
PARAMETER :: routinen =
'read_connectivity_amber'
293 INTEGER :: handle, iw
296 TYPE(cp_logger_type),
POINTER :: logger
299 CALL timeset(routinen, handle)
302 extension=
".subsysLog")
308 CALL rdparm_amber_8(filename, iw, para_env, do_connectivity=.true., do_forcefield=.false., &
309 atom_info=atom_info, conn_info=conn_info)
315 "PRINT%TOPOLOGY_INFO/AMBER_INFO")
316 CALL timestop(handle)
367 do_forcefield, atom_info, conn_info, amb_info, particle_set)
369 CHARACTER(LEN=*),
INTENT(IN) :: filename
370 INTEGER,
INTENT(IN) :: output_unit
371 TYPE(mp_para_env_type),
POINTER :: para_env
372 LOGICAL,
INTENT(IN) :: do_connectivity, do_forcefield
375 TYPE(amber_info_type),
OPTIONAL,
POINTER :: amb_info
376 TYPE(particle_type),
DIMENSION(:),
OPTIONAL, &
377 POINTER :: particle_set
379 CHARACTER(len=*),
PARAMETER :: routinen =
'rdparm_amber_8'
381 CHARACTER(LEN=default_string_length) :: input_format, section
382 CHARACTER(LEN=default_string_length), &
383 ALLOCATABLE,
DIMENSION(:) :: isymbl, labres, strtmp_a
384 INTEGER :: handle, handle2, i, ifbox, ifcap, ifpert, index_now, info(31), istart, mbona, &
385 mbper, mdper, mgper, mphia, mtheta, natom, natom_prev, natyp, nbona, nbond_prev, nbonh, &
386 nbper, ndper, ngper, nhparm, nmxrs, nnb, nparm, nphb, nphi_prev, nphia, nphih, nptra, &
387 nres, nsize, ntheta, ntheta_prev, ntheth, ntypes, numang, numbnd, numextra, &
389 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: iac, ib, ibh, icb, icbh, ico, icp, icph, &
390 ict, icth, ip, iph, ipres, it, ith, &
391 iwork, jb, jbh, jp, jph, jt, jth, kp, &
392 kph, kt, kth, lp, lph
393 INTEGER,
ALLOCATABLE,
DIMENSION(:, :) :: full_torsions
394 LOGICAL :: check, valid_format
395 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: asol, bsol, cn1, cn2, phase, pk, pn, &
397 TYPE(cp_parser_type) :: parser
399 CALL timeset(routinen, handle)
400 IF (output_unit > 0)
WRITE (output_unit,
'(/,A)')
" AMBER_INFO| Reading Amber Topology File: "// &
402 CALL parser_create(parser, filename, para_env=para_env, parse_white_lines=.true.)
403 valid_format = check_amber_8_std(parser, output_unit)
404 IF (valid_format)
THEN
405 DO WHILE (get_section_parmtop(parser, section, input_format))
406 SELECT CASE (trim(section))
411 CALL rd_amber_section(parser, section, info, 31)
447 IF (output_unit > 0)
THEN
448 WRITE (output_unit,
'(A,/)')
" AMBER_INFO| Information from AMBER topology file:"
449 WRITE (output_unit, 1000) &
450 natom, ntypes, nbonh, mbona, ntheth, mtheta, nphih, &
451 mphia, nhparm, nparm, nnb, nres, nbona, ntheta, &
452 nphia, numbnd, numang, nptra, natyp, nphb, ifbox, &
453 nmxrs, ifcap, numextra
457 IF (do_connectivity)
THEN
458 check =
PRESENT(atom_info) .AND.
PRESENT(conn_info)
461 IF (
ASSOCIATED(atom_info%id_molname)) natom_prev =
SIZE(atom_info%id_molname)
463 ALLOCATE (labres(nres))
464 ALLOCATE (ipres(nres))
466 IF (do_forcefield)
THEN
468 ALLOCATE (iac(natom))
469 ALLOCATE (ico(ntypes*ntypes))
470 ALLOCATE (rk(numbnd))
471 ALLOCATE (req(numbnd))
472 ALLOCATE (tk(numang))
473 ALLOCATE (teq(numang))
476 ALLOCATE (phase(nptra))
477 ALLOCATE (cn1(ntypes*(ntypes + 1)/2))
478 ALLOCATE (cn2(ntypes*(ntypes + 1)/2))
479 ALLOCATE (asol(ntypes*(ntypes + 1)/2))
480 ALLOCATE (bsol(ntypes*(ntypes + 1)/2))
483 ALLOCATE (ibh(nbonh))
484 ALLOCATE (jbh(nbonh))
485 ALLOCATE (icbh(nbonh))
488 ALLOCATE (icb(nbona))
489 ALLOCATE (ith(ntheth))
490 ALLOCATE (jth(ntheth))
491 ALLOCATE (kth(ntheth))
492 ALLOCATE (icth(ntheth))
493 ALLOCATE (it(ntheta))
494 ALLOCATE (jt(ntheta))
495 ALLOCATE (kt(ntheta))
496 ALLOCATE (ict(ntheta))
497 ALLOCATE (iph(nphih))
498 ALLOCATE (jph(nphih))
499 ALLOCATE (kph(nphih))
500 ALLOCATE (lph(nphih))
501 ALLOCATE (icph(nphih))
506 ALLOCATE (icp(nphia))
510 CASE (
"AMBER_ATOM_TYPE")
511 IF (.NOT. do_connectivity) cycle
512 CALL reallocate(atom_info%id_atmname, 1, natom_prev + natom)
513 ALLOCATE (strtmp_a(natom))
514 CALL rd_amber_section(parser, section, strtmp_a, natom)
516 atom_info%id_atmname(natom_prev + i) =
str2id(strtmp_a(i))
518 DEALLOCATE (strtmp_a)
520 IF (.NOT. do_connectivity) cycle
521 CALL reallocate(atom_info%atm_charge, 1, natom_prev + natom)
522 CALL rd_amber_section(parser, section, atom_info%atm_charge(natom_prev + 1:), natom)
524 atom_info%atm_charge(natom_prev + 1:) = atom_info%atm_charge(natom_prev + 1:)/amber_conv_charge
526 IF (.NOT. do_connectivity) cycle
527 CALL reallocate(atom_info%atm_mass, 1, natom_prev + natom)
528 CALL rd_amber_section(parser, section, atom_info%atm_mass(natom_prev + 1:), natom)
529 CASE (
"RESIDUE_LABEL")
530 IF (.NOT. do_connectivity) cycle
531 CALL reallocate(atom_info%id_resname, 1, natom_prev + natom)
532 CALL rd_amber_section(parser, section, labres, nres)
533 CASE (
"RESIDUE_POINTER")
534 IF (.NOT. do_connectivity) cycle
535 CALL reallocate(atom_info%resid, 1, natom_prev + natom)
536 CALL rd_amber_section(parser, section, ipres, nres)
537 CASE (
"ATOM_TYPE_INDEX")
538 IF (.NOT. do_forcefield) cycle
539 CALL rd_amber_section(parser, section, iac, natom)
540 CASE (
"NONBONDED_PARM_INDEX")
541 IF (.NOT. do_forcefield) cycle
542 CALL rd_amber_section(parser, section, ico, ntypes**2)
543 CASE (
"BOND_FORCE_CONSTANT")
544 IF (.NOT. do_forcefield) cycle
545 CALL rd_amber_section(parser, section, rk, numbnd)
546 CASE (
"BOND_EQUIL_VALUE")
547 IF (.NOT. do_forcefield) cycle
548 CALL rd_amber_section(parser, section, req, numbnd)
549 CASE (
"ANGLE_FORCE_CONSTANT")
550 IF (.NOT. do_forcefield) cycle
551 CALL rd_amber_section(parser, section, tk, numang)
552 CASE (
"ANGLE_EQUIL_VALUE")
553 IF (.NOT. do_forcefield) cycle
554 CALL rd_amber_section(parser, section, teq, numang)
555 CASE (
"DIHEDRAL_FORCE_CONSTANT")
556 IF (.NOT. do_forcefield) cycle
557 CALL rd_amber_section(parser, section, pk, nptra)
558 IF (nptra <= 0) cycle
560 IF (
ASSOCIATED(amb_info%raw_torsion_k))
DEALLOCATE (amb_info%raw_torsion_k)
561 ALLOCATE (amb_info%raw_torsion_k(nptra), source=pk)
562 CASE (
"DIHEDRAL_PERIODICITY")
563 IF (.NOT. do_forcefield) cycle
564 CALL rd_amber_section(parser, section, pn, nptra)
565 IF (nptra <= 0) cycle
567 IF (
ASSOCIATED(amb_info%raw_torsion_m))
DEALLOCATE (amb_info%raw_torsion_m)
568 ALLOCATE (amb_info%raw_torsion_m(nptra), source=pn)
569 CASE (
"DIHEDRAL_PHASE")
570 IF (.NOT. do_forcefield) cycle
571 CALL rd_amber_section(parser, section, phase, nptra)
572 IF (nptra <= 0) cycle
574 IF (
ASSOCIATED(amb_info%raw_torsion_phi0))
DEALLOCATE (amb_info%raw_torsion_phi0)
575 ALLOCATE (amb_info%raw_torsion_phi0(nptra), source=phase)
576 CASE (
"LENNARD_JONES_ACOEF")
577 IF (.NOT. do_forcefield) cycle
578 CALL rd_amber_section(parser, section, cn1, ntypes*(ntypes + 1)/2)
579 CASE (
"LENNARD_JONES_BCOEF")
580 IF (.NOT. do_forcefield) cycle
581 CALL rd_amber_section(parser, section, cn2, ntypes*(ntypes + 1)/2)
583 IF (.NOT. do_forcefield) cycle
584 CALL rd_amber_section(parser, section, asol, nphb)
586 IF (.NOT. do_forcefield) cycle
587 CALL rd_amber_section(parser, section, bsol, nphb)
588 CASE (
"BONDS_INC_HYDROGEN")
590 CALL rd_amber_section(parser, section, ibh, jbh, icbh, nbonh)
592 ibh(:) = ibh(:)/3 + 1
593 jbh(:) = jbh(:)/3 + 1
594 CASE (
"BONDS_WITHOUT_HYDROGEN")
596 CALL rd_amber_section(parser, section, ib, jb, icb, nbona)
600 CASE (
"ANGLES_INC_HYDROGEN")
602 CALL rd_amber_section(parser, section, ith, jth, kth, icth, ntheth)
604 ith(:) = ith(:)/3 + 1
605 jth(:) = jth(:)/3 + 1
606 kth(:) = kth(:)/3 + 1
607 CASE (
"ANGLES_WITHOUT_HYDROGEN")
609 CALL rd_amber_section(parser, section, it, jt, kt, ict, ntheta)
614 CASE (
"DIHEDRALS_INC_HYDROGEN")
616 CALL rd_amber_section(parser, section, iph, jph, kph, lph, icph, nphih)
618 iph(:) = iph(:)/3 + 1
619 jph(:) = jph(:)/3 + 1
620 kph(:) = abs(kph(:))/3 + 1
621 lph(:) = abs(lph(:))/3 + 1
622 CASE (
"DIHEDRALS_WITHOUT_HYDROGEN")
624 CALL rd_amber_section(parser, section, ip, jp, kp, lp, icp, nphia)
628 kp(:) = abs(kp(:))/3 + 1
629 lp(:) = abs(lp(:))/3 + 1
635 IF (do_forcefield .AND. (nphih + nphia > 0))
THEN
636 IF (
ASSOCIATED(amb_info%raw_torsion_id))
DEALLOCATE (amb_info%raw_torsion_id)
637 ALLOCATE (amb_info%raw_torsion_id(5, nphih + nphia))
639 amb_info%raw_torsion_id(1, i) = iph(i)
640 amb_info%raw_torsion_id(2, i) = jph(i)
641 amb_info%raw_torsion_id(3, i) = kph(i)
642 amb_info%raw_torsion_id(4, i) = lph(i)
643 amb_info%raw_torsion_id(5, i) = icph(i)
646 amb_info%raw_torsion_id(1, nphih + i) = ip(i)
647 amb_info%raw_torsion_id(2, nphih + i) = jp(i)
648 amb_info%raw_torsion_id(3, nphih + i) = kp(i)
649 amb_info%raw_torsion_id(4, nphih + i) = lp(i)
650 amb_info%raw_torsion_id(5, nphih + i) = icp(i)
656 IF (do_connectivity)
THEN
657 CALL timeset(trim(routinen)//
"_connectivity", handle2)
661 ALLOCATE (isymbl(natom))
662 ALLOCATE (iwork(natom))
664 DO i = 1,
SIZE(isymbl)
665 isymbl(i) =
id2str(atom_info%id_atmname(natom_prev + i))
669 CALL sort(isymbl, natom, iwork)
673 IF (trim(isymbl(i)) /= trim(isymbl(istart)))
THEN
674 CALL conform_atom_type_low(isymbl, iwork, i, istart, atom_info%atm_charge(natom_prev + 1:))
678 CALL conform_atom_type_low(isymbl, iwork, i, istart, atom_info%atm_charge(natom_prev + 1:))
682 atom_info%id_atmname(natom_prev + iwork(i)) =
str2id(
s2s(isymbl(i)))
689 atom_info%id_resname(natom_prev + ipres(i):natom_prev + ipres(i + 1)) =
str2id(
s2s(labres(i)))
690 atom_info%resid(natom_prev + ipres(i):natom_prev + ipres(i + 1)) = i
692 atom_info%id_resname(natom_prev + ipres(i):natom_prev + natom) =
str2id(
s2s(labres(i)))
693 atom_info%resid(natom_prev + ipres(i):natom_prev + natom) = i
706 IF (
ASSOCIATED(conn_info%bond_a)) nbond_prev =
SIZE(conn_info%bond_a)
708 CALL reallocate(conn_info%bond_a, 1, nbond_prev + nbonh + nbona)
709 CALL reallocate(conn_info%bond_b, 1, nbond_prev + nbonh + nbona)
711 index_now = nbond_prev + i
712 conn_info%bond_a(index_now) = natom_prev + ibh(i)
713 conn_info%bond_b(index_now) = natom_prev + jbh(i)
716 index_now = nbond_prev + i + nbonh
717 conn_info%bond_a(index_now) = natom_prev + ib(i)
718 conn_info%bond_b(index_now) = natom_prev + jb(i)
723 IF (
ASSOCIATED(conn_info%theta_a)) ntheta_prev =
SIZE(conn_info%theta_a)
725 CALL reallocate(conn_info%theta_a, 1, ntheta_prev + ntheth + ntheta)
726 CALL reallocate(conn_info%theta_b, 1, ntheta_prev + ntheth + ntheta)
727 CALL reallocate(conn_info%theta_c, 1, ntheta_prev + ntheth + ntheta)
729 index_now = ntheta_prev + i
730 conn_info%theta_a(index_now) = natom_prev + ith(i)
731 conn_info%theta_b(index_now) = natom_prev + jth(i)
732 conn_info%theta_c(index_now) = natom_prev + kth(i)
735 index_now = ntheta_prev + i + ntheth
736 conn_info%theta_a(index_now) = natom_prev + it(i)
737 conn_info%theta_b(index_now) = natom_prev + jt(i)
738 conn_info%theta_c(index_now) = natom_prev + kt(i)
745 IF (
ASSOCIATED(conn_info%phi_a)) nphi_prev =
SIZE(conn_info%phi_a)
747 CALL reallocate(conn_info%phi_a, 1, nphi_prev + nphih + nphia)
748 CALL reallocate(conn_info%phi_b, 1, nphi_prev + nphih + nphia)
749 CALL reallocate(conn_info%phi_c, 1, nphi_prev + nphih + nphia)
750 CALL reallocate(conn_info%phi_d, 1, nphi_prev + nphih + nphia)
752 IF (nphih + nphia /= 0)
THEN
753 ALLOCATE (full_torsions(4, nphih + nphia))
754 ALLOCATE (iwork(nphih + nphia))
757 full_torsions(1, i) = iph(i)
758 full_torsions(2, i) = jph(i)
759 full_torsions(3, i) = kph(i)
760 full_torsions(4, i) = lph(i)
763 full_torsions(1, nphih + i) = ip(i)
764 full_torsions(2, nphih + i) = jp(i)
765 full_torsions(3, nphih + i) = kp(i)
766 full_torsions(4, nphih + i) = lp(i)
768 CALL sort(full_torsions, 1, nphih + nphia, 1, 4, iwork)
770 unique_torsions = nphi_prev + 1
771 conn_info%phi_a(unique_torsions) = natom_prev + full_torsions(1, 1)
772 conn_info%phi_b(unique_torsions) = natom_prev + full_torsions(2, 1)
773 conn_info%phi_c(unique_torsions) = natom_prev + full_torsions(3, 1)
774 conn_info%phi_d(unique_torsions) = natom_prev + full_torsions(4, 1)
775 DO i = 2, nphih + nphia
776 IF ((full_torsions(1, i) /= full_torsions(1, i - 1)) .OR. &
777 (full_torsions(2, i) /= full_torsions(2, i - 1)) .OR. &
778 (full_torsions(3, i) /= full_torsions(3, i - 1)) .OR. &
779 (full_torsions(4, i) /= full_torsions(4, i - 1)))
THEN
780 unique_torsions = unique_torsions + 1
781 conn_info%phi_a(unique_torsions) = natom_prev + full_torsions(1, i)
782 conn_info%phi_b(unique_torsions) = natom_prev + full_torsions(2, i)
783 conn_info%phi_c(unique_torsions) = natom_prev + full_torsions(3, i)
784 conn_info%phi_d(unique_torsions) = natom_prev + full_torsions(4, i)
787 CALL reallocate(conn_info%phi_a, 1, unique_torsions)
788 CALL reallocate(conn_info%phi_b, 1, unique_torsions)
789 CALL reallocate(conn_info%phi_c, 1, unique_torsions)
790 CALL reallocate(conn_info%phi_d, 1, unique_torsions)
792 DEALLOCATE (full_torsions)
796 CALL reallocate(conn_info%impr_a, 1, 0)
797 CALL reallocate(conn_info%impr_b, 1, 0)
798 CALL reallocate(conn_info%impr_c, 1, 0)
799 CALL reallocate(conn_info%impr_d, 1, 0)
804 CALL reallocate(atom_info%id_molname, 1, natom_prev + natom)
805 atom_info%id_molname(natom_prev + 1:natom_prev + natom) =
str2id(
s2s(
"__UNDEF__"))
807 atom_info%id_molname(natom_prev + 1:natom_prev + natom))
808 CALL timestop(handle2)
812 IF (do_forcefield)
THEN
813 CALL timeset(trim(routinen)//
"_forcefield", handle2)
817 CALL reallocate(amb_info%bond_a, 1, buffer_size)
818 CALL reallocate(amb_info%bond_b, 1, buffer_size)
819 CALL reallocate(amb_info%bond_k, 1, buffer_size)
820 CALL reallocate(amb_info%bond_r0, 1, buffer_size)
823 CALL post_process_bonds_info(amb_info%bond_a, amb_info%bond_b, &
824 amb_info%bond_k, amb_info%bond_r0, particle_set, nsize, &
825 nbonh, ibh, jbh, icbh, rk, req)
827 CALL post_process_bonds_info(amb_info%bond_a, amb_info%bond_b, &
828 amb_info%bond_k, amb_info%bond_r0, particle_set, nsize, &
829 nbona, ib, jb, icb, rk, req)
831 CALL reallocate(amb_info%bond_a, 1, nsize)
832 CALL reallocate(amb_info%bond_b, 1, nsize)
833 CALL reallocate(amb_info%bond_k, 1, nsize)
834 CALL reallocate(amb_info%bond_r0, 1, nsize)
839 CALL reallocate(amb_info%bend_a, 1, buffer_size)
840 CALL reallocate(amb_info%bend_b, 1, buffer_size)
841 CALL reallocate(amb_info%bend_c, 1, buffer_size)
842 CALL reallocate(amb_info%bend_k, 1, buffer_size)
843 CALL reallocate(amb_info%bend_theta0, 1, buffer_size)
846 CALL post_process_bends_info(amb_info%bend_a, amb_info%bend_b, &
847 amb_info%bend_c, amb_info%bend_k, amb_info%bend_theta0, &
848 particle_set, nsize, ntheth, ith, jth, kth, icth, tk, teq)
850 CALL post_process_bends_info(amb_info%bend_a, amb_info%bend_b, &
851 amb_info%bend_c, amb_info%bend_k, amb_info%bend_theta0, &
852 particle_set, nsize, ntheta, it, jt, kt, ict, tk, teq)
854 CALL reallocate(amb_info%bend_a, 1, nsize)
855 CALL reallocate(amb_info%bend_b, 1, nsize)
856 CALL reallocate(amb_info%bend_c, 1, nsize)
857 CALL reallocate(amb_info%bend_k, 1, nsize)
858 CALL reallocate(amb_info%bend_theta0, 1, nsize)
865 CALL reallocate(amb_info%torsion_a, 1, buffer_size)
866 CALL reallocate(amb_info%torsion_b, 1, buffer_size)
867 CALL reallocate(amb_info%torsion_c, 1, buffer_size)
868 CALL reallocate(amb_info%torsion_d, 1, buffer_size)
869 CALL reallocate(amb_info%torsion_k, 1, buffer_size)
870 CALL reallocate(amb_info%torsion_m, 1, buffer_size)
871 CALL reallocate(amb_info%torsion_phi0, 1, buffer_size)
874 CALL post_process_torsions_info(amb_info%torsion_a, amb_info%torsion_b, &
875 amb_info%torsion_c, amb_info%torsion_d, amb_info%torsion_k, &
876 amb_info%torsion_m, amb_info%torsion_phi0, particle_set, nsize, &
877 nphih, iph, jph, kph, lph, icph, pk, pn, phase)
879 CALL post_process_torsions_info(amb_info%torsion_a, amb_info%torsion_b, &
880 amb_info%torsion_c, amb_info%torsion_d, amb_info%torsion_k, &
881 amb_info%torsion_m, amb_info%torsion_phi0, particle_set, nsize, &
882 nphia, ip, jp, kp, lp, icp, pk, pn, phase)
884 CALL reallocate(amb_info%torsion_a, 1, nsize)
885 CALL reallocate(amb_info%torsion_b, 1, nsize)
886 CALL reallocate(amb_info%torsion_c, 1, nsize)
887 CALL reallocate(amb_info%torsion_d, 1, nsize)
888 CALL reallocate(amb_info%torsion_k, 1, nsize)
889 CALL reallocate(amb_info%torsion_m, 1, nsize)
890 CALL reallocate(amb_info%torsion_phi0, 1, nsize)
893 IF (nphih + nphia /= 0)
THEN
894 ALLOCATE (iwork(nphih + nphia))
895 CALL sort(amb_info%raw_torsion_id, 1, nphih + nphia, 1, 5, iwork)
902 CALL reallocate(amb_info%nonbond_a, 1, buffer_size)
903 CALL reallocate(amb_info%nonbond_eps, 1, buffer_size)
904 CALL reallocate(amb_info%nonbond_rmin2, 1, buffer_size)
907 CALL post_process_lj_info(amb_info%nonbond_a, amb_info%nonbond_eps, &
908 amb_info%nonbond_rmin2, particle_set, ntypes, nsize, iac, ico, &
912 CALL reallocate(amb_info%nonbond_a, 1, nsize)
913 CALL reallocate(amb_info%nonbond_eps, 1, nsize)
914 CALL reallocate(amb_info%nonbond_rmin2, 1, nsize)
930 CALL timestop(handle2)
958 CALL timestop(handle)
962 /
' NATOM = ', i7,
' NTYPES = ', i7,
' NBONH = ', i7,
' MBONA = ', i7, &
963 /
' NTHETH = ', i7,
' MTHETA = ', i7,
' NPHIH = ', i7,
' MPHIA = ', i7, &
964 /
' NHPARM = ', i7,
' NPARM = ', i7,
' NNB = ', i7,
' NRES = ', i7, &
965 /
' NBONA = ', i7,
' NTHETA = ', i7,
' NPHIA = ', i7,
' NUMBND = ', i7, &
966 /
' NUMANG = ', i7,
' NPTRA = ', i7,
' NATYP = ', i7,
' NPHB = ', i7, &
967 /
' IFBOX = ', i7,
' NMXRS = ', i7,
' IFCAP = ', i7,
' NEXTRA = ', i7,/)
979 SUBROUTINE conform_atom_type_low(isymbl, iwork, i, istart, charges)
980 CHARACTER(LEN=default_string_length),
DIMENSION(:) :: isymbl
981 INTEGER,
DIMENSION(:) :: iwork
982 INTEGER,
INTENT(IN) :: i
983 INTEGER,
INTENT(INOUT) :: istart
984 REAL(kind=
dp),
DIMENSION(:),
INTENT(IN) :: charges
986 CHARACTER(len=*),
PARAMETER :: routinen =
'conform_atom_type_low'
988 INTEGER :: counter, gind, handle, iend, ind, isize, &
990 INTEGER,
DIMENSION(:),
POINTER :: cindx, lindx
991 REAL(kind=
dp) :: ctmp
992 REAL(kind=
dp),
DIMENSION(:),
POINTER :: cwork
994 CALL timeset(routinen, handle)
996 isize = iend - istart + 1
997 ALLOCATE (cwork(isize))
998 ALLOCATE (lindx(isize))
999 ALLOCATE (cindx(isize))
1003 cwork(ind) = charges(iwork(k))
1006 CALL sort(cwork, isize, cindx)
1011 IF (cwork(k) /= ctmp)
THEN
1012 counter = counter + 1
1016 IF (counter /= 1)
THEN
1021 IF (cwork(k) /= ctmp)
THEN
1024 gind = lindx(cindx(j))
1025 isymbl(gind) = trim(isymbl(gind))//adjustl(cp_to_string(counter))
1027 counter = counter + 1
1034 gind = lindx(cindx(j))
1035 isymbl(gind) = trim(isymbl(gind))//adjustl(cp_to_string(counter))
1041 CALL timestop(handle)
1042 END SUBROUTINE conform_atom_type_low
1053 SUBROUTINE rd_amber_section_i1(parser, section, array1, dim)
1054 TYPE(cp_parser_type),
INTENT(INOUT) :: parser
1055 CHARACTER(LEN=default_string_length),
INTENT(IN) :: section
1056 INTEGER,
DIMENSION(:) :: array1
1057 INTEGER,
INTENT(IN) :: dim
1064 DO WHILE ((i <= dim) .AND. (.NOT. my_end))
1068 CALL parser_get_object(parser, array1(i))
1072 IF (my_end .AND. (i <= dim)) &
1073 CALL cp_abort(__location__, &
1074 "End of file while reading section "//trim(section)//
" in amber topology file!")
1075 END SUBROUTINE rd_amber_section_i1
1088 SUBROUTINE rd_amber_section_i3(parser, section, array1, array2, array3, dim)
1089 TYPE(cp_parser_type),
INTENT(INOUT) :: parser
1090 CHARACTER(LEN=default_string_length),
INTENT(IN) :: section
1091 INTEGER,
DIMENSION(:) :: array1, array2, array3
1092 INTEGER,
INTENT(IN) :: dim
1099 DO WHILE ((i <= dim) .AND. (.NOT. my_end))
1104 CALL parser_get_object(parser, array1(i))
1109 CALL parser_get_object(parser, array2(i))
1114 CALL parser_get_object(parser, array3(i))
1118 IF (my_end .AND. (i <= dim)) &
1119 CALL cp_abort(__location__, &
1120 "End of file while reading section "//trim(section)//
" in amber topology file!")
1121 END SUBROUTINE rd_amber_section_i3
1135 SUBROUTINE rd_amber_section_i4(parser, section, array1, array2, array3, array4, dim)
1136 TYPE(cp_parser_type),
INTENT(INOUT) :: parser
1137 CHARACTER(LEN=default_string_length),
INTENT(IN) :: section
1138 INTEGER,
DIMENSION(:) :: array1, array2, array3, array4
1139 INTEGER,
INTENT(IN) :: dim
1146 DO WHILE ((i <= dim) .AND. (.NOT. my_end))
1151 CALL parser_get_object(parser, array1(i))
1156 CALL parser_get_object(parser, array2(i))
1161 CALL parser_get_object(parser, array3(i))
1166 CALL parser_get_object(parser, array4(i))
1170 IF (my_end .AND. (i <= dim)) &
1171 CALL cp_abort(__location__, &
1172 "End of file while reading section "//trim(section)//
" in amber topology file!")
1173 END SUBROUTINE rd_amber_section_i4
1188 SUBROUTINE rd_amber_section_i5(parser, section, array1, array2, array3, array4, &
1190 TYPE(cp_parser_type),
INTENT(INOUT) :: parser
1191 CHARACTER(LEN=default_string_length),
INTENT(IN) :: section
1192 INTEGER,
DIMENSION(:) :: array1, array2, array3, array4, array5
1193 INTEGER,
INTENT(IN) :: dim
1200 DO WHILE ((i <= dim) .AND. (.NOT. my_end))
1205 CALL parser_get_object(parser, array1(i))
1210 CALL parser_get_object(parser, array2(i))
1215 CALL parser_get_object(parser, array3(i))
1220 CALL parser_get_object(parser, array4(i))
1225 CALL parser_get_object(parser, array5(i))
1229 IF (my_end .AND. (i <= dim)) &
1230 CALL cp_abort(__location__, &
1231 "End of file while reading section "//trim(section)//
" in amber topology file!")
1232 END SUBROUTINE rd_amber_section_i5
1243 SUBROUTINE rd_amber_section_c1(parser, section, array1, dim)
1244 TYPE(cp_parser_type),
INTENT(INOUT) :: parser
1245 CHARACTER(LEN=default_string_length),
INTENT(IN) :: section
1246 CHARACTER(LEN=default_string_length),
DIMENSION(:) :: array1
1247 INTEGER,
INTENT(IN) :: dim
1254 DO WHILE ((i <= dim) .AND. (.NOT. my_end))
1258 CALL parser_get_object(parser, array1(i), lower_to_upper=.true.)
1262 IF (my_end .AND. (i <= dim)) &
1263 CALL cp_abort(__location__, &
1264 "End of file while reading section "//trim(section)//
" in amber topology file!")
1265 END SUBROUTINE rd_amber_section_c1
1276 SUBROUTINE rd_amber_section_r1(parser, section, array1, dim)
1277 TYPE(cp_parser_type),
INTENT(INOUT) :: parser
1278 CHARACTER(LEN=default_string_length),
INTENT(IN) :: section
1279 REAL(kind=
dp),
DIMENSION(:) :: array1
1280 INTEGER,
INTENT(IN) :: dim
1287 DO WHILE ((i <= dim) .AND. (.NOT. my_end))
1291 CALL parser_get_object(parser, array1(i))
1295 IF (my_end .AND. (i <= dim)) &
1296 CALL cp_abort(__location__, &
1297 "End of file while reading section "//trim(section)//
" in amber topology file!")
1298 END SUBROUTINE rd_amber_section_r1
1308 FUNCTION get_section_parmtop(parser, section, input_format)
RESULT(another_section)
1309 TYPE(cp_parser_type),
INTENT(INOUT) :: parser
1310 CHARACTER(LEN=default_string_length),
INTENT(OUT) :: section, input_format
1311 LOGICAL :: another_section
1313 INTEGER :: end_f, indflag, start_f
1314 LOGICAL :: found, my_end
1319 indflag = index(parser%input_line,
"%FLAG") + len_trim(
"%FLAG")
1320 DO WHILE (index(parser%input_line(indflag:indflag),
" ") /= 0)
1321 indflag = indflag + 1
1323 section = trim(parser%input_line(indflag:))
1326 IF (index(parser%input_line,
"%FORMAT") == 0 .OR. my_end) &
1327 cpabort(
"Expecting %FORMAT. Not found! Abort reading of AMBER topology file!")
1329 start_f = index(parser%input_line,
"(")
1330 end_f = index(parser%input_line,
")")
1331 input_format = parser%input_line(start_f:end_f)
1332 another_section = .true.
1334 another_section = .false.
1336 END FUNCTION get_section_parmtop
1345 FUNCTION check_amber_8_std(parser, output_unit)
RESULT(found_AMBER_V8)
1346 TYPE(cp_parser_type),
INTENT(INOUT) :: parser
1347 INTEGER,
INTENT(IN) :: output_unit
1348 LOGICAL :: found_amber_v8
1351 IF (.NOT. found_amber_v8) &
1352 CALL cp_abort(__location__, &
1353 "This is not an AMBER V.8 PRMTOP format file. Cannot interpret older "// &
1354 "AMBER file formats. ")
1355 IF (output_unit > 0)
WRITE (output_unit,
'(" AMBER_INFO| ",A)')
"Amber PrmTop V.8 or greater.", &
1356 trim(parser%input_line)
1358 END FUNCTION check_amber_8_std
1376 SUBROUTINE post_process_bonds_info(label_a, label_b, k, r0, particle_set, ibond, &
1377 nbond, ib, jb, icb, rk, req)
1378 CHARACTER(LEN=default_string_length), &
1379 DIMENSION(:),
POINTER :: label_a, label_b
1380 REAL(kind=
dp),
DIMENSION(:),
POINTER :: k, r0
1381 TYPE(particle_type),
DIMENSION(:),
POINTER :: particle_set
1382 INTEGER,
INTENT(INOUT) :: ibond
1383 INTEGER,
INTENT(IN) :: nbond
1384 INTEGER,
DIMENSION(:),
INTENT(IN) :: ib, jb, icb
1385 REAL(kind=
dp),
DIMENSION(:),
INTENT(IN) :: rk, req
1387 CHARACTER(len=*),
PARAMETER :: routinen =
'post_process_bonds_info'
1389 CHARACTER(LEN=default_string_length) :: name_atm_a, name_atm_b
1390 CHARACTER(LEN=default_string_length), &
1391 ALLOCATABLE,
DIMENSION(:, :) :: work_label
1392 INTEGER :: handle, i
1393 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: iwork
1396 CALL timeset(routinen, handle)
1397 IF (nbond /= 0)
THEN
1398 ALLOCATE (work_label(2, nbond))
1399 ALLOCATE (iwork(nbond))
1401 name_atm_a = particle_set(ib(i))%atomic_kind%name
1402 name_atm_b = particle_set(jb(i))%atomic_kind%name
1404 work_label(1, i) = name_atm_a
1405 work_label(2, i) = name_atm_b
1407 CALL sort(work_label, 1, nbond, 1, 2, iwork)
1411 IF (ibond >
SIZE(label_a))
THEN
1412 CALL reallocate(label_a, 1, int(buffer_size + ibond*1.5_dp))
1413 CALL reallocate(label_b, 1, int(buffer_size + ibond*1.5_dp))
1414 CALL reallocate(k, 1, int(buffer_size + ibond*1.5_dp))
1415 CALL reallocate(r0, 1, int(buffer_size + ibond*1.5_dp))
1417 label_a(ibond) = work_label(1, 1)
1418 label_b(ibond) = work_label(2, 1)
1419 k(ibond) = rk(icb(iwork(1)))
1420 r0(ibond) = req(icb(iwork(1)))
1423 IF ((work_label(1, i) /= label_a(ibond)) .OR. &
1424 (work_label(2, i) /= label_b(ibond)))
THEN
1427 IF (ibond >
SIZE(label_a))
THEN
1428 CALL reallocate(label_a, 1, int(buffer_size + ibond*1.5_dp))
1429 CALL reallocate(label_b, 1, int(buffer_size + ibond*1.5_dp))
1430 CALL reallocate(k, 1, int(buffer_size + ibond*1.5_dp))
1431 CALL reallocate(r0, 1, int(buffer_size + ibond*1.5_dp))
1433 label_a(ibond) = work_label(1, i)
1434 label_b(ibond) = work_label(2, i)
1435 k(ibond) = rk(icb(iwork(i)))
1436 r0(ibond) = req(icb(iwork(i)))
1440 DEALLOCATE (work_label)
1443 CALL timestop(handle)
1444 END SUBROUTINE post_process_bonds_info
1464 SUBROUTINE post_process_bends_info(label_a, label_b, label_c, k, theta0, &
1465 particle_set, itheta, ntheta, it, jt, kt, ict, tk, teq)
1466 CHARACTER(LEN=default_string_length), &
1467 DIMENSION(:),
POINTER :: label_a, label_b, label_c
1468 REAL(kind=
dp),
DIMENSION(:),
POINTER :: k, theta0
1469 TYPE(particle_type),
DIMENSION(:),
POINTER :: particle_set
1470 INTEGER,
INTENT(INOUT) :: itheta
1471 INTEGER,
INTENT(IN) :: ntheta
1472 INTEGER,
DIMENSION(:),
INTENT(IN) :: it, jt, kt, ict
1473 REAL(kind=
dp),
DIMENSION(:),
INTENT(IN) :: tk, teq
1475 CHARACTER(len=*),
PARAMETER :: routinen =
'post_process_bends_info'
1477 CHARACTER(LEN=default_string_length) :: name_atm_a, name_atm_b, name_atm_c
1478 CHARACTER(LEN=default_string_length), &
1479 ALLOCATABLE,
DIMENSION(:, :) :: work_label
1480 INTEGER :: handle, i
1481 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: iwork
1484 CALL timeset(routinen, handle)
1485 IF (ntheta /= 0)
THEN
1486 ALLOCATE (work_label(3, ntheta))
1487 ALLOCATE (iwork(ntheta))
1489 name_atm_a = particle_set(it(i))%atomic_kind%name
1490 name_atm_b = particle_set(jt(i))%atomic_kind%name
1491 name_atm_c = particle_set(kt(i))%atomic_kind%name
1494 work_label(1, i) = name_atm_a
1495 work_label(2, i) = name_atm_b
1496 work_label(3, i) = name_atm_c
1499 CALL sort(work_label, 1, ntheta, 1, 3, iwork)
1503 IF (itheta >
SIZE(label_a))
THEN
1504 CALL reallocate(label_a, 1, int(buffer_size + itheta*1.5_dp))
1505 CALL reallocate(label_b, 1, int(buffer_size + itheta*1.5_dp))
1506 CALL reallocate(label_c, 1, int(buffer_size + itheta*1.5_dp))
1507 CALL reallocate(k, 1, int(buffer_size + itheta*1.5_dp))
1508 CALL reallocate(theta0, 1, int(buffer_size + itheta*1.5_dp))
1510 label_a(itheta) = work_label(1, 1)
1511 label_b(itheta) = work_label(2, 1)
1512 label_c(itheta) = work_label(3, 1)
1513 k(itheta) = tk(ict(iwork(1)))
1514 theta0(itheta) = teq(ict(iwork(1)))
1517 IF ((work_label(1, i) /= label_a(itheta)) .OR. &
1518 (work_label(2, i) /= label_b(itheta)) .OR. &
1519 (work_label(3, i) /= label_c(itheta)))
THEN
1522 IF (itheta >
SIZE(label_a))
THEN
1523 CALL reallocate(label_a, 1, int(buffer_size + itheta*1.5_dp))
1524 CALL reallocate(label_b, 1, int(buffer_size + itheta*1.5_dp))
1525 CALL reallocate(label_c, 1, int(buffer_size + itheta*1.5_dp))
1526 CALL reallocate(k, 1, int(buffer_size + itheta*1.5_dp))
1527 CALL reallocate(theta0, 1, int(buffer_size + itheta*1.5_dp))
1529 label_a(itheta) = work_label(1, i)
1530 label_b(itheta) = work_label(2, i)
1531 label_c(itheta) = work_label(3, i)
1532 k(itheta) = tk(ict(iwork(i)))
1533 theta0(itheta) = teq(ict(iwork(i)))
1537 DEALLOCATE (work_label)
1540 CALL timestop(handle)
1541 END SUBROUTINE post_process_bends_info
1565 SUBROUTINE post_process_torsions_info(label_a, label_b, label_c, label_d, k, &
1566 m, phi0, particle_set, iphi, nphi, ip, jp, kp, lp, icp, pk, pn, phase)
1567 CHARACTER(LEN=default_string_length), &
1568 DIMENSION(:),
POINTER :: label_a, label_b, label_c, label_d
1569 REAL(kind=
dp),
DIMENSION(:),
POINTER :: k
1570 INTEGER,
DIMENSION(:),
POINTER :: m
1571 REAL(kind=
dp),
DIMENSION(:),
POINTER :: phi0
1572 TYPE(particle_type),
DIMENSION(:),
POINTER :: particle_set
1573 INTEGER,
INTENT(INOUT) :: iphi
1574 INTEGER,
INTENT(IN) :: nphi
1575 INTEGER,
DIMENSION(:),
INTENT(IN) :: ip, jp, kp, lp, icp
1576 REAL(kind=
dp),
DIMENSION(:),
INTENT(IN) :: pk, pn, phase
1578 CHARACTER(len=*),
PARAMETER :: routinen =
'post_process_torsions_info'
1580 CHARACTER(LEN=default_string_length) :: name_atm_a, name_atm_b, name_atm_c, &
1582 CHARACTER(LEN=default_string_length), &
1583 ALLOCATABLE,
DIMENSION(:, :) :: work_label
1584 INTEGER :: handle, i
1585 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: iwork
1588 CALL timeset(routinen, handle)
1590 ALLOCATE (work_label(6, nphi))
1591 ALLOCATE (iwork(nphi))
1593 name_atm_a = particle_set(ip(i))%atomic_kind%name
1594 name_atm_b = particle_set(jp(i))%atomic_kind%name
1595 name_atm_c = particle_set(kp(i))%atomic_kind%name
1596 name_atm_d = particle_set(lp(i))%atomic_kind%name
1598 id3=name_atm_c, id4=name_atm_d)
1599 work_label(1, i) = name_atm_a
1600 work_label(2, i) = name_atm_b
1601 work_label(3, i) = name_atm_c
1602 work_label(4, i) = name_atm_d
1605 work_label(5, i) = trim(adjustl(cp_to_string(phase(icp(i)))))
1606 work_label(6, i) = trim(adjustl(cp_to_string(pn(icp(i)))))
1609 CALL sort(work_label, 1, nphi, 1, 6, iwork)
1613 IF (iphi >
SIZE(label_a))
THEN
1614 CALL reallocate(label_a, 1, int(buffer_size + iphi*1.5_dp))
1615 CALL reallocate(label_b, 1, int(buffer_size + iphi*1.5_dp))
1616 CALL reallocate(label_c, 1, int(buffer_size + iphi*1.5_dp))
1617 CALL reallocate(label_d, 1, int(buffer_size + iphi*1.5_dp))
1618 CALL reallocate(k, 1, int(buffer_size + iphi*1.5_dp))
1619 CALL reallocate(m, 1, int(buffer_size + iphi*1.5_dp))
1620 CALL reallocate(phi0, 1, int(buffer_size + iphi*1.5_dp))
1622 label_a(iphi) = work_label(1, 1)
1623 label_b(iphi) = work_label(2, 1)
1624 label_c(iphi) = work_label(3, 1)
1625 label_d(iphi) = work_label(4, 1)
1626 k(iphi) = pk(icp(iwork(1)))
1627 m(iphi) = nint(pn(icp(iwork(1))))
1628 IF (m(iphi) - pn(icp(iwork(1))) .GT. epsilon(1.0_dp))
THEN
1633 phi0(iphi) = phase(icp(iwork(1)))
1639 IF ((work_label(1, i) /= label_a(iphi)) .OR. &
1640 (work_label(2, i) /= label_b(iphi)) .OR. &
1641 (work_label(3, i) /= label_c(iphi)) .OR. &
1642 (work_label(4, i) /= label_d(iphi)) .OR. &
1643 (pn(icp(iwork(i))) /= m(iphi)) .OR. &
1644 (phase(icp(iwork(i))) /= phi0(iphi)))
THEN
1647 IF (iphi >
SIZE(label_a))
THEN
1648 CALL reallocate(label_a, 1, int(buffer_size + iphi*1.5_dp))
1649 CALL reallocate(label_b, 1, int(buffer_size + iphi*1.5_dp))
1650 CALL reallocate(label_c, 1, int(buffer_size + iphi*1.5_dp))
1651 CALL reallocate(label_d, 1, int(buffer_size + iphi*1.5_dp))
1652 CALL reallocate(k, 1, int(buffer_size + iphi*1.5_dp))
1653 CALL reallocate(m, 1, int(buffer_size + iphi*1.5_dp))
1654 CALL reallocate(phi0, 1, int(buffer_size + iphi*1.5_dp))
1656 label_a(iphi) = work_label(1, i)
1657 label_b(iphi) = work_label(2, i)
1658 label_c(iphi) = work_label(3, i)
1659 label_d(iphi) = work_label(4, i)
1660 k(iphi) = pk(icp(iwork(i)))
1661 m(iphi) = nint(pn(icp(iwork(i))))
1662 IF (m(iphi) - pn(icp(iwork(i))) .GT. epsilon(1.0_dp))
THEN
1666 phi0(iphi) = phase(icp(iwork(i)))
1670 DEALLOCATE (work_label)
1673 CALL timestop(handle)
1674 END SUBROUTINE post_process_torsions_info
1691 SUBROUTINE post_process_lj_info(atom_label, eps, sigma, particle_set, &
1692 ntypes, nsize, iac, ico, cn1, cn2, natom)
1693 CHARACTER(LEN=default_string_length), &
1694 DIMENSION(:),
POINTER :: atom_label
1695 REAL(kind=
dp),
DIMENSION(:),
POINTER :: eps, sigma
1696 TYPE(particle_type),
DIMENSION(:),
POINTER :: particle_set
1697 INTEGER,
INTENT(IN) :: ntypes
1698 INTEGER,
INTENT(INOUT) :: nsize
1699 INTEGER,
DIMENSION(:),
INTENT(IN) :: iac, ico
1700 REAL(kind=
dp),
DIMENSION(:),
INTENT(IN) :: cn1, cn2
1701 INTEGER,
INTENT(IN) :: natom
1703 CHARACTER(len=*),
PARAMETER :: routinen =
'post_process_LJ_info'
1705 CHARACTER(LEN=default_string_length) :: name_atm_a
1706 CHARACTER(LEN=default_string_length), &
1707 ALLOCATABLE,
DIMENSION(:) :: work_label
1708 INTEGER :: handle, i
1709 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: iwork
1710 LOGICAL :: check, l_dum
1711 REAL(kind=
dp) :: f12, f6, my_eps, my_sigma, sigma6
1713 CALL timeset(routinen, handle)
1714 ALLOCATE (work_label(natom))
1715 ALLOCATE (iwork(natom))
1717 name_atm_a = particle_set(i)%atomic_kind%name
1719 work_label(i) = name_atm_a
1721 CALL sort(work_label, natom, iwork)
1724 IF (nsize >
SIZE(atom_label))
THEN
1725 CALL reallocate(atom_label, 1, int(buffer_size + nsize*1.5_dp))
1726 CALL reallocate(eps, 1, int(buffer_size + nsize*1.5_dp))
1727 CALL reallocate(sigma, 1, int(buffer_size + nsize*1.5_dp))
1729 f12 = cn1(ico(ntypes*(iac(iwork(1)) - 1) + iac(iwork(1))))
1730 f6 = cn2(ico(ntypes*(iac(iwork(1)) - 1) + iac(iwork(1))))
1731 check = (f6 == 0.0_dp) .EQV. (f12 == 0.0_dp)
1735 IF (f6 /= 0.0_dp)
THEN
1736 sigma6 = (2.0_dp*f12/f6)
1737 my_sigma = sigma6**(1.0_dp/6.0_dp)
1738 my_eps = f6/(2.0_dp*sigma6)
1740 atom_label(nsize) = work_label(1)
1741 sigma(nsize) = my_sigma/2.0_dp
1745 IF (work_label(i) /= atom_label(nsize))
THEN
1748 IF (nsize >
SIZE(atom_label))
THEN
1749 CALL reallocate(atom_label, 1, int(buffer_size + nsize*1.5_dp))
1750 CALL reallocate(eps, 1, int(buffer_size + nsize*1.5_dp))
1751 CALL reallocate(sigma, 1, int(buffer_size + nsize*1.5_dp))
1753 f12 = cn1(ico(ntypes*(iac(iwork(i)) - 1) + iac(iwork(i))))
1754 f6 = cn2(ico(ntypes*(iac(iwork(i)) - 1) + iac(iwork(i))))
1755 check = (f6 == 0.0_dp) .EQV. (f12 == 0.0_dp)
1759 IF (f6 /= 0.0_dp)
THEN
1760 sigma6 = (2.0_dp*f12/f6)
1761 my_sigma = sigma6**(1.0_dp/6.0_dp)
1762 my_eps = f6/(2.0_dp*sigma6)
1764 atom_label(nsize) = work_label(i)
1765 sigma(nsize) = my_sigma/2.0_dp
1770 DEALLOCATE (work_label)
1772 CALL timestop(handle)
1773 END SUBROUTINE post_process_lj_info
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,...
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.
real(kind=dp) function, public cp_unit_to_cp2k(value, unit_str, defaults, power)
converts to the internal cp2k units to the given unit
Define all structures types related to force_fields.
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.
Define the data structure for the particle information.
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
Handles all functions used to read and interpret AMBER coordinates and topology files.
subroutine, public rdparm_amber_8(filename, output_unit, para_env, do_connectivity, do_forcefield, atom_info, conn_info, amb_info, particle_set)
Access information form the AMBER topology file Notes on file structure:
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 ....
Collection of subroutine needed for topology related things.
subroutine, public topology_generate_molname(conn_info, natom, natom_prev, nbond_prev, id_molname)
Generates molnames: useful when the connectivity on file does not provide them.
Control for reading in different topologies and coordinates.
All kind of helpful little routines.