78 type(derivatives_t) :: der
79 type(stencil_t) :: stencil
80 type(symmetries_t) :: symm
81 type(symmetrizer_t) :: symmetrizer
84 integer,
parameter :: &
101 subroutine grid_init_stage_1(gr, namespace, space, grp, symm, latt, n_sites, site_position, variable_cell)
102 type(grid_t),
intent(inout) :: gr
103 type(namespace_t),
intent(in) :: namespace
104 class(space_t),
intent(in) :: space
105 type(mpi_grp_t),
intent(in) :: grp
106 type(symmetries_t),
optional,
intent(in) :: symm
107 type(lattice_vectors_t),
optional,
intent(in) :: latt
108 integer,
optional,
intent(in) :: n_sites
109 real(real64),
optional,
intent(in) :: site_position(:,:)
110 logical,
optional,
intent(in) :: variable_cell
112 type(stencil_t) :: cube
113 integer :: enlarge(space%dim)
116 real(real64) :: grid_spacing(space%dim)
120 gr%box =>
box_factory_create(namespace, space, latt=latt, n_sites=n_sites, site_position=site_position)
122 if (
present(symm))
then
150 if(
parse_block(namespace,
'Spacing', blk) == 0)
then
152 do idir = 1, space%dim
158 grid_spacing = grid_spacing(1)
161 if (any(grid_spacing(1:space%dim) <
m_epsilon))
then
162 message(1) =
" Your input for 'Spacing' is negative or zero."
172 if (
parse_block(namespace,
'PeriodicBoundaryMask', blk) < 0)
then
173 gr%masked_periodic_boundaries = .false.
175 gr%masked_periodic_boundaries = .
true.
201 enlarge = max(enlarge, gr%der%n_ghost)
203 call mesh_init_stage_1(gr, namespace, space, gr%box, gr%coord_system, grid_spacing, enlarge)
212 box, spacing_prefactor, latt, n_sites, site_position)
213 type(
grid_t),
intent(inout) :: gr
214 type(
grid_t),
intent(in) :: original_gr
216 class(
space_t),
intent(in) :: space
218 logical,
intent(in) :: variable_cell
219 class(
box_t),
target,
optional,
intent(in) :: box
220 real(real64),
optional,
intent(in) :: spacing_prefactor(:)
222 integer,
optional,
intent(in) :: n_sites
223 real(real64),
optional,
intent(in) :: site_position(:,:)
226 integer :: enlarge(space%dim)
231 if (.not.
present(box))
then
239 gr%symm = original_gr%symm
241 if (
present(spacing_prefactor))
then
242 gr%spacing = spacing_prefactor * original_gr%spacing
244 write(
message(1),
'(a)')
"The two grids have different spacings, it will not be possible to establish a map between them"
248 gr%spacing = original_gr%spacing
251 gr%masked_periodic_boundaries = original_gr%masked_periodic_boundaries
252 if (gr%masked_periodic_boundaries) gr%periodic_boundary_mask = original_gr%periodic_boundary_mask
264 if (.not. variable_cell)
then
273 enlarge = max(enlarge, gr%der%n_ghost)
275 call mesh_init_stage_1(gr, namespace, space, gr%box, gr%coord_system, gr%spacing, enlarge)
287 type(
grid_t),
intent(inout) :: gr
289 class(
space_t),
intent(in) :: space
290 real(real64),
intent(in) :: grid_spacing(:)
292 integer,
optional,
intent(in) :: n_sites
293 real(real64),
optional,
intent(in) :: site_position(:,:)
323 call parse_variable(namespace,
'CurvMethod', curv_affine, cv_method)
326 call messages_write(
'Curvilinear coordinates on GPUs is not implemented')
329 if (
present(latt))
then
330 if (cv_method /= curv_affine .and. latt%nonorthogonal)
then
331 call messages_input_error(namespace,
'CurvMethod',
'Curvilinear coordinates with non-orthogonal cells are not implemented')
337 select case (cv_method)
344 select case (cv_method)
347 gr%box%bounding_box_l(1:space%dim), grid_spacing(1:space%dim))
349 if (
present(site_position) .and.
present(n_sites))
then
350 gr%coord_system =>
curv_gygi_t(namespace, space%dim, n_sites, site_position)
352 message(1) =
"Option CurvMethod = curv_gygi is not currently implemented without ions present."
356 if (
present(site_position) .and.
present(n_sites))
then
357 gr%coord_system =>
curv_modine_t(namespace, space%dim, n_sites, site_position, &
358 gr%box%bounding_box_l(1:space%dim), grid_spacing(1:space%dim))
360 message(1) =
"Option CurvMethod = curv_modine is not currently implemented without ions present."
364 if (
present(latt))
then
365 if (latt%nonorthogonal)
then
368 gr%coord_system =>
cartesian_t(namespace, space%dim)
371 gr%coord_system =>
cartesian_t(namespace, space%dim)
388 type(
grid_t),
target,
intent(inout) :: gr
390 class(
space_t),
intent(in) :: space
392 real(real64),
optional,
intent(in) :: qvector(:)
403 if(space%dim == 3)
then
415 type(
grid_t),
intent(inout) :: gr
418 class(
box_t),
pointer :: box
427 coord_system => gr%coord_system
428 safe_deallocate_p(coord_system)
430 safe_deallocate_p(box)
444 type(
grid_t),
intent(in) :: gr
445 integer,
optional,
intent(in) :: iunit
446 type(
namespace_t),
optional,
intent(in) :: namespace
454 call gr%box%write_info(iunit, namespace)
460 if (gr%use_curvilinear)
then
461 call gr%coord_system%write_info(iunit, namespace)
474 type(
grid_t),
intent(inout) :: gr
475 type(
space_t),
intent(in) :: space
480 real(real64) :: new_box_bounds(2, space%dim)
484 call new_latt%write_info(namespace)
487 select type (coord_system=>gr%coord_system)
489 if (new_latt%nonorthogonal)
then
490 deallocate(gr%coord_system)
496 select type (coord_system=>gr%coord_system)
498 new_box_bounds = gr%box%bounds(coord_system%basis)
499 gr%spacing = (new_box_bounds(2,:)-new_box_bounds(1,:))/gr%idx%ll(:)
505 safe_deallocate_a(gr%x)
506 safe_deallocate_a(gr%x_t)
507 safe_deallocate_a(gr%chi)
508 safe_deallocate_a(gr%vol_pp)
509 safe_deallocate_a(gr%jacobian_inverse)
520#include "grid_inc.F90"
523#include "complex.F90"
524#include "grid_inc.F90"
pure logical function, public accel_is_enabled()
Module, implementing a factory for boxes.
class(box_t) function, pointer, public box_factory_create(namespace, space, latt, n_sites, site_position)
initialize a box of any type
This module implements the curvilinear coordinates given in E.L. Briggs, D.J. Sullivan,...
This module implements the curvilinear coordinates given in F. Gygi and G. Galli, PRB 52 R2229 (1996)...
This module implements the curvilinear coordinates given in N. A. Modine, G. Zumbach,...
This module calculates the derivatives (gradients, Laplacians, etc.) of a function.
subroutine, public derivatives_build(der, namespace, space, mesh, qvector, regenerate, verbose)
build the derivatives object:
subroutine, public derivatives_init(der, namespace, space, coord_system, order)
subroutine, public derivatives_end(der)
subroutine, public derivates_set_coordinates_system(der, coord_system)
real(real64), parameter, public m_epsilon
real(real64), parameter, public m_one
This module implements the underlying real-space grid.
subroutine initialize_coordinate_system(gr, namespace, space, grid_spacing, latt, n_sites, site_position)
this subroutine initializes the coordinate system
integer, parameter curv_gygi
integer, parameter curv_briggs
subroutine, public zgrid_symmetrize_scalar_field(gr, field, suppress_warning)
subroutine, public grid_init_stage_1(gr, namespace, space, grp, symm, latt, n_sites, site_position, variable_cell)
First stage of the grid initialization.
subroutine, public grid_init_from_grid_stage_1(gr, original_gr, namespace, space, grp, variable_cell, box, spacing_prefactor, latt, n_sites, site_position)
this subroutine allows to create a grid from an existing grid
subroutine, public zgrid_symmetrize_single(gr, iop, field, symm_field)
subroutine, public zgrid_symmetrize_vector_field(gr, field, suppress_warning)
subroutine, public grid_init_stage_2(gr, namespace, space, mc, qvector)
Second stage of the grid initialization.
subroutine, public dgrid_symmetrize_vector_field(gr, field, suppress_warning)
subroutine, public grid_write_info(gr, iunit, namespace)
subroutine, public grid_lattice_vectors_update(gr, space, namespace, mc, new_latt)
Regenerate the grid information after update of the lattice vectors.
subroutine, public dgrid_symmetrize_single(gr, iop, field, symm_field)
subroutine, public grid_end(gr)
finalize a grid object
subroutine, public dgrid_symmetrize_scalar_field(gr, field, suppress_warning)
integer, parameter curv_modine
This module contains subroutines, related to the initialization of the mesh.
subroutine, public mesh_init_stage_3(mesh, namespace, space, stencil, mc, parent, regenerate)
When running parallel in domains, stencil and np_stencil are needed to compute the ghost points....
subroutine, public mesh_init_stage_1(mesh, namespace, space, box, coord_system, spacing, enlarge)
First stage mesh initialization.
subroutine, public mesh_init_stage_2(mesh, namespace, space, box, stencil, grp, regenerate)
This subroutine creates the global array of spatial indices and the inverse mapping.
This module defines the meshes, which are used in Octopus.
subroutine, public mesh_write_info(this, iunit, namespace)
recursive subroutine, public mesh_end(this)
subroutine, public messages_print_with_emphasis(msg, iunit, namespace)
character(len=512), private msg
subroutine, public messages_warning(no_lines, all_nodes, namespace)
subroutine, public messages_new_line()
character(len=256), dimension(max_lines), public message
to be output by fatal, warning
subroutine, public messages_fatal(no_lines, only_root_writes, namespace)
subroutine, public messages_input_error(namespace, var, details, row, column)
subroutine, public messages_experimental(name, namespace)
subroutine, public messages_info(no_lines, iunit, debug_only, stress, all_nodes, namespace)
This module handles the communicators for the various parallelization strategies.
This module defines non-local operators.
subroutine, public nl_operator_global_init(namespace)
initialize global settings for non-local operators
subroutine, public nl_operator_global_end()
subroutine, public parse_block_string(blk, l, c, res, convert_to_c)
integer function, public parse_block(namespace, name, blk, check_varinfo_)
This module defines routines, generating operators for a cubic stencil.
subroutine, public stencil_cube_get_lapl(this, dim, order)
This module defines stencils used in Octopus.
subroutine, public stencil_end(this)
subroutine, public stencil_union(st1, st2, stu)
subroutine, public symmetrizer_end(this)
subroutine, public symmetrizer_init(this, mesh, symm)
brief This module defines the class unit_t which is used by the unit_systems_oct_m module.
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_inp
the units systems for reading and writing
class to tell whether a point is inside or outside
abstract class to describe coordinate systems
Description of the grid, containing information on derivatives, stencil, and symmetries.
Describes mesh distribution to nodes.
This is defined even when running serial.
Stores all communicators and groups.
The class representing the stencil, which is used for non-local mesh operations.