Octopus
io_function.F90
Go to the documentation of this file.
1!! Copyright (C) 2002-2006 M. Marques, A. Castro, A. Rubio, G. Bertsch
2!!
3!! This program is free software; you can redistribute it and/or modify
4!! it under the terms of the GNU General Public License as published by
5!! the Free Software Foundation; either version 2, or (at your option)
6!! any later version.
7!!
8!! This program is distributed in the hope that it will be useful,
9!! but WITHOUT ANY WARRANTY; without even the implied warranty of
10!! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11!! GNU General Public License for more details.
12!!
13!! You should have received a copy of the GNU General Public License
14!! along with this program; if not, write to the Free Software
15!! Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
16!! 02110-1301, USA.
17!!
18
19#include "global.h"
20
23 use atom_oct_m
24 use box_oct_m
26 use comm_oct_m
28 use cube_oct_m
29 use debug_oct_m
31 use fft_oct_m
32 use global_oct_m
33 use index_oct_m
34 use io_oct_m
36 use io_csv_oct_m
37 use iso_c_binding
40 use mesh_oct_m
43 use mpi_oct_m
46#if defined(HAVE_NETCDF)
47 use netcdf
48#endif
50 use parser_oct_m
53 use space_oct_m
55 use unit_oct_m
57 use utils_oct_m
59 use vtk_oct_m
60
61 implicit none
62
63 private
64 public :: &
82
83#if defined(HAVE_NETCDF)
84 public :: &
85 dout_cf_netcdf, &
86 zout_cf_netcdf
87#endif
88
90 integer, parameter, private :: &
91 DOUTPUT_KIND = 1, &
92 zoutput_kind = -1
93
95 character(len=3), parameter :: &
96 index2label(3) = (/ 're ', 'im ', 'abs' /)
97
98
101 end interface io_function_output_vector
102
105 end interface io_function_output_vector_bz
106
109 end interface io_function_output_global_bz
110
113 end interface io_function_output_supercell
114
115
116contains
117
118 ! ---------------------------------------------------------
119 subroutine io_function_read_what_how_when(namespace, space, what, how, output_interval, &
120 what_tag_in, how_tag_in, output_interval_tag_in, ignore_error)
121 type(namespace_t), intent(in) :: namespace
122 class(space_t), intent(in) :: space
123 logical, intent(inout) :: what(MAX_OUTPUT_TYPES)
124 integer(int64), intent(out) :: how(0:MAX_OUTPUT_TYPES)
125 integer, intent(out) :: output_interval(0:MAX_OUTPUT_TYPES)
126 character(len=*), optional, intent(in) :: what_tag_in
127 character(len=*), optional, intent(in) :: how_tag_in
128 character(len=*), optional, intent(in) :: output_interval_tag_in
129 logical, optional, intent(in) :: ignore_error
130
131 type(block_t) :: blk
132 integer :: ncols, nrows, iout, column_index, what_i
133 integer(int64) :: what_no_how(13)
134 character(len=80) :: what_tag
135 character(len=80) :: how_tag
136 character(len=80) :: output_interval_tag
137 character(len=80) :: output_column_marker
139
140 how = 0_8
141 output_interval = 0_8
142 ncols = 0
143 what_tag = optional_default(what_tag_in, 'Output')
144 how_tag = optional_default(how_tag_in, 'OutputFormat')
145 output_interval_tag = optional_default(output_interval_tag_in, 'OutputInterval')
146
147 call messages_obsolete_variable(namespace, 'OutputHow', 'OutputFormat')
148 call messages_obsolete_variable(namespace, 'Output_KPT', 'Output')
149 call messages_obsolete_variable(namespace, 'OutputLDA_U' , 'Output')
150 call messages_obsolete_variable(namespace, 'OutputEvery', 'OutputInterval')
151
152 !%Variable Output
153 !%Type block
154 !%Default none
155 !%Section Output
156 !%Description
157 !% Specifies what to print.
158 !% Each output must be in a separate row. Optionally individual output formats and output intervals can be defined
159 !% for each row or they can be read separately from <tt>OutputFormat</tt> and <tt>OutputInterval</tt> variables
160 !% in the input file.
161 !% The output files are written at the end of the run into the output directory for the
162 !% relevant kind of run (<i>e.g.</i> <tt>static</tt> for <tt>CalculationMode = gs</tt>).
163 !% Time-dependent simulations print only per iteration, including always the last. The frequency of output per iteration
164 !% (available for <tt>CalculationMode</tt> = <tt>gs</tt>, <tt>unocc</tt>, <tt>td</tt>, and <tt>opt_control</tt>)
165 !% is set by <tt>OutputInterval</tt> and the directory is set by <tt>OutputIterDir</tt>.
166 !% For linear-response run modes, the derivatives of many quantities can be printed, as listed in
167 !% the options below. Indices in the filename are labelled as follows:
168 !% <tt>sp</tt> = spin (or spinor component), <tt>k</tt> = <i>k</i>-point, <tt>st</tt> = state/band.
169 !% There is no tag for directions, given as a letter. The perturbation direction is always
170 !% the last direction for linear-response quantities, and a following +/- indicates the sign of the frequency.
171 !%
172 !% Example (minimal):
173 !% <br><br><tt>%Output
174 !% <br>&nbsp;&nbsp;density
175 !% <br>&nbsp;&nbsp;potential
176 !% <br>%<br></tt>
177 !%
178 !% Example (with OutputFormat):
179 !% <br><br><tt>%Output
180 !% <br>&nbsp;&nbsp;density | cube + axis_z
181 !% <br>&nbsp;&nbsp;potential | cube
182 !% <br>%<br></tt>
183 !%
184 !% Example (with OutputFormat, incomplete):
185 !% <br><br><tt>%Output
186 !% <br>&nbsp;&nbsp;density | cube + axis_z
187 !% <br>&nbsp;&nbsp;potential
188 !% <br>%<br></tt>
189 !%
190 !% Example (tagged):
191 !% <br><br><tt>%Output
192 !% <br>&nbsp;&nbsp;density | "output_format" | cube + axis_z | "output_interval" | 50
193 !% <br>&nbsp;&nbsp;potential | "output_format" | cube | "output_interval" | 20
194 !% <br>%<br></tt>
195 !%
196 !% Example (tagged, incomplete):
197 !% <br><br><tt>%Output
198 !% <br>&nbsp;&nbsp;density | "output_format" | cube + axis_z
199 !% <br>&nbsp;&nbsp;potential | "output_interval" | 20
200 !% <br>%<br></tt>
201 !% Missing information for the incomplete blocks will be parsed form the out-of-block
202 !% definitions. It is also possible to mix the order of columns in the tagged format.
203 !% See <tt>OutputFormat</tt>, and <tt>OutputInterval</tt>.
204 !%Option potential 1
205 !% Outputs Kohn-Sham potential, separated by parts. File names are <tt>v0</tt> for
206 !% the local part of the ionic potential, <tt>vc</tt> for the classical potential (if it exists),
207 !% <tt>vh</tt> for the Hartree potential, <tt>vks</tt> for the local part of the Kohn-Sham potential, and
208 !% <tt>vxc-</tt> for the exchange-correlation potentials. For <tt>vks</tt> and <tt>vxc</tt>,
209 !% a suffix for spin is added in the spin-polarized case.
210 !%Option density 2
211 !% Outputs density. The output file is called <tt>density-</tt>, or <tt>lr_density-</tt> in linear response.
212 !%Option wfs 3
213 !% Outputs wavefunctions. Which wavefunctions are to be printed is specified
214 !% by the variable <tt>OutputWfsNumber</tt> -- see below. The output file is called
215 !% <tt>wf-</tt>, or <tt>lr_wf-</tt> in linear response.
216 !%Option wfs_sqmod 4
217 !% Outputs modulus squared of the wavefunctions.
218 !% The output file is called <tt>sqm-wf-</tt>. For linear response, the filename is <tt>sqm_lr_wf-</tt>.
219 !%Option geometry 5
220 !% Outputs file containing the coordinates of the atoms treated within quantum mechanics.
221 !% If <tt>OutputFormat = xyz</tt>, the file is called <tt>geometry.xyz</tt>; a
222 !% file <tt>crystal.xyz</tt> is written with a supercell geometry if the system is periodic;
223 !% if point charges were defined in the PDB file (see <tt>PDBCoordinates</tt>), they will be output
224 !% in the file <tt>geometry_classical.xyz</tt>.
225 !% If <tt>OutputFormat = xcrysden</tt>, a file called <tt>geometry.xsf</tt> is written.
226 !%Option current 6
227 !% Outputs the total current density. The output file is called <tt>current-</tt>.
228 !% For linear response, the filename is <tt>lr_current-</tt>.
229 !%Option ELF 7
230 !% Outputs electron localization function (ELF). The output file is called <tt>elf-</tt>.
231 !% Only in 2D and 3D.
232 !%Option ELF_basins 8
233 !% Outputs basins of attraction of the ELF. The output file is called
234 !% <tt>elf_rs_basins.info</tt>. Only in 2D and 3D.
235 !%Option Bader 9
236 !% Outputs Laplacian of the density which shows lone pairs, bonded charge concentrations
237 !% and regions subject to electrophilic or nucleophilic attack.
238 !% See RF Bader, <i>Atoms in Molecules: A Quantum Theory</i> (Oxford Univ. Press, Oxford, 1990).
239 !%Option el_pressure 10
240 !% Outputs electronic pressure. See Tao, Vignale, and Tokatly, <i>Phys Rev Lett</i> <b>100</b>, 206405 (2008).
241 !%Option matrix_elements 11
242 !% Outputs a series of matrix elements of the Kohn-Sham states. What is output can
243 !% be controlled by the <tt>OutputMatrixElements</tt> variable.
244 !%Option pol_density 12
245 !% Outputs dipole-moment density <tt>dipole_density-</tt>, or polarizability density <tt>alpha_density-</tt>
246 !% in linear response. If <tt>ResponseMethod = finite_differences</tt>, the hyperpolarizability density
247 !% <tt>beta_density-</tt> is also printed.
248 !%Option mesh_r 13
249 !% Outputs values of the coordinates over the grid. Files
250 !% will be called <tt>mesh_r-</tt> followed by the direction.
251 !%Option kinetic_energy_density 14
252 !% Outputs kinetic-energy density, defined as:
253 !%
254 !% <math>\tau_\sigma(\vec{r}) = \sum_{i=1}^{N_\sigma}
255 !% \left| \vec{\nabla} \phi_{i\sigma}(\vec{r}) \right|^2\,. </math>
256 !%
257 !% The index <math>\sigma</math> is the spin index for the spin-polarized case,
258 !% or if you are using spinors. For spin-unpolarized calculations, you
259 !% get the total kinetic-energy density. The previous expression assumes full
260 !% or null occupations. If fractional occupation numbers, each term in the sum
261 !% is weighted by the occupation. Also, if we are working with an infinite
262 !% system, all <i>k</i>-points are summed up, with their corresponding weights. The
263 !% files will be called <tt>tau-sp1</tt> and <tt>tau-sp2</tt>, if the spin-resolved kinetic
264 !% energy density is produced (runs in spin-polarized and spinors mode), or
265 !% only <tt>tau</tt> if the run is in spin-unpolarized mode.
266 !%
267 !% Note that the code does not the U(1)gauge-invariant kinetic energy density, but simply the kinetic energy density.
268 !%Option dos 15
269 !% Outputs density of states. See <tt>DOSEnergyMax</tt>, <tt>DOSEnergyMin</tt>, <tt>DOSEnergyPoints</tt>,
270 !% and <tt>DOSGamma</tt>.
271 !%Option tpa 16
272 !% Outputs transition-potential approximation (TPA) matrix elements, using <math>\vec{q}</math>-vector specified
273 !% by <tt>MomentumTransfer</tt>.
274 !%Option forces 17
275 !% Outputs file <tt>forces.xsf</tt> containing structure and forces on the atoms as
276 !% a vector associated with each atom, which can be visualized with XCrySDen.
277 !%Option wfs_fourier 18
278 !% (Experimental) Outputs wavefunctions in Fourier space. This is
279 !% only implemented for the ETSF file format output. The file will
280 !% be called <tt>wfs-pw-etsf.nc</tt>.
281 !%Option xc_density 19
282 !% Outputs the XC density, which is the charge density that
283 !% generates the XC potential. (This is <math>-1/4\pi</math> times
284 !% the Laplacian of the XC potential). The files are called <tt>nxc</tt>.
285 !%Option PES_wfs 20
286 !% Outputs the photoelectron wavefunctions. The file name is <tt>pes_wfs-</tt>
287 !% plus the orbital number.
288 !%Option PES_density 21
289 !% Outputs the photolectron density. Output file is <tt>pes_dens-</tt> plus spin species if
290 !% spin-polarized calculation is performed.
291 !%Option PES 22
292 !% Outputs the time-dependent photoelectron spectrum.
293 !%Option BerkeleyGW 23
294 !% Output for a run with <a href=http://www.berkeleygw.org>BerkeleyGW</a>.
295 !% See <tt>Output::BerkeleyGW</tt> for further specification.
296 !%Option delta_perturbation 24
297 !% Outputs the "kick", or time-delta perturbation applied to compute optical response in real time.
298 !%Option external_td_potential 25
299 !% Outputs the (scalar) time-dependent potential.
300 !%Option mmb_wfs 26
301 !% Triggers the ModelMB wavefunctions to be output for each state.
302 !%Option mmb_den 27
303 !% Triggers the ModelMB density matrix to be output for each state, and the particles
304 !% specified by the <tt>DensitytoCalc</tt> block. Calculates, and outputs, the reduced density
305 !% matrix. For the moment the trace is made over the second dimension, and
306 !% the code is limited to 2D. The idea is to model <i>N</i> particles in 1D as an
307 !% <i>N</i>-dimensional non-interacting problem, then to trace out <i>N</i>-1 coordinates.
308 !%Option potential_gradient 28
309 !% Prints the gradient of the potential.
310 !%Option energy_density 29
311 !% Outputs the total energy density to a file called
312 !% <tt>energy_density</tt>.
313 !%Option heat_current 30
314 !% Outputs the total heat current density. The output file is
315 !% called <tt>heat_current-</tt>.
316 !%Option photon_correlator 31
317 !% Outputs the electron-photon correlation function. The output file is
318 !% called <tt>photon_correlator</tt>.
319 !%Option J_flow 32
320 !% todo: document J_flow option!
321 !%Option current_kpt 33
322 !% Outputs the current density resolved in momentum space. The output file is called <tt>current_kpt-</tt>.
323 !%Option density_kpt 34
324 !% Outputs the electronic density resolved in momentum space.
325 !%Option occ_matrices 35
326 !% Only for DFT+U calculations.
327 !% Outputs the occupation matrices of DFT+U
328 !%Option effectiveU 36
329 !% Only for DFT+U calculations.
330 !% Outputs the value of the effectiveU for each atoms
331 !%Option magnetization 37
332 !% Only for DFT+U calculations.
333 !% Outputs file containing structure and magnetization of the localized subspace
334 !% on the atoms as a vector associated with each atom, which can be visualized.
335 !% For the moment, it only works if a +U is added on one type of orbital per atom.
336 !%Option local_orbitals 38
337 !% Only for DFT+U calculations.
338 !% Outputs the localized orbitals that form the correlated subspace
339 !%Option kanamoriU 39
340 !% Only for DFT+U calculations.
341 !% Outputs the Kanamori interaction parameters U, U`, and J.
342 !% These parameters are not determined self-consistently, but are taken from the
343 !% occupation matrices and Coulomb integrals comming from a standard +U calculation.
344 !%Option xc_torque 40
345 !% Outputs the exchange-correlation torque. Only for the spinor case and in the 3D case.
346 !%Option eigenval_kpt 41
347 !% Outputs the eigenvalues resolved in momentum space, with one file for each band.
348 !%Option stress 42
349 !% Outputs the stress tensor and each of its contributing terms
350 !%Option current_dia 43
351 !% Outputs the diamagnetic current density from a non-uniform vector potential.
352 !% The output file is called <tt>current_dia-</tt>.
353 !%Option jdos 44
354 !% Outputs the joint density of states.
355 !% The same variables as for the regular DOS are used to control the energies and broadening.
356 !%Option ldos 45
357 !% Outputs the local density of states
358 !% The broadening uses the same value as the regular DOS. The energies at which the LDOS is computed are
359 !% specified by the <tt>LDOSEnergies</tt> block.
360 !%Option pdos 46
361 !% Outputs the projected density of states.
362 !% At the moment, the PDOS is computed from the bare pseudo-atomic orbitals, directly taken from
363 !% the pseudopotentials. The orbitals are not orthonormalized, in order to preserve their
364 !% atomic orbitals character. As a consequence, the sum of the different PDOS does not integrate
365 !% to the total DOS.
366 !%
367 !% The radii of the orbitals are controled by the threshold defined by <tt>AOThreshold</tt>,
368 !% and the fact that they are normalized or not by <tt>AONormalize</tt>.
369 !%End
370
371 !%Variable OutputFormat
372 !%Type flag
373 !%Default 0
374 !%Section Output
375 !%Description
376 !% Describes the format of the output files.
377 !% This variable can also be defined inside the <tt>Output</tt> block.
378 !% See <tt>Output</tt>.
379 !% Example: <tt>axis_x + plane_x + dx</tt>
380 !%Option axis_x bit(0)
381 !% The values of the function on the <i>x</i> axis are printed. The string <tt>.y=0,z=0</tt> is appended
382 !% to previous file names.
383 !% For non-orthogonal cells, this correspond to the first lattice vector instead the x axis.
384 !%Option axis_y bit(1)
385 !% The values of the function on the <i>y</i> axis are printed. The string <tt>.x=0,z=0</tt> is appended
386 !% to previous file names.
387 !% For non-orthogonal cells, this correspond to the second lattice vector instead the y axis.
388 !%Option axis_z bit(2)
389 !% The values of the function on the <i>z</i> axis are printed. The string <tt>.x=0,y=0</tt> is appended
390 !% to previous file names.
391 !% For non-orthogonal cells, this correspond to the third lattice vector instead the z axis.
392 !%Option plane_x bit(3)
393 !% A plane slice at <i>x</i> = 0 is printed. The string <tt>.x=0</tt> is appended
394 !% to previous file names.
395 !%Option plane_y bit(4)
396 !% A plane slice at <i>y</i> = 0 is printed. The string <tt>.y=0</tt> is appended
397 !% to previous file names.
398 !%Option plane_z bit(5)
399 !% A plane slice at <i>z</i> = 0 is printed. The string <tt>.z=0</tt> is appended to
400 !% previous file names.
401 !%Option dx bit(6)
402 !% For printing three-dimensional information, the open-source program
403 !% visualization tool <a href=http://www.opendx.org>OpenDX</a> can be used. The string
404 !% <tt>.dx</tt> is appended to previous file names. Available only in 3D.
405 !%Option netcdf bit(7)
406 !% Outputs in <a href=http://www.unidata.ucar.edu/packages/netcdf>NetCDF</a> format. This file
407 !% can then be read, for example, by OpenDX. The string <tt>.ncdf</tt> is appended to previous file names.
408 !% Requires the NetCDF library. Only writes the real part of complex functions.
409 !%Option mesh_index bit(8)
410 !% Generates output files of a given quantity (density, wavefunctions, ...) which include
411 !% the internal numbering of mesh points. Since this mode produces large datafiles this is only
412 !% useful for small meshes and debugging purposes.
413 !% The output can also be used to display the mesh directly. A Gnuplot script for mesh visualization
414 !% can be found under <tt>PREFIX/share/octopus/util/display_mesh_index.gp</tt>.
415 !%Option xcrysden bit(9)
416 !% A format for printing structures and three-dimensional information, which can be visualized by
417 !% the free open-source program <a href=http://www.xcrysden.org>XCrySDen</a> and others. The string
418 !% <tt>.xsf</tt> is appended to previous file names. Note that lattice vectors and coordinates are as
419 !% specified by <tt>UnitsOutput</tt>. Available in 2D and 3D.
420 !%Option matlab bit(10)
421 !% In combination with <tt>plane_x</tt>, <tt>plane_y</tt> and
422 !% <tt>plane_z</tt>, this option produces output files which are
423 !% suitable for 2D Matlab functions like <tt>mesh()</tt>,
424 !% <tt>surf()</tt>, or <tt>waterfall()</tt>. To load these files
425 !% into Matlab you can use, <i>e.g.</i>
426 !%<tt>
427 !% >> density = load('static/density-1.x=0.matlab.abs');
428 !% >> mesh(density);
429 !%</tt>
430 !%Option meshgrid bit(11)
431 !% Outputs in Matlab mode the internal mesh in a format similar to
432 !%<tt>
433 !% >> [x,y] = meshgrid(-2:.2:2,-1:.15:1)
434 !%</tt>
435 !% The <i>x</i> meshgrid is contained in a file <tt>*.meshgrid.x</tt> and the <i>y</i>-grid can be found in
436 !% <tt>*.meshgrid.y</tt>.
437 !%Option boundary_points bit(12)
438 !% This option includes the output of the mesh enlargement. Default is without.
439 !% Supported only by <tt>binary</tt>, <tt>axis</tt>, <tt>plane</tt>, <tt>mesh_index</tt>,
440 !% and <tt>matlab</tt> formats.
441 !% Not all types of <tt>Output</tt> will have this information available. Not supported when parallel in domains.
442 !%Option binary bit(13)
443 !% Plain binary, new format.
444 !%Option xyz bit(15)
445 !% Geometry will be output in XYZ format. Does not affect other outputs.
446 !%Option cube bit(16)
447 !% Generates output in the <a href=http://paulbourke.net/dataformats/cube>cube file format</a>.
448 !% Available only in 3D. Only writes the real part of complex functions.
449 !% This output format always uses atomic units.
450 !%Option bild bit(19)
451 !% Generates output in <a href=http://plato.cgl.ucsf.edu/chimera/docs/UsersGuide/bild.html>BILD format</a>.
452 !%Option vtk bit(20)
453 !% Generates output in <a href=http://www.vtk.org/VTK/img/file-formats.pdf>VTK legacy format</a>.
454 !%Option integrate_xy bit(21)
455 !% Integrates the function in the x-y plane and the result on the <i>z</i> axis is printed.
456 !%Option integrate_xz bit(22)
457 !% Integrates the function in the x-z plane and the result on the <i>y</i> axis is printed
458 !%Option integrate_yz bit(23)
459 !% Integrates the function in the y-z plane and the result on the <i>x</i> axis is printed
460 !%Option ascii bit(24)
461 !% Plain text format regardless of dimensionality. For the moment only employed by the oct-phototoelectron_spectrum
462 !% post-processing utility.
463 !%Option poscar bit(25)
464 !% Write geometry in POSCAR format.
465 !% Note that atoms are not ordered by labels and that species names are taken from the Octopus input,
466 !% and are not truncated to two letters.
467 !%End
468
469 !%Variable OutputInterval
470 !%Type integer
471 !%Default 50
472 !%Section Output
473 !%Description
474 !% The output requested by variable <tt>Output</tt> is written
475 !% to the directory <tt>OutputIterDir</tt>
476 !% when the iteration number is a multiple of the <tt>OutputInterval</tt> variable.
477 !% Subdirectories are named Y.X, where Y is <tt>td</tt>, <tt>scf</tt>, or <tt>unocc</tt>, and
478 !% X is the iteration number. To use the working directory, specify <tt>"."</tt>
479 !% Must be >= 0. If it is 0, then no output is written. For <tt>gs</tt> and <tt>unocc</tt>
480 !% calculations, <tt>OutputDuringSCF</tt> must be set too for this output to be produced.
481 !% This variable can also be defined inside the <tt>Output</tt> block.
482 !% See <tt>Output</tt>.
483 !%End
484
485
486 what_no_how = (/ &
487 option__output__matrix_elements, &
488 option__output__berkeleygw, &
489 option__output__dos, &
490 option__output__tpa, &
491 option__output__mmb_den, &
492 option__output__j_flow, &
493 option__output__occ_matrices, &
494 option__output__effectiveu, &
495 option__output__magnetization, &
496 option__output__kanamoriu, &
497 option__output__stress, &
498 option__output__jdos, &
499 option__output__pdos &
500 /)
501
502 if (parse_block(namespace, what_tag, blk) == 0) then
503 nrows = parse_block_n(blk)
504 do iout = 0, nrows - 1
505 ncols = max(ncols , parse_block_cols(blk, iout))
506 end do
507
508 if (ncols == 1) then
509 !new format, Type 0
510 !%Output
511 ! density
512 ! wfs
513 !%
514 do iout = 1, nrows
515 call parse_block_integer(blk, iout - 1, 0, what_i)
516 if (.not. varinfo_valid_option(what_tag, what_i)) then
517 call messages_input_error(namespace, what_tag)
518 end if
519 if (what_i > 0) then
520 what(what_i) = .true.
521 call parse_variable(namespace, output_interval_tag, 50, output_interval(what_i))
522 if (((what_tag == 'Output') .and. (.not. any(what_no_how == what_i)))&
523 .or. (what_tag /= 'Output')) then
524 call parse_variable(namespace, how_tag, 0, how(what_i))
525 if (.not. varinfo_valid_option(how_tag, how(what_i), is_flag=.true.)) then
526 call messages_input_error(namespace, how_tag)
527 end if
528 end if
529 end if
530 end do
531 else if (ncols == 2) then
532 !new format, Type 1
533 !%Output
534 ! density | cube + axis_z
535 ! wfs | cube
536 !%
537
538 do iout = 1, nrows
539 call parse_block_integer(blk, iout - 1, 0, what_i)
540 if (.not. varinfo_valid_option(what_tag, what_i)) then
541 call messages_input_error(namespace, what_tag)
542 end if
543 if (what_i > 0) then
544 what(what_i) = .true.
545 call parse_variable(namespace, output_interval_tag, 50, output_interval(what_i))
546 if (((what_tag == 'Output') .and. (.not. any(what_no_how == what_i)))&
547 .or. (what_tag /= 'Output')) then
548 call parse_block_integer(blk, iout - 1, 1, how(what_i))
549 if (how(what_i) == 0) call parse_variable(namespace, how_tag, 0, how(what_i))
550 if (.not. varinfo_valid_option(how_tag, how(what_i), is_flag=.true.)) then
551 call messages_input_error(namespace, how_tag)
552 end if
553 end if
554 end if
555 end do
556
557 else
558 !new format, Type 2 (tagged)
559 !%Output
560 ! density | "output_interval" | 10 | "output_format" | cube + axis_z
561 ! wfs | "output_format" | cube | "output_interval" | 50
562 !%
563 !
564 ! OR
565 !
566 !%Output
567 ! density | "output_interval" | 10 | "output_format" | cube + axis_z
568 ! wfs | "output_format" | cube
569 !%
570 do iout = 1, nrows
571 call parse_block_integer(blk, iout - 1, 0, what_i)
572 if (.not. varinfo_valid_option(what_tag, what_i)) then
573 call messages_input_error(namespace, what_tag)
574 end if
575 if (what_i > 0) then
576 what(what_i) = .true.
577 do column_index = 0, 1
578 call parse_block_string(blk, iout - 1, 1 + column_index * 2, output_column_marker)
579 if (output_column_marker == 'output_interval') then
580 call parse_block_integer(blk, iout - 1, 2 + column_index * 2, output_interval(what_i))
581 else if (output_column_marker == 'output_format') then
582 if (((what_tag == 'Output') .and. (.not. any(what_no_how == what_i)))&
583 .or. (what_tag /= 'Output')) then
584 call parse_block_integer(blk, iout - 1, 2 + column_index * 2, how(what_i))
585 if (.not. varinfo_valid_option(how_tag, how(what_i), is_flag=.true.)) then
586 call messages_input_error(namespace, how_tag)
587 end if
588 end if
589 else if (len_trim(output_column_marker) /= 0) then
590 ! Unknown output_column_marker
591 call messages_input_error(namespace, what_tag)
592 else
593 ! no output_column_marker -> full output info is not in this block
594 if (output_interval(what_i) == 0) then
595 call parse_variable(namespace, output_interval_tag, 50, output_interval(what_i))
596 end if
597 if (how(what_i) == 0) then
598 if (((what_tag == 'Output') .and. (.not. any(what_no_how == what_i)))&
599 .or. (what_tag /= 'Output')) then
600 call parse_variable(namespace, how_tag, 0, how(what_i))
601 if (.not. varinfo_valid_option(how_tag, how(what_i), is_flag=.true.)) then
602 call messages_input_error(namespace, how_tag)
603 end if
604 end if
605 end if
606 end if
607 end do
608 end if
609 end do
610 end if
611 call parse_block_end(blk)
612 else
613
614 call messages_variable_is_block(namespace, what_tag)
615
616 ! Output block does not exist but we may have OutputHow/OutputInterval
617 call parse_variable(namespace, how_tag, 0, how(0))
618 call parse_variable(namespace, output_interval_tag, 50, output_interval(0))
619 end if
620
621
622 do what_i = lbound(what, 1), ubound(what, 1)
623 if (what_tag == 'Output') then
624 if (what(what_i) .and. (.not. any(what_no_how == what_i))) then
625 if (.not. varinfo_valid_option(how_tag, how(what_i), is_flag=.true.)) then
626 call messages_input_error(namespace, how_tag)
627 end if
628
629 if (how(what_i) == 0 .and. .not. optional_default(ignore_error, .false.)) then
630 write(message(1), '(a)') 'Must specify output method with variable OutputFormat.'
631 call messages_fatal(1, only_root_writes = .true., namespace=namespace)
632 end if
633
634 ! some modes are not available in some circumstances
635 if (space%dim == 1) then
636 if (bitand(how(what_i), option__outputformat__axis_y) /= 0) then
637 message(1) = "OutputFormat = axis_y not available with Dimensions = 1."
638 call messages_fatal(1, namespace=namespace)
639 end if
640 if (bitand(how(what_i), option__outputformat__plane_z) /= 0) then
641 message(1) = "OutputFormat = plane_z not available with Dimensions = 1."
642 call messages_fatal(1, namespace=namespace)
643 end if
644 if (bitand(how(what_i), option__outputformat__xcrysden) /= 0) then
645 message(1) = "OutputFormat = xcrysden not available with Dimensions = 1."
646 call messages_fatal(1, namespace=namespace)
647 end if
648 end if
649
650 if (space%dim <= 2) then
651 if (bitand(how(what_i), option__outputformat__axis_z) /= 0) then
652 message(1) = "OutputFormat = axis_z not available with Dimensions <= 2."
653 call messages_fatal(1, namespace=namespace)
654 end if
655 if (bitand(how(what_i), option__outputformat__plane_x) /= 0) then
656 message(1) = "OutputFormat = plane_x not available with Dimensions <= 2."
657 call messages_fatal(1, namespace=namespace)
658 end if
659 if (bitand(how(what_i), option__outputformat__plane_y) /= 0) then
660 message(1) = "OutputFormat = plane_y not available with Dimensions <= 2."
661 call messages_fatal(1, namespace=namespace)
662 end if
663 if (bitand(how(what_i), option__outputformat__integrate_xy) /= 0) then
664 message(1) = "OutputFormat = integrate_xy not available with Dimensions <= 2."
665 call messages_fatal(1, namespace=namespace)
666 end if
667 if (bitand(how(what_i), option__outputformat__integrate_xz) /= 0) then
668 message(1) = "OutputFormat = integrate_xz not available with Dimensions <= 2."
669 call messages_fatal(1, namespace=namespace)
670 end if
671 if (bitand(how(what_i), option__outputformat__integrate_yz) /= 0) then
672 message(1) = "OutputFormat = integrate_yz not available with Dimensions <= 2."
673 call messages_fatal(1, namespace=namespace)
674 end if
675 if (bitand(how(what_i), option__outputformat__dx) /= 0) then
676 message(1) = "OutputFormat = dx not available with Dimensions <= 2."
677 call messages_fatal(1, namespace=namespace)
678 end if
679 if (bitand(how(what_i), option__outputformat__cube) /= 0) then
680 message(1) = "OutputFormat = cube not available with Dimensions <= 2."
681 call messages_fatal(1, namespace=namespace)
682 end if
683 if (bitand(how(what_i), option__outputformat__poscar) /= 0) then
684 message(1) = "OutputFormat = POSCAR not available with Dimensions <= 2."
685 call messages_fatal(1, namespace=namespace)
686 end if
687 end if
688
689 if (space%periodic_dim<=2) then
690 if (bitand(how(what_i), option__outputformat__poscar) /= 0) then
691 message(1) = "OutputFormat = POSCAR not available with periodic_dim <= 2."
692 call messages_fatal(1, namespace=namespace)
693 end if
694 end if
695
696#if !defined(HAVE_NETCDF)
697 if (bitand(how(what_i), option__outputformat__netcdf) /= 0) then
698 message(1) = 'Octopus was compiled without NetCDF support.'
699 message(2) = 'It is not possible to write output in NetCDF format.'
700 call messages_fatal(2, namespace=namespace)
701 end if
702#endif
703
704
705 end if
706 end if
707
708 if (output_interval(what_i) < 0) then
709 message(1) = "OutputInterval must be >= 0."
710 call messages_fatal(1, namespace=namespace)
711 end if
712 end do
713
715 end subroutine io_function_read_what_how_when
716
717 ! -------------------------------------------------------------------
720 ! ".", "func", mesh, sb, func, M_ONE, ierr)
721 ! -------------------------------------------------------------------
722 integer(int64) function io_function_fill_how(where) result(how)
723 character(len=*), intent(in) :: where
724
725 push_sub(io_function_fill_how)
726
727 how = 0
728 if (index(where, "AxisX") /= 0) how = ior(how, option__outputformat__axis_x)
729 if (index(where, "AxisY") /= 0) how = ior(how, option__outputformat__axis_y)
730 if (index(where, "AxisZ") /= 0) how = ior(how, option__outputformat__axis_z)
731 if (index(where, "PlaneX") /= 0) how = ior(how, option__outputformat__plane_x)
732 if (index(where, "PlaneY") /= 0) how = ior(how, option__outputformat__plane_y)
733 if (index(where, "PlaneZ") /= 0) how = ior(how, option__outputformat__plane_z)
734 if (index(where, "IntegrateXY") /= 0) how = ior(how, option__outputformat__integrate_xy)
735 if (index(where, "IntegrateXZ") /= 0) how = ior(how, option__outputformat__integrate_xz)
736 if (index(where, "IntegrateYZ") /= 0) how = ior(how, option__outputformat__integrate_yz)
737 if (index(where, "DX") /= 0) how = ior(how, option__outputformat__dx)
738 if (index(where, "XCrySDen") /= 0) how = ior(how, option__outputformat__xcrysden)
739 if (index(where, "Binary") /= 0) how = ior(how, option__outputformat__binary)
740 if (index(where, "MeshIndex") /= 0) how = ior(how, option__outputformat__mesh_index)
741 if (index(where, "XYZ") /= 0) how = ior(how, option__outputformat__xyz)
742#if defined(HAVE_NETCDF)
743 if (index(where, "NETCDF") /= 0) how = ior(how, option__outputformat__netcdf)
744#endif
745 if (index(where, "Cube") /= 0) how = ior(how, option__outputformat__cube)
746 if (index(where, "VTK") /= 0) how = ior(how, option__outputformat__vtk)
747 if (index(where, "ASCII") /= 0) how = ior(how, option__outputformat__ascii)
748 if (index(where, "Bild") /= 0) how = ior(how, option__outputformat__bild)
749
750 pop_sub(io_function_fill_how)
751 end function io_function_fill_how
752
757 subroutine write_standard_xyz_file(namespace, fname, pos, species, header)
758 type(namespace_t), intent(in) :: namespace
759 character(len=*), intent(in) :: fname
760 real(real64), contiguous, intent(in) :: pos(:,:)
761 character(len=*), contiguous, intent(in) :: species(:)
762 character(len=*), optional, intent(in) :: header
763
764 integer :: iunit, n_atoms, iatom, min_dim
765 real(real64) :: position(3)
766
768
769 n_atoms = size(pos, 2)
770 assert(size(species) == n_atoms)
771
772 iunit = io_open(trim(fname)//'.xyz', namespace, action='write', position='asis')
773
774 write(iunit, '(i6)') n_atoms
775 if (present(header)) then
776 write(iunit, '(a)') trim(adjustl(header))
777 else
778 write(iunit, '(a)')
779 endif
780
781 ! Ensure a set of three coordinate components is written for 1D, 2D and ND systems
782 min_dim = min(size(pos, 1), 3)
783 position(1:3) = 0.0_real64
784
785 ! xyz-style labels and positions:
786 do iatom = 1, n_atoms
787 position(1:min_dim) = units_from_atomic(unit_angstrom, pos(1:min_dim, iatom))
788 write(iunit, '(a10, 3(1x, f13.8))') trim(adjustl(species(iatom))), position
789 end do
790
791 call io_close(iunit)
792
794
795 end subroutine write_standard_xyz_file
796
802 subroutine write_canonicalized_xyz_file(dir, fname, space, latt, pos, atoms, box, namespace)
803 character(len=*), intent(in) :: dir
804 character(len=*), intent(in) :: fname
805 class(space_t), intent(in) :: space
806 type(lattice_vectors_t), intent(in) :: latt
807 real(real64), contiguous, intent(in) :: pos(:,:)
808 type(atom_t), contiguous, intent(in) :: atoms(:)
809 class(box_t), intent(in) :: box
810 type(namespace_t), intent(in) :: namespace
811
812 integer :: ia
813 character(len=:), allocatable :: info_str, dir_fname
814 character(len=LABEL_LEN), allocatable :: species(:)
815
818 call io_mkdir(dir, namespace)
819
820 info_str = trim(space%short_info()) // '; ' // trim(box%short_info(unit_angstrom))
821 if (space%is_periodic()) then
822 info_str = info_str // '; ' // trim(latt%short_info(unit_angstrom))
823 end if
824
825 safe_allocate(species(1:size(atoms)))
826 do ia = 1, size(atoms)
827 species(ia) = atoms(ia)%get_label()
828 enddo
829
830 dir_fname = trim(dir) // '/' // trim(fname)
831 call write_standard_xyz_file(namespace, dir_fname, pos, species, info_str)
832
833 safe_deallocate_a(species)
834
836
837 end subroutine write_canonicalized_xyz_file
838
842 subroutine write_extended_xyz_file(dir, fname, space, latt, pos, atoms, box, namespace)
843 character(len=*), intent(in) :: dir
844 character(len=*), intent(in) :: fname
845 class(space_t), intent(in) :: space
846 type(lattice_vectors_t), intent(in) :: latt
847 real(real64), contiguous, intent(in) :: pos(:,:)
848 type(atom_t), contiguous, intent(in) :: atoms(:)
849 class(box_t), intent(in) :: box
850 type(namespace_t), intent(in) :: namespace
851
852 integer :: ia, i, j
853 character(len=512), allocatable :: info_str
854 character(len=:), allocatable :: dir_fname
855 character(len=LABEL_LEN), allocatable :: species(:)
856
858
859 assert(space%dim == 3)
860
861 call io_mkdir(dir, namespace)
862
863 select case (space%periodic_dim)
864 case (0); info_str = "PBC = [ F, F, F]"
865 case (1); info_str = "PBC = [ T, F, F]"
866 case (2); info_str = "PBC = [ T, T, F]"
867 case (3); info_str = "PBC = [ T, T, T]"
868 end select
869
870 write(info_str, '(A, "; Lattice = """, 9(F13.8,","), """")') &
871 trim(info_str), &
872 (( units_from_atomic(unit_angstrom, latt%rlattice(j,i)), j = 1, 3 ), i = 1, 3)
873
874 safe_allocate(species(1:size(atoms)))
875 do ia = 1, size(atoms)
876 species(ia) = atoms(ia)%get_label()
877 enddo
878
879 dir_fname = trim(dir) // '/' // trim(fname)
880 call write_standard_xyz_file(namespace, dir_fname, pos, species, info_str)
881
882 safe_deallocate_a(species)
883
885 end subroutine write_extended_xyz_file
886
887 subroutine write_xsf_geometry_file(dir, fname, space, latt, pos, atoms, mesh, mpi_grp, namespace, total_forces)
888 character(len=*), intent(in) :: dir, fname
889 class(space_t), intent(in) :: space
890 type(lattice_vectors_t), intent(in) :: latt
891 real(real64), contiguous, intent(in) :: pos(:,:)
892 type(atom_t), contiguous, intent(in) :: atoms(:)
893 class(mesh_t), intent(in) :: mesh
894 type(mpi_grp_t), intent(in) :: mpi_grp
895 type(namespace_t), intent(in) :: namespace
896 real(real64), contiguous, optional, intent(in) :: total_forces(:,:)
898 integer :: iunit
899 real(real64), allocatable :: forces(:,:)
900
901 if (.not. mpi_grp%is_root()) return
902
904
905 call io_mkdir(dir, namespace)
906 iunit = io_open(trim(dir)//'/'//trim(fname)//'.xsf', namespace, action='write', position='asis')
907
908 if (present(total_forces)) then
909 safe_allocate(forces(1:space%dim, 1:size(atoms)))
910 forces = units_from_atomic(units_out%force, total_forces)
911 call write_xsf_geometry(iunit, space, latt, pos, atoms, mesh, forces = forces)
912 safe_deallocate_a(forces)
913 else
914 call write_xsf_geometry(iunit, space, latt, pos, atoms, mesh)
915 end if
916
917 call io_close(iunit)
918
920 end subroutine write_xsf_geometry_file
921
922 ! ---------------------------------------------------------
925 subroutine write_xsf_geometry(iunit, space, latt, pos, atoms, mesh, forces, index)
926 integer, intent(in) :: iunit
927 class(space_t), intent(in) :: space
928 type(lattice_vectors_t), intent(in) :: latt
929 real(real64), intent(in) :: pos(:,:)
930 type(atom_t), intent(in) :: atoms(:)
931 class(mesh_t), intent(in) :: mesh
932 real(real64), contiguous, optional, intent(in) :: forces(:, :)
933 integer, optional, intent(in) :: index
934
935 integer :: idir, idir2, iatom, index_, natoms
936 character(len=7) :: index_str
937 real(real64) :: offset(space%dim)
938 real(real64) :: rlattice(space%dim, space%dim)
939
940 push_sub(write_xsf_geometry)
941
942 if (present(index)) then
943 write(index_str, '(a,i6)') ' ', index
944 index_ = index
945 else
946 write(index_str, '(a)') ''
947 index_ = 1
948 end if
949 natoms = size(pos, dim=2)
950
951 ! The corner of the cell is always (0,0,0) to XCrySDen
952 ! so the offset is applied to the atomic coordinates.
953 ! Along periodic dimensions the offset is -1/2 in reduced coordinates, as
954 ! our origin is at the center of the cell instead of being at the edge.
955 offset(1:space%dim) = latt%red_to_cart(spread(-m_half, 1, space%dim))
956 ! Offset in aperiodic directions:
957 do idir = space%periodic_dim + 1, space%dim
958 offset(idir) = -(mesh%idx%ll(idir) - 1)/2 * mesh%spacing(idir)
959 end do
960
961 if (space%is_periodic()) then
962 if (index_ == 1) then
963 select case (space%periodic_dim)
964 case (3)
965 write(iunit, '(a)') 'CRYSTAL'
966 case (2)
967 write(iunit, '(a)') 'SLAB'
968 case (1)
969 write(iunit, '(a)') 'POLYMER'
970 end select
971 end if
972
973 write(iunit, '(a)') 'PRIMVEC'//trim(index_str)
974
975 !Computes the rlattice corresponding to the 3D periodic version of the simulation box
976 rlattice = latt%rlattice
977 do idir = space%periodic_dim+1, space%dim
978 rlattice(:,idir) = rlattice(:,idir)*m_two*mesh%box%bounding_box_l(idir)
979 end do
980
981 do idir = 1, space%dim
982 write(iunit, '(3f12.6)') (units_from_atomic(units_out%length, rlattice(idir2, idir)), idir2 = 1, space%dim)
983 end do
984
985 write(iunit, '(a)') 'PRIMCOORD'//trim(index_str)
986 write(iunit, '(i10, a)') natoms, ' 1'
987 else
988 write(iunit, '(a)') 'ATOMS'//trim(index_str)
989 end if
990
991 ! BoxOffset should be considered here
992 do iatom = 1, natoms
993 write(iunit, '(a10, 3f12.6)', advance='no') trim(atoms(iatom)%label), &
994 (units_from_atomic(units_out%length, pos(idir, iatom) - offset(idir)), idir = 1, space%dim)
995 if (present(forces)) then
996 write(iunit, '(5x, 3f12.6)', advance='no') forces(:, iatom)
997 end if
998 write(iunit, '()')
999 end do
1000
1001 pop_sub(write_xsf_geometry)
1002 end subroutine write_xsf_geometry
1003
1004! ---------------------------------------------------------
1007 subroutine write_xsf_geometry_supercell(iunit, space, latt, pos, atoms, mesh, centers, supercell, extra_atom)
1008 integer, intent(in) :: iunit
1009 class(space_t), intent(in) :: space
1010 type(lattice_vectors_t), intent(in) :: latt
1011 real(real64), contiguous, intent(in) :: pos(:,:)
1012 type(atom_t), contiguous, intent(in) :: atoms(:)
1013 class(mesh_t), intent(in) :: mesh
1014 real(real64), contiguous, intent(in) :: centers(:, :)
1015 integer, contiguous, intent(in) :: supercell(:)
1016 real(real64), contiguous, optional, intent(in) :: extra_atom(:)
1017
1018 integer :: idir, idir2, iatom, index_
1019 character(len=7) :: index_str
1020 real(real64) :: offset(3)
1021 integer :: irep, nreplica
1022
1024
1025 write(index_str, '(a)') ''
1026 index_ = 1
1027
1028 nreplica = product(supercell(1:space%dim))
1029
1030 ! The corner of the cell is always (0,0,0) to XCrySDen
1031 ! so the offset is applied to the atomic coordinates.
1032 ! Offset in periodic directions:
1033 offset(1:space%dim) = latt%red_to_cart(spread(-m_half, 1, space%dim))
1034 offset(1:3) = offset(1:3) + centers(1:3,1)
1035 ! Offset in aperiodic directions:
1036 do idir = space%periodic_dim + 1, 3
1037 offset(idir) = -(mesh%idx%ll(idir) - 1)/2 * mesh%spacing(idir)
1038 end do
1039
1040 if(space%is_periodic()) then
1041 if(index_ == 1) then
1042 select case(space%periodic_dim)
1043 case(3)
1044 write(iunit, '(a)') 'CRYSTAL'
1045 case(2)
1046 write(iunit, '(a)') 'SLAB'
1047 case(1)
1048 write(iunit, '(a)') 'POLYMER'
1049 end select
1050 end if
1051
1052 write(iunit, '(a)') 'PRIMVEC'//trim(index_str)
1053
1054 do idir = 1, space%dim
1055 write(iunit, '(3f12.6)') (units_from_atomic(units_out%length, &
1056 latt%rlattice(idir2, idir)*supercell(idir)), idir2 = 1, space%dim)
1057 end do
1058
1059 write(iunit, '(a)') 'PRIMCOORD'//trim(index_str)
1060 if(.not.present(extra_atom)) then
1061 write(iunit, '(i10, a)') size(atoms)*nreplica, ' 1'
1062 else
1063 write(iunit, '(i10, a)') size(atoms)*nreplica+1, ' 1'
1064 end if
1065 else
1066 write(iunit, '(a)') 'ATOMS'//trim(index_str)
1067 end if
1068
1069
1070 do irep = 1, nreplica
1071 ! BoxOffset should be considered here
1072 do iatom = 1, size(atoms)
1073 write(iunit, '(a10, 3f12.6)', advance='no') trim(atoms(iatom)%label), &
1074 (units_from_atomic(units_out%length, pos(idir, iatom) + centers(idir, irep) &
1075 - offset(idir)), idir = 1, space%dim)
1076 write(iunit, '()')
1077 end do
1078 end do
1079 if(present(extra_atom)) then
1080 write(iunit, '(a10, 3f12.6)', advance='no') 'X', &
1081 (units_from_atomic(units_out%length, extra_atom(idir) - offset(idir)), idir = 1, space%dim)
1082 write(iunit, '()')
1083 end if
1084
1086 end subroutine write_xsf_geometry_supercell
1087
1088
1089#if defined(HAVE_NETCDF)
1090 ! ---------------------------------------------------------
1091 subroutine ncdf_error(func, status, filename, namespace, ierr)
1092 character(len=*), intent(in) :: func
1093 integer, intent(in) :: status
1094 character(len=*), intent(in) :: filename
1095 type(namespace_t), intent(in) :: namespace
1096 integer, intent(inout) :: ierr
1097
1098 push_sub(ncdf_error)
1099
1100 if (status == nf90_noerr) then
1101 pop_sub(ncdf_error)
1102 return
1103 end if
1104
1105 write(message(1),'(3a)') "NETCDF error in function '" , trim(func) , "'"
1106 write(message(2),'(3a)') "(reading/writing ", trim(filename) , ")"
1107 write(message(3), '(6x,a,a)')'Error code = ', trim(nf90_strerror(status))
1108 call messages_warning(3, namespace=namespace)
1109 ierr = 5
1110
1111 pop_sub(ncdf_error)
1112 end subroutine ncdf_error
1113#endif
1114
1115 ! ---------------------------------------------------------
1116 subroutine transpose3(in, out)
1117 real(real64), intent(in) :: in(:, :, :)
1118 real(real64), contiguous, intent(out) :: out(:, :, :)
1119 integer :: ix, iy, iz
1120
1121 push_sub(transpose3)
1122
1123 do ix = lbound(in, 1), ubound(in, 1)
1124 do iy = lbound(in, 2), ubound(in, 2)
1125 do iz = lbound(in, 3), ubound(in, 3)
1126 out(iz, iy, ix) = in(ix, iy, iz)
1127 end do
1128 end do
1129 end do
1130
1131 pop_sub(transpose3)
1132 end subroutine transpose3
1133
1134#include "undef.F90"
1135#include "real.F90"
1136#include "io_function_inc.F90"
1137
1138#include "undef.F90"
1139#include "complex.F90"
1140#include "io_function_inc.F90"
1141#include "undef.F90"
1142
1143end module io_function_oct_m
1144
1145!! Local Variables:
1146!! mode: f90
1147!! coding: utf-8
1148!! End:
real(real64) function func(r1, rn, n, a)
Definition: logrid.F90:330
Fast Fourier Transform module. This module provides a single interface that works with different FFT ...
Definition: fft.F90:120
real(real64), parameter, public m_two
Definition: global.F90:202
real(real64), parameter, public m_half
Definition: global.F90:206
This module implements the index, used for the mesh points.
Definition: index.F90:124
subroutine zio_function_output_vector_bz(how, dir, fname, namespace, space, kpt, kpoints, ff, unit, ierr, grp, root)
subroutine, public write_canonicalized_xyz_file(dir, fname, space, latt, pos, atoms, box, namespace)
Write canonicalized xyz file with atom labels and positions in Angstroms.
subroutine, public zio_function_output(how, dir, fname, namespace, space, mesh, ff, unit, ierr, pos, atoms, grp, root)
Top-level IO routine for functions defined on the mesh.
subroutine, public dio_function_output_global(how, dir, fname, namespace, space, mesh, ff, unit, ierr)
subroutine, public io_function_read_what_how_when(namespace, space, what, how, output_interval, what_tag_in, how_tag_in, output_interval_tag_in, ignore_error)
subroutine, public zio_function_input(filename, namespace, space, mesh, ff, ierr, map)
Reads a mesh function from file filename, and puts it into ff. If the map argument is passed,...
subroutine, public write_xsf_geometry(iunit, space, latt, pos, atoms, mesh, forces, index)
for format specification see: http:
subroutine zio_function_output_vector(how, dir, fname, namespace, space, mesh, ff, unit, ierr, pos, atoms, grp, root)
subroutine write_xsf_geometry_supercell(iunit, space, latt, pos, atoms, mesh, centers, supercell, extra_atom)
for format specification see: http:
subroutine, public write_extended_xyz_file(dir, fname, space, latt, pos, atoms, box, namespace)
Write an extended xyz file compatible with ASE.
subroutine dio_function_output_supercell(how, dir, fname, mesh, space, latt, ff, centers, supercell, unit, ierr, namespace, pos, atoms, grp, root, is_global, extra_atom)
subroutine, public dio_function_output(how, dir, fname, namespace, space, mesh, ff, unit, ierr, pos, atoms, grp, root)
Top-level IO routine for functions defined on the mesh.
subroutine dio_function_output_vector(how, dir, fname, namespace, space, mesh, ff, unit, ierr, pos, atoms, grp, root)
subroutine transpose3(in, out)
subroutine zio_function_output_supercell(how, dir, fname, mesh, space, latt, ff, centers, supercell, unit, ierr, namespace, pos, atoms, grp, root, is_global, extra_atom)
subroutine, public write_xsf_geometry_file(dir, fname, space, latt, pos, atoms, mesh, mpi_grp, namespace, total_forces)
subroutine dio_function_output_global_bz(how, dir, fname, namespace, kpoints, ff, unit, ierr)
integer, parameter, private zoutput_kind
subroutine, public write_standard_xyz_file(namespace, fname, pos, species, header)
Write a standard xyz file with atom labels and positions (in Angstrom).
subroutine, public zio_function_output_global(how, dir, fname, namespace, space, mesh, ff, unit, ierr)
subroutine dio_function_output_vector_bz(how, dir, fname, namespace, space, kpt, kpoints, ff, unit, ierr, grp, root)
integer(int64) function, public io_function_fill_how(where)
Use this function to quickly plot functions for debugging purposes: call dio_function_output(io_funct...
subroutine, public dio_function_input(filename, namespace, space, mesh, ff, ierr, map)
Reads a mesh function from file filename, and puts it into ff. If the map argument is passed,...
subroutine zio_function_output_global_bz(how, dir, fname, namespace, kpoints, ff, unit, ierr)
Definition: io.F90:116
subroutine, public io_close(iunit, grp)
Definition: io.F90:467
subroutine, public io_mkdir(fname, namespace, parents)
Definition: io.F90:361
integer function, public io_open(file, namespace, action, status, form, position, die, recl, grp)
Definition: io.F90:402
This module defines various routines, operating on mesh functions.
This module defines the meshes, which are used in Octopus.
Definition: mesh.F90:120
subroutine, public messages_variable_is_block(namespace, name)
Definition: messages.F90:1024
subroutine, public messages_warning(no_lines, all_nodes, namespace)
Definition: messages.F90:525
subroutine, public messages_obsolete_variable(namespace, name, rep)
Definition: messages.F90:1000
character(len=256), dimension(max_lines), public message
to be output by fatal, warning
Definition: messages.F90:162
subroutine, public messages_fatal(no_lines, only_root_writes, namespace)
Definition: messages.F90:410
subroutine, public messages_input_error(namespace, var, details, row, column)
Definition: messages.F90:691
Some general things and nomenclature:
Definition: par_vec.F90:173
subroutine, public parse_block_string(blk, l, c, res, convert_to_c)
Definition: parser.F90:818
integer function, public parse_block(namespace, name, blk, check_varinfo_)
Definition: parser.F90:623
brief This module defines the class unit_t which is used by the unit_systems_oct_m module.
Definition: unit.F90:134
This module defines the unit system, used for input and output.
type(unit_t), public unit_angstrom
For XYZ files.
type(unit_system_t), public units_out
This module is intended to contain simple general-purpose utility functions and procedures.
Definition: utils.F90:120
class to tell whether a point is inside or outside
Definition: box.F90:143
Describes mesh distribution to nodes.
Definition: mesh.F90:188
This is defined even when running serial.
Definition: mpi.F90:144
int true(void)