41 molecule_kind_list_type
47 global_constraint_type,&
56 #include "../base/base_uses.f90"
61 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'cp_subsys_types'
62 LOGICAL,
PRIVATE,
PARAMETER :: debug_this_module = .false.
64 PUBLIC :: cp_subsys_type, &
90 INTEGER :: ref_count = 1
91 REAL(KIND=
dp),
DIMENSION(3, 2) :: seed = -1
92 TYPE(atomic_kind_list_type),
POINTER :: atomic_kinds => null()
93 TYPE(particle_list_type),
POINTER :: particles => null()
94 TYPE(particle_list_type),
POINTER :: shell_particles => null()
95 TYPE(particle_list_type),
POINTER :: core_particles => null()
96 TYPE(distribution_1d_type),
POINTER :: local_particles => null()
97 TYPE(mp_para_env_type),
POINTER :: para_env => null()
99 TYPE(molecule_list_type),
POINTER :: molecules => null()
100 TYPE(molecule_kind_list_type),
POINTER :: molecule_kinds => null()
101 TYPE(distribution_1d_type),
POINTER :: local_molecules => null()
103 TYPE(colvar_p_type),
DIMENSION(:),
POINTER :: colvar_p => null()
105 TYPE(global_constraint_type),
POINTER :: gci => null()
107 TYPE(multipole_type),
POINTER :: multipoles => null()
108 TYPE(atprop_type),
POINTER :: atprop => null()
109 TYPE(virial_type),
POINTER :: virial => null()
110 TYPE(cp_result_type),
POINTER :: results => null()
111 TYPE(cell_type),
POINTER :: cell => null()
112 END TYPE cp_subsys_type
122 TYPE cp_subsys_p_type
123 TYPE(cp_subsys_type),
POINTER :: subsys => null()
124 END TYPE cp_subsys_p_type
136 TYPE(cp_subsys_type),
INTENT(INOUT) :: subsys
138 cpassert(subsys%ref_count > 0)
139 subsys%ref_count = subsys%ref_count + 1
150 TYPE(cp_subsys_type),
POINTER :: subsys
152 IF (
ASSOCIATED(subsys))
THEN
153 cpassert(subsys%ref_count > 0)
154 subsys%ref_count = subsys%ref_count - 1
155 IF (subsys%ref_count == 0)
THEN
165 IF (
ASSOCIATED(subsys%multipoles))
THEN
167 DEALLOCATE (subsys%multipoles)
172 IF (
ASSOCIATED(subsys%virial))
DEALLOCATE (subsys%virial)
202 SUBROUTINE cp_subsys_set(subsys, atomic_kinds, particles, local_particles, &
203 molecules, molecule_kinds, local_molecules, para_env, &
204 colvar_p, shell_particles, core_particles, gci, multipoles, results, cell)
205 TYPE(cp_subsys_type),
INTENT(INOUT) :: subsys
206 TYPE(atomic_kind_list_type),
OPTIONAL,
POINTER :: atomic_kinds
207 TYPE(particle_list_type),
OPTIONAL,
POINTER :: particles
208 TYPE(distribution_1d_type),
OPTIONAL,
POINTER :: local_particles
209 TYPE(molecule_list_type),
OPTIONAL,
POINTER :: molecules
210 TYPE(molecule_kind_list_type),
OPTIONAL,
POINTER :: molecule_kinds
211 TYPE(distribution_1d_type),
OPTIONAL,
POINTER :: local_molecules
212 TYPE(mp_para_env_type),
OPTIONAL,
POINTER :: para_env
213 TYPE(colvar_p_type),
DIMENSION(:),
OPTIONAL, &
215 TYPE(particle_list_type),
OPTIONAL,
POINTER :: shell_particles, core_particles
216 TYPE(global_constraint_type),
OPTIONAL,
POINTER :: gci
217 TYPE(multipole_type),
OPTIONAL,
POINTER :: multipoles
218 TYPE(cp_result_type),
OPTIONAL,
POINTER :: results
219 TYPE(cell_type),
OPTIONAL,
POINTER :: cell
221 cpassert(subsys%ref_count > 0)
222 IF (
PRESENT(multipoles))
THEN
223 IF (
ASSOCIATED(subsys%multipoles))
THEN
224 IF (.NOT.
ASSOCIATED(subsys%multipoles, multipoles))
THEN
226 DEALLOCATE (subsys%multipoles)
229 subsys%multipoles => multipoles
231 IF (
PRESENT(atomic_kinds))
THEN
234 subsys%atomic_kinds => atomic_kinds
236 IF (
PRESENT(particles))
THEN
239 subsys%particles => particles
241 IF (
PRESENT(local_particles))
THEN
244 subsys%local_particles => local_particles
246 IF (
PRESENT(local_molecules))
THEN
249 subsys%local_molecules => local_molecules
251 IF (
PRESENT(molecule_kinds))
THEN
254 subsys%molecule_kinds => molecule_kinds
256 IF (
PRESENT(molecules))
THEN
259 subsys%molecules => molecules
261 IF (
PRESENT(para_env))
THEN
262 CALL para_env%retain()
264 subsys%para_env => para_env
266 IF (
PRESENT(colvar_p))
THEN
267 cpassert(.NOT.
ASSOCIATED(subsys%colvar_p))
268 subsys%colvar_p => colvar_p
270 IF (
PRESENT(shell_particles))
THEN
271 IF (
ASSOCIATED(shell_particles))
THEN
274 subsys%shell_particles => shell_particles
277 IF (
PRESENT(core_particles))
THEN
278 IF (
ASSOCIATED(core_particles))
THEN
281 subsys%core_particles => core_particles
284 IF (
PRESENT(gci))
THEN
285 cpassert(.NOT.
ASSOCIATED(subsys%gci))
288 IF (
PRESENT(results))
THEN
289 IF (
ASSOCIATED(results))
THEN
292 subsys%results => results
295 IF (
PRESENT(cell))
THEN
296 IF (
ASSOCIATED(cell))
THEN
338 SUBROUTINE cp_subsys_get(subsys, ref_count, atomic_kinds, atomic_kind_set, &
339 particles, particle_set, &
340 local_particles, molecules, molecule_set, molecule_kinds, &
341 molecule_kind_set, local_molecules, para_env, colvar_p, &
342 shell_particles, core_particles, gci, multipoles, &
343 natom, nparticle, ncore, nshell, nkind, atprop, virial, &
345 TYPE(cp_subsys_type),
INTENT(IN) :: subsys
346 INTEGER,
INTENT(out),
OPTIONAL :: ref_count
347 TYPE(atomic_kind_list_type),
OPTIONAL,
POINTER :: atomic_kinds
348 TYPE(atomic_kind_type),
DIMENSION(:),
OPTIONAL, &
349 POINTER :: atomic_kind_set
350 TYPE(particle_list_type),
OPTIONAL,
POINTER :: particles
351 TYPE(particle_type),
DIMENSION(:),
OPTIONAL, &
352 POINTER :: particle_set
353 TYPE(distribution_1d_type),
OPTIONAL,
POINTER :: local_particles
354 TYPE(molecule_list_type),
OPTIONAL,
POINTER :: molecules
355 TYPE(molecule_type),
DIMENSION(:),
OPTIONAL, &
356 POINTER :: molecule_set
357 TYPE(molecule_kind_list_type),
OPTIONAL,
POINTER :: molecule_kinds
358 TYPE(molecule_kind_type),
DIMENSION(:),
OPTIONAL, &
359 POINTER :: molecule_kind_set
360 TYPE(distribution_1d_type),
OPTIONAL,
POINTER :: local_molecules
361 TYPE(mp_para_env_type),
OPTIONAL,
POINTER :: para_env
362 TYPE(colvar_p_type),
DIMENSION(:),
OPTIONAL, &
364 TYPE(particle_list_type),
OPTIONAL,
POINTER :: shell_particles, core_particles
365 TYPE(global_constraint_type),
OPTIONAL,
POINTER :: gci
366 TYPE(multipole_type),
OPTIONAL,
POINTER :: multipoles
367 INTEGER,
INTENT(out),
OPTIONAL :: natom, nparticle, ncore, nshell, nkind
368 TYPE(atprop_type),
OPTIONAL,
POINTER :: atprop
369 TYPE(virial_type),
OPTIONAL,
POINTER :: virial
370 TYPE(cp_result_type),
OPTIONAL,
POINTER :: results
371 TYPE(cell_type),
OPTIONAL,
POINTER :: cell
373 INTEGER :: n_atom, n_core, n_shell
379 cpassert(subsys%ref_count > 0)
381 IF (
PRESENT(ref_count)) ref_count = subsys%ref_count
382 IF (
PRESENT(atomic_kinds)) atomic_kinds => subsys%atomic_kinds
383 IF (
PRESENT(atomic_kind_set)) atomic_kind_set => subsys%atomic_kinds%els
384 IF (
PRESENT(particles)) particles => subsys%particles
385 IF (
PRESENT(particle_set)) particle_set => subsys%particles%els
386 IF (
PRESENT(local_particles)) local_particles => subsys%local_particles
387 IF (
PRESENT(molecules)) molecules => subsys%molecules
388 IF (
PRESENT(molecule_set)) molecule_set => subsys%molecules%els
389 IF (
PRESENT(molecule_kinds)) molecule_kinds => subsys%molecule_kinds
390 IF (
PRESENT(molecule_kind_set)) molecule_kind_set => subsys%molecule_kinds%els
391 IF (
PRESENT(local_molecules)) local_molecules => subsys%local_molecules
392 IF (
PRESENT(para_env)) para_env => subsys%para_env
393 IF (
PRESENT(colvar_p)) colvar_p => subsys%colvar_p
394 IF (
PRESENT(shell_particles)) shell_particles => subsys%shell_particles
395 IF (
PRESENT(core_particles)) core_particles => subsys%core_particles
396 IF (
PRESENT(gci)) gci => subsys%gci
397 IF (
PRESENT(multipoles)) multipoles => subsys%multipoles
398 IF (
PRESENT(virial)) virial => subsys%virial
399 IF (
PRESENT(atprop)) atprop => subsys%atprop
400 IF (
PRESENT(results)) results => subsys%results
401 IF (
PRESENT(cell)) cell => subsys%cell
402 IF (
PRESENT(nkind)) nkind =
SIZE(subsys%atomic_kinds%els)
404 IF (
PRESENT(natom) .OR.
PRESENT(nparticle) .OR.
PRESENT(nshell))
THEN
406 cpassert(
ASSOCIATED(subsys%particles))
407 n_atom = subsys%particles%n_els
409 IF (
ASSOCIATED(subsys%shell_particles))
THEN
410 n_shell = subsys%shell_particles%n_els
411 cpassert(
ASSOCIATED(subsys%core_particles))
412 n_core = subsys%core_particles%n_els
414 cpassert(n_core == n_shell)
415 ELSE IF (
ASSOCIATED(subsys%core_particles))
THEN
417 cpassert(
ASSOCIATED(subsys%shell_particles))
422 IF (
PRESENT(natom)) natom = n_atom
423 IF (
PRESENT(nparticle)) nparticle = n_atom + n_shell
424 IF (
PRESENT(ncore)) ncore = n_core
425 IF (
PRESENT(nshell)) nshell = n_shell
446 TYPE(cp_subsys_type),
INTENT(IN) :: subsys
447 REAL(kind=
dp),
DIMENSION(:),
INTENT(OUT),
OPTIONAL :: f, r, s, v
448 REAL(kind=
dp),
INTENT(IN),
OPTIONAL :: fscale
449 TYPE(cell_type),
OPTIONAL,
POINTER :: cell
451 INTEGER :: i, iatom, j, k, natom, nparticle, nsize, &
453 REAL(kind=
dp),
DIMENSION(3) :: rs
454 TYPE(particle_list_type),
POINTER :: core_particles, particles, &
458 cpassert(
PRESENT(cell))
459 cpassert(
ASSOCIATED(cell))
462 NULLIFY (core_particles)
464 NULLIFY (shell_particles)
467 core_particles=core_particles, &
469 nparticle=nparticle, &
470 particles=particles, &
471 shell_particles=shell_particles)
478 cpassert((
SIZE(f) >= nsize))
481 shell_index = particles%els(iatom)%shell_index
482 IF (shell_index == 0)
THEN
485 f(j) = particles%els(iatom)%f(i)
490 f(j) = core_particles%els(shell_index)%f(i)
492 k = 3*(natom + shell_index - 1)
494 f(k + i) = shell_particles%els(shell_index)%f(i)
498 IF (
PRESENT(fscale)) f(1:nsize) = fscale*f(1:nsize)
504 cpassert((
SIZE(r) >= nsize))
507 shell_index = particles%els(iatom)%shell_index
508 IF (shell_index == 0)
THEN
511 r(j) = particles%els(iatom)%r(i)
516 r(j) = core_particles%els(shell_index)%r(i)
518 k = 3*(natom + shell_index - 1)
520 r(k + i) = shell_particles%els(shell_index)%r(i)
529 cpassert((
SIZE(s) >= nsize))
532 shell_index = particles%els(iatom)%shell_index
533 IF (shell_index == 0)
THEN
546 k = 3*(natom + shell_index - 1)
557 cpassert((
SIZE(v) >= nsize))
560 shell_index = particles%els(iatom)%shell_index
561 IF (shell_index == 0)
THEN
564 v(j) = particles%els(iatom)%v(i)
569 v(j) = core_particles%els(shell_index)%v(i)
571 k = 3*(natom + shell_index - 1)
573 v(k + i) = shell_particles%els(shell_index)%v(i)
596 TYPE(cp_subsys_type),
INTENT(IN) :: subsys
597 REAL(kind=
dp),
DIMENSION(:),
INTENT(IN),
OPTIONAL :: f, r, s, v
598 REAL(kind=
dp),
INTENT(IN),
OPTIONAL :: fscale
599 TYPE(cell_type),
OPTIONAL,
POINTER :: cell
601 INTEGER :: i, iatom, j, k, natom, nparticle, nsize, &
603 REAL(kind=
dp) :: fc, fs, mass, my_fscale
604 REAL(kind=
dp),
DIMENSION(3) :: rs
605 TYPE(particle_list_type),
POINTER :: core_particles, particles, &
608 NULLIFY (core_particles)
610 NULLIFY (shell_particles)
613 core_particles=core_particles, &
615 nparticle=nparticle, &
616 particles=particles, &
617 shell_particles=shell_particles)
624 cpassert((
SIZE(f) >= nsize))
625 IF (
PRESENT(fscale))
THEN
632 shell_index = particles%els(iatom)%shell_index
633 IF (shell_index == 0)
THEN
636 particles%els(iatom)%f(i) = my_fscale*f(j)
641 core_particles%els(shell_index)%f(i) = my_fscale*f(j)
643 k = 3*(natom + shell_index - 1)
645 shell_particles%els(shell_index)%f(i) = my_fscale*f(k + i)
654 cpassert((
SIZE(r) >= nsize))
657 shell_index = particles%els(iatom)%shell_index
658 IF (shell_index == 0)
THEN
661 particles%els(iatom)%r(i) = r(j)
666 core_particles%els(shell_index)%r(i) = r(j)
668 k = 3*(natom + shell_index - 1)
670 shell_particles%els(shell_index)%r(i) = r(k + i)
673 mass = particles%els(iatom)%atomic_kind%mass
674 fc = core_particles%els(shell_index)%atomic_kind%shell%mass_core/mass
675 fs = shell_particles%els(shell_index)%atomic_kind%shell%mass_shell/mass
676 particles%els(iatom)%r(1:3) = fc*core_particles%els(shell_index)%r(1:3) + &
677 fs*shell_particles%els(shell_index)%r(1:3)
685 cpassert((
SIZE(s) >= nsize))
686 cpassert(
PRESENT(cell))
687 cpassert(
ASSOCIATED(cell))
690 shell_index = particles%els(iatom)%shell_index
691 IF (shell_index == 0)
THEN
703 k = 3*(natom + shell_index - 1)
709 mass = particles%els(iatom)%atomic_kind%mass
710 fc = core_particles%els(shell_index)%atomic_kind%shell%mass_core/mass
711 fs = shell_particles%els(shell_index)%atomic_kind%shell%mass_shell/mass
712 particles%els(iatom)%r(1:3) = fc*core_particles%els(shell_index)%r(1:3) + &
713 fs*shell_particles%els(shell_index)%r(1:3)
721 cpassert((
SIZE(v) >= nsize))
724 shell_index = particles%els(iatom)%shell_index
725 IF (shell_index == 0)
THEN
728 particles%els(iatom)%v(i) = v(j)
733 core_particles%els(shell_index)%v(i) = v(j)
735 k = 3*(natom + shell_index - 1)
737 shell_particles%els(shell_index)%v(i) = v(k + i)
740 mass = particles%els(iatom)%atomic_kind%mass
741 fc = core_particles%els(shell_index)%atomic_kind%shell%mass_core/mass
742 fs = shell_particles%els(shell_index)%atomic_kind%shell%mass_shell/mass
743 particles%els(iatom)%v(1:3) = fc*core_particles%els(shell_index)%v(1:3) + &
744 fs*shell_particles%els(shell_index)%v(1:3)
represent a simple array based list of the given type
subroutine, public atomic_kind_list_release(list)
releases a list (see doc/ReferenceCounting.html)
subroutine, public atomic_kind_list_retain(list)
retains a list (see doc/ReferenceCounting.html)
Define the atomic kind types and their sub types.
Holds information on atomic properties.
subroutine, public atprop_release(atprop_env)
releases the atprop
Handles all functions related to the CELL.
subroutine, public scaled_to_real(r, s, cell)
Transform scaled cell coordinates real coordinates. r=h*s.
subroutine, public real_to_scaled(s, r, cell)
Transform real to scaled cell coordinates. s=h_inv*r.
subroutine, public cell_release(cell)
releases the given cell (see doc/ReferenceCounting.html)
subroutine, public cell_retain(cell)
retains the given cell (see doc/ReferenceCounting.html)
Initialize the collective variables types.
subroutine, public colvar_p_release(colvar_p)
Deallocate a set of colvar_p_type.
set of type/routines to handle the storage of results in force_envs
subroutine, public cp_result_retain(results)
Retains cp_result type.
subroutine, public cp_result_release(results)
Releases cp_result type.
types that represent a subsys, i.e. a part of the system
subroutine, public cp_subsys_release(subsys)
releases a subsys (see doc/ReferenceCounting.html)
subroutine, public unpack_subsys_particles(subsys, f, r, s, v, fscale, cell)
Unpack components of a subsystem particle sets into a single vector.
subroutine, public cp_subsys_retain(subsys)
retains a subsys (see doc/ReferenceCounting.html)
subroutine, public cp_subsys_set(subsys, atomic_kinds, particles, local_particles, molecules, molecule_kinds, local_molecules, para_env, colvar_p, shell_particles, core_particles, gci, multipoles, results, cell)
sets various propreties of the subsys
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)
returns information about various attributes of the given subsys
subroutine, public pack_subsys_particles(subsys, f, r, s, v, fscale, cell)
Pack components of a subsystem particle sets into a single vector.
stores a lists of integer that are local to a processor. The idea is that these integers represent ob...
subroutine, public distribution_1d_retain(distribution_1d)
retains a distribution_1d
subroutine, public distribution_1d_release(distribution_1d)
releases the given distribution_1d
Defines the basic variable types.
integer, parameter, public dp
Interface to the message passing library MPI.
subroutine, public mp_para_env_release(para_env)
releases the para object (to be called when you don't want anymore the shared copy of this object)
represent a simple array based list of the given type
subroutine, public molecule_kind_list_release(list)
releases a list (see doc/ReferenceCounting.html)
subroutine, public molecule_kind_list_retain(list)
retains a list (see doc/ReferenceCounting.html)
Define the molecule kind structure types and the corresponding functionality.
represent a simple array based list of the given type
subroutine, public molecule_list_retain(list)
retains a list (see doc/ReferenceCounting.html)
subroutine, public molecule_list_release(list)
releases a list (see doc/ReferenceCounting.html)
Define the data structure for the molecule information.
subroutine, public deallocate_global_constraint(gci)
Deallocate a global constraint.
Multipole structure: for multipole (fixed and induced) in FF based MD.
subroutine, public release_multipole_type(multipoles)
...
represent a simple array based list of the given type
subroutine, public particle_list_retain(list)
retains a list (see doc/ReferenceCounting.html)
subroutine, public particle_list_release(list)
releases a list (see doc/ReferenceCounting.html)
Define the data structure for the particle information.