(git:59cf93c)
Loading...
Searching...
No Matches
sirius_interface.F
Go to the documentation of this file.
1!--------------------------------------------------------------------------------------------------!
2! CP2K: A general program to perform molecular dynamics simulations !
3! Copyright 2000-2026 CP2K developers group <https://cp2k.org> !
4! !
5! SPDX-License-Identifier: GPL-2.0-or-later !
6!--------------------------------------------------------------------------------------------------!
7
8!***************************************************************************************************
9!> \brief Interface to the SIRIUS Library
10!> \par History
11!> 07.2018 initial create
12!> \author JHU
13!***************************************************************************************************
14#if defined(__SIRIUS)
16 USE iso_c_binding, ONLY: c_double,&
17 c_int,&
18 c_loc
22 USE atom_upf, ONLY: atom_upfpot_type
26 USE cell_types, ONLY: cell_type,&
31 USE cp_output_handling, ONLY: cp_p_file,&
45 USE kinds, ONLY: default_string_length,&
46 dp
47 USE machine, ONLY: m_flush
48 USE mathconstants, ONLY: fourpi,&
49 gamma1
52 USE physcon, ONLY: massunit
61 USE qs_kind_types, ONLY: get_qs_kind,&
65 USE sirius, ONLY: &
66 sirius_integer_array_type, sirius_integer_type, sirius_logical_array_type, &
67 sirius_logical_type, sirius_number_array_type, sirius_number_type, &
68 sirius_string_array_type, sirius_string_type, sirius_add_atom, sirius_add_atom_type, &
69 sirius_add_atom_type_radial_function, sirius_add_xc_functional, sirius_context_handler, &
70 sirius_create_context, sirius_create_ground_state, sirius_create_kset_from_grid, &
71 sirius_finalize, sirius_find_ground_state, sirius_get_band_energies, &
72 sirius_get_band_occupancies, sirius_get_energy, sirius_get_forces, &
73 sirius_get_kpoint_properties, sirius_get_num_kpoints, sirius_get_parameters, &
74 sirius_get_stress_tensor, sirius_ground_state_handler, sirius_import_parameters, &
75 sirius_initialize, sirius_initialize_context, sirius_is_initialized, &
76 sirius_kpoint_set_handler, sirius_option_get_info, sirius_option_get_section_length, &
77 sirius_option_set, sirius_set_atom_position, sirius_set_atom_type_dion, &
78 sirius_set_atom_type_hubbard, sirius_set_atom_type_radial_grid, &
79 sirius_set_lattice_vectors, sirius_set_mpi_grid_dims, sirius_update_ground_state
80#include "./base/base_uses.f90"
81
82 IMPLICIT NONE
83
84 PRIVATE
85
86 ! Global parameters
87
88 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'sirius_interface'
89
90 ! Public subroutines
91
92 PUBLIC :: cp_sirius_create_env, &
98
99CONTAINS
100
101!***************************************************************************************************
102!> \brief Initialize the Sirius library
103!> \par Creation (07.2018, JHU)
104!> \author JHU
105! **************************************************************************************************
106 SUBROUTINE cp_sirius_init()
107 CALL sirius_initialize(.false.)
108 END SUBROUTINE cp_sirius_init
109
110!***************************************************************************************************
111!> \brief Check the initialisation status of the Sirius library
112!> \return Return the initialisation status of the Sirius library as boolean
113!> \par Creation (03.12.2025, MK)
114!> \author Matthias Krack
115! **************************************************************************************************
116 LOGICAL FUNCTION cp_sirius_is_initialized()
117 CALL sirius_is_initialized(cp_sirius_is_initialized)
118 END FUNCTION cp_sirius_is_initialized
119
120!***************************************************************************************************
121!> \brief Finalize the Sirius library
122!> \par Creation (07.2018, JHU)
123!> \author JHU
124! **************************************************************************************************
125 SUBROUTINE cp_sirius_finalize()
126 CALL sirius_finalize(.false., .false., .false.)
127 END SUBROUTINE cp_sirius_finalize
128
129!***************************************************************************************************
130!> \brief ...
131!> \param pwdft_env ...
132!> \param
133!> \par History
134!> 07.2018 Create the Sirius environment
135!> \author JHU
136! **************************************************************************************************
137 SUBROUTINE cp_sirius_create_env(pwdft_env)
138 TYPE(pwdft_environment_type), POINTER :: pwdft_env
139#if defined(__SIRIUS)
140
141 CHARACTER(len=2) :: element_symbol
142 CHARACTER(len=default_string_length) :: label
143 INTEGER :: i, ii, jj, iatom, ibeta, ifun, ikind, iwf, j, l, &
144 n, ns, natom, nbeta, nbs, nkind, nmesh, &
145 num_mag_dims, sirius_mpi_comm, vdw_func, nu, lu, output_unit
146 INTEGER, DIMENSION(:), POINTER :: mpi_grid_dims
147 INTEGER(KIND=C_INT), DIMENSION(3) :: k_grid, k_shift
148 INTEGER, DIMENSION(:), POINTER :: kk
149 LOGICAL :: up, use_ref_cell
150 LOGICAL(4) :: use_so, use_symmetry, dft_plus_u_atom
151 REAL(KIND=c_double), ALLOCATABLE, DIMENSION(:) :: fun
152 REAL(KIND=c_double), ALLOCATABLE, DIMENSION(:, :) :: dion
153 REAL(KIND=c_double), DIMENSION(3) :: a1, a2, a3, v1, v2
154 REAL(KIND=dp) :: al, angle1, angle2, cval, focc, &
155 magnetization, mass, pf, rl, zeff, alpha_u, beta_u, &
156 j0_u, j_u, u_u, occ_u, u_minus_j, vnlp, vnlm
157 REAL(KIND=dp), ALLOCATABLE, DIMENSION(:) :: beta, corden, ef, fe, locpot, rc, rp
158 REAL(KIND=dp), DIMENSION(3) :: vr, vs, j_t
159 REAL(KIND=dp), DIMENSION(:), POINTER :: density
160 REAL(KIND=dp), DIMENSION(:, :), POINTER :: wavefunction, wfninfo
161 TYPE(atom_gthpot_type), POINTER :: gth_atompot
162 TYPE(atom_upfpot_type), POINTER :: upf_pot
163 TYPE(atomic_kind_type), DIMENSION(:), POINTER :: atomic_kind_set
164 TYPE(atomic_kind_type), POINTER :: atomic_kind
165 TYPE(cell_type), POINTER :: my_cell
166 TYPE(mp_para_env_type), POINTER :: para_env
167 TYPE(grid_atom_type), POINTER :: atom_grid
168 TYPE(gth_potential_type), POINTER :: gth_potential
169 TYPE(particle_type), DIMENSION(:), POINTER :: particle_set
170 TYPE(qs_kind_type), DIMENSION(:), POINTER :: qs_kind_set
171 TYPE(qs_subsys_type), POINTER :: qs_subsys
172 TYPE(section_vals_type), POINTER :: pwdft_section, pwdft_sub_section, &
173 xc_fun, xc_section
174 TYPE(sirius_context_handler) :: sctx
175 TYPE(sirius_ground_state_handler) :: gs_handler
176 TYPE(sirius_kpoint_set_handler) :: ks_handler
177
178 cpassert(ASSOCIATED(pwdft_env))
179
180 output_unit = cp_logger_get_default_io_unit()
181 ! create context of simulation
182 CALL pwdft_env_get(pwdft_env, para_env=para_env)
183 sirius_mpi_comm = para_env%get_handle()
184 CALL sirius_create_context(sirius_mpi_comm, sctx)
185
186! the "fun" starts.
187
188 CALL pwdft_env_get(pwdft_env=pwdft_env, pwdft_input=pwdft_section, xc_input=xc_section)
189
190 CALL section_vals_val_get(pwdft_section, "ignore_convergence_failure", &
191 l_val=pwdft_env%ignore_convergence_failure)
192 ! cp2k should *have* a function that return all xc_functionals. Doing
193 ! manually is prone to errors
194
195 IF (ASSOCIATED(xc_section)) THEN
196 ifun = 0
197 DO
198 ifun = ifun + 1
199 xc_fun => section_vals_get_subs_vals2(xc_section, i_section=ifun)
200 IF (.NOT. ASSOCIATED(xc_fun)) EXIT
201 ! Here, we do not have to check whether the functional name starts with XC_
202 ! because we only allow the shorter form w/o XC_
203 CALL sirius_add_xc_functional(sctx, "XC_"//trim(xc_fun%section%name))
204 END DO
205 END IF
206
207 ! import control section
208 pwdft_sub_section => section_vals_get_subs_vals(pwdft_section, "control")
209 IF (ASSOCIATED(pwdft_sub_section)) THEN
210 CALL cp_sirius_fill_in_section(sctx, pwdft_sub_section, "control")
211 CALL section_vals_val_get(pwdft_sub_section, "mpi_grid_dims", i_vals=mpi_grid_dims)
212 END IF
213
214! import parameters section
215 pwdft_sub_section => section_vals_get_subs_vals(pwdft_section, "parameters")
216
217 IF (ASSOCIATED(pwdft_sub_section)) THEN
218 CALL cp_sirius_fill_in_section(sctx, pwdft_sub_section, "parameters")
219 CALL section_vals_val_get(pwdft_sub_section, "ngridk", i_vals=kk)
220 k_grid(1) = kk(1)
221 k_grid(2) = kk(2)
222 k_grid(3) = kk(3)
223
224 CALL section_vals_val_get(pwdft_sub_section, "shiftk", i_vals=kk)
225 k_shift(1) = kk(1)
226 k_shift(2) = kk(2)
227 k_shift(3) = kk(3)
228 CALL section_vals_val_get(pwdft_sub_section, "num_mag_dims", i_val=num_mag_dims)
229 CALL section_vals_val_get(pwdft_sub_section, "use_symmetry", l_val=use_symmetry)
230 CALL section_vals_val_get(pwdft_sub_section, "so_correction", l_val=use_so)
231
232! now check if van der walls corrections are needed
233 vdw_func = -1
234#ifdef __LIBVDWXC
235 CALL section_vals_val_get(pwdft_sub_section, "vdw_functional", i_val=vdw_func)
236 SELECT CASE (vdw_func)
237 CASE (sirius_func_vdwdf)
238 CALL sirius_add_xc_functional(sctx, "XC_FUNC_VDWDF")
239 CASE (sirius_func_vdwdf2)
240 CALL sirius_add_xc_functional(sctx, "XC_FUNC_VDWDF2")
242 CALL sirius_add_xc_functional(sctx, "XC_FUNC_VDWDFCX")
243 CASE default
244 END SELECT
245#endif
246
247 END IF
248
249! import mixer section
250 pwdft_sub_section => section_vals_get_subs_vals(pwdft_section, "mixer")
251 IF (ASSOCIATED(pwdft_sub_section)) THEN
252 CALL cp_sirius_fill_in_section(sctx, pwdft_sub_section, "mixer")
253 END IF
254
255! import settings section
256 pwdft_sub_section => section_vals_get_subs_vals(pwdft_section, "settings")
257 IF (ASSOCIATED(pwdft_sub_section)) THEN
258 CALL cp_sirius_fill_in_section(sctx, pwdft_sub_section, "settings")
259 END IF
260
261 ! import solver section
262 pwdft_sub_section => section_vals_get_subs_vals(pwdft_section, "iterative_solver")
263 IF (ASSOCIATED(pwdft_sub_section)) THEN
264 CALL cp_sirius_fill_in_section(sctx, pwdft_sub_section, "iterative_solver")
265 END IF
266
267#if defined(__SIRIUS_DFTD4)
268 ! import dftd3 and dftd4 section
269 pwdft_sub_section => section_vals_get_subs_vals(pwdft_section, "dftd4")
270 IF (ASSOCIATED(pwdft_sub_section)) THEN
271 CALL cp_sirius_fill_in_section(sctx, pwdft_sub_section, "dftd4")
272 END IF
273
274 pwdft_sub_section => section_vals_get_subs_vals(pwdft_section, "dftd3")
275 IF (ASSOCIATED(pwdft_sub_section)) THEN
276 CALL cp_sirius_fill_in_section(sctx, pwdft_sub_section, "dftd3")
277 END IF
278#endif
279
280 !
281 ! uncomment these lines when nlcg is officially supported
282 !
283#if defined(__SIRIUS_NLCG)
284 ! import nlcg section
285 pwdft_sub_section => section_vals_get_subs_vals(pwdft_section, "nlcg")
286 IF (ASSOCIATED(pwdft_sub_section)) THEN
287 CALL cp_sirius_fill_in_section(sctx, pwdft_sub_section, "nlcg")
288 END IF
289#endif
290
291#if defined(__SIRIUS_VCSQNM)
292 pwdft_sub_section => section_vals_get_subs_vals(pwdft_section, "vcsqnm")
293 IF (ASSOCIATED(pwdft_sub_section)) THEN
294 CALL cp_sirius_fill_in_section(sctx, pwdft_sub_section, "vcsqnm")
295 END IF
296#endif
297
298 !CALL sirius_dump_runtime_setup(sctx, "runtime.json")
299 CALL sirius_import_parameters(sctx, '{}')
300
301! lattice vectors of the unit cell should be in [a.u.] (length is in [a.u.])
302 CALL pwdft_env_get(pwdft_env=pwdft_env, qs_subsys=qs_subsys)
303 CALL qs_subsys_get(qs_subsys, cell=my_cell, use_ref_cell=use_ref_cell)
304 a1(:) = my_cell%hmat(:, 1)
305 a2(:) = my_cell%hmat(:, 2)
306 a3(:) = my_cell%hmat(:, 3)
307 CALL sirius_set_lattice_vectors(sctx, a1(1), a2(1), a3(1))
308
309 IF (use_ref_cell) THEN
310 cpwarn("SIRIUS| The specified CELL_REF will be ignored for PW_DFT calculations")
311 END IF
312
313! set up the atomic type definitions
314 CALL qs_subsys_get(qs_subsys, &
315 atomic_kind_set=atomic_kind_set, &
316 qs_kind_set=qs_kind_set, &
317 particle_set=particle_set)
318 nkind = SIZE(atomic_kind_set)
319 DO ikind = 1, nkind
320 CALL get_atomic_kind(atomic_kind_set(ikind), &
321 name=label, element_symbol=element_symbol, mass=mass)
322 CALL get_qs_kind(qs_kind_set(ikind), zeff=zeff)
323 NULLIFY (upf_pot, gth_potential)
324 CALL get_qs_kind(qs_kind_set(ikind), upf_potential=upf_pot, gth_potential=gth_potential)
325
326 IF (ASSOCIATED(upf_pot)) THEN
327 CALL sirius_add_atom_type(sctx, label, fname=upf_pot%filename, &
328 symbol=element_symbol, &
329 mass=real(mass/massunit, kind=c_double))
330
331 ELSEIF (ASSOCIATED(gth_potential)) THEN
332!
333 NULLIFY (atom_grid)
334 CALL allocate_grid_atom(atom_grid)
335 nmesh = 929
336 atom_grid%nr = nmesh
337 CALL create_grid_atom(atom_grid, nmesh, 1, 1, 0, do_gapw_log)
338 ALLOCATE (rp(nmesh), fun(nmesh))
339 IF (atom_grid%rad(1) < atom_grid%rad(nmesh)) THEN
340 up = .true.
341 ELSE
342 up = .false.
343 END IF
344 IF (up) THEN
345 rp(1:nmesh) = atom_grid%rad(1:nmesh)
346 ELSE
347 DO i = 1, nmesh
348 rp(i) = atom_grid%rad(nmesh - i + 1)
349 END DO
350 END IF
351! add new atom type
352 CALL sirius_add_atom_type(sctx, label, &
353 zn=nint(zeff + 0.001d0), &
354 symbol=element_symbol, &
355 mass=real(mass/massunit, kind=c_double), &
356 spin_orbit=gth_potential%soc)
357!
358 ALLOCATE (gth_atompot)
359 CALL gth_potential_conversion(gth_potential, gth_atompot)
360! set radial grid
361 fun(1:nmesh) = rp(1:nmesh)
362 CALL sirius_set_atom_type_radial_grid(sctx, label, nmesh, fun(1))
363! set beta-projectors
364! GTH SOC uses the same projectors, SIRIUS can use the same or different projectors for l+1/2, l-1/2 (l > 0 l+1/2 l < 0 l-/2 )
365 ALLOCATE (ef(nmesh), beta(nmesh))
366 ibeta = 0
367 DO l = 0, 3
368 IF (gth_atompot%nl(l) == 0) cycle
369 rl = gth_atompot%rcnl(l)
370! we need to multiply by r so that data transferred to sirius are r \beta(r) not beta(r)
371 ef(1:nmesh) = exp(-0.5_dp*rp(1:nmesh)*rp(1:nmesh)/(rl*rl))
372 DO i = 1, gth_atompot%nl(l)
373 pf = rl**(l + 0.5_dp*(4._dp*i - 1._dp))
374 j = l + 2*i - 1
375 pf = sqrt(2._dp)/(pf*sqrt(gamma1(j)))
376 beta(:) = pf*rp**(l + 2*i - 2)*ef
377 ibeta = ibeta + 1
378 fun(1:nmesh) = beta(1:nmesh)*rp(1:nmesh)
379 CALL sirius_add_atom_type_radial_function(sctx, label, &
380 "beta", fun(1), nmesh, l=l)
381 ! we double the number of beta projectors for SO and l>0
382 IF (gth_atompot%soc .AND. l /= 0) THEN
383 CALL sirius_add_atom_type_radial_function(sctx, label, &
384 "beta", fun(1), nmesh, l=-l)
385 END IF
386 END DO
387 END DO
388 DEALLOCATE (ef, beta)
389 nbeta = ibeta
390
391! nonlocal PP matrix elements
392 IF (gth_atompot%soc) THEN
393 nbs = 2*nbeta - gth_atompot%nl(0)
394 ALLOCATE (dion(nbs, nbs))
395 ELSE
396 ALLOCATE (dion(nbeta, nbeta))
397 END IF
398 dion = 0.0_dp
399 IF (gth_atompot%soc) THEN
400 ns = gth_atompot%nl(0)
401 IF (ns /= 0) THEN
402 dion(1:ns, 1:ns) = gth_atompot%hnl(1:ns, 1:ns, 0)
403 END IF
404 DO l = 1, 3
405 IF (gth_atompot%nl(l) == 0) cycle
406 DO i = 1, gth_atompot%nl(l)
407 ii = ns + 2*sum(gth_atompot%nl(1:l - 1))
408 ii = ii + 2*(i - 1) + 1
409 DO j = 1, gth_atompot%nl(l)
410 jj = ns + 2*sum(gth_atompot%nl(1:l - 1))
411 jj = jj + 2*(j - 1) + 1
412 vnlp = gth_atompot%hnl(i, j, l) + 0.5_dp*l*gth_atompot%knl(i, j, l)
413 vnlm = gth_atompot%hnl(i, j, l) - 0.5_dp*(l + 1)*gth_atompot%knl(i, j, l)
414 dion(ii, jj) = vnlp
415 dion(ii + 1, jj + 1) = vnlm
416 END DO
417 END DO
418 END DO
419 CALL sirius_set_atom_type_dion(sctx, label, nbs, dion(1, 1))
420 ELSE
421 DO l = 0, 3
422 IF (gth_atompot%nl(l) == 0) cycle
423 ibeta = sum(gth_atompot%nl(0:l - 1)) + 1
424 i = ibeta + gth_atompot%nl(l) - 1
425 dion(ibeta:i, ibeta:i) = gth_atompot%hnl(1:gth_atompot%nl(l), 1:gth_atompot%nl(l), l)
426 END DO
427 CALL sirius_set_atom_type_dion(sctx, label, nbeta, dion(1, 1))
428 END IF
429
430 DEALLOCATE (dion)
431
432! set non-linear core correction
433 IF (gth_atompot%nlcc) THEN
434 ALLOCATE (corden(nmesh), fe(nmesh), rc(nmesh))
435 corden(:) = 0.0_dp
436 n = gth_atompot%nexp_nlcc
437 DO i = 1, n
438 al = gth_atompot%alpha_nlcc(i)
439 rc(:) = rp(:)/al
440 fe(:) = exp(-0.5_dp*rc(:)*rc(:))
441 DO j = 1, gth_atompot%nct_nlcc(i)
442 cval = gth_atompot%cval_nlcc(j, i)
443 corden(:) = corden(:) + fe(:)*rc(:)**(2*j - 2)*cval
444 END DO
445 END DO
446 fun(1:nmesh) = corden(1:nmesh)*rp(1:nmesh)
447 CALL sirius_add_atom_type_radial_function(sctx, label, "ps_rho_core", &
448 fun(1), nmesh)
449 DEALLOCATE (corden, fe, rc)
450 END IF
451
452! local potential
453 ALLOCATE (locpot(nmesh))
454 locpot(:) = 0.0_dp
455 CALL atom_local_potential(locpot, gth_atompot, rp)
456 fun(1:nmesh) = locpot(1:nmesh)
457 CALL sirius_add_atom_type_radial_function(sctx, label, "vloc", &
458 fun(1), nmesh)
459 DEALLOCATE (locpot)
460!
461 NULLIFY (density, wavefunction, wfninfo)
462 CALL calculate_atomic_orbitals(atomic_kind_set(ikind), qs_kind_set(ikind), &
463 density=density, wavefunction=wavefunction, &
464 wfninfo=wfninfo, agrid=atom_grid)
465
466! set the atomic radial functions
467 DO iwf = 1, SIZE(wavefunction, 2)
468 focc = wfninfo(1, iwf)
469 l = nint(wfninfo(2, iwf))
470! we can not easily get the principal quantum number
471 nu = -1
472 IF (up) THEN
473 fun(1:nmesh) = wavefunction(1:nmesh, iwf)*rp(i)
474 ELSE
475 DO i = 1, nmesh
476 fun(i) = wavefunction(nmesh - i + 1, iwf)*rp(i)
477 END DO
478 END IF
479 CALL sirius_add_atom_type_radial_function(sctx, &
480 label, "ps_atomic_wf", &
481 fun(1), nmesh, l=l, occ=real(focc, kind=c_double), n=nu)
482 END DO
483
484! set total charge density of a free atom (to compute initial rho(r))
485 IF (up) THEN
486 fun(1:nmesh) = fourpi*density(1:nmesh)*atom_grid%rad(1:nmesh)**2
487 ELSE
488 DO i = 1, nmesh
489 fun(i) = fourpi*density(nmesh - i + 1)*atom_grid%rad(nmesh - i + 1)**2
490 END DO
491 END IF
492 CALL sirius_add_atom_type_radial_function(sctx, label, "ps_rho_total", &
493 fun(1), nmesh)
494
495 IF (ASSOCIATED(density)) DEALLOCATE (density)
496 IF (ASSOCIATED(wavefunction)) DEALLOCATE (wavefunction)
497 IF (ASSOCIATED(wfninfo)) DEALLOCATE (wfninfo)
498
499 CALL deallocate_grid_atom(atom_grid)
500 DEALLOCATE (rp, fun)
501 DEALLOCATE (gth_atompot)
502!
503 ELSE
504 CALL cp_abort(__location__, &
505 "CP2K/SIRIUS: atomic kind needs UPF or GTH potential definition")
506 END IF
507
508 CALL get_qs_kind(qs_kind_set(ikind), &
509 dft_plus_u_atom=dft_plus_u_atom, &
510 l_of_dft_plus_u=lu, &
511 n_of_dft_plus_u=nu, &
512 u_minus_j_target=u_minus_j, &
513 u_of_dft_plus_u=u_u, &
514 j_of_dft_plus_u=j_u, &
515 alpha_of_dft_plus_u=alpha_u, &
516 beta_of_dft_plus_u=beta_u, &
517 j0_of_dft_plus_u=j0_u, &
518 occupation_of_dft_plus_u=occ_u)
519
520 IF (dft_plus_u_atom) THEN
521 IF (nu < 1) THEN
522 cpabort("CP2K/SIRIUS (hubbard): principal quantum number not specified")
523 END IF
524
525 IF (lu < 0) THEN
526 cpabort("CP2K/SIRIUS (hubbard): l can not be negative.")
527 END IF
528
529 IF (occ_u < 0.0) THEN
530 cpabort("CP2K/SIRIUS (hubbard): the occupation number can not be negative.")
531 END IF
532
533 j_t(:) = 0.0
534 IF (abs(u_minus_j) < 1e-8) THEN
535 j_t(1) = j_u
536 CALL sirius_set_atom_type_hubbard(sctx, label, lu, nu, &
537 occ_u, u_u, j_t, alpha_u, beta_u, j0_u)
538 ELSE
539 CALL sirius_set_atom_type_hubbard(sctx, label, lu, nu, &
540 occ_u, u_minus_j, j_t, alpha_u, beta_u, j0_u)
541 END IF
542 END IF
543
544 END DO
545
546! add atoms to the unit cell
547! WARNING: sirius accepts only fractional coordinates;
548 natom = SIZE(particle_set)
549 DO iatom = 1, natom
550 vr(1:3) = particle_set(iatom)%r(1:3)
551 CALL real_to_scaled(vs, vr, my_cell)
552 atomic_kind => particle_set(iatom)%atomic_kind
553 ikind = atomic_kind%kind_number
554 CALL get_atomic_kind(atomic_kind, name=label)
555 CALL get_qs_kind(qs_kind_set(ikind), zeff=zeff, magnetization=magnetization)
556! angle of magnetization might come from input Atom x y z mx my mz
557! or as an angle?
558! Answer : SIRIUS only accept the magnetization as mx, my, mz
559 IF (num_mag_dims == 3) THEN
560 angle1 = 0.0_dp
561 angle2 = 0.0_dp
562 v1(1) = magnetization*sin(angle1)*cos(angle2)
563 v1(2) = magnetization*sin(angle1)*sin(angle2)
564 v1(3) = magnetization*cos(angle1)
565 ELSE
566 v1 = 0._dp
567 v1(3) = magnetization
568 END IF
569 v2(1:3) = vs(1:3)
570 CALL sirius_add_atom(sctx, label, v2(1), v1(1))
571 END DO
572
573 CALL sirius_set_mpi_grid_dims(sctx, 2, mpi_grid_dims)
574
575! initialize global variables/indices/arrays/etc. of the simulation
576 CALL sirius_initialize_context(sctx)
577
578 ! strictly speaking the parameter use_symmetry is initialized at the
579 ! beginning but it does no harm to do it that way
580 IF (use_symmetry) THEN
581 CALL sirius_create_kset_from_grid(sctx, k_grid(1), k_shift(1), use_symmetry=.true., kset_handler=ks_handler)
582 ELSE
583 CALL sirius_create_kset_from_grid(sctx, k_grid(1), k_shift(1), use_symmetry=.false., kset_handler=ks_handler)
584 END IF
585! create ground-state class
586 CALL sirius_create_ground_state(ks_handler, gs_handler)
587
588 CALL pwdft_env_set(pwdft_env, sctx=sctx, gs_handler=gs_handler, ks_handler=ks_handler)
589#endif
590 END SUBROUTINE cp_sirius_create_env
591
592!***************************************************************************************************
593!> \brief ...
594!> \param pwdft_env ...
595!> \param
596!> \par History
597!> 07.2018 Update the Sirius environment
598!> \author JHU
599! **************************************************************************************************
600 SUBROUTINE cp_sirius_update_context(pwdft_env)
601 TYPE(pwdft_environment_type), POINTER :: pwdft_env
602
603 INTEGER :: iatom, natom
604 REAL(KIND=c_double), DIMENSION(3) :: a1, a2, a3, v2
605 REAL(KIND=dp), DIMENSION(3) :: vr, vs
606 TYPE(cell_type), POINTER :: my_cell
607 TYPE(particle_type), DIMENSION(:), POINTER :: particle_set
608 TYPE(qs_subsys_type), POINTER :: qs_subsys
609 TYPE(sirius_context_handler) :: sctx
610 TYPE(sirius_ground_state_handler) :: gs_handler
611
612 cpassert(ASSOCIATED(pwdft_env))
613 CALL pwdft_env_get(pwdft_env, sctx=sctx, gs_handler=gs_handler)
614
615! get current positions and lattice vectors
616 CALL pwdft_env_get(pwdft_env=pwdft_env, qs_subsys=qs_subsys)
617
618! lattice vectors of the unit cell should be in [a.u.] (length is in [a.u.])
619 CALL qs_subsys_get(qs_subsys, cell=my_cell)
620 a1(:) = my_cell%hmat(:, 1)
621 a2(:) = my_cell%hmat(:, 2)
622 a3(:) = my_cell%hmat(:, 3)
623 CALL sirius_set_lattice_vectors(sctx, a1(1), a2(1), a3(1))
624
625! new atomic positions
626 CALL qs_subsys_get(qs_subsys, particle_set=particle_set)
627 natom = SIZE(particle_set)
628 DO iatom = 1, natom
629 vr(1:3) = particle_set(iatom)%r(1:3)
630 CALL real_to_scaled(vs, vr, my_cell)
631 v2(1:3) = vs(1:3)
632 CALL sirius_set_atom_position(sctx, iatom, v2(1))
633 END DO
634
635! update ground-state class
636 CALL sirius_update_ground_state(gs_handler)
637
638 CALL pwdft_env_set(pwdft_env, sctx=sctx, gs_handler=gs_handler)
639
640 END SUBROUTINE cp_sirius_update_context
641
642! **************************************************************************************************
643!> \brief ...
644!> \param sctx ...
645!> \param section ...
646!> \param section_name ...
647! **************************************************************************************************
648 SUBROUTINE cp_sirius_fill_in_section(sctx, section, section_name)
649 TYPE(sirius_context_handler), INTENT(INOUT) :: sctx
650 TYPE(section_vals_type), POINTER :: section
651 CHARACTER(*), INTENT(in) :: section_name
652
653 CHARACTER(len=256), TARGET :: option_name
654 CHARACTER(len=4096) :: description, usage
655 CHARACTER(len=80), DIMENSION(:), POINTER :: tmp
656 CHARACTER(len=80), TARGET :: str
657 INTEGER :: ctype, elem, ic, j
658 INTEGER, DIMENSION(:), POINTER :: ivals
659 INTEGER, TARGET :: enum_length, ival, length, &
660 num_possible_values, number_of_options
661 LOGICAL :: explicit
662 LOGICAL, DIMENSION(:), POINTER :: lvals
663 LOGICAL, TARGET :: found, lval
664 REAL(kind=dp), DIMENSION(:), POINTER :: rvals
665 REAL(kind=dp), TARGET :: rval
666
667 NULLIFY (rvals)
668 NULLIFY (ivals)
669 CALL sirius_option_get_section_length(section_name, number_of_options)
670
671 DO elem = 1, number_of_options
672 option_name = ''
673 CALL sirius_option_get_info(section_name, &
674 elem, &
675 option_name, &
676 256, &
677 ctype, &
678 num_possible_values, &
679 enum_length, &
680 description, &
681 4096, &
682 usage, &
683 4096)
684
685 ! ignore the keyword parametes for sections dftd3 and dftd4.
686 IF (((section_name == 'dftd3') .OR. (section_name == 'dftd4')) .AND. (option_name == 'parameters')) THEN
687 cycle
688 END IF
689
690 IF ((option_name /= 'memory_usage') .AND. (option_name /= 'xc_functionals') .AND. (option_name /= 'vk')) THEN
691 CALL section_vals_val_get(section, option_name, explicit=found)
692 IF (found) THEN
693 SELECT CASE (ctype)
694 CASE (sirius_integer_type)
695 CALL section_vals_val_get(section, option_name, i_val=ival)
696 CALL sirius_option_set(sctx, section_name, option_name, ctype, c_loc(ival))
697 CASE (sirius_number_type)
698 CALL section_vals_val_get(section, option_name, r_val=rval)
699 CALL sirius_option_set(sctx, section_name, option_name, ctype, c_loc(rval))
700 CASE (sirius_logical_type)
701 CALL section_vals_val_get(section, option_name, l_val=lval)
702 CALL sirius_option_set(sctx, section_name, option_name, ctype, c_loc(lval))
703 CASE (sirius_string_type) ! string nightmare
704 str = ''
705 CALL section_vals_val_get(section, option_name, explicit=explicit, c_val=str)
706 str = trim(adjustl(str))
707 DO j = 1, len(str)
708 ic = ichar(str(j:j))
709 IF (ic >= 65 .AND. ic < 90) str(j:j) = char(ic + 32)
710 END DO
711
712 CALL sirius_option_set(sctx, section_name, option_name, ctype, c_loc(str), max_length=len_trim(str))
713 CASE (sirius_integer_array_type)
714 CALL section_vals_val_get(section, option_name, i_vals=ivals)
715 CALL sirius_option_set(sctx, section_name, option_name, ctype, c_loc(ivals(1)), &
716 max_length=num_possible_values)
717 CASE (sirius_number_array_type)
718 CALL section_vals_val_get(section, option_name, r_vals=rvals)
719 CALL sirius_option_set(sctx, section_name, option_name, ctype, c_loc(rvals(1)), &
720 max_length=num_possible_values)
721 CASE (sirius_logical_array_type)
722 CALL section_vals_val_get(section, option_name, l_vals=lvals)
723 CALL sirius_option_set(sctx, section_name, option_name, ctype, c_loc(lvals(1)), &
724 max_length=num_possible_values)
725 CASE (sirius_string_array_type)
726 CALL section_vals_val_get(section, option_name, explicit=explicit, n_rep_val=length)
727 DO j = 1, length
728 str = ''
729 CALL section_vals_val_get(section, option_name, i_rep_val=j, explicit=explicit, c_vals=tmp)
730 str = trim(adjustl(tmp(j)))
731 CALL sirius_option_set(sctx, section_name, option_name, ctype, c_loc(str), &
732 max_length=len_trim(str), append=.true.)
733 END DO
734 CASE DEFAULT
735 END SELECT
736 END IF
737 END IF
738 END DO
739 END SUBROUTINE cp_sirius_fill_in_section
740
741!***************************************************************************************************
742!> \brief ...
743!> \param pwdft_env ...
744!> \param calculate_forces ...
745!> \param calculate_stress_tensor ...
746!> \param
747!> \par History
748!> 07.2018 start the Sirius library
749!> \author JHU
750! **************************************************************************************************
751 SUBROUTINE cp_sirius_energy_force(pwdft_env, calculate_forces, calculate_stress_tensor)
752 TYPE(pwdft_environment_type), INTENT(INOUT), &
753 POINTER :: pwdft_env
754 LOGICAL, INTENT(IN) :: calculate_forces, calculate_stress_tensor
755
756 INTEGER :: iw, n1, n2
757 LOGICAL :: do_print, gs_converged
758 REAL(KIND=c_double) :: etotal
759 REAL(KIND=c_double), ALLOCATABLE, DIMENSION(:, :) :: cforces
760 REAL(KIND=c_double), DIMENSION(3, 3) :: cstress
761 REAL(KIND=dp), DIMENSION(3, 3) :: stress
762 REAL(KIND=dp), DIMENSION(:, :), POINTER :: forces
763 TYPE(cp_logger_type), POINTER :: logger
764 TYPE(pwdft_energy_type), POINTER :: energy
765 TYPE(section_vals_type), POINTER :: print_section, pwdft_input
766 TYPE(sirius_ground_state_handler) :: gs_handler
767
768 cpassert(ASSOCIATED(pwdft_env))
769
770 NULLIFY (logger)
771 logger => cp_get_default_logger()
773
774 CALL pwdft_env_get(pwdft_env=pwdft_env, gs_handler=gs_handler)
775 CALL sirius_find_ground_state(gs_handler, converged=gs_converged)
776
777 IF (gs_converged) THEN
778 IF (iw > 0) WRITE (iw, '(A)') "CP2K/SIRIUS: ground state is converged"
779 ELSE
780 IF (pwdft_env%ignore_convergence_failure) THEN
781 IF (iw > 0) WRITE (iw, '(A)') "CP2K/SIRIUS Warning: ground state is not converged"
782 ELSE
783 cpabort("CP2K/SIRIUS (ground state): SIRIUS did not converge.")
784 END IF
785 END IF
786 IF (iw > 0) CALL m_flush(iw)
787
788 CALL pwdft_env_get(pwdft_env=pwdft_env, energy=energy)
789 etotal = 0.0_c_double
790
791 CALL sirius_get_energy(gs_handler, 'band-gap', etotal)
792 energy%band_gap = etotal
793
794 etotal = 0.0_c_double
795 CALL sirius_get_energy(gs_handler, 'total', etotal)
796 energy%etotal = etotal
797
798 ! extract entropy (TS returned by sirius is always negative, sign
799 ! convention in QE)
800 etotal = 0.0_c_double
801 CALL sirius_get_energy(gs_handler, 'demet', etotal)
802 energy%entropy = -etotal
803
804 IF (calculate_forces) THEN
805 CALL pwdft_env_get(pwdft_env=pwdft_env, forces=forces)
806 n1 = SIZE(forces, 1)
807 n2 = SIZE(forces, 2)
808
809 ALLOCATE (cforces(n2, n1))
810 cforces = 0.0_c_double
811 CALL sirius_get_forces(gs_handler, 'total', cforces)
812 ! Sirius computes the forces but cp2k use the gradient everywhere
813 ! so a minus sign is needed.
814 ! note also that sirius and cp2k store the forces transpose to each other
815 ! sirius : forces(coordinates, atoms)
816 ! cp2k : forces(atoms, coordinates)
817 forces = -transpose(cforces(:, :))
818 DEALLOCATE (cforces)
819 END IF
820
821 IF (calculate_stress_tensor) THEN
822 cstress = 0.0_c_double
823 CALL sirius_get_stress_tensor(gs_handler, 'total', cstress)
824 stress(1:3, 1:3) = cstress(1:3, 1:3)
825 CALL pwdft_env_set(pwdft_env=pwdft_env, stress=stress)
826 END IF
827
828 CALL pwdft_env_get(pwdft_env=pwdft_env, pwdft_input=pwdft_input)
829 print_section => section_vals_get_subs_vals(pwdft_input, "PRINT")
830 CALL section_vals_get(print_section, explicit=do_print)
831 IF (do_print) THEN
832 CALL cp_sirius_print_results(pwdft_env, print_section)
833 END IF
834 END SUBROUTINE cp_sirius_energy_force
835
836!***************************************************************************************************
837!> \brief ...
838!> \param pwdft_env ...
839!> \param print_section ...
840!> \param
841!> \par History
842!> 12.2019 init
843!> \author JHU
844! **************************************************************************************************
845 SUBROUTINE cp_sirius_print_results(pwdft_env, print_section)
846 TYPE(pwdft_environment_type), INTENT(INOUT), &
847 POINTER :: pwdft_env
848 TYPE(section_vals_type), POINTER :: print_section
849
850 CHARACTER(LEN=default_string_length) :: my_act, my_pos
851 INTEGER :: i, ik, iounit, ispn, iterstep, iv, iw, &
852 nbands, nhist, nkpts, nspins
853 INTEGER(KIND=C_INT) :: cint
854 LOGICAL :: append, dos, ionode
855 REAL(KIND=c_double) :: creal
856 REAL(KIND=c_double), ALLOCATABLE, DIMENSION(:) :: slist
857 REAL(KIND=dp) :: de, e_fermi(2), emax, emin, eval
858 REAL(KIND=dp), ALLOCATABLE, DIMENSION(:) :: wkpt
859 REAL(KIND=dp), ALLOCATABLE, DIMENSION(:, :) :: ehist, hist, occval
860 REAL(KIND=dp), ALLOCATABLE, DIMENSION(:, :, :) :: energies, occupations
861 TYPE(cp_logger_type), POINTER :: logger
862 TYPE(sirius_context_handler) :: sctx
863 TYPE(sirius_ground_state_handler) :: gs_handler
864 TYPE(sirius_kpoint_set_handler) :: ks_handler
865
866 NULLIFY (logger)
867 logger => cp_get_default_logger()
868 ionode = logger%para_env%is_source()
869 iounit = cp_logger_get_default_io_unit(logger)
870
871 ! Density of States
872 dos = btest(cp_print_key_should_output(logger%iter_info, print_section, "DOS"), cp_p_file)
873 IF (dos) THEN
874 CALL pwdft_env_get(pwdft_env, ks_handler=ks_handler)
875 CALL pwdft_env_get(pwdft_env, gs_handler=gs_handler)
876 CALL pwdft_env_get(pwdft_env, sctx=sctx)
877
878 CALL section_vals_val_get(print_section, "DOS%DELTA_E", r_val=de)
879 CALL section_vals_val_get(print_section, "DOS%APPEND", l_val=append)
880
881 CALL sirius_get_num_kpoints(ks_handler, cint)
882 nkpts = cint
883 CALL sirius_get_parameters(sctx, num_bands=cint)
884 nbands = cint
885 CALL sirius_get_parameters(sctx, num_spins=cint)
886 nspins = cint
887 e_fermi(:) = 0.0_dp
888 ALLOCATE (energies(nbands, nspins, nkpts))
889 energies = 0.0_dp
890 ALLOCATE (occupations(nbands, nspins, nkpts))
891 occupations = 0.0_dp
892 ALLOCATE (wkpt(nkpts))
893 ALLOCATE (slist(nbands))
894 DO ik = 1, nkpts
895 CALL sirius_get_kpoint_properties(ks_handler, ik, creal)
896 wkpt(ik) = creal
897 END DO
898 DO ik = 1, nkpts
899 DO ispn = 1, nspins
900 CALL sirius_get_band_energies(ks_handler, ik, ispn, slist)
901 energies(1:nbands, ispn, ik) = slist(1:nbands)
902 CALL sirius_get_band_occupancies(ks_handler, ik, ispn, slist)
903 occupations(1:nbands, ispn, ik) = slist(1:nbands)
904 END DO
905 END DO
906 emin = minval(energies)
907 emax = maxval(energies)
908 nhist = nint((emax - emin)/de) + 1
909 ALLOCATE (hist(nhist, nspins), occval(nhist, nspins), ehist(nhist, nspins))
910 hist = 0.0_dp
911 occval = 0.0_dp
912 ehist = 0.0_dp
913
914 DO ik = 1, nkpts
915 DO ispn = 1, nspins
916 DO i = 1, nbands
917 eval = energies(i, ispn, ik) - emin
918 iv = nint(eval/de) + 1
919 cpassert((iv > 0) .AND. (iv <= nhist))
920 hist(iv, ispn) = hist(iv, ispn) + wkpt(ik)
921 occval(iv, ispn) = occval(iv, ispn) + wkpt(ik)*occupations(i, ispn, ik)
922 END DO
923 END DO
924 END DO
925 hist = hist/real(nbands, kind=dp)
926 DO i = 1, nhist
927 ehist(i, 1:nspins) = emin + (i - 1)*de
928 END DO
929
930 iterstep = logger%iter_info%iteration(logger%iter_info%n_rlevel)
931 my_act = "WRITE"
932 IF (append .AND. iterstep > 1) THEN
933 my_pos = "APPEND"
934 ELSE
935 my_pos = "REWIND"
936 END IF
937
938 iw = cp_print_key_unit_nr(logger, print_section, "DOS", &
939 extension=".dos", file_position=my_pos, file_action=my_act, &
940 file_form="FORMATTED")
941 IF (iw > 0) THEN
942 IF (nspins == 2) THEN
943 WRITE (unit=iw, fmt="(T2,A,I0,A,2F12.6)") &
944 "# DOS at iteration step i = ", iterstep, ", E_Fermi[a.u.] = ", e_fermi(1:2)
945 WRITE (unit=iw, fmt="(T2,A, A)") " Energy[a.u.] Alpha_Density Occupation", &
946 " Beta_Density Occupation"
947 ELSE
948 WRITE (unit=iw, fmt="(T2,A,I0,A,F12.6)") &
949 "# DOS at iteration step i = ", iterstep, ", E_Fermi[a.u.] = ", e_fermi(1)
950 WRITE (unit=iw, fmt="(T2,A)") " Energy[a.u.] Density Occupation"
951 END IF
952 DO i = 1, nhist
953 eval = emin + (i - 1)*de
954 IF (nspins == 2) THEN
955 WRITE (unit=iw, fmt="(F15.8,4F15.4)") eval, hist(i, 1), occval(i, 1), &
956 hist(i, 2), occval(i, 2)
957 ELSE
958 WRITE (unit=iw, fmt="(F15.8,2F15.4)") eval, hist(i, 1), occval(i, 1)
959 END IF
960 END DO
961 END IF
962 CALL cp_print_key_finished_output(iw, logger, print_section, "DOS")
963
964 DEALLOCATE (energies, occupations, wkpt, slist)
965 DEALLOCATE (hist, occval, ehist)
966 END IF
967 END SUBROUTINE cp_sirius_print_results
968
969END MODULE sirius_interface
970
971#else
972
973!***************************************************************************************************
974!> \brief Empty implementation in case SIRIUS is not compiled in.
975!***************************************************************************************************
978#include "./base/base_uses.f90"
979
980 IMPLICIT NONE
981
982 PRIVATE
983
984 ! Public subroutines
985
986 PUBLIC :: cp_sirius_create_env, &
992
993CONTAINS
994
995! **************************************************************************************************
996!> \brief Empty implementation in case SIRIUS is not compiled in.
997! **************************************************************************************************
998 SUBROUTINE cp_sirius_init()
999 END SUBROUTINE cp_sirius_init
1000
1001! **************************************************************************************************
1002!> \brief Return always .FALSE. because the Sirius library is not compiled in.
1003!> \return Return the initialisation status of the Sirius library as boolean
1004! **************************************************************************************************
1005 LOGICAL FUNCTION cp_sirius_is_initialized()
1006 cp_sirius_is_initialized = .false.
1007 END FUNCTION cp_sirius_is_initialized
1008
1009! **************************************************************************************************
1010!> \brief Empty implementation in case SIRIUS is not compiled in.
1011! **************************************************************************************************
1013 END SUBROUTINE cp_sirius_finalize
1014
1015! **************************************************************************************************
1016!> \brief Empty implementation in case SIRIUS is not compiled in.
1017!> \param pwdft_env ...
1018! **************************************************************************************************
1019 SUBROUTINE cp_sirius_create_env(pwdft_env)
1020 TYPE(pwdft_environment_type), POINTER :: pwdft_env
1021
1022 mark_used(pwdft_env)
1023 cpabort("Sirius library is missing")
1024 END SUBROUTINE cp_sirius_create_env
1025
1026! **************************************************************************************************
1027!> \brief Empty implementation in case SIRIUS is not compiled in.
1028!> \param pwdft_env ...
1029!> \param calculate_forces ...
1030!> \param calculate_stress ...
1031! **************************************************************************************************
1032 SUBROUTINE cp_sirius_energy_force(pwdft_env, calculate_forces, calculate_stress)
1033 TYPE(pwdft_environment_type), POINTER :: pwdft_env
1034 LOGICAL :: calculate_forces, calculate_stress
1035
1036 mark_used(pwdft_env)
1037 mark_used(calculate_forces)
1038 mark_used(calculate_stress)
1039 cpabort("Sirius library is missing")
1040 END SUBROUTINE cp_sirius_energy_force
1041
1042! **************************************************************************************************
1043!> \brief Empty implementation in case SIRIUS is not compiled in.
1044!> \param pwdft_env ...
1045! **************************************************************************************************
1046 SUBROUTINE cp_sirius_update_context(pwdft_env)
1047 TYPE(pwdft_environment_type), POINTER :: pwdft_env
1048
1049 mark_used(pwdft_env)
1050 cpabort("Sirius library is missing")
1051 END SUBROUTINE cp_sirius_update_context
1052
1053END MODULE sirius_interface
1054
1055#endif
calculate the orbitals for a given atomic kind type
subroutine, public calculate_atomic_orbitals(atomic_kind, qs_kind, agrid, iunit, pmat, fmat, density, wavefunction, wfninfo, confine, xc_section, nocc)
...
subroutine, public gth_potential_conversion(gth_potential, gth_atompot)
...
Define the atom type and its sub types.
Definition atom_types.F:15
Routines that process Quantum Espresso UPF files.
Definition atom_upf.F:14
Some basic routines for atomic calculations.
Definition atom_utils.F:15
pure subroutine, public atom_local_potential(locpot, gthpot, rr)
...
Definition atom_utils.F:799
Define the atomic kind types and their sub types.
subroutine, public get_atomic_kind(atomic_kind, fist_potential, element_symbol, name, mass, kind_number, natom, atom_list, rcov, rvdw, z, qeff, apol, cpol, mm_radius, shell, shell_active, damping)
Get attributes of an atomic kind.
Handles all functions related to the CELL.
Definition cell_types.F:15
subroutine, public real_to_scaled(s, r, cell)
Transform real to scaled cell coordinates. s=h_inv*r.
Definition cell_types.F:491
various routines to log and control the output. The idea is that decisions about where to log should ...
integer function, public cp_logger_get_default_io_unit(logger)
returns the unit nr for the ionode (-1 on all other processors) skips as well checks if the procs cal...
type(cp_logger_type) function, pointer, public cp_get_default_logger()
returns the default logger
routines to handle the output, The idea is to remove the decision of wheter to output and what to out...
integer function, public cp_print_key_unit_nr(logger, basis_section, print_key_path, extension, middle_name, local, log_filename, ignore_should_output, file_form, file_position, file_action, file_status, do_backup, on_file, is_new_file, mpi_io, fout)
...
subroutine, public cp_print_key_finished_output(unit_nr, logger, basis_section, print_key_path, local, ignore_should_output, on_file, mpi_io)
should be called after you finish working with a unit obtained with cp_print_key_unit_nr,...
integer, parameter, public cp_p_file
integer function, public cp_print_key_should_output(iteration_info, basis_section, print_key_path, used_print_key, first_time)
returns what should be done with the given property if btest(res,cp_p_store) then the property should...
Definition of the atomic potential types.
collects all constants needed in input so that they can be used without circular dependencies
integer, parameter, public do_gapw_log
integer, parameter, public sirius_func_vdwdfcx
integer, parameter, public sirius_func_vdwdf2
integer, parameter, public sirius_func_vdwdf
objects that represent the structure of input sections and the data contained in an input section
type(section_vals_type) function, pointer, public section_vals_get_subs_vals2(section_vals, i_section, i_rep_section)
returns the values of the n-th non default subsection (null if no such section exists (not so many no...
recursive type(section_vals_type) function, pointer, public section_vals_get_subs_vals(section_vals, subsection_name, i_rep_section, can_return_null)
returns the values of the requested subsection
subroutine, public section_vals_get(section_vals, ref_count, n_repetition, n_subs_vals_rep, section, explicit)
returns various attributes about the section_vals
subroutine, public section_vals_val_get(section_vals, keyword_name, i_rep_section, i_rep_val, n_rep_val, val, l_val, i_val, r_val, c_val, l_vals, i_vals, r_vals, c_vals, explicit)
returns the requested value
Defines the basic variable types.
Definition kinds.F:23
integer, parameter, public dp
Definition kinds.F:34
integer, parameter, public default_string_length
Definition kinds.F:57
Machine interface based on Fortran 2003 and POSIX.
Definition machine.F:17
subroutine, public m_flush(lunit)
flushes units if the &GLOBAL flag is set accordingly
Definition machine.F:136
Definition of mathematical constants and functions.
real(kind=dp), dimension(0:maxfac), parameter, public gamma1
real(kind=dp), parameter, public fourpi
Interface to the message passing library MPI.
Define the data structure for the particle information.
Definition of physical constants:
Definition physcon.F:68
real(kind=dp), parameter, public massunit
Definition physcon.F:141
The type definitions for the PWDFT environment.
subroutine, public pwdft_env_get(pwdft_env, pwdft_input, force_env_input, xc_input, cp_subsys, qs_subsys, para_env, energy, forces, stress, sctx, gs_handler, ks_handler)
Returns various attributes of the pwdft environment.
subroutine, public pwdft_env_set(pwdft_env, pwdft_input, force_env_input, xc_input, qs_subsys, cp_subsys, para_env, energy, forces, stress, sctx, gs_handler, ks_handler)
Sets various attributes of the pwdft environment.
subroutine, public deallocate_grid_atom(grid_atom)
Deallocate a Gaussian-type orbital (GTO) basis set data set.
subroutine, public allocate_grid_atom(grid_atom)
Initialize components of the grid_atom_type structure.
subroutine, public create_grid_atom(grid_atom, nr, na, llmax, ll, quadrature)
...
Define the quickstep kind type and their sub types.
subroutine, public get_qs_kind(qs_kind, basis_set, basis_type, ncgf, nsgf, all_potential, tnadd_potential, gth_potential, sgp_potential, upf_potential, cneo_potential, se_parameter, dftb_parameter, xtb_parameter, dftb3_param, zatom, zeff, elec_conf, mao, lmax_dftb, alpha_core_charge, ccore_charge, core_charge, core_charge_radius, paw_proj_set, paw_atom, hard_radius, hard0_radius, max_rad_local, covalent_radius, vdw_radius, gpw_type_forced, harmonics, max_iso_not0, max_s_harm, grid_atom, ngrid_ang, ngrid_rad, lmax_rho0, dft_plus_u_atom, l_of_dft_plus_u, n_of_dft_plus_u, u_minus_j, u_of_dft_plus_u, j_of_dft_plus_u, alpha_of_dft_plus_u, beta_of_dft_plus_u, j0_of_dft_plus_u, occupation_of_dft_plus_u, dispersion, bs_occupation, magnetization, no_optimize, addel, laddel, naddel, orbitals, max_scf, eps_scf, smear, u_ramping, u_minus_j_target, eps_u_ramping, init_u_ramping_each_scf, reltmat, ghost, monovalent, floating, name, element_symbol, pao_basis_size, pao_model_file, pao_potentials, pao_descriptors, nelec)
Get attributes of an atomic kind.
types that represent a quickstep subsys
subroutine, public qs_subsys_get(subsys, atomic_kinds, atomic_kind_set, particles, particle_set, local_particles, molecules, molecule_set, molecule_kinds, molecule_kind_set, local_molecules, para_env, colvar_p, shell_particles, core_particles, gci, multipoles, natom, nparticle, ncore, nshell, nkind, atprop, virial, results, cell, cell_ref, use_ref_cell, energy, force, qs_kind_set, cp_subsys, nelectron_total, nelectron_spin)
...
Interface to the SIRIUS Library.
subroutine, public cp_sirius_update_context(pwdft_env)
Empty implementation in case SIRIUS is not compiled in.
subroutine, public cp_sirius_init()
Empty implementation in case SIRIUS is not compiled in.
subroutine, public cp_sirius_energy_force(pwdft_env, calculate_forces, calculate_stress)
Empty implementation in case SIRIUS is not compiled in.
logical function, public cp_sirius_is_initialized()
Return always .FALSE. because the Sirius library is not compiled in.
subroutine, public cp_sirius_finalize()
Empty implementation in case SIRIUS is not compiled in.
subroutine, public cp_sirius_create_env(pwdft_env)
Empty implementation in case SIRIUS is not compiled in.
Provides all information about a pseudopotential.
Definition atom_types.F:98
Provides all information about an atomic kind.
Type defining parameters related to the simulation cell.
Definition cell_types.F:60
type of a logger, at the moment it contains just a print level starting at which level it should be l...
stores all the informations relevant to an mpi environment
Provides all information about a quickstep kind.