53 integer,
parameter,
public :: &
68 function box_factory_create(namespace, space, latt, n_sites, site_position)
result(box)
69 type(namespace_t),
intent(in) :: namespace
70 class(space_t),
intent(in) :: space
71 type(lattice_vectors_t),
optional,
intent(in) :: latt
72 integer,
optional,
intent(in) :: n_sites
73 real(real64),
optional,
intent(in) :: site_position(:,:)
75 class(box_t),
pointer :: box
78 integer :: default_boxshape, idir, box_shape
79 real(real64) :: center(space%dim), axes(space%dim, space%dim), rsize, xsize, lsize(space%dim)
80 character(len=1024) :: filename
81 character(len=1024) :: user_def
82 real(real64),
parameter :: tol = 1.0e-13_real64
87 assert(
present(n_sites) .eqv.
present(site_position))
117 if (space%is_periodic())
then
119 if(.not.
present(latt))
then
120 message(1) =
"Periodic system box is trying to be generated without lattice vectors given."
124 if (
present(site_position))
then
130 call parse_variable(namespace,
'BoxShape', default_boxshape, box_shape)
132 select case (box_shape)
136 if (space%dim == 2)
then
137 message(1) =
"BoxShape = cylinder is not meaningful in 2D. Use sphere if you want a circle."
145 if (space%is_periodic())
then
154 message(1) =
"For more than 3 dimensions, you can only use the parallelepiped box."
167 if (box_shape == sphere .or. box_shape ==
cylinder .or. box_shape ==
minimum)
then
169 message(1) =
"BoxShape = sphere, cylinder and minimum require the Radius variable to be defined."
177 if (box_shape ==
minimum .and. .not.
present(site_position))
then
179 message(1) =
"BoxShape = minimum only makes sense when the calculation includes atomic sites."
192 if (space%is_periodic())
then
193 xsize = norm2(latt%rlattice(1:space%periodic_dim, 1))/
m_two
218 if (
present(latt))
then
221 do idir = 1, space%periodic_dim
222 lsize(idir) = norm2(latt%rlattice(1:space%dim, idir))/
m_two
226 if (space%is_periodic())
then
230 do idir = space%periodic_dim + 1, space%dim
231 lsize(idir) = norm2(latt%rlattice(1:space%dim, idir))/
m_two
246 if (
parse_block(namespace,
'Lsize', blk) == 0)
then
252 do idir = 1, space%dim
263 do idir = 2, space%dim
264 lsize(idir) = lsize(1)
270 do idir = 1, space%periodic_dim
271 if (abs(
m_two*lsize(idir) - norm2(latt%rlattice(1:space%dim, idir))) > tol)
then
273 'Lsize must be exactly half the length of the lattice vectors along periodic dimensions')
290 call parse_variable(namespace,
'BoxShapeUsDef',
'x^2+y^2+z^2 < 4', user_def)
296 message(1) =
"To use 'BoxShape = box_cgal', you have to compile Octopus"
297 message(2) =
"with CGAL library support."
308 message(1) =
"Must specify BoxCgalFile if BoxShape = box_cgal."
322 if(
parse_block(namespace,
'BoxCenter', blk) == 0)
then
324 do idir = 1, space%dim
332 if (
present(latt))
then
341 select case (box_shape)
343 box =>
box_sphere_t(space%dim, center, rsize, namespace)
345 box =>
box_cylinder_t(space%dim, center, axes, rsize,
m_two * xsize, namespace, periodic_boundaries=space%is_periodic())
348 n_periodic_boundaries=space%periodic_dim)
352 box =>
box_cgal_t(space%dim, center, filename,
m_two*lsize(1:space%dim), namespace)
354 box =>
box_minimum_t(space%dim, rsize, n_sites, site_position, namespace)
Module, implementing a factory for boxes.
integer, parameter, public minimum
integer, parameter, public box_cgal
integer, parameter, public parallelepiped
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 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...