56#include "../base/base_uses.f90"
61 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'cp_subsys_types'
62 LOGICAL,
PRIVATE,
PARAMETER :: debug_this_module = .false.
90 INTEGER :: ref_count = 1
91 REAL(kind=
dp),
DIMENSION(3, 2) :: seed = -1
111 TYPE(
cell_type),
POINTER :: cell => null(), cell_ref => null()
112 LOGICAL :: use_ref_cell = .false.
139 cpassert(subsys%ref_count > 0)
140 subsys%ref_count = subsys%ref_count + 1
153 IF (
ASSOCIATED(subsys))
THEN
154 cpassert(subsys%ref_count > 0)
155 subsys%ref_count = subsys%ref_count - 1
156 IF (subsys%ref_count == 0)
THEN
166 IF (
ASSOCIATED(subsys%multipoles))
THEN
168 DEALLOCATE (subsys%multipoles)
173 IF (
ASSOCIATED(subsys%virial))
DEALLOCATE (subsys%virial)
206 SUBROUTINE cp_subsys_set(subsys, atomic_kinds, particles, local_particles, &
207 molecules, molecule_kinds, local_molecules, para_env, &
208 colvar_p, shell_particles, core_particles, gci, multipoles, &
209 results, cell, cell_ref, use_ref_cell)
224 TYPE(
cell_type),
OPTIONAL,
POINTER :: cell, cell_ref
225 LOGICAL,
OPTIONAL :: use_ref_cell
227 cpassert(subsys%ref_count > 0)
228 IF (
PRESENT(multipoles))
THEN
229 IF (
ASSOCIATED(subsys%multipoles))
THEN
230 IF (.NOT.
ASSOCIATED(subsys%multipoles, multipoles))
THEN
232 DEALLOCATE (subsys%multipoles)
235 subsys%multipoles => multipoles
237 IF (
PRESENT(atomic_kinds))
THEN
240 subsys%atomic_kinds => atomic_kinds
242 IF (
PRESENT(particles))
THEN
245 subsys%particles => particles
247 IF (
PRESENT(local_particles))
THEN
250 subsys%local_particles => local_particles
252 IF (
PRESENT(local_molecules))
THEN
255 subsys%local_molecules => local_molecules
257 IF (
PRESENT(molecule_kinds))
THEN
260 subsys%molecule_kinds => molecule_kinds
262 IF (
PRESENT(molecules))
THEN
265 subsys%molecules => molecules
267 IF (
PRESENT(para_env))
THEN
268 CALL para_env%retain()
270 subsys%para_env => para_env
272 IF (
PRESENT(colvar_p))
THEN
273 cpassert(.NOT.
ASSOCIATED(subsys%colvar_p))
274 subsys%colvar_p => colvar_p
276 IF (
PRESENT(shell_particles))
THEN
277 IF (
ASSOCIATED(shell_particles))
THEN
280 subsys%shell_particles => shell_particles
283 IF (
PRESENT(core_particles))
THEN
284 IF (
ASSOCIATED(core_particles))
THEN
287 subsys%core_particles => core_particles
290 IF (
PRESENT(gci))
THEN
291 cpassert(.NOT.
ASSOCIATED(subsys%gci))
294 IF (
PRESENT(results))
THEN
295 IF (
ASSOCIATED(results))
THEN
298 subsys%results => results
301 IF (
PRESENT(cell))
THEN
302 IF (
ASSOCIATED(cell))
THEN
308 IF (
PRESENT(cell_ref))
THEN
309 IF (
ASSOCIATED(cell_ref))
THEN
312 subsys%cell_ref => cell_ref
313 subsys%use_ref_cell = .true.
316 IF (
PRESENT(use_ref_cell))
THEN
317 subsys%use_ref_cell = use_ref_cell
357 SUBROUTINE cp_subsys_get(subsys, ref_count, atomic_kinds, atomic_kind_set, &
358 particles, particle_set, &
359 local_particles, molecules, molecule_set, molecule_kinds, &
360 molecule_kind_set, local_molecules, para_env, colvar_p, &
361 shell_particles, core_particles, gci, multipoles, &
362 natom, nparticle, ncore, nshell, nkind, atprop, virial, &
363 results, cell, cell_ref, use_ref_cell)
365 INTEGER,
INTENT(out),
OPTIONAL :: ref_count
368 POINTER :: atomic_kind_set
371 POINTER :: particle_set
375 POINTER :: molecule_set
378 POINTER :: molecule_kind_set
386 INTEGER,
INTENT(out),
OPTIONAL :: natom, nparticle, ncore, nshell, nkind
390 TYPE(
cell_type),
OPTIONAL,
POINTER :: cell, cell_ref
391 LOGICAL,
OPTIONAL :: use_ref_cell
393 INTEGER :: n_atom, n_core, n_shell
399 cpassert(subsys%ref_count > 0)
401 IF (
PRESENT(ref_count)) ref_count = subsys%ref_count
402 IF (
PRESENT(atomic_kinds)) atomic_kinds => subsys%atomic_kinds
403 IF (
PRESENT(atomic_kind_set)) atomic_kind_set => subsys%atomic_kinds%els
404 IF (
PRESENT(particles)) particles => subsys%particles
405 IF (
PRESENT(particle_set)) particle_set => subsys%particles%els
406 IF (
PRESENT(local_particles)) local_particles => subsys%local_particles
407 IF (
PRESENT(molecules)) molecules => subsys%molecules
408 IF (
PRESENT(molecule_set)) molecule_set => subsys%molecules%els
409 IF (
PRESENT(molecule_kinds)) molecule_kinds => subsys%molecule_kinds
410 IF (
PRESENT(molecule_kind_set)) molecule_kind_set => subsys%molecule_kinds%els
411 IF (
PRESENT(local_molecules)) local_molecules => subsys%local_molecules
412 IF (
PRESENT(para_env)) para_env => subsys%para_env
413 IF (
PRESENT(colvar_p)) colvar_p => subsys%colvar_p
414 IF (
PRESENT(shell_particles)) shell_particles => subsys%shell_particles
415 IF (
PRESENT(core_particles)) core_particles => subsys%core_particles
416 IF (
PRESENT(gci)) gci => subsys%gci
417 IF (
PRESENT(multipoles)) multipoles => subsys%multipoles
418 IF (
PRESENT(virial)) virial => subsys%virial
419 IF (
PRESENT(atprop)) atprop => subsys%atprop
420 IF (
PRESENT(results)) results => subsys%results
421 IF (
PRESENT(cell)) cell => subsys%cell
422 IF (
PRESENT(cell_ref)) cell_ref => subsys%cell_ref
423 IF (
PRESENT(use_ref_cell)) use_ref_cell = subsys%use_ref_cell
424 IF (
PRESENT(nkind)) nkind =
SIZE(subsys%atomic_kinds%els)
426 IF (
PRESENT(natom) .OR.
PRESENT(nparticle) .OR.
PRESENT(nshell))
THEN
428 cpassert(
ASSOCIATED(subsys%particles))
429 n_atom = subsys%particles%n_els
431 IF (
ASSOCIATED(subsys%shell_particles))
THEN
432 n_shell = subsys%shell_particles%n_els
433 cpassert(
ASSOCIATED(subsys%core_particles))
434 n_core = subsys%core_particles%n_els
436 cpassert(n_core == n_shell)
437 ELSE IF (
ASSOCIATED(subsys%core_particles))
THEN
439 cpassert(
ASSOCIATED(subsys%shell_particles))
444 IF (
PRESENT(natom)) natom = n_atom
445 IF (
PRESENT(nparticle)) nparticle = n_atom + n_shell
446 IF (
PRESENT(ncore)) ncore = n_core
447 IF (
PRESENT(nshell)) nshell = n_shell
469 REAL(kind=
dp),
DIMENSION(:),
INTENT(OUT),
OPTIONAL :: f, r, s, v
470 REAL(kind=
dp),
INTENT(IN),
OPTIONAL :: fscale
471 TYPE(
cell_type),
OPTIONAL,
POINTER :: cell
473 INTEGER :: i, iatom, j, k, natom, nparticle, nsize, &
475 REAL(kind=
dp),
DIMENSION(3) :: rs
480 cpassert(
PRESENT(cell))
481 cpassert(
ASSOCIATED(cell))
484 NULLIFY (core_particles)
486 NULLIFY (shell_particles)
489 core_particles=core_particles, &
491 nparticle=nparticle, &
492 particles=particles, &
493 shell_particles=shell_particles)
500 cpassert((
SIZE(f) >= nsize))
503 shell_index = particles%els(iatom)%shell_index
504 IF (shell_index == 0)
THEN
507 f(j) = particles%els(iatom)%f(i)
512 f(j) = core_particles%els(shell_index)%f(i)
514 k = 3*(natom + shell_index - 1)
516 f(k + i) = shell_particles%els(shell_index)%f(i)
520 IF (
PRESENT(fscale)) f(1:nsize) = fscale*f(1:nsize)
526 cpassert((
SIZE(r) >= nsize))
529 shell_index = particles%els(iatom)%shell_index
530 IF (shell_index == 0)
THEN
533 r(j) = particles%els(iatom)%r(i)
538 r(j) = core_particles%els(shell_index)%r(i)
540 k = 3*(natom + shell_index - 1)
542 r(k + i) = shell_particles%els(shell_index)%r(i)
551 cpassert((
SIZE(s) >= nsize))
554 shell_index = particles%els(iatom)%shell_index
555 IF (shell_index == 0)
THEN
568 k = 3*(natom + shell_index - 1)
579 cpassert((
SIZE(v) >= nsize))
582 shell_index = particles%els(iatom)%shell_index
583 IF (shell_index == 0)
THEN
586 v(j) = particles%els(iatom)%v(i)
591 v(j) = core_particles%els(shell_index)%v(i)
593 k = 3*(natom + shell_index - 1)
595 v(k + i) = shell_particles%els(shell_index)%v(i)
619 REAL(kind=
dp),
DIMENSION(:),
INTENT(IN),
OPTIONAL :: f, r, s, v
620 REAL(kind=
dp),
INTENT(IN),
OPTIONAL :: fscale
621 TYPE(
cell_type),
OPTIONAL,
POINTER :: cell
623 INTEGER :: i, iatom, j, k, natom, nparticle, nsize, &
625 REAL(kind=
dp) :: fc, fs, mass, my_fscale
626 REAL(kind=
dp),
DIMENSION(3) :: rs
630 NULLIFY (core_particles)
632 NULLIFY (shell_particles)
635 core_particles=core_particles, &
637 nparticle=nparticle, &
638 particles=particles, &
639 shell_particles=shell_particles)
646 cpassert((
SIZE(f) >= nsize))
647 IF (
PRESENT(fscale))
THEN
654 shell_index = particles%els(iatom)%shell_index
655 IF (shell_index == 0)
THEN
658 particles%els(iatom)%f(i) = my_fscale*f(j)
663 core_particles%els(shell_index)%f(i) = my_fscale*f(j)
665 k = 3*(natom + shell_index - 1)
667 shell_particles%els(shell_index)%f(i) = my_fscale*f(k + i)
676 cpassert((
SIZE(r) >= nsize))
679 shell_index = particles%els(iatom)%shell_index
680 IF (shell_index == 0)
THEN
683 particles%els(iatom)%r(i) = r(j)
688 core_particles%els(shell_index)%r(i) = r(j)
690 k = 3*(natom + shell_index - 1)
692 shell_particles%els(shell_index)%r(i) = r(k + i)
695 mass = particles%els(iatom)%atomic_kind%mass
696 fc = core_particles%els(shell_index)%atomic_kind%shell%mass_core/mass
697 fs = shell_particles%els(shell_index)%atomic_kind%shell%mass_shell/mass
698 particles%els(iatom)%r(1:3) = fc*core_particles%els(shell_index)%r(1:3) + &
699 fs*shell_particles%els(shell_index)%r(1:3)
707 cpassert((
SIZE(s) >= nsize))
708 cpassert(
PRESENT(cell))
709 cpassert(
ASSOCIATED(cell))
712 shell_index = particles%els(iatom)%shell_index
713 IF (shell_index == 0)
THEN
725 k = 3*(natom + shell_index - 1)
731 mass = particles%els(iatom)%atomic_kind%mass
732 fc = core_particles%els(shell_index)%atomic_kind%shell%mass_core/mass
733 fs = shell_particles%els(shell_index)%atomic_kind%shell%mass_shell/mass
734 particles%els(iatom)%r(1:3) = fc*core_particles%els(shell_index)%r(1:3) + &
735 fs*shell_particles%els(shell_index)%r(1:3)
743 cpassert((
SIZE(v) >= nsize))
746 shell_index = particles%els(iatom)%shell_index
747 IF (shell_index == 0)
THEN
750 particles%els(iatom)%v(i) = v(j)
755 core_particles%els(shell_index)%v(i) = v(j)
757 k = 3*(natom + shell_index - 1)
759 shell_particles%els(shell_index)%v(i) = v(k + i)
762 mass = particles%els(iatom)%atomic_kind%mass
763 fc = core_particles%els(shell_index)%atomic_kind%shell%mass_core/mass
764 fs = shell_particles%els(shell_index)%atomic_kind%shell%mass_shell/mass
765 particles%els(iatom)%v(1:3) = fc*core_particles%els(shell_index)%v(1:3) + &
766 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_set(subsys, atomic_kinds, particles, local_particles, molecules, molecule_kinds, local_molecules, para_env, colvar_p, shell_particles, core_particles, gci, multipoles, results, cell, cell_ref, use_ref_cell)
sets various propreties of the subsys
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_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
subroutine, public cp_subsys_retain(subsys)
retains a subsys (see doc/ReferenceCounting.html)
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.
represent a list of objects
Provides all information about an atomic kind.
type for the atomic properties
Type defining parameters related to the simulation cell.
contains arbitrary information which need to be stored
represent a pointer to a subsys, to be able to create arrays of pointers
represents a system: atoms, molecules, their pos,vel,...
structure to store local (to a processor) ordered lists of integers.
stores all the informations relevant to an mpi environment
represent a list of objects
represent a list of objects
represent a list of objects