53 integer,
parameter,
public :: &
69 function box_factory_create(namespace, space, latt, n_sites, site_position)
result(box)
70 type(namespace_t),
intent(in) :: namespace
71 class(space_t),
intent(in) :: space
72 type(lattice_vectors_t),
optional,
intent(in) :: latt
73 integer,
optional,
intent(in) :: n_sites
74 real(real64),
optional,
intent(in) :: site_position(:,:)
76 class(box_t),
pointer :: box
79 integer :: default_boxshape, idir, box_shape
80 real(real64) :: center(space%dim), axes(space%dim, space%dim), rsize, xsize, lsize(space%dim)
81 character(len=1024) :: filename
82 character(len=1024) :: user_def
83 real(real64),
parameter :: tol = 1.0e-13_real64
88 assert(
present(n_sites) .eqv.
present(site_position))
126 if (space%is_periodic())
then
128 if(.not.
present(latt))
then
129 message(1) =
"Periodic system box is trying to be generated without lattice vectors given."
133 if (
present(site_position))
then
139 call parse_variable(namespace,
'BoxShape', default_boxshape, box_shape)
141 select case (box_shape)
145 if (space%dim == 2)
then
146 message(1) =
"BoxShape = cylinder is not meaningful in 2D. Use sphere if you want a circle."
161 message(1) =
"For more than 3 dimensions, you can only use the parallelepiped box."
174 if (box_shape == sphere .or. box_shape ==
cylinder .or. box_shape ==
minimum)
then
176 message(1) =
"BoxShape = sphere, cylinder and minimum require the Radius variable to be defined."
184 if (box_shape ==
minimum .and. .not.
present(site_position))
then
186 message(1) =
"BoxShape = minimum only makes sense when the calculation includes atomic sites."
199 if (space%is_periodic())
then
200 xsize = norm2(latt%rlattice(1:space%periodic_dim, 1))/
m_two
227 if (
present(latt))
then
230 do idir = 1, space%periodic_dim
231 lsize(idir) = norm2(latt%rlattice(1:space%dim, idir))/
m_two
235 if (space%is_periodic())
then
239 do idir = space%periodic_dim + 1, space%dim
240 lsize(idir) = norm2(latt%rlattice(1:space%dim, idir))/
m_two
255 if (
parse_block(namespace,
'Lsize', blk) == 0)
then
261 do idir = 1, space%dim
272 do idir = 2, space%dim
273 lsize(idir) = lsize(1)
279 do idir = 1, space%periodic_dim
280 if (abs(
m_two*lsize(idir) - norm2(latt%rlattice(1:space%dim, idir))) > tol)
then
282 'Lsize must be exactly half the length of the lattice vectors along periodic dimensions')
298#if defined(HAVE_GDLIB)
300 if (trim(filename) ==
"")
then
301 message(1) =
"Must specify BoxShapeImage if BoxShape = box_image."
305 message(1) =
"To use 'BoxShape = box_image', you have to compile Octopus"
306 message(2) =
"with GD library support."
323 call parse_variable(namespace,
'BoxShapeUsDef',
'x^2+y^2+z^2 < 4', user_def)
329 message(1) =
"To use 'BoxShape = box_cgal', you have to compile Octopus"
330 message(2) =
"with CGAL library support."
341 message(1) =
"Must specify BoxCgalFile if BoxShape = box_cgal."
355 if(
parse_block(namespace,
'BoxCenter', blk) == 0)
then
357 do idir = 1, space%dim
365 if (
present(latt))
then
374 select case (box_shape)
376 box =>
box_sphere_t(space%dim, center, rsize, namespace)
378 box =>
box_cylinder_t(space%dim, center, axes, rsize,
m_two * xsize, namespace, periodic_boundaries=space%is_periodic())
381 n_periodic_boundaries=space%periodic_dim)
385 box =>
box_cgal_t(space%dim, center, filename,
m_two*lsize(1:space%dim), namespace)
387 box =>
box_minimum_t(space%dim, rsize, n_sites, site_position, namespace)
389 box =>
box_image_t(center, axes, lsize, filename, space%periodic_dim, namespace)
Module, implementing a factory for boxes.
integer, parameter, public minimum
integer, parameter, public box_cgal
integer, parameter, public parallelepiped
integer, parameter, public box_image
integer, parameter, public cylinder
class(box_t) function, pointer, public box_factory_create(namespace, space, latt, n_sites, site_position)
initialize a box of any type
integer, parameter, public box_usdef
real(real64), parameter, public m_two
real(real64), parameter, public m_zero
real(real64), parameter, public m_epsilon
real(real64), parameter, public m_one
This module is intended to contain "only mathematical" functions and procedures.
subroutine, public messages_obsolete_variable(namespace, name, rep)
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)
logical function, public parse_is_defined(namespace, name)
integer function, public parse_block(namespace, name, blk, check_varinfo_)
This module defines the unit system, used for input and output.
type(unit_system_t), public units_inp
the units systems for reading and writing
Class implementing a box defined by a file read using the cgal library.
Class implementing a cylinder box. The cylinder axis is always along the first direction defined by t...
Class implementing a box generated from a 2D image.
Class implementing a box that is a union of spheres. We do this in a specific class instead of using ...
Class implementing a parallelepiped box. Currently this is restricted to a rectangular cuboid (all th...
Class implementing a spherical box.
Class implementing a box defined by a mathematical expression. This box needs to be inside a parallel...