(git:495eafe)
Loading...
Searching...
No Matches
mixed_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 mixed environment
10!> \author fschiff
11! **************************************************************************************************
14 USE cell_types, ONLY: cell_type
31#include "./base/base_uses.f90"
32
33 IMPLICIT NONE
34
35 PRIVATE
36
37 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'mixed_environment'
38 PUBLIC :: mixed_init
39
40CONTAINS
41
42! **************************************************************************************************
43!> \brief reads the input and database file for mixed
44!> \param mixed_env ...
45!> \param root_section ...
46!> \param para_env ...
47!> \param force_env_section ...
48!> \param use_motion_section ...
49!> \par Used By
50!> mixed_main
51!> \author fschiff
52! **************************************************************************************************
53 SUBROUTINE mixed_init(mixed_env, root_section, para_env, force_env_section, &
54 use_motion_section)
55
56 TYPE(mixed_environment_type), INTENT(INOUT) :: mixed_env
57 TYPE(section_vals_type), POINTER :: root_section
58 TYPE(mp_para_env_type), POINTER :: para_env
59 TYPE(section_vals_type), POINTER :: force_env_section
60 LOGICAL, INTENT(IN) :: use_motion_section
61
62 CHARACTER(len=*), PARAMETER :: routinen = 'mixed_init'
63
64 INTEGER :: handle
65 TYPE(cp_subsys_type), POINTER :: subsys
66 TYPE(section_vals_type), POINTER :: subsys_section
67
68 CALL timeset(routinen, handle)
69
70 NULLIFY (subsys)
71
72 subsys_section => section_vals_get_subs_vals(force_env_section, "SUBSYS")
73
74 CALL set_mixed_env(mixed_env, input=force_env_section)
75 CALL cp_subsys_create(subsys, para_env, root_section, &
76 force_env_section=force_env_section, &
77 use_motion_section=use_motion_section)
78
79 CALL mixed_init_subsys(mixed_env, subsys, &
80 force_env_section, subsys_section)
81
82 CALL timestop(handle)
83
84 END SUBROUTINE mixed_init
85
86! **************************************************************************************************
87!> \brief Read the input and the database files for the setup of the
88!> mixed environment.
89!> \param mixed_env ...
90!> \param subsys ...
91!> \param force_env_section ...
92!> \param subsys_section ...
93!> \date 11.06
94!> \author fschiff
95!> \version 1.0
96! **************************************************************************************************
97 SUBROUTINE mixed_init_subsys(mixed_env, subsys, force_env_section, &
98 subsys_section)
99
100 TYPE(mixed_environment_type), INTENT(INOUT) :: mixed_env
101 TYPE(cp_subsys_type), POINTER :: subsys
102 TYPE(section_vals_type), POINTER :: force_env_section, subsys_section
103
104 CHARACTER(len=*), PARAMETER :: routinen = 'mixed_init_subsys'
105
106 INTEGER :: handle
107 TYPE(atomic_kind_type), DIMENSION(:), POINTER :: atomic_kind_set
108 TYPE(cell_type), POINTER :: my_cell_ref
109 TYPE(distribution_1d_type), POINTER :: local_molecules, local_particles
110 TYPE(mixed_energy_type), POINTER :: mixed_energy
111 TYPE(molecule_kind_type), DIMENSION(:), POINTER :: molecule_kind_set
112 TYPE(molecule_type), DIMENSION(:), POINTER :: molecule_set
113 TYPE(particle_type), DIMENSION(:), POINTER :: particle_set
114
115 CALL timeset(routinen, handle)
116 NULLIFY (mixed_energy, local_molecules, local_particles, my_cell_ref)
117 particle_set => subsys%particles%els
118 atomic_kind_set => subsys%atomic_kinds%els
119 molecule_set => subsys%molecules%els
120 molecule_kind_set => subsys%molecule_kinds%els
121 my_cell_ref => subsys%cell_ref
122
123 ! Create the mixed_energy_type
124 CALL allocate_mixed_energy(mixed_energy)
125
126 ! Print the molecule kind set
127 CALL write_molecule_kind_set(molecule_kind_set, subsys_section)
128
129 ! Distribute molecules and atoms using the new data structures ***
130 CALL distribute_molecules_1d(atomic_kind_set=atomic_kind_set, &
131 particle_set=particle_set, &
132 local_particles=local_particles, &
133 molecule_kind_set=molecule_kind_set, &
134 molecule_set=molecule_set, &
135 local_molecules=local_molecules, &
136 force_env_section=force_env_section)
137
138 ! set the mixed_env
139 CALL set_mixed_env(mixed_env=mixed_env, subsys=subsys)
140 CALL set_mixed_env(mixed_env=mixed_env, &
141 cell_ref=my_cell_ref, &
142 local_molecules=local_molecules, &
143 local_particles=local_particles, &
144 mixed_energy=mixed_energy)
145
146 CALL distribution_1d_release(local_particles)
147 CALL distribution_1d_release(local_molecules)
148
149 CALL timestop(handle)
150
151 END SUBROUTINE mixed_init_subsys
152
153END MODULE mixed_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.
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.
subroutine, public allocate_mixed_energy(mixed_energy)
Allocate and/or initialise a mixed energy data structure.
subroutine, public set_mixed_env(mixed_env, atomic_kind_set, particle_set, local_particles, local_molecules, molecule_kind_set, molecule_set, cell_ref, mixed_energy, subsys, input, sub_para_env, cdft_control)
Set the MIXED environment.
initialize mixed environment
subroutine, public mixed_init(mixed_env, root_section, para_env, force_env_section, use_motion_section)
reads the input and database file for mixed
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.
stores all the informations relevant to an mpi environment