44#include "../base/base_uses.f90"
49 LOGICAL,
PRIVATE,
PARAMETER :: debug_this_module = .true.
50 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'dimer_types'
66 TYPE dimer_rotational_type
68 INTEGER :: rotation_step = 0
69 LOGICAL :: interpolate_gradient = .false.
70 REAL(KIND=
dp) :: angle_tol = 0.0_dp, angle1 = 0.0_dp, angle2 = 0.0_dp, &
71 dcdp = 0.0_dp, curvature = 0.0_dp
72 REAL(KIND=
dp),
POINTER,
DIMENSION(:) :: g0 => null(), g1 => null(), g1p => null()
73 END TYPE dimer_rotational_type
81 TYPE dimer_translational_type
83 REAL(KIND=
dp),
POINTER,
DIMENSION(:) :: tls_vec => null()
84 END TYPE dimer_translational_type
92 TYPE dimer_cg_rot_type
93 REAL(KIND=
dp) :: norm_theta = 0.0_dp, norm_theta_old = 0.0_dp, norm_h = 0.0_dp
94 REAL(KIND=
dp),
POINTER,
DIMENSION(:) :: nvec_old => null()
95 END TYPE dimer_cg_rot_type
104 INTEGER :: ref_count = 0
105 REAL(kind=
dp) :: dr = 0.0_dp
106 REAL(kind=
dp),
POINTER,
DIMENSION(:) :: nvec => null()
107 REAL(kind=
dp) :: beta = 0.0_dp
108 TYPE(dimer_rotational_type) :: rot = dimer_rotational_type()
109 TYPE(dimer_translational_type) :: tsl = dimer_translational_type()
110 TYPE(dimer_cg_rot_type) :: cg_rot = dimer_cg_rot_type()
111 LOGICAL :: kdimer = .false.
135 INTEGER :: i, j, k, natom, unit_nr
136 REAL(kind=
dp) :: norm, xval(3)
141 cpassert(.NOT.
ASSOCIATED(dimer_env))
143 dimer_env%ref_count = 1
148 ALLOCATE (dimer_env%rot%g0(natom*3))
149 ALLOCATE (dimer_env%rot%g1(natom*3))
150 ALLOCATE (dimer_env%rot%g1p(natom*3))
153 unit_nr, globenv, force_env)
154 IF (unit_nr > 0)
THEN
155 WRITE (unit_nr,
"(/,T2,A,T9,A,T71,I10)") &
156 "DIMER|",
"Dimension of dimer vector (natom * 3)", natom*3
158 WRITE (unit_nr,
"(T2,A,T9,3(F12.6,3X))") &
159 "DIMER|", dimer_env%nvec(3*j - 2:3*j)
164 xval(:) = dimer_env%nvec(3*i - 2:3*i)
166 dimer_env%nvec(3*i - 2:3*i) = xval(:)
174 xval(k) = xval(k) + dimer_env%nvec(i)
177 IF (unit_nr > 0)
THEN
178 WRITE (unit_nr,
"(/,T2,A,T9,A)") &
179 "DIMER|",
"Overall translation to be removed from the initial dimer vector"
180 WRITE (unit_nr,
"(T2,A,T9,3(F12.6,3X))") &
184 xval = xval/real(natom*3, kind=
dp)
188 dimer_env%nvec(i) = dimer_env%nvec(i) - xval(k)
195 norm = sqrt(sum(dimer_env%nvec**2))
196 IF (norm <= epsilon(0.0_dp))
THEN
197 cpabort(
"The norm of the dimer vector is 0! Calculation cannot proceed further.")
199 IF (unit_nr > 0)
THEN
200 WRITE (unit_nr,
"(T2,A,T9,A,T69,F12.6)") &
201 "DIMER|",
"Norm of dimer vector to be normalized by rescaling", norm
203 dimer_env%nvec = dimer_env%nvec/norm
207 l_val=dimer_env%rot%interpolate_gradient)
209 r_val=dimer_env%rot%angle_tol)
211 l_val=dimer_env%kdimer)
213 r_val=dimer_env%beta)
215 dimer_env%cg_rot%norm_h = 1.0_dp
216 dimer_env%rot%g0 = 0.0_dp
217 dimer_env%rot%g1 = 0.0_dp
218 dimer_env%rot%g1p = 0.0_dp
219 ALLOCATE (dimer_env%cg_rot%nvec_old(natom*3))
232 cpassert(
ASSOCIATED(dimer_env))
233 cpassert(dimer_env%ref_count > 0)
234 dimer_env%ref_count = dimer_env%ref_count + 1
247 IF (
ASSOCIATED(dimer_env))
THEN
248 cpassert(dimer_env%ref_count > 0)
249 dimer_env%ref_count = dimer_env%ref_count - 1
250 IF (dimer_env%ref_count == 0)
THEN
251 IF (
ASSOCIATED(dimer_env%nvec))
THEN
252 DEALLOCATE (dimer_env%nvec)
254 IF (
ASSOCIATED(dimer_env%rot%g0))
THEN
255 DEALLOCATE (dimer_env%rot%g0)
257 IF (
ASSOCIATED(dimer_env%rot%g1))
THEN
258 DEALLOCATE (dimer_env%rot%g1)
260 IF (
ASSOCIATED(dimer_env%rot%g1p))
THEN
261 DEALLOCATE (dimer_env%rot%g1p)
263 IF (
ASSOCIATED(dimer_env%cg_rot%nvec_old))
THEN
264 DEALLOCATE (dimer_env%cg_rot%nvec_old)
267 NULLIFY (dimer_env%tsl%tls_vec)
268 DEALLOCATE (dimer_env)
286 REAL(kind=
dp),
DIMENSION(:),
INTENT(INOUT) :: vec
288 INTEGER,
INTENT(IN),
OPTIONAL :: unit
290 INTEGER :: ii, ikind, ind, iparticle, nfixed_atoms, &
297 NULLIFY (molecule_kinds, molecule_kind, fixd_list)
301 molecule_kinds=molecule_kinds)
302 molecule_kind_set => molecule_kinds%els
306 nkinds = molecule_kinds%n_els
308 molecule_kind => molecule_kind_set(ikind)
310 nfixd=nfixed_atoms, &
312 IF (
ASSOCIATED(fixd_list))
THEN
313 IF (
PRESENT(unit))
THEN
315 WRITE (unit,
"(/,T2,A,T9,A,T71,I10)") &
316 "DIMER|",
"Number of fixed atoms to adjust dimer vector", nfixed_atoms
319 DO ii = 1, nfixed_atoms
320 IF (.NOT. fixd_list(ii)%restraint%active)
THEN
321 iparticle = fixd_list(ii)%fixd
322 ind = (iparticle - 1)*3
324 SELECT CASE (fixd_list(ii)%itype)
326 vec(ind + 1) = 0.0_dp
328 vec(ind + 2) = 0.0_dp
330 vec(ind + 3) = 0.0_dp
332 vec(ind + 1) = 0.0_dp
333 vec(ind + 2) = 0.0_dp
335 vec(ind + 1) = 0.0_dp
336 vec(ind + 3) = 0.0_dp
338 vec(ind + 2) = 0.0_dp
339 vec(ind + 3) = 0.0_dp
341 vec(ind + 1) = 0.0_dp
342 vec(ind + 2) = 0.0_dp
343 vec(ind + 3) = 0.0_dp
366 INTEGER,
INTENT(IN) :: natom, unit
370 CHARACTER(LEN=17) :: vib_name
371 CHARACTER(LEN=default_path_length) :: molden_name
372 INTEGER :: dimer_init_method, i, ierr, isize, j, &
373 n_rep_val, nvec_size, vib_list_size
374 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: vib_id_list
375 LOGICAL :: explicit, found
376 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: array_r, vib_wt_list
377 REAL(kind=
dp),
DIMENSION(:),
POINTER :: array
382 para_env => force_env%para_env
387 ALLOCATE (dimer_env%nvec(nvec_size))
388 dimer_env%nvec(:) = 0.0_dp
391 IF (unit > 0)
WRITE (unit,
"(/,T2,A,T9,A)") &
392 "DIMER|",
"Initial dimer vector read from input DIMER_VECTOR section"
397 DO j = 1,
SIZE(array)
399 IF (isize <= nvec_size)
THEN
400 dimer_env%nvec(isize) = array(j)
402 cpabort(
"Size of input DIMER_VECTOR more than natom * 3")
406 IF (isize /= nvec_size)
THEN
407 cpabort(
"Size of input DIMER_VECTOR inconsistent with natom * 3")
411 SELECT CASE (dimer_init_method)
413 IF (unit > 0)
WRITE (unit,
"(/,T2,A,T9,A)") &
414 "DIMER|",
"Initial dimer vector generated randomly"
415 CALL globenv%gaussian_rng_stream%fill(dimer_env%nvec)
418 IF (.NOT. explicit)
THEN
419 cpabort(
"INITIALIZATION_METHOD MOLDEN requires VIB_MOLDEN_NAME")
423 WRITE (unit,
"(/,T2,A,T9,A)") &
424 "DIMER|",
"Initial dimer vector by linear combination of normal modes from:"
425 WRITE (unit,
"(T2,A,T9,A)") &
426 "DIMER|", trim(adjustl(molden_name))
432 ALLOCATE (array_r(nvec_size))
433 CALL parser_create(parser, molden_name, para_env=para_env, apply_preprocessing=.false.)
434 vib_modes:
DO i = 1, vib_list_size
436 WRITE (unit=vib_name, fmt=
'(T2,A,1X,I6)')
"vibration", vib_id_list(i)
438 ignore_case=.false., found=found, &
439 begin_line=.true., search_from_begin_of_file=.true.)
440 IF (.NOT. found)
CALL cp_abort(__location__, &
441 "Could not found <"//vib_name//
"> from molden file")
444 READ (unit=parser%input_line, fmt=*, iostat=ierr) &
445 array_r(3*j - 2), array_r(3*j - 1), array_r(3*j)
447 CALL cp_abort(__location__, &
448 "Error while reading MOLDEN file: cannot parse the line "// &
449 trim(adjustl(
cp_to_string(j)))//
" of <"//vib_name//
"> "// &
450 "for components of the normal mode")
453 dimer_env%nvec(:) = dimer_env%nvec(:) + array_r(:)*vib_wt_list(i)
456 IF (
ALLOCATED(array_r))
DEALLOCATE (array_r)
457 IF (
ALLOCATED(vib_id_list))
DEALLOCATE (vib_id_list)
458 IF (
ALLOCATED(vib_wt_list))
DEALLOCATE (vib_wt_list)
460 cpabort(
"Invalid or not yet implemented dimer initialization method")
479 INTEGER,
ALLOCATABLE,
DIMENSION(:),
INTENT(OUT) :: vib_id_list
480 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:), &
481 INTENT(OUT) :: vib_wt_list
482 INTEGER,
INTENT(OUT) :: vib_list_size
483 INTEGER,
INTENT(IN) :: unit
485 INTEGER :: i, isize, n_rep_val, vib_id_size, &
487 INTEGER,
DIMENSION(:),
POINTER :: tmpilist
488 REAL(kind=
dp),
DIMENSION(:),
POINTER :: tmprlist
494 i_vals=tmpilist, i_rep_val=i)
495 vib_id_size = vib_id_size +
SIZE(tmpilist)
497 ALLOCATE (vib_id_list(vib_id_size))
501 i_vals=tmpilist, i_rep_val=i)
502 vib_id_list(isize + 1:isize +
SIZE(tmpilist)) = tmpilist
503 isize = isize +
SIZE(tmpilist)
510 r_vals=tmprlist, i_rep_val=i)
511 vib_wt_size = vib_wt_size +
SIZE(tmprlist)
513 ALLOCATE (vib_wt_list(vib_wt_size))
517 r_vals=tmprlist, i_rep_val=i)
518 vib_wt_list(isize + 1:isize +
SIZE(tmprlist)) = tmprlist
519 isize = isize +
SIZE(tmprlist)
522 IF (vib_id_size /= vib_wt_size)
THEN
523 CALL cp_abort(__location__, &
524 "Inconsistent count of values speficied in input between "// &
525 "VIB_INDEX ("//trim(adjustl(
cp_to_string(vib_id_size)))//
") "// &
526 "and VIB_WEIGHT ("//trim(adjustl(
cp_to_string(vib_wt_size)))//
")")
528 vib_list_size = vib_id_size
531 WRITE (unit,
"(/,T2,A,T9,A)") &
532 "DIMER|",
"Indices and weights of vibrational modes in linear combination"
533 DO i = 1, vib_list_size
534 WRITE (unit,
"(T2,A,T10,I6,T18,F12.6)") &
535 "DIMER|", vib_id_list(i), vib_wt_list(i)
Handles all functions related to the CELL.
integer, parameter, public use_perd_xyz
integer, parameter, public use_perd_y
integer, parameter, public use_perd_xz
integer, parameter, public use_perd_x
integer, parameter, public use_perd_z
integer, parameter, public use_perd_yz
integer, parameter, public use_perd_xy
subroutine, public cell_transform_input_cartesian(cell, vector)
Transform a Cartesian real-space vector from the user input cell frame into CP2K's canonical internal...
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...
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 ...
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.
types that represent a subsys, i.e. a part of the system
subroutine, public cp_subsys_get(subsys, ref_count, atomic_kinds, atomic_kind_set, particles, particle_set, local_particles, molecules, molecule_set, molecule_kinds, molecule_kind_set, local_molecules, para_env, colvar_p, shell_particles, core_particles, gci, multipoles, natom, nparticle, ncore, nshell, nkind, atprop, virial, results, cell, cell_ref, use_ref_cell)
returns information about various attributes of the given subsys
Contains types used for a Dimer Method calculations.
subroutine, public vib_get_index_weight(dimer_section, vib_id_list, vib_wt_list, vib_list_size, unit)
Read VIB_INDEX and VIB_WEIGHT under DIMER section.
subroutine, public dimer_fixed_atom_control(vec, subsys, unit)
Set parts of a given array vec to zero according to fixed atom constraints. When atoms are (partially...
subroutine, public dimer_env_retain(dimer_env)
...
subroutine, public dimer_env_release(dimer_env)
...
subroutine, public dimer_init_vector(dimer_env, dimer_section, natom, unit, globenv, force_env)
Read dimer vector from input and store into dimer_envnvec.
subroutine, public dimer_env_create(dimer_env, subsys, globenv, dimer_section, force_env)
...
Interface for the force calculations.
Define type storing the global information of a run. Keep the amount of stored data small....
Defines the basic variable types.
integer, parameter, public dp
integer, parameter, public default_path_length
Interface to the message passing library MPI.
represent a simple array based list of the given type
Define the molecule kind structure types and the corresponding functionality.
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.
Type defining parameters related to the simulation cell.
represents a system: atoms, molecules, their pos,vel,...
Defines the environment for a Dimer Method calculation.
wrapper to abstract the force evaluation of the various methods
contains the initially parsed file and the initial parallel environment
stores all the informations relevant to an mpi environment
represent a list of objects