(git:cb5d5fc)
Loading...
Searching...
No Matches
eip_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 Methods and functions on the EIP environment
10!> \par History
11!> 03.2006 initial create [tdk]
12!> \author Thomas D. Kuehne (tkuehne@phys.chem.ethz.ch)
13! **************************************************************************************************
17 USE cell_types, ONLY: cell_type
28 USE kinds, ONLY: default_string_length,&
29 dp
38#include "./base/base_uses.f90"
39
40 IMPLICIT NONE
41
42 PRIVATE
43
44! *** Global parameters ***
45
46 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'eip_environment'
47
48! *** Public subroutines ***
49
50 PUBLIC :: eip_init
51
52CONTAINS
53
54! **************************************************************************************************
55!> \brief Initialize the eip environment
56!> \param eip_env The eip environment to retain
57!> \param root_section ...
58!> \param para_env ...
59!> \param force_env_section ...
60!> \param subsys_section ...
61!> \par History
62!> 03.2006 initial create [tdk]
63!> \author Thomas D. Kuehne (tkuehne@phys.chem.ethz.ch)
64! **************************************************************************************************
65 SUBROUTINE eip_init(eip_env, root_section, para_env, force_env_section, &
66 subsys_section)
67 TYPE(eip_environment_type), POINTER :: eip_env
68 TYPE(section_vals_type), POINTER :: root_section
69 TYPE(mp_para_env_type), POINTER :: para_env
70 TYPE(section_vals_type), POINTER :: force_env_section, subsys_section
71
72 CHARACTER(len=*), PARAMETER :: routinen = 'eip_init'
73
74 INTEGER :: handle
75 TYPE(cp_subsys_type), POINTER :: subsys
76 TYPE(section_vals_type), POINTER :: colvar_section, eip_section
77
78 CALL timeset(routinen, handle)
79
80 cpassert(ASSOCIATED(eip_env))
81
82 ! nullifying pointers
83 NULLIFY (colvar_section, eip_section, subsys)
84
85 IF (.NOT. ASSOCIATED(subsys_section)) THEN
86 subsys_section => section_vals_get_subs_vals(force_env_section, "SUBSYS")
87 END IF
88 colvar_section => section_vals_get_subs_vals(subsys_section, "COLVAR")
89 eip_section => section_vals_get_subs_vals(force_env_section, "EIP")
90
91 CALL eip_env_set(eip_env=eip_env, eip_input=eip_section, &
92 force_env_input=force_env_section)
93
94 CALL cp_subsys_create(subsys, para_env, root_section)
95
96 CALL eip_init_subsys(eip_env=eip_env, subsys=subsys, &
97 subsys_section=subsys_section)
98
99 CALL timestop(handle)
100
101 END SUBROUTINE eip_init
102
103! **************************************************************************************************
104!> \brief Initialize the eip environment
105!> \param eip_env The eip environment of matter
106!> \param subsys the subsys
107!> \param subsys_section ...
108!> \par History
109!> 03.2006 initial create [tdk]
110!> \author Thomas D. Kuehne (tkuehne@phys.chem.ethz.ch)
111! **************************************************************************************************
112 SUBROUTINE eip_init_subsys(eip_env, subsys, subsys_section)
113 TYPE(eip_environment_type), POINTER :: eip_env
114 TYPE(cp_subsys_type), POINTER :: subsys
115 TYPE(section_vals_type), POINTER :: subsys_section
116
117 CHARACTER(len=*), PARAMETER :: routinen = 'eip_init_subsys'
118
119 INTEGER :: handle, natom
120 TYPE(atomic_kind_type), DIMENSION(:), POINTER :: atomic_kind_set
121 TYPE(cell_type), POINTER :: my_cell, my_cell_ref
122 TYPE(distribution_1d_type), POINTER :: local_molecules, local_particles
123 TYPE(molecule_kind_type), DIMENSION(:), POINTER :: molecule_kind_set
124 TYPE(molecule_type), DIMENSION(:), POINTER :: molecule_set
125 TYPE(particle_type), DIMENSION(:), POINTER :: particle_set
126
127! ------------------------------------------------------------------------
128
129 CALL timeset(routinen, handle)
130
131 NULLIFY (atomic_kind_set, molecule_kind_set, particle_set, molecule_set, &
132 my_cell, my_cell_ref, local_molecules, local_particles)
133
134 particle_set => subsys%particles%els
135 atomic_kind_set => subsys%atomic_kinds%els
136 molecule_kind_set => subsys%molecule_kinds%els
137 molecule_set => subsys%molecules%els
138 my_cell => subsys%cell
139 my_cell_ref => subsys%cell_ref
140
141! *** Set up cell ***
142 CALL eip_env_set(eip_env=eip_env, subsys=subsys, &
143 cell_ref=my_cell_ref, &
144 use_ref_cell=subsys%use_ref_cell)
145
146! *** Print the molecule kind set ***
147 CALL write_molecule_kind_set(molecule_kind_set, subsys_section)
148
149! *** Print the atomic coordinates
150 CALL write_fist_particle_coordinates(particle_set, subsys_section)
151 CALL write_particle_distances(particle_set, cell=my_cell, &
152 subsys_section=subsys_section)
153 CALL write_structure_data(particle_set, cell=my_cell, &
154 input_section=subsys_section)
155
156! *** Distribute molecules and atoms using the new data structures ***
157 CALL distribute_molecules_1d(atomic_kind_set=atomic_kind_set, &
158 particle_set=particle_set, &
159 local_particles=local_particles, &
160 molecule_kind_set=molecule_kind_set, &
161 molecule_set=molecule_set, &
162 local_molecules=local_molecules, &
163 force_env_section=eip_env%force_env_input)
164
165 natom = SIZE(particle_set)
166
167 ALLOCATE (eip_env%eip_forces(3, natom))
168
169 eip_env%eip_forces(:, :) = 0.0_dp
170
171 CALL eip_env_set(eip_env=eip_env, &
172 local_molecules=local_molecules, &
173 local_particles=local_particles)
174
175 CALL distribution_1d_release(local_particles)
176 CALL distribution_1d_release(local_molecules)
177
178 CALL eip_init_model(eip_env=eip_env)
179
180 CALL timestop(handle)
181
182 END SUBROUTINE eip_init_subsys
183
184! **************************************************************************************************
185!> \brief Initialize the empirical interatomic potnetial (force field) model
186!> \param eip_env The eip environment to retain
187!> \par History
188!> 03.2006 initial create [tdk]
189!> \author Thomas D. Kuehne (tkuehne@phys.chem.ethz.ch)
190! **************************************************************************************************
191 SUBROUTINE eip_init_model(eip_env)
192 TYPE(eip_environment_type), POINTER :: eip_env
193
194 CHARACTER(len=*), PARAMETER :: routinen = 'eip_init_model'
195
196 CHARACTER(LEN=default_string_length) :: eip_atomic_kind_name
197 INTEGER :: handle, i
198 TYPE(atomic_kind_type), DIMENSION(:), POINTER :: atomic_kind_set
199 TYPE(atomic_kind_type), POINTER :: atomic_kind_ptr
200 TYPE(section_vals_type), POINTER :: eip_section
201
202! ------------------------------------------------------------------------
203
204 CALL timeset(routinen, handle)
205
206 NULLIFY (atomic_kind_set, atomic_kind_ptr, eip_section)
207
208 eip_section => section_vals_get_subs_vals(eip_env%force_env_input, &
209 "EIP")
210
211 atomic_kind_set => eip_env%subsys%atomic_kinds%els
212
213 ! loop over all kinds
214 DO i = 1, SIZE(atomic_kind_set)
215 atomic_kind_ptr => eip_env%subsys%atomic_kinds%els(i)
216 CALL get_atomic_kind(atomic_kind=atomic_kind_ptr, &
217 name=eip_atomic_kind_name)
218 SELECT CASE (eip_atomic_kind_name)
219 CASE ("SI", "Si")
220 CALL section_vals_val_get(section_vals=eip_section, &
221 keyword_name="EIP-Model", &
222 i_val=eip_env%eip_model)
223 CASE DEFAULT
224 cpabort("EIP models for other elements than Si isn't implemented yet.")
225 END SELECT
226 END DO
227
228 CALL timestop(handle)
229
230 END SUBROUTINE eip_init_model
231
232END MODULE eip_environment
Define the atomic kind types and their sub types.
subroutine, public get_atomic_kind(atomic_kind, fist_potential, element_symbol, name, mass, kind_number, natom, atom_list, rcov, rvdw, z, qeff, apol, cpol, mm_radius, shell, shell_active, damping)
Get attributes of an atomic kind.
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.
The environment for the empirical interatomic potential methods.
subroutine, public eip_env_set(eip_env, eip_model, eip_energy, eip_energy_var, eip_forces, coord_avg, coord_var, count, subsys, atomic_kind_set, particle_set, local_particles, molecule_kind_set, molecule_set, local_molecules, eip_input, force_env_input, cell_ref, use_ref_cell, eip_kinetic_energy, eip_potential_energy)
Sets various attributes of the eip environment.
Methods and functions on the EIP environment.
subroutine, public eip_init(eip_env, root_section, para_env, force_env_section, subsys_section)
Initialize the eip environment.
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
subroutine, public section_vals_val_get(section_vals, keyword_name, i_rep_section, i_rep_val, n_rep_val, val, l_val, i_val, r_val, c_val, l_vals, i_vals, r_vals, c_vals, explicit)
returns the requested value
Defines the basic variable types.
Definition kinds.F:23
integer, parameter, public dp
Definition kinds.F:34
integer, parameter, public default_string_length
Definition kinds.F:57
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 methods related to particle_type.
subroutine, public write_fist_particle_coordinates(particle_set, subsys_section, charges)
Write the atomic coordinates to the output unit.
subroutine, public write_structure_data(particle_set, cell, input_section)
Write structure data requested by a separate structure data input section to the output unit....
subroutine, public write_particle_distances(particle_set, cell, subsys_section)
Write the matrix of the particle distances to the output unit.
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.
The empirical interatomic potential environment.
stores all the informations relevant to an mpi environment