(git:495eafe)
Loading...
Searching...
No Matches
embed_environment.F
Go to the documentation of this file.
1!--------------------------------------------------------------------------------------------------!
2! CP2K: A general program to perform molecular dynamics simulations !
3! Copyright 2000-2026 CP2K developers group <https://cp2k.org> !
4! !
5! SPDX-License-Identifier: GPL-2.0-or-later !
6!--------------------------------------------------------------------------------------------------!
7
8! **************************************************************************************************
9!> \brief initialize embed environment: clone of the mixed environment
10!> \author Vladimir Rybkin
11! **************************************************************************************************
14 USE cell_types, ONLY: cell_type
20 USE embed_types, ONLY: embed_env_type,&
29#include "./base/base_uses.f90"
30
31 IMPLICIT NONE
32
33 PRIVATE
34
35 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'embed_environment'
36 PUBLIC :: embed_init
37
38CONTAINS
39
40! **************************************************************************************************
41!> \brief reads the input and database file for embedding
42!> \param embed_env ...
43!> \param root_section ...
44!> \param para_env ...
45!> \param force_env_section ...
46!> \param use_motion_section ...
47!> \par Used By
48!> embed_main
49!> \author Vladimir Rybkin
50! **************************************************************************************************
51 SUBROUTINE embed_init(embed_env, root_section, para_env, force_env_section, &
52 use_motion_section)
53
54 TYPE(embed_env_type), INTENT(INOUT) :: embed_env
55 TYPE(section_vals_type), POINTER :: root_section
56 TYPE(mp_para_env_type), POINTER :: para_env
57 TYPE(section_vals_type), POINTER :: force_env_section
58 LOGICAL, INTENT(IN) :: use_motion_section
59
60 CHARACTER(len=*), PARAMETER :: routinen = 'embed_init'
61
62 INTEGER :: handle
63 TYPE(cp_subsys_type), POINTER :: subsys
64 TYPE(section_vals_type), POINTER :: subsys_section
65
66 CALL timeset(routinen, handle)
67
68 NULLIFY (subsys)
69
70 subsys_section => section_vals_get_subs_vals(force_env_section, "SUBSYS")
71
72 CALL set_embed_env(embed_env, input=force_env_section)
73 CALL cp_subsys_create(subsys, para_env, root_section, &
74 force_env_section=force_env_section, &
75 use_motion_section=use_motion_section)
76
77 CALL embed_init_subsys(embed_env, subsys, &
78 force_env_section, subsys_section)
79
80 CALL timestop(handle)
81
82 END SUBROUTINE embed_init
83
84! **************************************************************************************************
85!> \brief Read the input and the database files for the setup of the
86!> embed environment.
87!> \param embed_env ...
88!> \param subsys ...
89!> \param force_env_section ...
90!> \param subsys_section ...
91!> \date 02.2018
92!> \author Vladimir Rybkin
93! **************************************************************************************************
94 SUBROUTINE embed_init_subsys(embed_env, subsys, force_env_section, &
95 subsys_section)
96
97 TYPE(embed_env_type), INTENT(INOUT) :: embed_env
98 TYPE(cp_subsys_type), POINTER :: subsys
99 TYPE(section_vals_type), POINTER :: force_env_section, subsys_section
100
101 CHARACTER(len=*), PARAMETER :: routinen = 'embed_init_subsys'
102
103 INTEGER :: handle
104 TYPE(atomic_kind_type), DIMENSION(:), POINTER :: atomic_kind_set
105 TYPE(cell_type), POINTER :: my_cell_ref
106 TYPE(distribution_1d_type), POINTER :: local_molecules, local_particles
107 TYPE(molecule_kind_type), DIMENSION(:), POINTER :: molecule_kind_set
108 TYPE(molecule_type), DIMENSION(:), POINTER :: molecule_set
109 TYPE(particle_type), DIMENSION(:), POINTER :: particle_set
110
111 CALL timeset(routinen, handle)
112 NULLIFY (local_molecules, local_particles, my_cell_ref)
113 particle_set => subsys%particles%els
114 atomic_kind_set => subsys%atomic_kinds%els
115 molecule_set => subsys%molecules%els
116 molecule_kind_set => subsys%molecule_kinds%els
117 my_cell_ref => subsys%cell_ref
118
119 ! Print the molecule kind set
120 CALL write_molecule_kind_set(molecule_kind_set, subsys_section)
121
122 ! Distribute molecules and atoms using the new data structures ***
123 CALL distribute_molecules_1d(atomic_kind_set=atomic_kind_set, &
124 particle_set=particle_set, &
125 local_particles=local_particles, &
126 molecule_kind_set=molecule_kind_set, &
127 molecule_set=molecule_set, &
128 local_molecules=local_molecules, &
129 force_env_section=force_env_section)
130
131 ! set the embed_env
132 CALL set_embed_env(embed_env=embed_env, subsys=subsys)
133 CALL set_embed_env(embed_env=embed_env, &
134 cell_ref=my_cell_ref, &
135 local_molecules=local_molecules, &
136 local_particles=local_particles)
137
138 CALL distribution_1d_release(local_particles)
139 CALL distribution_1d_release(local_molecules)
140
141 CALL timestop(handle)
142
143 END SUBROUTINE embed_init_subsys
144
145END MODULE embed_environment
Define the atomic kind types and their sub types.
Handles all functions related to the CELL.
Definition cell_types.F:15
Initialize a small environment for a particular calculation.
subroutine, public cp_subsys_create(subsys, para_env, root_section, force_env_section, subsys_section, use_motion_section, qmmm, qmmm_env, exclusions, elkind)
Creates allocates and fills subsys from given input.
types that represent a subsys, i.e. a part of the system
stores a lists of integer that are local to a processor. The idea is that these integers represent ob...
subroutine, public distribution_1d_release(distribution_1d)
releases the given distribution_1d
Distribution methods for atoms, particles, or molecules.
subroutine, public distribute_molecules_1d(atomic_kind_set, particle_set, local_particles, molecule_kind_set, molecule_set, local_molecules, force_env_section, prev_molecule_kind_set, prev_local_molecules)
Distribute molecules and particles.
initialize embed environment: clone of the mixed environment
subroutine, public embed_init(embed_env, root_section, para_env, force_env_section, use_motion_section)
reads the input and database file for embedding
subroutine, public set_embed_env(embed_env, atomic_kind_set, particle_set, local_particles, local_molecules, molecule_kind_set, molecule_set, cell_ref, subsys, input, sub_para_env)
...
objects that represent the structure of input sections and the data contained in an input section
recursive type(section_vals_type) function, pointer, public section_vals_get_subs_vals(section_vals, subsection_name, i_rep_section, can_return_null)
returns the values of the requested subsection
Interface to the message passing library MPI.
Define the molecule kind structure types and the corresponding functionality.
subroutine, public write_molecule_kind_set(molecule_kind_set, subsys_section)
Write a moleculeatomic kind set data set to the output unit.
Define the data structure for the molecule information.
Define the data structure for the particle information.
Provides all information about an atomic kind.
Type defining parameters related to the simulation cell.
Definition cell_types.F:60
represents a system: atoms, molecules, their pos,vel,...
structure to store local (to a processor) ordered lists of integers.
Embedding environment type.
stores all the informations relevant to an mpi environment