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)
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(:,:)
111 type(stencil_t) :: cube
112 integer :: enlarge(space%dim)
115 real(real64) :: grid_spacing(space%dim)
119 gr%box =>
box_factory_create(namespace, space, latt=latt, n_sites=n_sites, site_position=site_position)
121 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 (
associated(gr%box))
then
162 select type (box => gr%box)
164 do idir = 1, space%dim
166 if (grid_spacing(idir) <
m_zero)
then
167 grid_spacing(idir) = box%pixel_size(idir)
174 message(1) =
" Your input for 'Spacing' is negative or zero."
184 if (
parse_block(namespace,
'PeriodicBoundaryMask', blk) < 0)
then
185 gr%masked_periodic_boundaries = .false.
187 gr%masked_periodic_boundaries = .
true.
206 enlarge = max(enlarge, gr%der%n_ghost)
208 call mesh_init_stage_1(gr, namespace, space, gr%box, gr%coord_system, grid_spacing, enlarge)
217 box, spacing_prefactor, latt, n_sites, site_position)
218 type(
grid_t),
intent(inout) :: gr
219 type(
grid_t),
intent(in) :: original_gr
221 class(
space_t),
intent(in) :: space
223 class(
box_t),
target,
optional,
intent(in) :: box
224 real(real64),
optional,
intent(in) :: spacing_prefactor(:)
226 integer,
optional,
intent(in) :: n_sites
227 real(real64),
optional,
intent(in) :: site_position(:,:)
230 integer :: enlarge(space%dim)
235 if (.not.
present(box))
then
243 gr%symm = original_gr%symm
245 if (
present(spacing_prefactor))
then
246 gr%spacing = spacing_prefactor * original_gr%spacing
248 write(
message(1),
'(a)')
"The two grids have different spacings, it will not be possible to establish a map between them"
252 gr%spacing = original_gr%spacing
255 gr%masked_periodic_boundaries = original_gr%masked_periodic_boundaries
256 if (gr%masked_periodic_boundaries) gr%periodic_boundary_mask = original_gr%periodic_boundary_mask
270 enlarge = max(enlarge, gr%der%n_ghost)
272 call mesh_init_stage_1(gr, namespace, space, gr%box, gr%coord_system, gr%spacing, enlarge)
284 type(
grid_t),
intent(inout) :: gr
286 class(
space_t),
intent(in) :: space
287 real(real64),
intent(in) :: grid_spacing(:)
289 integer,
optional,
intent(in) :: n_sites
290 real(real64),
optional,
intent(in) :: site_position(:,:)
319 call parse_variable(namespace,
'CurvMethod', curv_affine, cv_method)
322 call messages_write(
'Curvilinear coordinates on GPUs is not implemented')
325 if (
present(latt))
then
326 if (cv_method /= curv_affine .and. latt%nonorthogonal)
then
327 call messages_input_error(namespace,
'CurvMethod',
'Curvilinear coordinates with non-orthogonal cells are not implemented')
337 select case (cv_method)
340 gr%box%bounding_box_l(1:space%dim), grid_spacing(1:space%dim))
342 if (
present(site_position) .and.
present(n_sites))
then
343 gr%coord_system =>
curv_gygi_t(namespace, space%dim, n_sites, site_position)
345 message(1) =
"Option CurvMethod = curv_gygi is not currently implemented without ions present."
349 if (
present(site_position) .and.
present(n_sites))
then
350 gr%coord_system =>
curv_modine_t(namespace, space%dim, n_sites, site_position, &
351 gr%box%bounding_box_l(1:space%dim), grid_spacing(1:space%dim))
353 message(1) =
"Option CurvMethod = curv_modine is not currently implemented without ions present."
357 if (
present(latt))
then
358 if (latt%nonorthogonal)
then
361 gr%coord_system =>
cartesian_t(namespace, space%dim)
364 gr%coord_system =>
cartesian_t(namespace, space%dim)
381 type(
grid_t),
target,
intent(inout) :: gr
383 class(
space_t),
intent(in) :: space
385 real(real64),
optional,
intent(in) :: qvector(:)
396 if(space%dim == 3)
then
408 type(
grid_t),
intent(inout) :: gr
411 class(
box_t),
pointer :: box
420 coord_system => gr%coord_system
421 safe_deallocate_p(coord_system)
423 safe_deallocate_p(box)
437 type(
grid_t),
intent(in) :: gr
438 integer,
optional,
intent(in) :: iunit
439 type(
namespace_t),
optional,
intent(in) :: namespace
447 call gr%box%write_info(iunit, namespace)
453 if (gr%use_curvilinear)
then
454 call gr%coord_system%write_info(iunit, namespace)
467 type(
grid_t),
intent(inout) :: gr
468 type(
space_t),
intent(in) :: space
473 real(real64) :: new_box_bounds(2, space%dim)
477 call new_latt%write_info(namespace)
480 select type (coord_system=>gr%coord_system)
482 if (new_latt%nonorthogonal)
then
483 deallocate(gr%coord_system)
489 select type (coord_system=>gr%coord_system)
491 new_box_bounds = gr%box%bounds(coord_system%basis)
492 gr%spacing = (new_box_bounds(2,:)-new_box_bounds(1,:))/gr%idx%ll(:)
498 safe_deallocate_a(gr%x)
499 safe_deallocate_a(gr%x_t)
500 safe_deallocate_a(gr%chi)
501 safe_deallocate_a(gr%vol_pp)
502 safe_deallocate_a(gr%jacobian_inverse)
513#include "grid_inc.F90"
516#include "complex.F90"
517#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_zero
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_from_grid_stage_1(gr, original_gr, namespace, space, grp, box, spacing_prefactor, latt, n_sites, site_position)
this subroutine allows to create a grid from an existing grid
subroutine, public grid_init_stage_1(gr, namespace, space, grp, symm, latt, n_sites, site_position)
First stage of the grid initialization.
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 implementing a box generated from a 2D image.
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.