(git:618e178)
Loading...
Searching...
No Matches
input_cp2k_motion_print.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!> \par History
10!> - taken out of input_cp2k_motion
11!> \author Ole Schuett
12! **************************************************************************************************
19 USE input_constants, ONLY: dump_atomic,&
20 dump_dcd,&
23 dump_pdb,&
34 USE string_utilities, ONLY: s2a
35#include "./base/base_uses.f90"
36
37 IMPLICIT NONE
38 PRIVATE
39
40 LOGICAL, PRIVATE, PARAMETER :: debug_this_module = .true.
41 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'input_cp2k_motion_print'
42
44
45CONTAINS
46
47! **************************************************************************************************
48!> \brief creates the motion%print section
49!> \param section the section to be created
50!> \author teo
51! **************************************************************************************************
52 SUBROUTINE create_motion_print_section(section)
53 TYPE(section_type), POINTER :: section
54
55 TYPE(keyword_type), POINTER :: keyword
56 TYPE(section_type), POINTER :: print_key
57
58 NULLIFY (keyword, section, print_key)
59
60 CALL section_create(section, __location__, name="print", &
61 description="Controls the printing properties during an MD/Optimization run", &
62 n_keywords=1, n_subsections=1, repeats=.true.)
63
64 CALL keyword_create(keyword, __location__, name="MEMORY_INFO", &
65 variants=["MEMORY"], &
66 description="Whether overall memory usage should be sampled and printed "// &
67 "at each MD/Optimization step.", &
68 usage="MEMORY_INFO LOGICAL", &
69 default_l_val=.true., lone_keyword_l_val=.true.)
70 CALL section_add_keyword(section, keyword)
71 CALL keyword_release(keyword)
72
73 CALL cp_print_key_section_create(print_key, __location__, "TRAJECTORY", &
74 description="Controls the output of the trajectory", &
75 print_level=low_print_level, common_iter_levels=1, &
76 filename="", unit_str="angstrom")
77 CALL add_format_keyword(keyword, print_key, pos=.true., &
78 description="Specifies the format of the output file for the trajectory.")
79 CALL section_add_subsection(section, print_key)
80 CALL section_release(print_key)
81
83 print_key, __location__, "SHELL_TRAJECTORY", &
84 description="Controls the output of the trajectory of shells when the shell-model is used ", &
85 print_level=high_print_level, common_iter_levels=1, &
86 filename="", unit_str="angstrom")
87 CALL add_format_keyword(keyword, print_key, pos=.true., &
88 description="Specifies the format of the output file for the trajectory of shells.")
89 CALL section_add_subsection(section, print_key)
90 CALL section_release(print_key)
91
92 CALL cp_print_key_section_create(print_key, __location__, "CORE_TRAJECTORY", &
93 description="Controls the output of the trajectory of cores when the shell-model is used ", &
94 print_level=high_print_level, common_iter_levels=1, &
95 filename="", unit_str="angstrom")
96 CALL add_format_keyword(keyword, print_key, pos=.true., &
97 description="Specifies the format of the output file for the trajectory of cores.")
98 CALL section_add_subsection(section, print_key)
99 CALL section_release(print_key)
100
101 CALL cp_print_key_section_create(print_key, __location__, "CELL", &
102 description="Controls the output of the simulation cell. "// &
103 "For later analysis of the trajectory it is recommendable that the "// &
104 "frequency of printing is the same as the one used for the trajectory file.", &
105 print_level=high_print_level, common_iter_levels=1, &
106 filename="")
107 CALL section_add_subsection(section, print_key)
108 CALL section_release(print_key)
109
110 CALL cp_print_key_section_create(print_key, __location__, "VELOCITIES", &
111 description="Controls the output of the atomic velocities. "// &
112 "The default unit for the atomic velocities $v$ is bohr/au_time. "// &
113 "The kinetic energy $K_i$ in [hartree] of an atom $i$ with mass $m_i$ in "// &
114 "atomic mass units [amu] (or just [u]) and velocity $v_i$ can be obtained by "// &
115 "$K_i = \frac{1}{2}f_u\,m_i\,v_i^2$ with $f_u = 1822.888$ as conversion factor "// &
116 "from [u] to [a.u.]. $f_u$ is printed in full precision in the top of the CP2K "// &
117 "output for print level MEDIUM or higher.", &
118 print_level=high_print_level, common_iter_levels=1, &
119 filename="", unit_str="bohr*au_t^-1")
120 CALL add_format_keyword(keyword, print_key, pos=.false., &
121 description="Specifies the format of the output file for the velocities.")
122 CALL section_add_subsection(section, print_key)
123 CALL section_release(print_key)
124
125 CALL cp_print_key_section_create(print_key, __location__, "SHELL_VELOCITIES", &
126 description="Controls the output of the velocities of shells when the shell model is used", &
127 print_level=high_print_level, common_iter_levels=1, &
128 filename="", unit_str="bohr*au_t^-1")
129 CALL add_format_keyword(keyword, print_key, pos=.false., &
130 description="Specifies the format of the output file for the velocities of shells.")
131 CALL section_add_subsection(section, print_key)
132 CALL section_release(print_key)
133
134 CALL cp_print_key_section_create(print_key, __location__, "CORE_VELOCITIES", &
135 description="controls the output of the velocities of cores when the shell model is used", &
136 print_level=high_print_level, common_iter_levels=1, &
137 filename="", unit_str="bohr*au_t^-1")
138 CALL add_format_keyword(keyword, print_key, pos=.false., &
139 description="Specifies the format of the output file for the velocities of cores.")
140 CALL section_add_subsection(section, print_key)
141 CALL section_release(print_key)
142
143 CALL create_structure_data_section(print_key)
144 CALL section_add_subsection(section, print_key)
145 CALL section_release(print_key)
146
147 CALL cp_print_key_section_create(print_key, __location__, "FINAL_STRUCTURE", &
148 description="Controls the dumping of the final "// &
149 "geometry and cell for optimization tasks. ", &
150 print_level=low_print_level, filename="FINAL")
151
152 CALL keyword_create(keyword, __location__, name="PRINT_CIF", &
153 description="Print the final structure as CIF. Currently the "// &
154 "structure will always be dumped with the space "// &
155 "group `P 1` and a single symmetry-equivalent "// &
156 "position `x, y, z` for all of the atoms.", &
157 usage="PRINT_CIF T", default_l_val=.true., &
158 lone_keyword_l_val=.true.)
159 CALL section_add_keyword(print_key, keyword)
160 CALL keyword_release(keyword)
161
162 CALL keyword_create(keyword, __location__, name="PRINT_XYZ", &
163 description="Print the final structure as XYZ. The cell "// &
164 "information is available in the comment line according "// &
165 "to the extended XYZ specification as the `Lattice=...` "// &
166 "field, and the unit is angstrom for both the cell vectors "// &
167 "and the atomic coordinates.", &
168 usage="PRINT_XYZ T", default_l_val=.true., &
169 lone_keyword_l_val=.true.)
170 CALL section_add_keyword(print_key, keyword)
171 CALL keyword_release(keyword)
172
173 CALL section_add_subsection(section, print_key)
174 CALL section_release(print_key)
175
177 print_key, __location__, "FORCE_MIXING_LABELS", &
178 description="Controls the output of the force mixing (FORCE_EVAL&QMMM&FORCE_MIXING) labels", &
179 print_level=high_print_level, common_iter_levels=1, &
180 filename="")
181 CALL add_format_keyword(keyword, print_key, pos=.false., &
182 description="Specifies the format of the output file for the force mixing labels.")
183 CALL section_add_subsection(section, print_key)
184 CALL section_release(print_key)
185
186 CALL cp_print_key_section_create(print_key, __location__, "FORCES", &
187 description="Controls the output of the forces", &
188 print_level=high_print_level, common_iter_levels=1, &
189 filename="", unit_str="hartree*bohr^-1")
190 CALL add_format_keyword(keyword, print_key, pos=.false., &
191 description="Specifies the format of the output file for the forces.")
192 CALL section_add_subsection(section, print_key)
193 CALL section_release(print_key)
194
195 CALL cp_print_key_section_create(print_key, __location__, "SHELL_FORCES", &
196 description="Controls the output of the forces on shells when shell-model is used", &
197 print_level=high_print_level, common_iter_levels=1, &
198 filename="", unit_str="hartree*bohr^-1")
199 CALL add_format_keyword(keyword, print_key, pos=.false., &
200 description="Specifies the format of the output file for the forces on shells.")
201 CALL section_add_subsection(section, print_key)
202 CALL section_release(print_key)
203
204 CALL cp_print_key_section_create(print_key, __location__, "CORE_FORCES", &
205 description="Controls the output of the forces on cores when shell-model is used", &
206 print_level=high_print_level, common_iter_levels=1, &
207 filename="", unit_str="hartree*bohr^-1")
208 CALL add_format_keyword(keyword, print_key, pos=.false., &
209 description="Specifies the format of the output file for the forces on cores.")
210 CALL section_add_subsection(section, print_key)
211 CALL section_release(print_key)
212
213 CALL cp_print_key_section_create(print_key, __location__, "MIXED_ENERGIES", &
214 description="Controls the output of the energies of the two "// &
215 "regular FORCE_EVALS in the MIXED method "// &
216 "printed is step,time,Etot,E_F1,E_F2,CONS_QNT", &
217 print_level=low_print_level, common_iter_levels=1, &
218 filename="")
219 CALL section_add_subsection(section, print_key)
220 CALL section_release(print_key)
221
222 CALL cp_print_key_section_create(print_key, __location__, "STRESS", &
223 description="Controls the output of the stress tensor", &
224 print_level=high_print_level, common_iter_levels=1, &
225 filename="")
226 CALL section_add_subsection(section, print_key)
227 CALL section_release(print_key)
228
229 CALL cp_print_key_section_create(print_key, __location__, "POLAR_MATRIX", &
230 description="Controls the output of the polarisability tensor during an MD run", &
231 print_level=low_print_level, common_iter_levels=1, &
232 filename="")
233 CALL section_add_subsection(section, print_key)
234 CALL section_release(print_key)
235
236 CALL cp_print_key_section_create(print_key, __location__, "RESTART", &
237 description="Controls the dumping of the restart file during runs. "// &
238 "By default keeps a short history of three restarts. See also RESTART_HISTORY", &
239 each_iter_names=s2a("MD"), each_iter_values=[20], &
240 print_level=silent_print_level, common_iter_levels=1, &
241 add_last=add_last_numeric, filename="")
242
243 CALL keyword_create(keyword, __location__, name="BACKUP_COPIES", &
244 description="Specifies the maximum number of backup copies.", &
245 usage="BACKUP_COPIES {int}", &
246 default_i_val=1)
247 CALL section_add_keyword(print_key, keyword)
248 CALL keyword_release(keyword)
249
250 CALL keyword_create(keyword, __location__, name="SPLIT_RESTART_FILE", &
251 description="If specified selected input sections, which are growing with the "// &
252 "number of atoms in the system, are written to another restart file "// &
253 "in binary format instead of the default restart file in human "// &
254 "readable ASCII format. This split of the restart file may "// &
255 "provide significant memory savings and an accelerated I/O for "// &
256 "systems with a very large number of atoms", &
257 usage="SPLIT_RESTART_FILE yes", &
258 default_l_val=.false., &
259 lone_keyword_l_val=.true.)
260 CALL section_add_keyword(print_key, keyword)
261 CALL keyword_release(keyword)
262
263 CALL section_add_subsection(section, print_key)
264 CALL section_release(print_key)
265
266 CALL cp_print_key_section_create(print_key, __location__, "RESTART_HISTORY", &
267 description="Dumps unique restart files during the run keeping all of them. "// &
268 "Most useful if recovery is needed at a later point.", &
269 print_level=low_print_level, common_iter_levels=0, &
270 each_iter_names=s2a("MD", "GEO_OPT", "ROT_OPT"), each_iter_values=[500, 500, 500], &
271 filename="")
272 CALL section_add_subsection(section, print_key)
273 CALL section_release(print_key)
274
275 CALL cp_print_key_section_create(print_key, __location__, "TRANSLATION_VECTOR", &
276 description="Dumps the translation vector applied along an MD (if any). Useful"// &
277 " for postprocessing of QMMM trajectories in which the QM fragment is continuously"// &
278 " centered in the QM box", &
279 print_level=high_print_level, common_iter_levels=1, &
280 filename="")
281 CALL section_add_subsection(section, print_key)
282 CALL section_release(print_key)
283
284 END SUBROUTINE create_motion_print_section
285
286! **************************************************************************************************
287!> \brief creates the FORMAT keyword
288!> \param keyword ...
289!> \param section will contain the pint section
290!> \param pos ...
291!> \param description ...
292!> \author Teodoro Laino 10.2008 [tlaino]
293! **************************************************************************************************
294 SUBROUTINE add_format_keyword(keyword, section, pos, description)
295 TYPE(keyword_type), POINTER :: keyword
296 TYPE(section_type), POINTER :: section
297 LOGICAL, INTENT(IN) :: pos
298 CHARACTER(LEN=*), INTENT(IN) :: description
299
300 cpassert(ASSOCIATED(section))
301 cpassert(.NOT. ASSOCIATED(keyword))
302
303 IF (pos) THEN
304
305 CALL keyword_create( &
306 keyword, __location__, name="FORMAT", &
307 description=description, usage="FORMAT (ATOMIC|DCD|PDB|XMOL|XYZ|EXTXYZ)", &
308 default_i_val=dump_xmol, &
309 enum_c_vals=s2a("ATOMIC", "DCD", "DCD_ALIGNED_CELL", "PDB", "XMOL", "XYZ", "EXTXYZ"), &
311 enum_desc=s2a("Write only the coordinates X,Y,Z without element symbols to a formatted file", &
312 "Write the coordinates (no element labels) and the cell information to a binary file", &
313 "Like DCD, but the dumped coordinates refer to an aligned cell following the common convention: "// &
314 "the cell vector **a** is aligned with the *x* axis and the cell vector **b** lies in "// &
315 "the *xy* plane. This allows the reconstruction of scaled coordinates from the DCD data only.", &
316 "Write the atomic information in PDB format to a formatted file", &
317 "Mostly known as XYZ format, provides in a formatted file: element_symbol X Y Z", &
318 "Alias name for XMOL", &
319 "Extended XYZ format including cell information. "// &
320 "For details see [ASE](https://ase-lib.org/ase/io/formatoptions.html#extxyz) "// &
321 "and [OVITO](https://www.ovito.org/manual/reference/file_formats/input/xyz.html)."))
322 CALL section_add_keyword(section, keyword)
323 CALL keyword_release(keyword)
324
325 CALL keyword_create(keyword, __location__, name="CHARGE_OCCUP", &
326 variants=["CHARGE_O"], &
327 description="Write the MM charges to the OCCUP field of the PDB file", &
328 usage="CHARGE_OCCUP logical", &
329 default_l_val=.false., lone_keyword_l_val=.true.)
330 CALL section_add_keyword(section, keyword)
331 CALL keyword_release(keyword)
332
333 CALL keyword_create(keyword, __location__, name="CHARGE_BETA", &
334 variants=["CHARGE_B"], &
335 description="Write the MM charges to the BETA field of the PDB file", &
336 usage="CHARGE_BETA logical", &
337 default_l_val=.false., lone_keyword_l_val=.true.)
338 CALL section_add_keyword(section, keyword)
339 CALL keyword_release(keyword)
340
341 CALL keyword_create(keyword, __location__, name="CHARGE_EXTENDED", &
342 description="Write the MM charges to the very last field of the PDB file (starting from column 81)", &
343 usage="CHARGE_EXTENDED logical", &
344 default_l_val=.false., lone_keyword_l_val=.true.)
345 CALL section_add_keyword(section, keyword)
346 CALL keyword_release(keyword)
347
348 ELSE
349
350 CALL keyword_create(keyword, __location__, name="FORMAT", &
351 description=description, usage="FORMAT (ATOMIC|DCD|XMOL|XYZ|EXTXYZ)", &
352 default_i_val=dump_xmol, &
353 enum_c_vals=s2a("ATOMIC", "DCD", "XMOL", "XYZ", "EXTXYZ"), &
355 enum_desc=s2a("Write only the coordinates X,Y,Z without element symbols to a formatted file", &
356 "Write the coordinates (no element labels) and the cell information to a binary file", &
357 "Mostly known as XYZ format, provides in a formatted file: element_symbol X Y Z", &
358 "Alias name for XMOL", &
359 "Extended XYZ format including cell information. "// &
360 "For details see [ASE](https://ase-lib.org/ase/io/formatoptions.html#extxyz) "// &
361 "and [OVITO](https://www.ovito.org/manual/reference/file_formats/input/xyz.html)."))
362 CALL section_add_keyword(section, keyword)
363 CALL keyword_release(keyword)
364
365 END IF
366
367 CALL keyword_create(keyword, __location__, name="PRINT_ATOM_KIND", &
368 description="Write the atom kind given in the subsys section instead of the element symbol. "// &
369 "Only valid for the XMOL and EXTXYZ format.", &
370 usage="PRINT_ATOM_KIND logical", &
371 default_l_val=.false., lone_keyword_l_val=.true.)
372 CALL section_add_keyword(section, keyword)
373 CALL keyword_release(keyword)
374
375 END SUBROUTINE add_format_keyword
376
routines to handle the output, The idea is to remove the decision of wheter to output and what to out...
integer, parameter, public low_print_level
integer, parameter, public high_print_level
integer, parameter, public add_last_numeric
integer, parameter, public silent_print_level
subroutine, public cp_print_key_section_create(print_key_section, location, name, description, print_level, each_iter_names, each_iter_values, add_last, filename, common_iter_levels, citations, unit_str)
creates a print_key section
collects all constants needed in input so that they can be used without circular dependencies
integer, parameter, public dump_xmol
integer, parameter, public dump_pdb
integer, parameter, public dump_extxyz
integer, parameter, public dump_atomic
integer, parameter, public dump_dcd_aligned_cell
integer, parameter, public dump_dcd
subroutine, public add_format_keyword(keyword, section, pos, description)
creates the FORMAT keyword
subroutine, public create_motion_print_section(section)
creates the motionprint section
builds the subsystem section of the input
subroutine, public create_structure_data_section(print_key)
creates structure data section for output.. both subsys (for initialization) and motion section....
represents keywords in an input
subroutine, public keyword_release(keyword)
releases the given keyword (see doc/ReferenceCounting.html)
subroutine, public keyword_create(keyword, location, name, description, usage, type_of_var, n_var, repeats, variants, default_val, default_l_val, default_r_val, default_lc_val, default_c_val, default_i_val, default_l_vals, default_r_vals, default_c_vals, default_i_vals, lone_keyword_val, lone_keyword_l_val, lone_keyword_r_val, lone_keyword_c_val, lone_keyword_i_val, lone_keyword_l_vals, lone_keyword_r_vals, lone_keyword_c_vals, lone_keyword_i_vals, enum_c_vals, enum_i_vals, enum, enum_strict, enum_desc, unit_str, citations, deprecation_notice, removed)
creates a keyword object
objects that represent the structure of input sections and the data contained in an input section
subroutine, public section_create(section, location, name, description, n_keywords, n_subsections, repeats, citations, deprecation_notice)
creates a list of keywords
subroutine, public section_add_keyword(section, keyword)
adds a keyword to the given section
subroutine, public section_add_subsection(section, subsection)
adds a subsection to the given section
recursive subroutine, public section_release(section)
releases the given keyword list (see doc/ReferenceCounting.html)
Utilities for string manipulations.
represent a keyword in the input
represent a section of the input file