Octopus
species_pot.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
25 use debug_oct_m
27 use global_oct_m
29 use index_oct_m
30 use, intrinsic :: iso_fortran_env
35 use logrid_oct_m
37 use mesh_oct_m
39 use mpi_oct_m
41 use parser_oct_m
43 use ps_oct_m
46 use space_oct_m
51 use unit_oct_m
53 use volume_oct_m
54
55 implicit none
56
57 private
58 public :: &
69
70 type(mesh_t), pointer :: mesh_p
71 real(real64), allocatable :: rho_p(:)
72 real(real64), allocatable :: grho_p(:, :)
73 real(real64) :: alpha2_p
74 real(real64), pointer :: pos_p(:)
75
76contains
77
78
79 ! ---------------------------------------------------------
80 subroutine species_atom_density(species, namespace, space, latt, pos, mesh, spin_channels, rho)
81 class(species_t), target, intent(in) :: species
82 type(namespace_t), intent(in) :: namespace
83 class(space_t), intent(in) :: space
84 type(lattice_vectors_t), intent(in) :: latt
85 real(real64), intent(in) :: pos(1:space%dim)
86 type(mesh_t), intent(in) :: mesh
87 integer, intent(in) :: spin_channels
88 real(real64), contiguous, intent(inout) :: rho(:, :)
89
90 integer :: isp, ip, in_points, icell
91 real(real64) :: rr, x, pos_pc(space%dim), nrm, rmax
92 real(real64) :: xx(space%dim), yy(space%dim), rerho, imrho
93 real(real64), allocatable :: dorbital(:)
94 type(ps_t), pointer :: ps
95 type(volume_t) :: volume
96 integer :: in_points_red
97 type(lattice_iterator_t) :: latt_iter
98 integer :: iorb, ii, nn, ll, mm
99 real(real64) :: radius, density
100 type(submesh_t) :: sphere
101
102 push_sub(species_atom_density)
103
104 assert(spin_channels == 1 .or. spin_channels == 2)
105
106 rho = m_zero
107
108 ! build density ...
109 select type (species)
110 type is(species_from_file_t)
112
115
116 type is(soft_coulomb_t)
118
119 class is(allelectron_t)
120
121 do isp = 1, spin_channels
122 do iorb = 1, species%get_niwfs()
123 call species%get_iwf_ilm(iorb, isp, ii, ll, mm)
124 ! For all-electron species, we want to use the principal quantum number
125 call species%get_iwf_n(iorb, isp, nn)
126
127 radius = species%get_iwf_radius(nn, isp)
128 ! make sure that if the spacing is too large, the orbitals fit in a few points at least
129 radius = max(radius, m_two*maxval(mesh%spacing))
130
131 call submesh_init(sphere, space, mesh, latt, pos, radius)
132 safe_allocate(dorbital(1:sphere%np))
133
134 call datomic_orbital_get_submesh(species, sphere, nn, ll, mm, isp, dorbital)
135 ! The occupations are for one type of orbitals, e.g. 2p gets 6 electrons
136 ! So we normalize them by (2*l+1) such that they get distributed evenly
137 ! for each value of m
138 do ip = 1, sphere%np
139 dorbital(ip) = species%conf%occ(ii, isp)/real(2*ll+1, real64) *dorbital(ip)*dorbital(ip)
140 end do
141 call submesh_add_to_mesh(sphere, dorbital, rho(:, isp))
142 safe_deallocate_a(dorbital)
144 call submesh_end(sphere)
145 end do
146 end do
147
148 type is (jellium_charge_t)
149 ! We put, for the electron density, the same as the positive density that
150 ! creates the external potential.
151 ! This code is repeated in get_density, and should therefore be cleaned!!!!!
153 call volume_init(volume)
154 call volume_read_from_block(volume, namespace, trim(species%rho_string()))
155
156 rmax = latt%max_length()
157 latt_iter = lattice_iterator_t(latt, rmax)
158 rho = m_zero
159 do icell = 1, latt_iter%n_cells
160 yy = latt_iter%get(icell)
161 do ip = 1, mesh%np
162 call mesh_r(mesh, ip, rr, origin = pos, coords = xx)
163 xx = xx + yy
164 rr = norm2(xx)
165
166 rerho = m_zero
167 if (volume_in_volume(space, volume, xx)) rerho = m_one
168 rho(ip, 1) = rho(ip, 1) + rerho
169 end do
170 end do
171
172 call volume_end(volume)
173
174 if (spin_channels > 1) then
175 rho(:, 1) = m_half*rho(:, 1)
176 rho(:, 2) = rho(:, 1)
177 end if
178
179 ! rescale to match the valence charge
180 do isp = 1, spin_channels
181 x = species%get_zval() / dmf_integrate(mesh, rho(:, isp))
182 !$omp parallel do
183 do ip = 1, mesh%np
184 rho(ip, isp) = x * rho(ip, isp)
185 end do
186 !$omp end parallel do
187 end do
188
190 ! We put, for the electron density, the same as the positive density that
191 ! creates the external potential.
192 ! This code is repeated in get_density, and should therefore be cleaned!!!!!
193
194 rmax = latt%max_length()
195 latt_iter = lattice_iterator_t(latt, rmax)
196 rho = m_zero
197 do icell = 1, latt_iter%n_cells
198 yy = latt_iter%get(icell)
199 do ip = 1, mesh%np
200 call mesh_r(mesh, ip, rr, origin = pos, coords = xx)
201 xx = xx + yy
202 rr = norm2(xx)
203
204 rerho = m_zero
205 call parse_expression(rerho, imrho, space%dim, xx, rr, m_zero, trim(species%rho_string()))
206 rho(ip, 1) = rho(ip, 1) + rerho
207 end do
208 end do
209
210 if (spin_channels > 1) then
211 rho(:, 1) = m_half*rho(:, 1)
212 rho(:, 2) = rho(:, 1)
213 end if
214
215 ! rescale to match the valence charge
216 do isp = 1, spin_channels
217 x = species%get_zval() / dmf_integrate(mesh, rho(:, isp))
218 !$omp parallel do
219 do ip = 1, mesh%np
220 rho(ip, isp) = x * rho(ip, isp)
221 end do
222 !$omp end parallel do
223 end do
224
225
226 type is (jellium_sphere_t) ! ... from jellium
227 in_points = 0
228 do ip = 1, mesh%np
229 call mesh_r(mesh, ip, rr, origin = pos)
230 if (rr <= species%radius()) then
231 in_points = in_points + 1
232 end if
233 end do
234
235 if (mesh%parallel_in_domains) then
236 call mesh%mpi_grp%allreduce(in_points, in_points_red, 1, mpi_integer, mpi_sum)
237 in_points = in_points_red
238 end if
239
240 if (in_points > 0) then
241 ! This probably should be done inside the mesh_function_oct_m module.
242
243 if (mesh%use_vol_pp) then
244 do ip = 1, mesh%np
245 call mesh_r(mesh, ip, rr, origin = pos)
246 if (rr <= species%radius()) then
247 rho(ip, 1:spin_channels) = species%get_zval() / &
248 (mesh%vol_pp(ip) * real(in_points*spin_channels, real64) )
249 end if
250 end do
251 else
252 do ip = 1, mesh%np
253 call mesh_r(mesh, ip, rr, origin = pos)
254 if (rr <= species%radius()) then
255 rho(ip, 1:spin_channels) = species%get_zval() / &
256 (mesh%vol_pp(1) * real(in_points * spin_channels, real64) )
257 end if
258 end do
259 end if
260 end if
261
262 type is (jellium_slab_t) ! ... from jellium slab
263 density = species%get_density(mesh%box%bounding_box_l) / spin_channels
264
265 do ip = 1, mesh%np
266 rr = abs(mesh%x(3, ip) - pos(3))
267 if (rr <= species%thickness() / m_two) then
268 rho(ip, 1:spin_channels) = density
269 end if
270 end do
271
272 class is (pseudopotential_t)
273 ! ...from pseudopotentials
274
275 ps => species%ps
276
277 if (ps_has_density(ps)) then
278
279 assert(allocated(ps%density))
280
281 rmax = m_zero
282 do isp = 1, spin_channels
283 rmax = max(rmax, ps%density(isp)%x_threshold)
284 end do
285
286 latt_iter = lattice_iterator_t(latt, rmax)
287 do icell = 1, latt_iter%n_cells
288 pos_pc = pos + latt_iter%get(icell)
289 do ip = 1, mesh%np
290 call mesh_r(mesh, ip, rr, origin = pos_pc)
291 rr = max(rr, r_small)
292
293 do isp = 1, spin_channels
294 if (rr >= spline_range_max(ps%density(isp))) cycle
295 rho(ip, isp) = rho(ip, isp) + spline_eval(ps%density(isp), rr)
296 end do
297
298 end do
299 end do
300
301 else
302
303 !we use the square root of the short-range local potential, just to put something that looks like a density
304
305 latt_iter = lattice_iterator_t(latt, ps%vl%x_threshold)
306 do icell = 1, latt_iter%n_cells
307 pos_pc = pos + latt_iter%get(icell)
308 do ip = 1, mesh%np
309 call mesh_r(mesh, ip, rr, origin = pos_pc)
310 rr = max(rr, r_small)
311
312 if (rr >= spline_range_max(ps%vl)) cycle
313
314 do isp = 1, spin_channels
315 rho(ip, isp) = rho(ip, isp) + sqrt(abs(spline_eval(ps%vl, rr)))
316 end do
317
318 end do
319 end do
320
321 ! normalize
322 nrm = m_zero
323 do isp = 1, spin_channels
324 nrm = nrm + dmf_integrate(mesh, rho(:, isp))
325 end do
326
327 do isp = 1, spin_channels
328 call lalg_scal(mesh%np, species%get_zval()/nrm, rho(:, isp))
329 end do
330
331 end if
332 class default
333 assert(.false.)
334 end select
335
336 pop_sub(species_atom_density)
337 contains
338 subroutine generate_uniform_density()
339 do isp = 1, spin_channels
340 rho(1:mesh%np, isp) = m_one
341 x = (species%get_zval()/real(spin_channels, real64) ) / dmf_integrate(mesh, rho(:, isp))
342 rho(1:mesh%np, isp) = x
343 end do
344 end subroutine generate_uniform_density
345 end subroutine species_atom_density
346
347 ! ---------------------------------------------------------
348 ! A non periodized version of the routine species_atom_density
349 ! This is used for the Hirshfeld routines
350 ! TODO: implement it for other approaches than pseudo potentials.
351 subroutine species_atom_density_np(species, namespace, pos, mesh, spin_channels, rho)
352 class(species_t), target, intent(in) :: species
353 type(namespace_t), intent(in) :: namespace
354 real(real64), intent(in) :: pos(:)
355 type(mesh_t), intent(in) :: mesh
356 integer, intent(in) :: spin_channels
357 real(real64), intent(inout) :: rho(:, :)
358
359 integer :: isp, ip
360 real(real64) :: rr, nrm
361 type(ps_t), pointer :: ps
362
364
365 call profiling_in("SPECIES_ATOM_DEN_NP")
366
367 rho = m_zero
368 select type(species)
369 class is(pseudopotential_t)
370 ! ...from pseudopotentials
371
372 ps => species%ps
373 if (ps_has_density(ps)) then
374
375 assert(allocated(ps%density))
376
377 !$omp parallel private(ip, rr, isp)
378 do isp = 1, spin_channels
379 !$omp do
380 do ip = 1, mesh%np
381 call mesh_r(mesh, ip, rr, origin = pos)
382 if (rr >= spline_range_max(ps%density(isp))) cycle
383 rr = max(rr, r_small)
384 rho(ip, isp) = rho(ip, isp) + spline_eval(ps%density(isp), rr)
385 end do
386 !$omp end do nowait
387 end do
388 !$omp end parallel
389
390 else
391
392 !we use the square root of the short-range local potential, just to put something that looks like a density
393
394 do ip = 1, mesh%np
395 call mesh_r(mesh, ip, rr, origin = pos)
396 rr = max(rr, r_small)
397
398 if (rr >= spline_range_max(ps%vl)) cycle
399
400 do isp = 1, spin_channels
401 rho(ip, isp) = rho(ip, isp) + sqrt(abs(spline_eval(ps%vl, rr)))
402 end do
403
404 end do
405
406 ! normalize
407 nrm = m_zero
408 do isp = 1, spin_channels
409 nrm = nrm + dmf_integrate(mesh, rho(:, isp))
410 end do
411
412 do isp = 1, spin_channels
413 call lalg_scal(mesh%np, species%get_zval()/nrm, rho(:, isp))
414 end do
415
416 end if
417 class default
418 call messages_not_implemented('species_atom_density_np for non-pseudopotential species', namespace=namespace)
419
420 end select
421
422 call profiling_out("SPECIES_ATOM_DEN_NP")
425 end subroutine species_atom_density_np
426
427 ! ---------------------------------------------------------
428 !! Non-periodic version of the above routine
429 subroutine species_atom_density_derivative_np(species, namespace, pos, mesh, spin_channels, drho)
430 class(species_t), target, intent(in) :: species
431 type(namespace_t), intent(in) :: namespace
432 real(real64), contiguous, intent(in) :: pos(:)
433 type(mesh_t), intent(in) :: mesh
434 integer, intent(in) :: spin_channels
435 real(real64), intent(inout) :: drho(:, :)
436
437 integer :: isp, ip
438 real(real64) :: rr
439 type(ps_t), pointer :: ps
440
442
443 call profiling_in("SPECIES_ATOM_DEN_DER_NP")
444
445 select type(species)
446 class is(pseudopotential_t)
447 ps => species%ps
448
449 if (ps_has_density(ps)) then
450 !$omp parallel private(ip, rr, isp)
451 do isp = 1, spin_channels
452 !$omp do
453 do ip = 1, mesh%np
454 call mesh_r(mesh, ip, rr, origin = pos)
455 if (rr >= spline_range_max(ps%density_der(isp))) cycle
456 rr = max(rr, r_small)
457 drho(ip, isp) = drho(ip, isp) + spline_eval(ps%density_der(isp), rr)
458 end do
459 !$omp end do nowait
460 end do
461 !$omp end parallel
462
463 else
464 call messages_write('The pseudopotential for')
465 call messages_write(species%get_label())
466 call messages_write(' does not contain the density.')
467 call messages_fatal(namespace=namespace)
468 end if
469 class default
470 assert(.false.)
471 end select
472
473 call profiling_out("SPECIES_ATOM_DEN_DER_NP")
474
477
478
479 ! ---------------------------------------------------------
480 !! Gradient of the atomic density, if available
481 subroutine species_atom_density_grad(species, namespace, space, latt, pos, mesh, spin_channels, drho)
482 class(species_t), target, intent(in) :: species
483 type(namespace_t), intent(in) :: namespace
484 class(space_t), intent(in) :: space
485 type(lattice_vectors_t), intent(in) :: latt
486 real(real64), intent(in) :: pos(1:space%dim)
487 type(mesh_t), intent(in) :: mesh
488 integer, intent(in) :: spin_channels
489 real(real64), intent(inout) :: drho(:, :, :)
490
491 integer :: isp, ip, icell, idir
492 real(real64) :: rr, pos_pc(space%dim), range, spline
493 type(ps_t), pointer :: ps
494 type(lattice_iterator_t) :: latt_iter
495
497
498 assert(spin_channels == 1 .or. spin_channels == 2)
499
500 drho = m_zero
502 ! build density ...
503 select type(species)
504 class is(pseudopotential_t)
505 ps => species%ps
506 ! ...from pseudopotentials
507
508 if (ps_has_density(ps)) then
509
510 range = ps%density_der(1)%x_threshold
511 if (spin_channels == 2) range = max(range, ps%density_der(2)%x_threshold)
512 latt_iter = lattice_iterator_t(latt, range)
513
514 do icell = 1, latt_iter%n_cells
515 pos_pc = pos + latt_iter%get(icell)
516
517 do ip = 1, mesh%np
518 call mesh_r(mesh, ip, rr, origin = pos_pc)
519 rr = max(rr, r_small)
520
521 do isp = 1, spin_channels
522 if (rr >= spline_range_max(ps%density_der(isp))) cycle
523 spline = spline_eval(ps%density_der(isp), rr)
524
525 if(abs(spline) < 1e-150_real64) cycle
526
527 do idir = 1, space%dim
528 drho(ip, isp, idir) = drho(ip, isp, idir) - spline*(mesh%x(idir, ip) - pos_pc(idir))/rr
529 end do
530 end do
531 end do
532 end do
533
534 else
535 call messages_write('The pseudopotential for')
536 call messages_write(species%get_label())
537 call messages_write(' does not contain the density.')
538 call messages_fatal(namespace=namespace)
539 end if
540
541 class default
542 call messages_not_implemented('species_atom_density_grad for non-pseudopotential species', namespace=namespace)
543
544 end select
545
547 end subroutine species_atom_density_grad
548
549 ! ---------------------------------------------------------
550
551 subroutine species_get_long_range_density(species, namespace, space, latt, pos, mesh, rho, sphere_inout, nlr_x)
552 class(species_t), target, intent(in) :: species
553 type(namespace_t), intent(in) :: namespace
554 class(space_t), intent(in) :: space
555 type(lattice_vectors_t), intent(in) :: latt
556 real(real64), target, intent(in) :: pos(1:space%dim)
557 class(mesh_t), target, intent(in) :: mesh
558 real(real64), contiguous, intent(out) :: rho(:)
559 type(submesh_t), optional, target, intent(inout) :: sphere_inout
560 real(real64), contiguous, optional, intent(inout) :: nlr_x(:,:)
561
562 type(root_solver_t) :: rs
563 logical :: conv
564 real(real64) :: startval(space%dim)
565 real(real64) :: delta, alpha, xx(space%dim), yy(space%dim), rr, imrho1, rerho
566 real(real64) :: dist2_min
567 integer :: icell, ipos, ip, idir, rankmin
568 type(lattice_iterator_t) :: latt_iter
569 type(ps_t), pointer :: ps
570 type(volume_t) :: volume
571 type(submesh_t), target :: sphere_local
572 type(submesh_t), pointer :: sphere
573 logical :: have_point
574 real(real64), allocatable :: rho_sphere(:)
575 real(real64), parameter :: threshold = 1e-6_real64
576 real(real64) :: norm_factor, range, radius, radius_nlr, radius_vl
577
579
580 call profiling_in("SPECIES_LR_DENSITY")
581
582 if(present(nlr_x)) then
583 assert(species%is_ps())
584 end if
585
586 select type (species)
587 type is(pseudopotential_t)
588 ps => species%ps
589 radius_nlr = spline_x_threshold(ps%nlr, threshold)
590 if (present(sphere_inout)) then
591 radius_vl = ps%vl%x_threshold*1.05_real64
592 radius = max(radius_nlr, radius_vl)
593 call submesh_init(sphere_inout, space, mesh, latt, pos, radius)
594 sphere => sphere_inout
595 else
596 radius = radius_nlr
597 call submesh_init(sphere_local, space, mesh, latt, pos, radius)
598 sphere => sphere_local
599 endif
600
601 safe_allocate(rho_sphere(1:sphere%np))
602 if (.not. present(sphere_inout) .and. sphere%np > 0) then
603 call lalg_copy(sphere%np, sphere%r, rho_sphere)
604 call spline_eval_vec(ps%nlr, sphere%np, rho_sphere)
605 else
606 do ip = 1, sphere%np
607 if(sphere%r(ip) <= radius_nlr) then
608 rho_sphere(ip) = spline_eval(ps%nlr, sphere%r(ip))
609 else
610 rho_sphere(ip) = m_zero
611 endif
612 end do
613 end if
614
615 rho(1:mesh%np) = m_zero
616
617 ! A small amount of charge is missing with the cutoff, we
618 ! renormalize so that the long range potential is exact
619 norm_factor = abs(species%get_zval()/dsm_integrate(mesh, sphere, rho_sphere))
620 do ip = 1, sphere%np
621 rho(sphere%map(ip)) = rho(sphere%map(ip)) + norm_factor*rho_sphere(ip)
622 end do
624 if (present(nlr_x)) then
625 do idir = 1, space%dim
626 do ip = 1, sphere%np
627 nlr_x(sphere%map(ip), idir) = nlr_x(sphere%map(ip), idir) + norm_factor*rho_sphere(ip)*sphere%rel_x(idir, ip)
628 end do
629 end do
630 end if
631
632 safe_deallocate_a(rho_sphere)
633 nullify(ps)
634 if ( .not. present(sphere_inout) ) then
635 call submesh_end(sphere)
636 end if
637 nullify(sphere)
638
639 type is (full_delta_t)
640
641 rho(1:mesh%np) = m_zero
642
643 ipos = mesh_nearest_point(mesh, pos, dist2_min, rankmin)
644 have_point = .true.
645 if (mesh%mpi_grp%rank /= rankmin) have_point = .false.
646
647 if (have_point) then
648 if (mesh%use_vol_pp) then
649 rho(ipos) = -species%get_z()/mesh%vol_pp(ipos)
650 else
651 rho(ipos) = -species%get_z()/mesh%vol_pp(1)
652 end if
653 end if
654
655 write(message(1), '(3a,f12.6,3a)') &
656 "Info: species_full_delta species ", trim(species%get_label()), &
657 " atom displaced ", units_from_atomic(units_out%length, sqrt(dist2_min)), &
658 " [ ", trim(units_abbrev(units_out%length)), " ]"
659 call messages_info(1, namespace=namespace)
660
661 type is (full_gaussian_t)
662
663 ! periodic copies are not considered in this routine
664 if (space%is_periodic()) then
665 call messages_not_implemented("species_full_gaussian for periodic systems", namespace=namespace)
666 end if
667
668 ! The Gaussian is built in the primitive coordinates \xi (see getrho below), so the
669 ! only thing we need from the coordinate system is the position of the atom in \xi.
670 ! curv_briggs does not implement the inverse transformation.
671 select type (cs => mesh%coord_system)
672 type is (curv_briggs_t)
673 call messages_not_implemented("species_full_gaussian with the curv_briggs coordinates", &
674 namespace=namespace)
675 end select
676
677 ! --------------------------------------------------------------
678 ! Constructs density for an all-electron atom with the procedure
679 ! sketched in Modine et al. [Phys. Rev. B 55, 10289 (1997)],
680 ! section II.B
681 ! --------------------------------------------------------------
682
683 safe_allocate(rho_p(1:mesh%np))
684 safe_allocate(grho_p(1:mesh%np, 1:space%dim))
685
686 mesh_p => mesh
687 pos_p => pos
688
689 ! Initial guess.
690 delta = mesh%spacing(1)
691 alpha = sqrt(m_two)*species%get_sigma()*delta
692 alpha2_p = alpha**2 ! global copy of alpha
693
694 ! the dim variables are the position of the delta function, in primitive coordinates
695 startval(1:space%dim) = mesh%coord_system%from_cartesian(pos)
696
697 ! solve equation
698 ! Setting a tolerance such that the distance to the first moment is smaller than 1e-5 Bohr
699 call root_solver_init(rs, namespace, space%dim, solver_type=root_newton, maxiter=500, abs_tolerance=1.0e-10_real64)
700 call droot_solver_run(rs, func, xx, conv, startval=startval)
701
702 if (.not. conv) then
703 write(message(1),'(a)') 'Root finding in species_get_density did not converge.'
704 call messages_fatal(1, namespace=namespace)
705 end if
706
707 ! Echo the derived nuclear parameters, so that the nuclear model can be reproduced.
708 write(message(1),'(3a)') &
709 "Info: species_full_gaussian species ", trim(species%get_label()), ":"
710 write(message(2),'(a,f12.6,a,f12.6)') &
711 " sigma = ", species%get_sigma(), " spacing = ", delta
712 write(message(3),'(a,f12.6,a,f12.6,a)') &
713 " alpha = ", alpha, " zeta = ", m_one/alpha2_p, " [bohr^-2]"
714 call messages_info(3, namespace=namespace)
715
716 if(debug%info .and. space%dim == 3) then
717 write(message(1),'(a,3(f6.3,a))') &
718 'Debug: Gaussian charge position in primitive coordinates (', xx(1), ', ', xx(2), ', ', xx(3), ')'
719 call messages_info(1, namespace=namespace)
720 end if
721
722 ! we want a charge of -Z
723 rho = -species%get_z()*rho_p
724
725 nullify(mesh_p)
726 nullify(pos_p)
727 safe_deallocate_a(grho_p)
728 safe_deallocate_a(rho_p)
729
730 type is (full_anc_t)
731
732 rho = m_zero
733
734 type is(jellium_charge_t)
735
736 call volume_init(volume)
737 call volume_read_from_block(volume, namespace, trim(species%rho_string()))
738
739 range = latt%max_length()
740 latt_iter = lattice_iterator_t(latt, range)
741
742 rho = m_zero
743 do icell = 1, latt_iter%n_cells
744 yy = latt_iter%get(icell)
745 do ip = 1, mesh%np
746 call mesh_r(mesh, ip, rr, origin = pos, coords = xx)
747 xx = xx + yy
748 rr = norm2(xx)
749
750 rerho = m_zero
751 if (volume_in_volume(space, volume, xx)) rerho = m_one
752 rho(ip) = rho(ip) - rerho
753 end do
754 end do
755
756 call volume_end(volume)
757
759
760 range = latt%max_length()
761 latt_iter = lattice_iterator_t(latt, range)
762
763 rho = m_zero
764 do icell = 1, latt_iter%n_cells
765 yy = latt_iter%get(icell)
766 do ip = 1, mesh%np
767 call mesh_r(mesh, ip, rr, origin = pos, coords = xx)
768 xx = xx + yy
769 rr = norm2(xx)
770
771 rerho = m_zero
772 call parse_expression(rerho, imrho1, space%dim, xx, rr, m_zero, trim(species%rho_string()))
773 rho(ip) = rho(ip) - rerho
774 end do
775 end do
776
777 rr = species%get_zval() / abs(dmf_integrate(mesh, rho(:)))
778 call lalg_scal(mesh%np, rr, rho)
779
780 class default
781 assert(.false.)
782 end select
783
784 call profiling_out("SPECIES_LR_DENSITY")
786 end subroutine species_get_long_range_density
787
788
789 ! ---------------------------------------------------------
790 subroutine func(xin, ff, jacobian)
791 real(real64), intent(in) :: xin(:)
792 real(real64), intent(out) :: ff(:), jacobian(:,:)
793
794 real(real64), allocatable :: xrho(:)
795 integer :: idir, jdir, dim, ip
796
797 push_sub(func)
798
799 dim = mesh_p%box%dim
800
801 call getrho(dim, xin)
802 safe_allocate(xrho(1:mesh_p%np))
803
804 ! First, we calculate the function ff.
805 do idir = 1, dim
806 !$omp parallel do simd
807 do ip = 1, mesh_p%np
808 xrho(ip) = rho_p(ip) * mesh_p%x_t(ip, idir)
809 end do
810 ff(idir) = dmf_integrate(mesh_p, xrho) - pos_p(idir)
811 end do
812
813 ! Now the jacobian.
814 do idir = 1, dim
815 do jdir = 1, dim
816 !$omp parallel do simd
817 do ip = 1, mesh_p%np
818 xrho(ip) = grho_p(ip, jdir) * mesh_p%x_t(ip, idir)
819 end do
820 jacobian(idir, jdir) = dmf_integrate(mesh_p, xrho)
821 end do
822 end do
823
824 safe_deallocate_a(xrho)
825 pop_sub(func)
826 end subroutine func
827
828 ! ---------------------------------------------------------
829 subroutine species_get_nlcc(species, space, latt, pos, mesh, rho_core, accumulate, dgrid)
830 class(species_t), target, intent(in) :: species
831 class(space_t), intent(in) :: space
832 type(lattice_vectors_t), intent(in) :: latt
833 real(real64), intent(in) :: pos(1:space%dim)
834 class(mesh_t), intent(in) :: mesh
835 real(real64), contiguous, intent(inout) :: rho_core(:)
836 logical, optional, intent(in) :: accumulate
837 type(double_grid_t), intent(in) :: dgrid
838
839 real(real64) :: center(space%dim), rr
840 integer :: icell, ip
841 type(lattice_iterator_t) :: latt_iter
842 type(ps_t), pointer :: ps
843 type(submesh_t) :: sphere
844 real(real64), allocatable :: core_sm(:, :)
845
846 push_sub(species_get_nlcc)
847
848 ! only for 3D pseudopotentials, please
849 select type(species)
850 class is(pseudopotential_t)
851 ps => species%ps
852 if (.not. optional_default(accumulate, .false.)) rho_core = m_zero
853
854 if (.not. species%has_nlcc()) then
855 pop_sub(species_get_nlcc)
856 return
857 end if
858
859 if (dgrid%enabled) then
860 call submesh_init(sphere, space, mesh, latt, pos, &
861 ps%core%x_threshold + double_grid_margin(dgrid, mesh))
862 safe_allocate(core_sm(1:sphere%np, 1:1))
863 call double_grid_transform(dgrid, sphere, 1, [ps%core], [-1], [0], [ps%core%x_threshold], core_sm)
864 call submesh_add_to_mesh(sphere, core_sm(:, 1), rho_core)
865 safe_deallocate_a(core_sm)
866 call submesh_end(sphere)
867 else
868 latt_iter = lattice_iterator_t(latt, ps%core%x_threshold)
869 do icell = 1, latt_iter%n_cells
870 center = pos + latt_iter%get(icell)
871 do ip = 1, mesh%np
872 rr = norm2(mesh%x(1:space%dim, ip) - center)
873 if (rr < spline_range_max(ps%core)) then
874 rho_core(ip) = rho_core(ip) + spline_eval(ps%core, rr)
875 end if
876 end do
877 end do
878 end if
879 class default
880 if (.not. optional_default(accumulate, .false.)) rho_core = m_zero
881 end select
882
883 pop_sub(species_get_nlcc)
884 end subroutine species_get_nlcc
885
886 ! ---------------------------------------------------------
899 subroutine species_get_nlcc_grad(species, space, latt, pos, mesh, rho_core_grad_x)
900 class(species_t), target, intent(in) :: species
901 class(space_t), intent(in) :: space
902 type(lattice_vectors_t), intent(in) :: latt
903 real(real64), intent(in) :: pos(1:space%dim)
904 class(mesh_t), intent(in) :: mesh
905 real(real64), contiguous, intent(inout) :: rho_core_grad_x(:,:,:)
906
907 real(real64) :: center(space%dim), dd(space%dim), rr, drho
908 integer :: icell, ip, idir, jdir
909 type(lattice_iterator_t) :: latt_iter
910 type(ps_t), pointer :: ps
911
912 push_sub(species_get_nlcc_grad)
913
914 rho_core_grad_x = m_zero
915
916 ! only for 3D pseudopotentials with NLCC
917 select type(species)
918 class is(pseudopotential_t)
919 ps => species%ps
920
921 if (.not. species%has_nlcc()) then
922 pop_sub(species_get_nlcc_grad)
923 return
924 end if
925
926 latt_iter = lattice_iterator_t(latt, ps%core%x_threshold)
927 do icell = 1, latt_iter%n_cells
928 center = pos + latt_iter%get(icell)
929 do ip = 1, mesh%np
930 dd(1:space%dim) = mesh%x(1:space%dim, ip) - center
931 rr = norm2(dd)
932 if (rr < spline_range_max(ps%core) .and. rr > r_small) then
933 ! rho`_core(r)/r, so that drho * dd_a * dd_b = (d_a rho_core)(r-R)_b
934 drho = spline_eval(ps%core_der, rr) / rr
935 do idir = 1, space%dim
936 do jdir = idir, space%dim
937 rho_core_grad_x(ip, idir, jdir) = rho_core_grad_x(ip, idir, jdir) &
938 + drho * dd(idir) * dd(jdir)
939 end do
940 end do
941 end if
942 end do
943 end do
944
945 do idir = 1, space%dim
946 do jdir = idir + 1, space%dim
947 rho_core_grad_x(1:mesh%np, jdir, idir) = rho_core_grad_x(1:mesh%np, idir, jdir)
948 end do
949 end do
950 end select
951
952 pop_sub(species_get_nlcc_grad)
953 end subroutine species_get_nlcc_grad
954
955 ! ---------------------------------------------------------
965 subroutine species_get_nlcc_grad_bare(species, space, latt, pos, mesh, grad_rho_core)
966 class(species_t), target, intent(in) :: species
967 class(space_t), intent(in) :: space
968 type(lattice_vectors_t), intent(in) :: latt
969 real(real64), intent(in) :: pos(1:space%dim)
970 class(mesh_t), intent(in) :: mesh
971 real(real64), contiguous, intent(out) :: grad_rho_core(:,:)
972
973 real(real64) :: center(space%dim), dd(space%dim), rr, drho
974 integer :: icell, ip, idir
975 type(lattice_iterator_t) :: latt_iter
976 type(ps_t), pointer :: ps
977
979
980 grad_rho_core = m_zero
981
982 ! only for 3D pseudopotentials with NLCC
983 select type(species)
984 class is(pseudopotential_t)
985 ps => species%ps
986
987 if (.not. species%has_nlcc()) then
989 return
990 end if
991
992 latt_iter = lattice_iterator_t(latt, ps%core%x_threshold)
993 do icell = 1, latt_iter%n_cells
994 center = pos + latt_iter%get(icell)
995 do ip = 1, mesh%np
996 dd(1:space%dim) = mesh%x(1:space%dim, ip) - center
997 rr = norm2(dd)
998 if (rr < spline_range_max(ps%core) .and. rr > r_small) then
999 ! rho`_core(r)/r, so that drho * dd_a = d_a rho_core
1000 drho = spline_eval(ps%core_der, rr) / rr
1001 do idir = 1, space%dim
1002 grad_rho_core(ip, idir) = grad_rho_core(ip, idir) + drho * dd(idir)
1003 end do
1004 end if
1005 end do
1006 end do
1007 end select
1008
1010 end subroutine species_get_nlcc_grad_bare
1011
1012 ! ---------------------------------------------------------
1018 subroutine species_get_local_sr(species, space, latt, pos, mesh, sphere, vpsl, dgrid)
1019 class(species_t), target, intent(in) :: species
1020 class(space_t), intent(in) :: space
1021 type(lattice_vectors_t), intent(in) :: latt
1022 real(real64), intent(in) :: pos(1:space%dim)
1023 class(mesh_t), intent(in) :: mesh
1024 type(submesh_t), intent(inout) :: sphere
1025 real(real64), contiguous, intent(inout) :: vpsl(:)
1026 type(double_grid_t), intent(in) :: dgrid
1027
1028 real(real64) :: radius, sm_radius
1029 real(real64), allocatable :: vl_sm(:, :)
1030 type(ps_t), pointer :: ps
1031
1032 push_sub(species_get_local_sr)
1033
1034 select type(species)
1035 class is(pseudopotential_t)
1036
1037 ps => species%ps
1038
1039 radius = min(ps%vl%x_threshold*1.05_real64, spline_range_max(ps%vl))
1040 sm_radius = radius + double_grid_margin(dgrid, mesh)
1041 if (.not. submesh_compatible(sphere, sm_radius, pos, minval(mesh%spacing(1:space%dim)))) then
1042 call submesh_end(sphere)
1043 call submesh_init(sphere, space, mesh, latt, pos, sm_radius)
1044 end if
1045 safe_allocate(vl_sm(1:sphere%np, 1:1))
1046
1047 call double_grid_transform(dgrid, sphere, 1, [ps%vl], [-1], [0], [radius], vl_sm)
1048
1049 call submesh_add_to_mesh(sphere, vl_sm(:, 1), vpsl)
1050
1051 safe_deallocate_a(vl_sm)
1052 nullify(ps)
1053
1054 end select
1055
1056 pop_sub(species_get_local_sr)
1057 end subroutine species_get_local_sr
1058
1059 ! ---------------------------------------------------------
1060 ! Return the density of a normalized Gaussian centered on xin
1061 ! as well as its gradient with respect to the central position
1062 subroutine getrho(dim, xin)
1063 integer, intent(in) :: dim
1064 real(real64), intent(in) :: xin(1:dim)
1065
1066 integer :: ip, idir
1067 real(real64) :: r2, chi(dim), norm, threshold
1068
1069 push_sub(getrho)
1070
1071 ! We set here a threshold of 0.0001 for the tail of the Gaussian, similar to what we do for the
1072 ! pseudopotentials.
1073 ! Note that this needs to be small enough such that the norm is close to 1. Else, we would need to get
1074 ! the derivative of the normalization with respect to the grid to have the correct Jacobian.
1075 threshold = -log(0.0001_real64)*alpha2_p
1076
1077 do ip = 1, mesh_p%np
1078 ! The Gaussian is Gaussian in the primitive coordinates \xi, whose spacing is uniform;
1079 ! this is what alpha = sqrt(2)*sigma*delta refers to. On a Cartesian mesh chi == x.
1080 chi(1:dim) = mesh_p%chi(1:dim, ip)
1081 r2 = sum((chi - xin(1:dim))**2)
1082
1083 if (r2 < threshold) then
1084 rho_p(ip) = exp(-r2/alpha2_p)
1085 else
1086 rho_p(ip) = m_zero
1087 end if
1088
1089 do idir = 1, dim
1090 grho_p(ip, idir) = (chi(idir) - xin(idir)) * rho_p(ip)
1091 end do
1092 end do
1093
1094 norm = dmf_integrate(mesh_p, rho_p)
1095 call lalg_scal(mesh_p%np, m_one/norm, rho_p)
1096 call lalg_scal(mesh_p%np, dim, m_two/alpha2_p/norm, grho_p)
1097
1098 pop_sub(getrho)
1099 end subroutine getrho
1100
1101
1102 ! ---------------------------------------------------------
1104 subroutine species_get_local(species, namespace, space, latt, pos, mesh, vl)
1105 class(species_t), target, intent(in) :: species
1106 type(namespace_t), intent(in) :: namespace
1107 class(space_t), intent(in) :: space
1108 type(lattice_vectors_t), intent(in) :: latt
1109 real(real64), intent(in) :: pos(1:space%dim)
1110 type(mesh_t), intent(in) :: mesh
1111 real(real64), contiguous, intent(out) :: vl(:)
1112
1113 real(real64) :: a1, a2, rb2, range, density ! for jellium
1114 real(real64) :: xx(space%dim), pos_pc(space%dim), r, r2, threshold
1115 integer :: ip, err, icell
1116 complex(real64) :: zpot
1117 type(lattice_iterator_t) :: latt_iter
1118 real(real64) :: aa, bb
1119
1120 push_sub_with_profile(species_get_local)
1121
1122 select type(species)
1123
1124 type is (soft_coulomb_t)
1125
1126 call parse_variable(namespace, 'SpeciesProjectorSphereThreshold', 0.001_real64, threshold)
1127
1128 !Assuming that we want to take the contribution from all replica that contributes up to 0.001
1129 ! to the center of the cell, we arrive to a range of 1000 a.u..
1130 latt_iter = lattice_iterator_t(latt, species%get_zval() / threshold)
1131 vl = m_zero
1132 do icell = 1, latt_iter%n_cells
1133 pos_pc = pos + latt_iter%get(icell)
1134 do ip = 1, mesh%np
1135 call mesh_r(mesh, ip, r, origin = pos_pc)
1136 r2 = r*r
1137 vl(ip) = vl(ip) -species%get_zval()/sqrt(r2+species%get_softening2())
1138 end do
1139 end do
1140
1141 type is (species_user_defined_t)
1142 !TODO: we should control the value of 5 by a variable.
1143 range = 5.0_real64 * latt%max_length()
1144 latt_iter = lattice_iterator_t(latt, range)
1145 vl = m_zero
1146 do icell = 1, latt_iter%n_cells
1147 pos_pc = pos + latt_iter%get(icell)
1148 do ip = 1, mesh%np
1149 call mesh_r(mesh, ip, r, origin = pos_pc, coords = xx)
1150
1151 zpot = species%user_pot(space%dim, xx, r)
1152 vl(ip) = vl(ip) + real(zpot, real64)
1153 end do
1154 end do
1155
1156 type is(species_from_file_t)
1157
1158 call dio_function_input(trim(species%get_filename()), namespace, space, mesh, vl, err)
1159 if (err /= 0) then
1160 write(message(1), '(a)') 'Error loading file '//trim(species%get_filename())//'.'
1161 write(message(2), '(a,i4)') 'Error code returned = ', err
1162 call messages_fatal(2, namespace=namespace)
1163 end if
1164
1165 type is(jellium_sphere_t)
1166
1167 assert(.not. space%is_periodic())
1168
1169 a1 = species%get_z()/(m_two*species%radius()**3)
1170 a2 = species%get_z()/species%radius()
1171 rb2= species%radius()**2
1172
1173 do ip = 1, mesh%np
1174
1175 xx = mesh%x(:, ip) - pos(1:space%dim)
1176 r = norm2(xx)
1177
1178 if (r <= species%radius()) then
1179 vl(ip) = (a1*(r*r - rb2) - a2)
1180 else
1181 vl(ip) = -species%get_z()/r
1182 end if
1183
1184 end do
1185
1186 type is (jellium_slab_t)
1187
1188 ! Electrostatic potential from an infinite slab of thickness species%thickness
1189 ! Potential and electric fields are continuous at +/- L/2
1190 density = species%get_density(mesh%box%bounding_box_l)
1191 a1 = m_four * m_pi * density * species%thickness() / m_two
1192
1193 do ip = 1, mesh%np
1194
1195 r = abs(mesh%x(3, ip) - pos(3))
1196
1197 if (r <= species%thickness()/m_two) then
1198 vl(ip) = a1 * (r * r / species%thickness() + species%thickness() / m_four)
1199 else
1200 vl(ip) = a1 * r
1201 end if
1202
1203 end do
1204
1205 class is (pseudopotential_t)
1206
1207 assert(.not. space%is_periodic())
1208
1209 !$omp parallel do private(r)
1210 do ip = 1, mesh%np
1211 r = norm2(mesh%x(:, ip) - pos)
1212 vl(ip) = long_range_potential(r, species%ps%sigma_erf, species%ps%z_val)
1213 end do
1214
1215 type is (full_anc_t)
1216 ! periodic copies are not considered in this routine
1217 if (space%is_periodic()) then
1218 call messages_experimental("species_full_anc for periodic systems", namespace=namespace)
1219 end if
1220
1221 aa = species%a()
1222 bb = species%b()
1223 assert(bb < m_zero) ! To be sure it was computed
1224
1225 ! Evaluation of the scaled potential, see Eq. 19
1226 do ip = 1, mesh%np
1227 r2 = sum((mesh%x(:, ip) - pos)**2)*(species%get_z()*aa)**2
1228 if(r2 > r_small**2) then
1229 r = sqrt(r2)
1230 vl(ip) = -m_half &
1231 - (erf(r) + m_two*(aa*bb + m_one/sqrt(m_pi))*r*exp(-r2))/r*aa &
1232 + (erf(r) + m_two*(aa*bb + m_one/sqrt(m_pi))*r*exp(-r2))**2*m_half &
1233 + (-m_two*aa**2*bb - m_four*aa/sqrt(m_pi) &
1234 + m_four*aa*(aa*bb + m_one/sqrt(m_pi))*r2)*exp(-r2)*m_half
1235 else ! Eq. 10
1236 vl(ip) = -m_half - m_three * aa**2*bb - 6.0_real64*aa/sqrt(m_pi)
1237 end if
1238 vl(ip) = vl(ip) * (species%get_z())**2
1239 end do
1240
1241 class default
1242 vl(1:mesh%np) = m_zero
1243 end select
1244
1245 pop_sub_with_profile(species_get_local)
1246 end subroutine species_get_local
1247
1248end module species_pot_oct_m
1249
1250!! Local Variables:
1251!! mode: f90
1252!! coding: utf-8
1253!! End:
Copies a vector x, to a vector y.
Definition: lalg_basic.F90:197
scales a vector by a constant
Definition: lalg_basic.F90:147
Both the filling of the function, and the retrieval of the values may be done using single- or double...
Definition: splines.F90:291
double log(double __x) __attribute__((__nothrow__
double exp(double __x) __attribute__((__nothrow__
subroutine, public datomic_orbital_get_submesh(species, submesh, ii, ll, mm, ispin, phi, derivative)
This module implements the curvilinear coordinates given in E.L. Briggs, D.J. Sullivan,...
Definition: curv_briggs.F90:98
type(debug_t), save, public debug
Definition: debug.F90:133
The Ono-Hirose double-grid technique [T. Ono and K. Hirose, Phys. Rev. Lett. 82, 5016 (1999); Phys....
real(real64) function, public double_grid_margin(this, mesh)
Submesh radius enlargement needed to contain the effective support of a transformed function: the ten...
subroutine, public double_grid_transform(this, sm, nf, spl, ll, mm, rcut, feff, cart_dir, cache)
Evaluate a batch of localized functions f_jf(x) = spl_jf(r) * Y_{ll,mm}(x) (or a purely radial spl_jf...
real(real64), parameter, public m_two
Definition: global.F90:175
real(real64), parameter, public r_small
Definition: global.F90:165
real(real64), parameter, public m_zero
Definition: global.F90:173
real(real64), parameter, public m_four
Definition: global.F90:177
real(real64), parameter, public m_pi
some mathematical constants
Definition: global.F90:171
real(real64), parameter, public m_half
Definition: global.F90:179
real(real64), parameter, public m_one
Definition: global.F90:174
real(real64), parameter, public m_three
Definition: global.F90:176
This module implements the index, used for the mesh points.
Definition: index.F90:101
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,...
This module defines various routines, operating on mesh functions.
This module defines the meshes, which are used in Octopus.
Definition: mesh.F90:97
integer function, public mesh_nearest_point(mesh, pos, dmin, rankmin)
Returns the index of the point which is nearest to a given vector position pos.
Definition: mesh.F90:368
pure subroutine, public mesh_r(mesh, ip, rr, origin, coords)
return the distance to the origin for a given grid point
Definition: mesh.F90:324
subroutine, public messages_not_implemented(feature, namespace)
Definition: messages.F90:1048
character(len=256), dimension(max_lines), public message
to be output by fatal, warning
Definition: messages.F90:138
subroutine, public messages_fatal(no_lines, only_root_writes, namespace)
Definition: messages.F90:386
subroutine, public messages_experimental(name, namespace)
Definition: messages.F90:1020
subroutine, public messages_info(no_lines, iunit, debug_only, stress, all_nodes, namespace)
Definition: messages.F90:570
/* To use the profiling module, call profiling_in and profiling_out with the label of the region as a...
Definition: profiling.F90:122
subroutine, public profiling_out(label)
Increment out counter and sum up difference between entry and exit time.
Definition: profiling.F90:672
subroutine, public profiling_in(label, exclude)
Increment in counter and save entry time.
Definition: profiling.F90:604
Definition: ps.F90:93
pure logical function, public ps_has_density(ps)
Definition: ps.F90:1829
real(real64) pure function, public long_range_potential(r, sigma, z_val)
Evaluate the long-range potential at a given distance.
Definition: ps.F90:786
integer, parameter, public root_newton
subroutine, public root_solver_init(rs, namespace, dimensionality, solver_type, maxiter, rel_tolerance, abs_tolerance)
subroutine, public droot_solver_run(rs, func, root, success, startval)
subroutine, public species_get_nlcc_grad_bare(species, space, latt, pos, mesh, grad_rho_core)
Returns the bare analytic gradient of the NLCC core density.
subroutine, public species_get_local(species, namespace, space, latt, pos, mesh, vl)
used when the density is not available, or otherwise the Poisson eqn would be used instead
subroutine func(xin, ff, jacobian)
subroutine, public species_atom_density_np(species, namespace, pos, mesh, spin_channels, rho)
subroutine, public species_get_long_range_density(species, namespace, space, latt, pos, mesh, rho, sphere_inout, nlr_x)
subroutine, public species_atom_density_derivative_np(species, namespace, pos, mesh, spin_channels, drho)
subroutine, public species_get_nlcc(species, space, latt, pos, mesh, rho_core, accumulate, dgrid)
subroutine, public species_get_nlcc_grad(species, space, latt, pos, mesh, rho_core_grad_x)
Returns the (r-R_I)-weighted analytic gradient of the NLCC core density.
subroutine, public species_get_local_sr(species, space, latt, pos, mesh, sphere, vpsl, dgrid)
Accumulate the short-range (localized) part of the local pseudopotential of one atom into vpsl,...
subroutine, public species_atom_density_grad(species, namespace, space, latt, pos, mesh, spin_channels, drho)
subroutine getrho(dim, xin)
subroutine, public species_atom_density(species, namespace, space, latt, pos, mesh, spin_channels, rho)
real(real64) function, public spline_x_threshold(spl, threshold)
Determines the largest value of x for which the spline values are above the threshold.
Definition: splines.F90:1243
real(real64) function, public spline_eval(spl, x)
Definition: splines.F90:578
real(real64) pure function, public spline_range_max(this)
Definition: splines.F90:1282
real(real64) function, public dsm_integrate(mesh, sm, ff, reduce)
Definition: submesh.F90:1108
subroutine, public submesh_end(this)
Definition: submesh.F90:693
logical function, public submesh_compatible(this, radius, center, dx)
Definition: submesh.F90:675
subroutine, public submesh_init(this, space, mesh, latt, center, rc)
Definition: submesh.F90:209
brief This module defines the class unit_t which is used by the unit_systems_oct_m module.
Definition: unit.F90:111
character(len=20) pure function, public units_abbrev(this)
Definition: unit.F90:202
This module defines the unit system, used for input and output.
type(unit_system_t), public units_out
subroutine, public volume_read_from_block(vol, namespace, block_name)
Definition: volume.F90:136
logical function, public volume_in_volume(space, vol, xx)
Definition: volume.F90:206
subroutine, public volume_end(vol)
Definition: volume.F90:128
subroutine, public volume_init(vol)
Definition: volume.F90:122
subroutine generate_uniform_density()
An abstract type for all electron species.
The following class implements a lattice iterator. It allows one to loop over all cells that are with...
Describes mesh distribution to nodes.
Definition: mesh.F90:165
A type storing the information and data about a pseudopotential.
Definition: ps.F90:169
An abstract class for species. Derived classes include jellium, all electron, and pseudopotential spe...
Definition: species.F90:124
A submesh is a type of mesh, used for the projectors in the pseudopotentials It contains points on a ...
Definition: submesh.F90:154
int true(void)