23#include "./base/base_uses.f90"
28 LOGICAL,
PRIVATE,
PARAMETER :: debug_this_module = .true.
29 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'qmmm_links_methods'
49 INTEGER,
DIMENSION(:),
POINTER :: qm_atom_index
51 INTEGER :: ilink, ip, ip_mm, ip_qm, mm_index, &
53 REAL(kind=
dp) :: alpha
56 n_imomm =
SIZE(qmmm_links%imomm)
57 cpassert(n_imomm /= 0)
59 my_link => qmmm_links%imomm(ilink)%link
60 qm_index = my_link%qm_index
61 mm_index = my_link%mm_index
62 alpha = 1.0_dp/my_link%alpha
63 DO ip = 1,
SIZE(qm_atom_index)
64 IF (qm_atom_index(ip) == qm_index)
EXIT
66 IF (ip ==
SIZE(qm_atom_index) + 1)
THEN
67 CALL cp_abort(__location__, &
68 "QM atom index ("//
cp_to_string(qm_index)//
") specified in the LINK section nr.("// &
69 cp_to_string(ilink)//
") is not defined as a QM atom! Please inspect your QM_KIND sections. ")
72 DO ip = 1,
SIZE(qm_atom_index)
73 IF (qm_atom_index(ip) == mm_index)
EXIT
75 IF (ip ==
SIZE(qm_atom_index) + 1)
THEN
76 CALL cp_abort(__location__, &
77 "Error in setting up the MM atom index ("//
cp_to_string(mm_index)// &
78 ") specified in the LINK section nr.("//
cp_to_string(ilink)//
"). Please report this bug! ")
81 particles(ip_mm)%r = alpha*particles(ip_mm)%r + (1.0_dp - alpha)*particles(ip_qm)%r
98 INTEGER,
DIMENSION(:),
POINTER :: qm_atom_index
100 INTEGER :: ilink, ip, ip_mm, ip_qm, mm_index, &
102 REAL(kind=
dp) :: alpha
105 n_imomm =
SIZE(qmmm_links%imomm)
106 cpassert(n_imomm /= 0)
107 DO ilink = 1, n_imomm
108 my_link => qmmm_links%imomm(ilink)%link
109 qm_index = my_link%qm_index
110 mm_index = my_link%mm_index
111 alpha = 1.0_dp/my_link%alpha
112 DO ip = 1,
SIZE(qm_atom_index)
113 IF (qm_atom_index(ip) == qm_index)
EXIT
115 IF (ip ==
SIZE(qm_atom_index) + 1)
THEN
116 CALL cp_abort(__location__, &
117 "QM atom index ("//
cp_to_string(qm_index)//
") specified in the LINK section nr.("// &
118 cp_to_string(ilink)//
") is not defined as a QM atom! Please inspect your QM_KIND sections. ")
121 DO ip = 1,
SIZE(qm_atom_index)
122 IF (qm_atom_index(ip) == mm_index)
EXIT
124 IF (ip ==
SIZE(qm_atom_index) + 1)
THEN
125 CALL cp_abort(__location__, &
126 "Error in setting up the MM atom index ("//
cp_to_string(mm_index)// &
127 ") specified in the LINK section nr.("//
cp_to_string(ilink)//
"). Please report this bug! ")
130 particles_qm(ip_qm)%f = particles_qm(ip_qm)%f + particles_qm(ip_mm)%f*(1.0_dp - alpha)
131 particles_qm(ip_mm)%f = particles_qm(ip_mm)%f*alpha
148 INTEGER :: i, index1, index2
149 REAL(kind=
dp) :: alpha
152 added_charges => qmmm_env%added_charges
154 DO i = 1, added_charges%num_mm_atoms
155 index1 = added_charges%add_env(i)%Index1
156 index2 = added_charges%add_env(i)%Index2
157 alpha = added_charges%add_env(i)%alpha
158 added_charges%added_particles(i)%r = alpha*particles(index1)%r + (1.0_dp - alpha)*particles(index2)%r
175 INTEGER :: i, index1, index2
176 REAL(kind=
dp) :: alpha
179 added_charges => qmmm_env%added_charges
181 DO i = 1, added_charges%num_mm_atoms
182 index1 = added_charges%add_env(i)%Index1
183 index2 = added_charges%add_env(i)%Index2
184 alpha = added_charges%add_env(i)%alpha
185 particles(index1)%f = particles(index1)%f + alpha*added_charges%added_particles(i)%f
186 particles(index2)%f = particles(index2)%f + (1.0_dp - alpha)*added_charges%added_particles(i)%f
various routines to log and control the output. The idea is that decisions about where to log should ...
Defines the basic variable types.
integer, parameter, public dp
Define the data structure for the particle information.
A collection of methods to treat the QM/MM links.
subroutine, public qmmm_added_chrg_coord(qmmm_env, particles)
correct the position for added charges in qm/mm link scheme
subroutine, public qmmm_added_chrg_forces(qmmm_env, particles)
correct the forces due to the added charges in qm/mm link scheme
subroutine, public qmmm_link_imomm_coord(qmmm_links, particles, qm_atom_index)
correct the position for qm/mm IMOMM link type
subroutine, public qmmm_link_imomm_forces(qmmm_links, particles_qm, qm_atom_index)
correct the forces for qm/mm IMOMM link type