21 qmmm_imomm_link_type,&
23 #include "./base/base_uses.f90"
28 LOGICAL,
PRIVATE,
PARAMETER :: debug_this_module = .true.
29 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'qmmm_links_methods'
47 TYPE(qmmm_links_type),
POINTER :: qmmm_links
48 TYPE(particle_type),
DIMENSION(:),
POINTER :: particles
49 INTEGER,
DIMENSION(:),
POINTER :: qm_atom_index
51 INTEGER :: ilink, ip, ip_mm, ip_qm, mm_index, &
53 REAL(kind=
dp) :: alpha
54 TYPE(qmmm_imomm_link_type),
POINTER :: my_link
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) &
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. ")
71 DO ip = 1,
SIZE(qm_atom_index)
72 IF (qm_atom_index(ip) == mm_index)
EXIT
74 IF (ip ==
SIZE(qm_atom_index) + 1) &
75 CALL cp_abort(__location__, &
76 "Error in setting up the MM atom index ("//cp_to_string(mm_index)// &
77 ") specified in the LINK section nr.("//cp_to_string(ilink)//
"). Please report this bug! ")
79 particles(ip_mm)%r = alpha*particles(ip_mm)%r + (1.0_dp - alpha)*particles(ip_qm)%r
94 TYPE(qmmm_links_type),
POINTER :: qmmm_links
95 TYPE(particle_type),
DIMENSION(:),
POINTER :: particles_qm
96 INTEGER,
DIMENSION(:),
POINTER :: qm_atom_index
98 INTEGER :: ilink, ip, ip_mm, ip_qm, mm_index, &
100 REAL(kind=
dp) :: alpha
101 TYPE(qmmm_imomm_link_type),
POINTER :: my_link
103 n_imomm =
SIZE(qmmm_links%imomm)
104 cpassert(n_imomm /= 0)
105 DO ilink = 1, n_imomm
106 my_link => qmmm_links%imomm(ilink)%link
107 qm_index = my_link%qm_index
108 mm_index = my_link%mm_index
109 alpha = 1.0_dp/my_link%alpha
110 DO ip = 1,
SIZE(qm_atom_index)
111 IF (qm_atom_index(ip) == qm_index)
EXIT
113 IF (ip ==
SIZE(qm_atom_index) + 1) &
114 CALL cp_abort(__location__, &
115 "QM atom index ("//cp_to_string(qm_index)//
") specified in the LINK section nr.("// &
116 cp_to_string(ilink)//
") is not defined as a QM atom! Please inspect your QM_KIND sections. ")
118 DO ip = 1,
SIZE(qm_atom_index)
119 IF (qm_atom_index(ip) == mm_index)
EXIT
121 IF (ip ==
SIZE(qm_atom_index) + 1) &
122 CALL cp_abort(__location__, &
123 "Error in setting up the MM atom index ("//cp_to_string(mm_index)// &
124 ") specified in the LINK section nr.("//cp_to_string(ilink)//
"). Please report this bug! ")
126 particles_qm(ip_qm)%f = particles_qm(ip_qm)%f + particles_qm(ip_mm)%f*(1.0_dp - alpha)
127 particles_qm(ip_mm)%f = particles_qm(ip_mm)%f*alpha
141 TYPE(qmmm_env_qm_type),
POINTER :: qmmm_env
142 TYPE(particle_type),
DIMENSION(:),
POINTER :: particles
144 INTEGER :: i, index1, index2
145 REAL(kind=
dp) :: alpha
146 TYPE(add_set_type),
POINTER :: added_charges
148 added_charges => qmmm_env%added_charges
150 DO i = 1, added_charges%num_mm_atoms
151 index1 = added_charges%add_env(i)%Index1
152 index2 = added_charges%add_env(i)%Index2
153 alpha = added_charges%add_env(i)%alpha
154 added_charges%added_particles(i)%r = alpha*particles(index1)%r + (1.0_dp - alpha)*particles(index2)%r
168 TYPE(qmmm_env_qm_type),
POINTER :: qmmm_env
169 TYPE(particle_type),
DIMENSION(:),
POINTER :: particles
171 INTEGER :: i, index1, index2
172 REAL(kind=
dp) :: alpha
173 TYPE(add_set_type),
POINTER :: added_charges
175 added_charges => qmmm_env%added_charges
177 DO i = 1, added_charges%num_mm_atoms
178 index1 = added_charges%add_env(i)%Index1
179 index2 = added_charges%add_env(i)%Index2
180 alpha = added_charges%add_env(i)%alpha
181 particles(index1)%f = particles(index1)%f + alpha*added_charges%added_particles(i)%f
182 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