111 REAL(kind=
dp),
INTENT(INOUT),
OPTIONAL :: pos(:, :), vel(:, :),
for(:, :)
112 LOGICAL,
INTENT(IN),
OPTIONAL :: add
114 CHARACTER(len=*),
PARAMETER :: routinen =
'update_particle_set'
116 INTEGER :: handle, iparticle, nparticle
117 LOGICAL :: my_add, update_for, update_pos, &
120 CALL timeset(routinen, handle)
122 nparticle =
SIZE(particle_set)
123 update_pos =
PRESENT(pos)
124 update_vel =
PRESENT(vel)
125 update_for =
PRESENT(
for)
127 IF (
PRESENT(add)) my_add = add
130 CALL int_group%sum(pos)
132 DO iparticle = 1, nparticle
133 particle_set(iparticle)%r(:) = particle_set(iparticle)%r(:) + pos(:, iparticle)
136 DO iparticle = 1, nparticle
137 particle_set(iparticle)%r(:) = pos(:, iparticle)
142 CALL int_group%sum(vel)
144 DO iparticle = 1, nparticle
145 particle_set(iparticle)%v(:) = particle_set(iparticle)%v(:) + vel(:, iparticle)
148 DO iparticle = 1, nparticle
149 particle_set(iparticle)%v(:) = vel(:, iparticle)
154 CALL int_group%sum(
for)
156 DO iparticle = 1, nparticle
157 particle_set(iparticle)%f(:) = particle_set(iparticle)%f(:) +
for(:, iparticle)
160 DO iparticle = 1, nparticle
161 particle_set(iparticle)%f(:) =
for(:, iparticle)
166 CALL timestop(handle)
183 INTEGER,
INTENT(IN) :: iatom
184 TYPE(
particle_type),
DIMENSION(:),
INTENT(IN) :: particle_set
185 REAL(kind=
dp),
DIMENSION(:),
INTENT(IN) :: vector
186 REAL(kind=
dp),
DIMENSION(3) :: x
189 REAL(kind=
dp) :: fc, fs, mass
192 IF (particle_set(iatom)%shell_index == 0)
THEN
193 x(1:3) = vector(ic + 1:ic + 3)
195 is = 3*(
SIZE(particle_set) + particle_set(iatom)%shell_index - 1)
196 mass = particle_set(iatom)%atomic_kind%mass
197 fc = particle_set(iatom)%atomic_kind%shell%mass_core/mass
198 fs = particle_set(iatom)%atomic_kind%shell%mass_shell/mass
199 x(1:3) = fc*vector(ic + 1:ic + 3) + fs*vector(is + 1:is + 3)
220 INTEGER,
INTENT(IN) :: iatom
221 TYPE(
particle_type),
DIMENSION(:),
INTENT(IN) :: particle_set
222 REAL(kind=
dp),
DIMENSION(3),
INTENT(INOUT) :: x
223 REAL(kind=
dp),
DIMENSION(:),
INTENT(INOUT) :: vector
226 REAL(kind=
dp) :: fc, fs, mass
229 IF (particle_set(iatom)%shell_index == 0)
THEN
230 vector(ic + 1:ic + 3) = vector(ic + 1:ic + 3) + x(1:3)
231 x(1:3) = vector(ic + 1:ic + 3)
233 is = 3*(
SIZE(particle_set) + particle_set(iatom)%shell_index - 1)
234 mass = particle_set(iatom)%atomic_kind%mass
235 fc = particle_set(iatom)%atomic_kind%shell%mass_core/mass
236 fs = particle_set(iatom)%atomic_kind%shell%mass_shell/mass
237 vector(ic + 1:ic + 3) = vector(ic + 1:ic + 3) + x(1:3)
238 vector(is + 1:is + 3) = vector(is + 1:is + 3) + x(1:3)
239 x(1:3) = fc*vector(ic + 1:ic + 3) + fs*vector(is + 1:is + 3)
Define the data structure for the particle information.
pure subroutine, public update_particle_pos_or_vel(iatom, particle_set, x, vector)
Update the atomic position or velocity by x and return the updated atomic position or velocity in x e...
subroutine, public deallocate_particle_set(particle_set)
Deallocate a particle set.
pure real(kind=dp) function, dimension(3), public get_particle_pos_or_vel(iatom, particle_set, vector)
Return the atomic position or velocity of atom iatom in x from a packed vector even if core-shell par...
subroutine, public update_particle_set(particle_set, int_group, pos, vel, for, add)
...
subroutine, public allocate_particle_set(particle_set, nparticle)
Allocate a particle set.