PROGRESS  master
prg_c_interface.F90
Go to the documentation of this file.
2 
3  use iso_c_binding
4 
8  use prg_ewald_mod
9  use prg_dos_mod
10  use prg_genz_mod
12  use prg_system_mod
17  use prg_sp2_mod
18  use prg_timer_mod
19  use bml_types_m
20 
21  implicit none
22 
23  public :: prg_version_c
24  public :: prg_progress_init_c
25  public :: prg_progress_shutdown_c
26 
27  ! density matrix module
28  public :: prg_build_density_t0_c
34 
35 contains
36 
37  ! C wrapper subroutine
38  subroutine prg_version_c() bind(C, name="prg_version")
39  call prg_version()
40  end subroutine prg_version_c
41 
42  subroutine prg_progress_init_c() bind(C, name="prg_progress_init")
43  call prg_progress_init()
44  end subroutine prg_progress_init_c
45 
46  subroutine prg_progress_shutdown_c() bind(C, name="prg_progress_shutdown")
48  end subroutine prg_progress_shutdown_c
49 
50 
51  !------------------------------------------------
52  ! Beginning of prg_densitymatrix_mod
53  !------------------------------------------------
54 
55  subroutine prg_build_density_t0_c(norbs, ham_bml_c, rho_bml_c, threshold, bndfil,&
56  eigenvalues_out) bind(C, name="prg_build_density_T0")
57  integer(c_int), value :: norbs
58  real(c_double), intent(in), value :: threshold, bndfil
59  type(c_ptr), value :: ham_bml_c
60  type(c_ptr), value :: rho_bml_c
61  type(bml_matrix_t) :: ham_bml
62  type(bml_matrix_t) :: rho_bml
63  real(c_double) :: eigenvalues_out(norbs)
64  real(c_double), allocatable :: eigenvalues(:)
65 
66  ham_bml%ptr = ham_bml_c
67  rho_bml%ptr = rho_bml_c
68 
69  call prg_build_density_t0(ham_bml, rho_bml, threshold, bndfil, eigenvalues)
70  eigenvalues_out = eigenvalues
71  deallocate(eigenvalues)
72 
73  end subroutine prg_build_density_t0_c
74 
75  subroutine prg_build_density_t_c(norbs, ham_bml_c, rho_bml_c, threshold, bndfil, kbt,&
76  ef, eigenvalues_out) bind(C, name="prg_build_density_T")
77  integer(c_int), value :: norbs
78  real(c_double), value :: bndfil
79  real(c_double), value :: threshold
80  real(c_double), value :: kbt
81  real(c_double), value :: ef
82  real(c_double) :: eigenvalues_out(norbs)
83  real(c_double), allocatable :: eigenvalues(:)
84  type(c_ptr), value :: ham_bml_c
85  type(bml_matrix_t) :: ham_bml
86  type(c_ptr), value :: rho_bml_c
87  type(bml_matrix_t) :: rho_bml
88  ham_bml%ptr = ham_bml_c
89  rho_bml%ptr = rho_bml_c
90  call prg_build_density_t(ham_bml, rho_bml, threshold, bndfil, kbt, ef, eigenvalues)
91  eigenvalues_out = eigenvalues
92  deallocate(eigenvalues)
93  end subroutine prg_build_density_t_c
94 
95  subroutine prg_build_density_t_fulldata_c(norbs, ham_bml_c, rho_bml_c, threshold, bndfil, kbt, &
96  ef, eigenvalues_out, evects_bml_c, fvals_out) bind(C, name="prg_build_density_T_fulldata")
97  integer(c_int), value :: norbs
98  real(c_double), value :: bndfil
99  real(c_double), value :: threshold
100  real(c_double), value :: kbt
101  real(c_double), value :: ef
102  real(c_double) :: eigenvalues_out(norbs)
103  real(c_double) :: fvals_out(norbs)
104 
105  real(c_double), allocatable :: fvals(:)
106  real(c_double), allocatable :: eigenvalues(:)
107 
108  type(c_ptr), value :: ham_bml_c
109  type(c_ptr), value :: rho_bml_c
110  type(c_ptr), value :: evects_bml_c
111  type(bml_matrix_t) :: ham_bml
112  type(bml_matrix_t) :: rho_bml
113  type(bml_matrix_t) :: evects_bml
114 
115  ham_bml%ptr = ham_bml_c
116  rho_bml%ptr = rho_bml_c
117  evects_bml%ptr = evects_bml_c
118  call prg_build_density_t_fulldata(ham_bml, rho_bml, threshold, bndfil, kbt, ef,&
119  eigenvalues, evects_bml, fvals)
120  fvals_out = fvals
121  eigenvalues_out = eigenvalues
122  deallocate(eigenvalues)
123  deallocate(fvals)
124 
125  end subroutine prg_build_density_t_fulldata_c
126 
127  subroutine prg_build_density_t_ed_c(norbs, ham_bml_c, rho_bml_c, evects_bml_c, threshold,&
128  bndfil, kbt, ef, evals_out, dvals_out, hindex_out, llsize, verbose)&
129  bind(C, name="prg_build_density_T_ed")
130  integer(c_int), value :: norbs
131  integer(c_int), value :: llsize
132  integer(c_int), value :: verbose
133  real(c_double), value :: bndfil
134  real(c_double), value :: threshold
135  real(c_double), value :: kbt
136  real(c_double), value :: ef
137  real(c_double) :: evals_out(norbs)
138  real(c_double) :: dvals_out(norbs)
139  integer(c_int) :: hindex_out(norbs, norbs)
140 
141  integer(c_int), allocatable :: hindex(:,:)
142  real(c_double), allocatable :: evals(:)
143  real(c_double), allocatable :: dvals(:)
144 
145  type(c_ptr), value :: ham_bml_c
146  type(bml_matrix_t) :: ham_bml
147  type(c_ptr), value :: rho_bml_c
148  type(bml_matrix_t) :: rho_bml
149  type(c_ptr), value :: evects_bml_c
150  type(bml_matrix_t) :: evects_bml
151  ham_bml%ptr = ham_bml_c
152  rho_bml%ptr = rho_bml_c
153  evects_bml%ptr = evects_bml_c
154 
155  call prg_build_density_t_ed(ham_bml, rho_bml, evects_bml, threshold, bndfil, kbt, ef, evals,&
156  dvals, hindex, llsize, verbose)
157 
158  evals_out = evals
159  dvals_out = dvals
160  hindex_out = hindex
161  deallocate(evals)
162  deallocate(dvals)
163  deallocate(hindex)
164 
165  end subroutine prg_build_density_t_ed_c
166 
167  subroutine prg_get_evalsdvalsevects_c(norbs, ham_bml_c, threshold, hindex_in, llsize, evals_out,&
168  dvals_out, evects_bml_c, verbose) bind(C, name="prg_get_evalsDvalsEvects")
169  integer(c_int), value :: norbs, llsize, verbose
170  real(c_double), value :: threshold
171  integer(c_int) :: hindex_in(norbs,norbs)
172  real(c_double) :: evals_out(norbs)
173  real(c_double) :: dvals_out(norbs)
174  integer(c_int), allocatable :: hindex(:,:)
175  real(c_double), allocatable :: evals(:)
176  real(c_double), allocatable :: dvals(:)
177  type(bml_matrix_t) :: ham_bml
178  type(bml_matrix_t) :: evects_bml
179  type(c_ptr), value :: ham_bml_c
180  type(c_ptr), value :: evects_bml_c
181 
182  ham_bml%ptr = ham_bml_c
183  evects_bml%ptr = evects_bml_c
184  allocate(hindex(2, llsize))
185  hindex = hindex_in
186  call prg_get_evalsdvalsevects(ham_bml, threshold, hindex, llsize, evals, dvals, evects_bml,&
187  verbose)
188  evals_out = evals
189  dvals_out = dvals
190  deallocate(hindex, evals, dvals)
191 
192  end subroutine prg_get_evalsdvalsevects_c
193 
194  subroutine prg_build_density_fromevalsandevects_c(norbs,evects_bml_c, evals,rho_bml_c,threshold,&
195  bndfil, kbt, ef, verbose) bind(C, name="prg_build_density_fromEvalsAndEvects")
196  integer(c_int), value :: norbs, verbose
197  real(c_double), value :: threshold
198  real(c_double), value :: bndfil
199  real(c_double), value :: kbt
200  real(c_double), value :: ef
201  real(c_double) :: evals(norbs)
202  type(c_ptr), value :: evects_bml_c
203  type(bml_matrix_t) :: evects_bml
204  type(c_ptr), value :: rho_bml_c
205  type(bml_matrix_t) :: rho_bml
206 
207  evects_bml%ptr = evects_bml_c
208  rho_bml%ptr = rho_bml_c
209  call prg_build_density_fromevalsandevects(evects_bml, evals, rho_bml, threshold, bndfil, kbt,&
210  ef, verbose)
211 
213 
214  subroutine prg_build_density_t_fermi_c(ham_bml_c, rho_bml_c, threshold, kbt, ef, verbose, drho)&
215  bind(C, name="prg_build_density_T_fermi")
216  integer(c_int), value :: verbose
217  real(c_double), value :: threshold
218  real(c_double), value :: kbt
219  real(c_double), value :: ef
220  type(c_ptr), value :: ham_bml_c
221  type(bml_matrix_t) :: ham_bml
222  type(c_ptr), value :: rho_bml_c
223  type(bml_matrix_t) :: rho_bml
224  real(c_double), intent(inout) :: drho
225  ham_bml%ptr = ham_bml_c
226  rho_bml%ptr = rho_bml_c
227  call prg_build_density_t_fermi(ham_bml, rho_bml, threshold, kbt, ef, verbose, drho)
228  end subroutine prg_build_density_t_fermi_c
229 
230  subroutine prg_build_atomic_density_c(rhoat_bml_c, numel, hindex, spindex, norb, bml_type)&
231  bind(C, name="prg_build_atomic_density")
232  character(c_char), value :: bml_type
233  integer(c_int), target :: hindex(norb, norb)
234  integer(c_int), value :: norb
235  integer(c_int), target :: spindex(norb)
236  real(c_double), target :: numel(norb)
237  type(c_ptr), value :: rhoat_bml_c
238  type(bml_matrix_t) :: rhoat_bml
239  rhoat_bml%ptr = rhoat_bml_c
240  call prg_build_atomic_density(rhoat_bml, numel, hindex, spindex, norb, bml_type)
241  end subroutine prg_build_atomic_density_c
242 
243  subroutine prg_get_flevel_c(norbs, eigenvalues, kbt, bndfil, tol, Ef)&
244  bind(C, name="prg_get_flevel")
245  integer(c_int) :: norbs
246  real(c_double), value :: tol
247  real(c_double), value :: bndfil
248  real(c_double), target :: eigenvalues(norbs)
249  real(c_double), value :: kbt
250  real(c_double), value :: ef
251  logical :: err
252  call prg_get_flevel(eigenvalues, kbt, bndfil, tol, ef, err)
253  end subroutine prg_get_flevel_c
254 
255  subroutine prg_get_flevel_nt_c(norbs, eigenvalues, kbt, bndfil, tol, ef, verbose)&
256  bind(C, name="prg_get_flevel_nt")
257  integer(c_int) :: norbs
258  real(c_double), value :: bndfil
259  real(c_double), value :: kbt
260  real(c_double), value :: tol
261  real(c_double), target :: eigenvalues(norbs)
262  real(c_double), value :: ef
263  integer(c_int), optional :: verbose
264  logical :: err
265  call prg_get_flevel_nt(eigenvalues, kbt, bndfil, tol, ef, err, verbose)
266  end subroutine prg_get_flevel_nt_c
267 
268  subroutine prg_get_eigenvalues_c(norbs, ham_bml_c, eigenvalues_out, verbose)&
269  bind(C, name="prg_get_eigenvalues")
270  integer(c_int) :: norbs
271  integer(c_int), value :: verbose
272  real(c_double) :: eigenvalues_out(norbs)
273  real(c_double), allocatable :: eigenvalues(:)
274  type(c_ptr), value :: ham_bml_c
275  type(bml_matrix_t) :: ham_bml
276  ham_bml%ptr = ham_bml_c
277  call prg_get_eigenvalues(ham_bml, eigenvalues, verbose)
278  eigenvalues_out = eigenvalues
279  deallocate(eigenvalues)
280  end subroutine prg_get_eigenvalues_c
281 
282  subroutine prg_check_idempotency_c(mat_bml_c, threshold, idempotency)&
283  bind(C, name="prg_check_idempotency")
284  real(c_double), value :: threshold
285  real(c_double), value :: idempotency
286  type(c_ptr), value :: mat_bml_c
287  type(bml_matrix_t) :: mat_bml
288  mat_bml%ptr = mat_bml_c
289 
290  call prg_check_idempotency(mat_bml, threshold, idempotency)
291 
292  end subroutine prg_check_idempotency_c
293 
294  subroutine prg_toeigenspace_c(mat_bml_c, matEig_bml_c, evects_bml_c, threshold, verbose)&
295  bind(C, name="prg_toEigenspace")
296  integer(c_int), optional :: verbose
297  type(c_ptr), value :: mat_bml_c
298  type(bml_matrix_t) :: mat_bml
299  type(c_ptr), value :: evects_bml_c
300  type(bml_matrix_t) :: evects_bml
301  type(c_ptr), value :: mateig_bml_c
302  type(bml_matrix_t) :: mateig_bml
303  real(c_double), value :: threshold
304  mat_bml%ptr = mat_bml_c
305  evects_bml%ptr = evects_bml_c
306  mateig_bml%ptr = mateig_bml_c
307  call prg_toeigenspace(mat_bml, mateig_bml, evects_bml, threshold, verbose)
308  end subroutine prg_toeigenspace_c
309 
310  subroutine prg_tocanonicalspace_c(mat_bml_c, matCan_bml_c, evects_bml_c, threshold, verbose)&
311  bind(C, name="prg_toCanonicalspace")
312  integer(c_int), optional :: verbose
313  type(c_ptr), value :: mat_bml_c
314  type(bml_matrix_t) :: mat_bml
315  type(c_ptr), value :: evects_bml_c
316  type(bml_matrix_t) :: evects_bml
317  type(c_ptr), value :: matcan_bml_c
318  type(bml_matrix_t) :: matcan_bml
319  real(c_double), value :: threshold
320  mat_bml%ptr = mat_bml_c
321  evects_bml%ptr = evects_bml_c
322  matcan_bml%ptr = matcan_bml_c
323  call prg_tocanonicalspace(mat_bml, matcan_bml, evects_bml, threshold, verbose)
324  end subroutine prg_tocanonicalspace_c
325 
326  subroutine canon_dm_prt_c(P1, H1, Nocc, T, Q, e, mu0, m, HDIM) bind(C, name="Canon_DM_PRT")
327  integer(c_int), value :: hdim
328  integer(c_int), value :: m
329  real(c_double), intent(in) :: h1(hdim, hdim), q(hdim, hdim), e(hdim)
330  real(c_double), intent(out) :: p1(hdim, hdim)
331  real(c_double), value :: t, mu0, nocc
332 
333  call canon_dm_prt(p1, h1, nocc, t, q, e, mu0, m, hdim)
334  end subroutine canon_dm_prt_c
335 
336 
337  !------------------------------------------------
338  ! end of prg_densitymatrix_mod
339  !------------------------------------------------
340 
341 
342  !------------------------------------------------
343  ! Beginning of prg_charges_mod
344  !------------------------------------------------
345  subroutine prg_get_charges_c(nats, norbs, rho_bml_c, over_bml_c, hindex, charges, numel,&
346  spindex, mdimin, threshold) bind(C, name="prg_get_charges")
347  integer(c_int), value :: nats, norbs
348  integer(c_int), value :: mdimin
349  integer(c_int) :: hindex(nats,nats)
350  integer(c_int) :: spindex(nats)
351  real(c_double) :: charges_out(nats)
352  real(c_double) :: numel_in(norbs)
353  real(c_double), value :: threshold
354 
355  real(c_double), allocatable :: charges(:)
356  real(c_double), allocatable :: numel(:)
357 
358  type(c_ptr), value :: over_bml_c
359  type(bml_matrix_t) :: over_bml
360  type(c_ptr), value :: rho_bml_c
361  type(bml_matrix_t) :: rho_bml
362  over_bml%ptr = over_bml_c
363  rho_bml%ptr = rho_bml_c
364  allocate(numel(norbs))
365  numel = numel_in
366  call prg_get_charges(rho_bml, over_bml, hindex, charges, numel, spindex, mdimin, threshold)
367  charges_out = charges
368  deallocate(charges, numel)
369 
370  end subroutine prg_get_charges_c
371 
372  subroutine prg_get_hscf_c(nats, ham0_bml_c, over_bml_c, ham_bml_c, spindex, hindex, hubbardu,&
373  charges, coulomb_pot_r, coulomb_pot_k, mdimin, threshold) bind(C, name="prg_get_hscf")
374  integer(c_int), value :: nats
375  integer(c_int), target :: hindex(nats, nats)
376  integer(c_int), value :: mdimin
377  integer(c_int), target :: spindex(nats)
378  real(c_double), target :: charges(nats)
379  real(c_double), target :: coulomb_pot_r(nats)
380  real(c_double), target :: coulomb_pot_k(nats)
381  real(c_double), target :: hubbardu(nats)
382  real(c_double), value :: threshold
383  type(c_ptr), value :: ham0_bml_c
384  type(bml_matrix_t) :: ham0_bml
385  type(c_ptr), value :: over_bml_c
386  type(bml_matrix_t) :: over_bml
387  type(c_ptr), value :: ham_bml_c
388  type(bml_matrix_t) :: ham_bml
389  ham0_bml%ptr = ham0_bml_c
390  over_bml%ptr = over_bml_c
391  ham_bml%ptr = ham_bml_c
392  call prg_get_hscf(ham0_bml, over_bml, ham_bml, spindex, hindex, hubbardu, charges,&
393  coulomb_pot_r, coulomb_pot_k, mdimin, threshold)
394  end subroutine prg_get_hscf_c
395 
396  subroutine prg_get_hscf_v2_c(nats, ham0_bml_c, over_bml_c, ham_bml_c, spindex, hindex, hubbardu,&
397  charges, coulomb_pot_r, coulomb_pot_k, mdimin, threshold) bind(C, name="prg_get_hscf_v2")
398  integer(c_int), value :: nats
399  integer(c_int) :: hindex(nats, nats)
400  integer(c_int), value :: mdimin
401  real(c_double), value :: threshold
402  integer(c_int) :: spindex(nats)
403  real(c_double) :: charges(nats)
404  real(c_double) :: coulomb_pot_r(nats)
405  real(c_double) :: coulomb_pot_k(nats)
406  real(c_double) :: hubbardu(nats)
407  type(c_ptr), value :: ham0_bml_c
408  type(bml_matrix_t) :: ham0_bml
409  type(c_ptr), value :: over_bml_c
410  type(bml_matrix_t) :: over_bml
411  type(c_ptr), value :: ham_bml_c
412  type(bml_matrix_t) :: ham_bml
413 
414  ham0_bml%ptr = ham0_bml_c
415  over_bml%ptr = over_bml_c
416  ham_bml%ptr = ham_bml_c
417  call prg_get_hscf_v2(ham0_bml, over_bml, ham_bml, spindex, hindex, hubbardu, charges,&
418  coulomb_pot_r, coulomb_pot_k, mdimin, threshold)
419  end subroutine prg_get_hscf_v2_c
420 
421  !------------------------------------------------
422  ! End of prg_charges_mod
423  !------------------------------------------------
424 
425  !------------------------------------------------
426  ! prg_chebyshev_mod
427  !------------------------------------------------
428 
429  subroutine prg_build_density_cheb_c(ham_bml_c, rho_bml_c, athr, threshold, ncoeffs, kbt, ef,&
430  bndfil, jon, verbose) bind(C, name="prg_build_density_cheb")
431  integer(c_int), value :: ncoeffs
432  integer(c_int), value :: verbose
433  real(c_double), value :: athr
434  real(c_double), value :: kbt
435  real(c_double), value :: bndfil
436  real(c_double), value :: threshold
437  real(c_double), value :: ef
438  type(c_ptr), value :: ham_bml_c
439  type(bml_matrix_t) :: ham_bml
440  type(c_ptr), value :: rho_bml_c
441  type(bml_matrix_t) :: rho_bml
442  integer(c_int), value :: jon
443  logical :: jon_l = .false.
444  if (jon==1) jon_l = .true.
445 
446  ham_bml%ptr = ham_bml_c
447  rho_bml%ptr = rho_bml_c
448  call prg_build_density_cheb(ham_bml, rho_bml, athr, threshold, ncoeffs, kbt, ef, bndfil,&
449  jon_l, verbose)
450  end subroutine prg_build_density_cheb_c
451 
452  subroutine prg_build_density_cheb_fermi_c(ham_bml_c, rho_bml_c, athr, threshold, ncoeffs, kbt,&
453  ef, bndfil, getef, fermitol, jon, npts, trkfunc, verbose)&
454  bind(C, name="prg_build_density_cheb_fermi")
455  type(c_ptr), value :: ham_bml_c
456  type(c_ptr), value :: rho_bml_c
457  integer(c_int), value :: npts
458  integer(c_int), value :: ncoeffs
459  integer(c_int), value :: verbose
460  real(c_double), value :: fermitol
461  real(c_double), value :: athr
462  real(c_double), value :: kbt
463  real(c_double), value :: bndfil
464  real(c_double), value :: threshold
465  real(c_double), value :: ef
466  type(bml_matrix_t) :: ham_bml
467  type(bml_matrix_t) :: rho_bml
468  integer(c_int), value :: getef
469  integer(c_int), value :: jon
470  integer(c_int), value :: trkfunc
471  logical :: getef_l = .false., jon_l = .false., trkfunc_l = .false.
472 
473  if (jon == 1) jon_l = .true.
474  if (getef == 1) getef_l = .true.
475  if (trkfunc == 1) trkfunc_l = .true.
476 
477  ham_bml%ptr = ham_bml_c
478  rho_bml%ptr = rho_bml_c
479 
480  call prg_build_density_cheb_fermi(ham_bml, rho_bml, athr, threshold, ncoeffs, kbt, ef, bndfil,&
481  getef_l, fermitol, jon_l, npts, trkfunc_l, verbose)
482 
483  end subroutine prg_build_density_cheb_fermi_c
484 
485  !------------------------------------------------
486  ! prg_dos_mod
487  !------------------------------------------------
488 
489  subroutine prg_write_tdos_c(nstates, eigenvals, gamma, npts, emin, emax, filename)&
490  bind(C, name="prg_write_tdos")
491  integer(c_int), value :: nstates, npts
492  real(c_double), target :: eigenvals(nstates)
493  real(c_double), value :: emax
494  real(c_double), value :: emin
495  real(c_double), value :: gamma
496  character(c_char), value :: filename
497 
498  call prg_write_tdos(eigenvals, gamma, npts, emin, emax, filename)
499  end subroutine prg_write_tdos_c
500 
501  !------------------------------------------------
502  ! prg_ewald_mod
503  !------------------------------------------------
504 
505  subroutine ewald_real_space_single_latte_c(COULOMBV, I, RXYZ, Box, Nr_elem, DELTAQ, J, U,&
506  Element_Pointer, Nr_atoms, COULACC, HDIM, Max_Nr_Neigh) bind(C, name="Ewald_Real_Space_Single_latte")
507  integer(c_int), value :: Nr_atoms
508  integer(c_int), value :: Nr_elem
509  integer(c_int), value :: HDIM
510  integer(c_int), value :: Max_Nr_Neigh
511  integer(c_int), value :: I
512  integer(c_int), value :: J
513  integer(c_int), target :: Element_Pointer(Nr_atoms)
514  real(c_double), value :: COULACC
515  real(c_double), target :: DELTAQ(Nr_atoms)
516  real(c_double), target :: RXYZ(3,Nr_atoms)
517  real(c_double), target :: Box(3,3)
518  real(c_double), target :: U(Nr_elem)
519  real(c_double), intent(out) :: COULOMBV
520  call ewald_real_space_single_latte(coulombv, i, rxyz, box, nr_elem, deltaq, j, u, element_pointer,&
521  nr_atoms, coulacc, hdim, max_nr_neigh)
522  end subroutine ewald_real_space_single_latte_c
523 
524  subroutine ewald_real_space_single_c(COULOMBV, FCOUL, I, RX, RY, RZ, LBox, DELTAQ, J, U,&
525  Element_Type, Nr_atoms, COULACC, TIMERATIO, HDIM, Max_Nr_Neigh)&
526  bind(C, name="Ewald_Real_Space_Single")
527  integer(c_int), value :: Nr_atoms
528  integer(c_int), value :: HDIM
529  integer(c_int), value :: Max_Nr_Neigh
530  integer(c_int), value :: I
531  integer(c_int), value :: J
532  real(c_double), value :: COULACC
533  real(c_double), value :: TIMERATIO
534  real(c_double), target :: DELTAQ(Nr_atoms)
535  real(c_double), target :: RX(Nr_atoms)
536  real(c_double), target :: RY(Nr_atoms)
537  real(c_double), target :: RZ(Nr_atoms)
538  real(c_double), target :: LBox(3)
539  real(c_double), target :: U(Nr_atoms)
540  character(c_char), target :: Element_Type(Nr_atoms)
541  real(c_double), intent(out) :: COULOMBV
542  real(c_double), intent(out) :: FCOUL(3)
543  call ewald_real_space_single(coulombv, fcoul, i, rx, ry, rz, lbox, deltaq, j, u, element_type,&
544  nr_atoms, coulacc, timeratio, hdim, max_nr_neigh)
545  end subroutine ewald_real_space_single_c
546 
547  subroutine ewald_real_space_matrix_latte_c(E, RXYZ, Box, U, Element_Pointer, Nr_atoms, COULACC,&
548  nebcoul, totnebcoul, HDIM, Max_Nr_Neigh, Nr_Elem)&
549  bind(C, name="Ewald_Real_Space_Matrix_latte")
550  integer(c_int), value :: Nr_atoms
551  integer(c_int), value :: HDIM
552  integer(c_int), value :: Max_Nr_Neigh
553  integer(c_int), value :: Nr_Elem
554  real(c_double), value :: COULACC
555  real(c_double), intent(out) :: E(Nr_atoms,Nr_atoms)
556  real(c_double), target :: RXYZ(3,Nr_atoms)
557  real(c_double), target :: Box(3,3)
558  real(c_double), target :: U(Nr_elem)
559  integer(c_int), target :: Element_Pointer(Nr_atoms)
560  integer(c_int), target :: totnebcoul(Nr_atoms)
561  integer(c_int), target :: nebcoul(4,Max_Nr_Neigh,Nr_atoms)
562  call ewald_real_space_matrix_latte(e, rxyz, box, u, element_pointer, nr_atoms, coulacc, nebcoul,&
563  totnebcoul, hdim, max_nr_neigh, nr_elem)
564  end subroutine ewald_real_space_matrix_latte_c
565 
566  subroutine ewald_real_space_latte_c(COULOMBV, I, RXYZ, Box, DELTAQ, U, Element_Pointer, Nr_atoms,&
567  COULACC, nebcoul, totnebcoul, HDIM, Max_Nr_Neigh, Nr_Elem)&
568  bind(C, name="Ewald_Real_Space_latte")
569  integer(c_int), value :: Nr_atoms
570  integer(c_int), value :: HDIM
571  integer(c_int), value :: Max_Nr_Neigh
572  integer(c_int), value :: I
573  integer(c_int), value :: Nr_Elem
574  real(c_double), value :: COULACC
575  real(c_double), target :: RXYZ(3,Nr_atoms)
576  real(c_double), target :: Box(3,3)
577  real(c_double), target :: DELTAQ(Nr_atoms)
578  real(c_double), target :: U(Nr_elem)
579  integer(c_int), target :: Element_Pointer(Nr_atoms)
580  integer(c_int), target :: totnebcoul(Nr_atoms)
581  integer(c_int), target :: nebcoul(4,Max_Nr_Neigh,Nr_atoms)
582  real(c_double), intent(out) :: COULOMBV
583  call ewald_real_space_latte(coulombv, i, rxyz, box, deltaq, u, element_pointer, nr_atoms, coulacc, &
584  nebcoul, totnebcoul, hdim, max_nr_neigh, nr_elem)
585  end subroutine ewald_real_space_latte_c
586 
587  subroutine ewald_real_space_test_c(COULOMBV, I, RX, RY, RZ, LBox, DELTAQ, U, Element_Type,&
588  Nr_atoms, COULACC, nnRx, nnRy, nnRz, nrnnlist, nnType, Max_Nr_Neigh)&
589  bind(C, name="Ewald_Real_Space_Test")
590  integer(c_int), value :: Nr_atoms
591  integer(c_int), value :: Max_Nr_Neigh
592  integer(c_int), value :: I
593  real(c_double), value :: COULACC
594  real(c_double), target :: RX(Nr_atoms)
595  real(c_double), target :: RY(Nr_atoms)
596  real(c_double), target :: RZ(Nr_atoms)
597  real(c_double), target :: LBox(3)
598  real(c_double), target :: DELTAQ(Nr_atoms)
599  real(c_double), target :: U(Nr_atoms)
600  character(c_char), target :: Element_Type(Nr_atoms)
601  integer(c_int), target :: nrnnlist(Nr_atoms)
602  integer(c_int), target :: nnType(Nr_atoms,Max_Nr_Neigh)
603  real(c_double), target :: nnRx(Nr_atoms,Max_Nr_Neigh)
604  real(c_double), target :: nnRy(Nr_atoms,Max_Nr_Neigh)
605  real(c_double), target :: nnRz(Nr_atoms,Max_Nr_Neigh)
606  real(c_double), intent(out) :: COULOMBV
607  call ewald_real_space_test(coulombv, i, rx, ry, rz, lbox, deltaq, u, element_type, nr_atoms,&
608  coulacc, nnrx, nnry, nnrz, nrnnlist, nntype, max_nr_neigh)
609  end subroutine ewald_real_space_test_c
610 
611  subroutine ewald_real_space_c(COULOMBV, FCOUL, I, RX, RY, RZ, LBox, DELTAQ, U, Element_Type,&
612  Nr_atoms, COULACC, TIMERATIO, nnRx, nnRy, nnRz, nrnnlist, nnType, HDIM, Max_Nr_Neigh)&
613  bind(C, name="Ewald_Real_Space")
614  integer(c_int), value :: Nr_atoms
615  integer(c_int), value :: HDIM
616  integer(c_int), value :: Max_Nr_Neigh
617  integer(c_int), value :: I
618  real(c_double), value :: COULACC
619  real(c_double), value :: TIMERATIO
620  real(c_double), target :: RX(Nr_atoms)
621  real(c_double), target :: RY(Nr_atoms)
622  real(c_double), target :: RZ(Nr_atoms)
623  real(c_double), target :: LBox(3)
624  real(c_double), target :: DELTAQ(Nr_atoms)
625  real(c_double), target :: U(Nr_atoms)
626  character(c_char), target :: Element_Type(Nr_atoms)
627  integer(c_int), target :: nrnnlist(Nr_atoms)
628  integer(c_int), target :: nnType(Nr_atoms,Max_Nr_Neigh)
629  real(c_double), target :: nnRx(Nr_atoms,Max_Nr_Neigh)
630  real(c_double), target :: nnRy(Nr_atoms,Max_Nr_Neigh)
631  real(c_double), target :: nnRz(Nr_atoms,Max_Nr_Neigh)
632  real(c_double), intent(out) :: COULOMBV
633  real(c_double), intent(out) :: FCOUL(3)
634  call ewald_real_space(coulombv, fcoul, i, rx, ry, rz, lbox, deltaq, u, element_type, nr_atoms,&
635  coulacc, timeratio, nnrx, nnry, nnrz, nrnnlist, nntype, hdim, max_nr_neigh)
636  end subroutine ewald_real_space_c
637 
638  !------------------------------------------------
639  ! prg_normalize_mod
640  !------------------------------------------------
641 
642  subroutine prg_normalize_c(h_bml_c) bind(C, name="prg_normalize")
643  type(c_ptr),value :: h_bml_c
644  type(bml_matrix_t) :: h_bml
645  h_bml%ptr = h_bml_c
646  call prg_normalize(h_bml)
647  end subroutine prg_normalize_c
648 
649  subroutine prg_normalize_fermi_c(h_bml_c, h1, hN, mu) bind(C, name="prg_normalize_fermi")
650  type(c_ptr),value :: h_bml_c
651  type(bml_matrix_t) :: h_bml
652  real(c_double), value :: h1
653  real(c_double), value :: hN
654  real(c_double), value :: mu
655  h_bml%ptr = h_bml_c
656  call prg_normalize_fermi(h_bml, h1, hn, mu)
657  end subroutine prg_normalize_fermi_c
658 
659  subroutine prg_normalize_implicit_fermi_c(h_bml_c, cnst, mu)&
660  bind(C, name="prg_normalize_implicit_fermi")
661  type(c_ptr),value :: h_bml_c
662  type(bml_matrix_t) :: h_bml
663  real(c_double), value :: cnst
664  real(c_double), value :: mu
665  h_bml%ptr = h_bml_c
666  call prg_normalize_implicit_fermi(h_bml, cnst, mu)
667  end subroutine prg_normalize_implicit_fermi_c
668 
669  subroutine prg_normalize_cheb_c(h_bml_c, mu, emin, emax, alpha, scaledmu)&
670  bind(C, name="prg_normalize_cheb")
671  type(c_ptr),value :: h_bml_c
672  type(bml_matrix_t) :: h_bml
673  real(c_double), value :: mu
674  real(c_double), value :: emin
675  real(c_double), value :: emax
676  real(c_double), value :: scaledmu
677  real(c_double), value :: alpha
678  h_bml%ptr = h_bml_c
679  call prg_normalize_cheb(h_bml, mu, emin, emax, alpha, scaledmu)
680  end subroutine prg_normalize_cheb_c
681 
682  !------------------------------------------------
683  ! prg_sp2_mod
684  !------------------------------------------------
685 
686  subroutine prg_sp2_fermi_init_c(h_bml_c, nsteps, nocc, tscale, threshold, occErrLimit, traceLimit, &
687  x_bml_c, mu, beta, h1, hN, sgnlist) bind(C, name="prg_sp2_fermi_init")
688  type(c_ptr), value :: h_bml_c
689  type(bml_matrix_t) :: h_bml
690  type(c_ptr), value :: x_bml_c
691  type(bml_matrix_t) :: x_bml
692  integer(c_int), value :: nsteps
693  integer(c_int), target :: sgnlist(nsteps)
694  real(c_double), value :: nocc
695  real(c_double), value :: tscale
696  real(c_double), value :: threshold
697  real(c_double), value :: occErrLimit
698  real(c_double), value :: traceLimit
699  real(c_double), value :: mu
700  real(c_double), value :: beta
701  real(c_double), value :: h1
702  real(c_double), value :: hN
703  h_bml%ptr = h_bml_c
704  x_bml%ptr = x_bml_c
705  call prg_sp2_fermi_init(h_bml, nsteps, nocc, tscale, threshold, occerrlimit, tracelimit,&
706  x_bml, mu, beta, h1, hn, sgnlist)
707  end subroutine prg_sp2_fermi_init_c
708 
709  subroutine prg_sp2_fermi_init_norecs_c(h_bml_c, nsteps, nocc, tscale, threshold, occErrLimit,&
710  traceLimit, x_bml_c, mu, beta, h1, hN, sgnlist, verbose)&
711  bind(C, name="prg_sp2_fermi_init_norecs")
712  type(c_ptr), value :: h_bml_c
713  type(bml_matrix_t) :: h_bml
714  type(c_ptr), value :: x_bml_c
715  type(bml_matrix_t) :: x_bml
716  integer(c_int), value :: nsteps
717  integer(c_int), target :: sgnlist(nsteps)
718  real(c_double), value :: nocc
719  real(c_double), value :: tscale
720  real(c_double), value :: threshold
721  real(c_double), value :: occErrLimit
722  real(c_double), value :: traceLimit
723  real(c_double), value :: mu
724  real(c_double), value :: beta
725  real(c_double), value :: h1
726  real(c_double), value :: hN
727  integer(c_int), optional :: verbose
728  h_bml%ptr = h_bml_c
729  x_bml%ptr = x_bml_c
730  call prg_sp2_fermi_init_norecs(h_bml, nsteps, nocc, tscale, threshold, occerrlimit,&
731  tracelimit, x_bml, mu, beta, h1, hn, sgnlist, verbose)
732  end subroutine prg_sp2_fermi_init_norecs_c
733 
734  subroutine prg_sp2_fermi_c(h_bml_c, osteps, nsteps, nocc, mu, beta, h1, hN, sgnlist,&
735  threshold, eps, traceLimit, x_bml_c) bind(C, name="prg_sp2_fermi")
736  type(c_ptr), value :: h_bml_c
737  type(bml_matrix_t) :: h_bml
738  type(c_ptr), value :: x_bml_c
739  type(bml_matrix_t) :: x_bml
740  integer(c_int), value :: osteps
741  integer(c_int), value :: nsteps
742  integer(c_int), target :: sgnlist(nsteps)
743  real(c_double), value :: nocc
744  real(c_double), value :: threshold
745  real(c_double), value :: eps
746  real(c_double), value :: traceLimit
747  real(c_double), value :: beta
748  real(c_double), value :: h1
749  real(c_double), value :: hN
750  real(c_double), value :: mu
751  h_bml%ptr = h_bml_c
752  x_bml%ptr = x_bml_c
753  call prg_sp2_fermi(h_bml, osteps, nsteps, nocc, mu, beta, h1, hn, sgnlist, threshold,&
754  eps, tracelimit, x_bml)
755  end subroutine prg_sp2_fermi_c
756 
757  subroutine prg_sp2_entropy_function_c(mu, h1, hN, nsteps, sgnlist, GG, ee)&
758  bind(C, name="prg_sp2_entropy_function")
759  real(c_double), value :: mu
760  real(c_double), value :: h1
761  real(c_double), value :: hN
762  integer(c_int), value :: nsteps
763  integer(c_int), target :: sgnlist(nsteps)
764  real(c_double) :: GG(1001)
765  real(c_double) :: ee(1001)
766  real(c_double), allocatable :: GG_tmp(:), ee_tmp(:)
767  call prg_sp2_entropy_function(mu, h1, hn, nsteps, sgnlist, gg_tmp, ee_tmp)
768  gg = gg_tmp
769  ee = ee_tmp
770  deallocate(gg_tmp, ee_tmp)
771  end subroutine prg_sp2_entropy_function_c
772 
773  !------------------------------------------------
774  ! prg_sp2_mod
775  !------------------------------------------------
776 
777  subroutine prg_sp2_basic_c(h_bml_c, rho_bml_c, threshold, bndfil, minsp2iter, maxsp2iter, sp2conv,&
778  idemtol, verbose) bind(C, name="prg_sp2_basic")
779  integer(c_int), value :: minsp2iter
780  integer(c_int), value :: maxsp2iter
781  integer(c_int), value :: verbose
782  real(c_double), value :: bndfil
783  real(c_double), value :: threshold
784  real(c_double), value :: idemtol
785  character(c_char), value :: sp2conv
786  type(c_ptr), value :: rho_bml_c
787  type(bml_matrix_t) :: rho_bml
788  type(c_ptr), value :: h_bml_c
789  type(bml_matrix_t) :: h_bml
790  rho_bml%ptr = rho_bml_c
791  h_bml%ptr = h_bml_c
792  call prg_sp2_basic(h_bml, rho_bml, threshold, bndfil, minsp2iter, maxsp2iter, sp2conv, idemtol, verbose)
793  end subroutine prg_sp2_basic_c
794 
795  subroutine prg_sp2_basic_tcore_c(h_bml_c, rho_bml_c, rhofull_bml_c, threshold, bndfil, minsp2iter,&
796  maxsp2iter, sp2conv, idemtol, verbose) bind(C, name="prg_sp2_basic_tcore")
797  integer(c_int), value :: minsp2iter
798  integer(c_int), value :: maxsp2iter
799  integer(c_int), value :: verbose
800  real(c_double), value :: bndfil
801  real(c_double), value :: threshold
802  real(c_double), value :: idemtol
803  character(c_char), value :: sp2conv
804  type(c_ptr), value :: rho_bml_c
805  type(bml_matrix_t) :: rho_bml
806  type(c_ptr), value :: rhofull_bml_c
807  type(bml_matrix_t) :: rhofull_bml
808  type(c_ptr), value :: h_bml_c
809  type(bml_matrix_t) :: h_bml
810  rho_bml%ptr = rho_bml_c
811  rhofull_bml%ptr = rhofull_bml_c
812  h_bml%ptr = h_bml_c
813  call prg_sp2_basic_tcore(h_bml, rho_bml, rhofull_bml, threshold, bndfil, minsp2iter, maxsp2iter,&
814  sp2conv, idemtol, verbose)
815  end subroutine prg_sp2_basic_tcore_c
816 
817  subroutine prg_sp2_alg2_c(h_bml_c, rho_bml_c, threshold, bndfil, minsp2iter, maxsp2iter, sp2conv,&
818  idemtol, verbose) bind(C, name="prg_sp2_alg2")
819  integer(c_int), value :: minsp2iter
820  integer(c_int), value :: maxsp2iter
821  real(c_double), value :: threshold
822  real(c_double), value :: bndfil
823  real(c_double), value :: idemtol
824  character(c_char), value :: sp2conv
825  integer(c_int), value :: verbose
826  type(c_ptr),value :: h_bml_c
827  type(bml_matrix_t) :: h_bml
828  type(c_ptr),value :: rho_bml_c
829  type(bml_matrix_t) :: rho_bml
830  h_bml%ptr = h_bml_c
831  rho_bml%ptr = rho_bml_c
832  call prg_sp2_alg2(h_bml, rho_bml, threshold, bndfil, minsp2iter, maxsp2iter, sp2conv, idemtol, verbose)
833  end subroutine prg_sp2_alg2_c
834 
835  subroutine prg_sp2_alg2_genseq_c(h_bml_c, rho_bml_c, threshold, bndfil, minsp2iter, maxsp2iter, sp2conv,&
836  idemtol, pp, icount, vv, verbose) bind(C, name="prg_sp2_alg2_genseq")
837  integer(c_int), value :: minsp2iter
838  integer(c_int), value :: maxsp2iter
839  integer(c_int), value :: icount
840  integer(c_int), target :: pp(:)
841  real(c_double), value :: threshold
842  real(c_double), value :: bndfil
843  real(c_double), value :: idemtol
844  real(c_double), target :: vv(:)
845  character(c_char), value :: sp2conv
846  type(c_ptr),value :: h_bml_c
847  type(bml_matrix_t) :: h_bml
848  type(c_ptr),value :: rho_bml_c
849  type(bml_matrix_t) :: rho_bml
850  integer(c_int) :: verbose
851  h_bml%ptr = h_bml_c
852  rho_bml%ptr = rho_bml_c
853  call prg_sp2_alg2_genseq(h_bml, rho_bml, threshold, bndfil, minsp2iter, maxsp2iter, sp2conv, idemtol,&
854  pp, icount, vv, verbose)
855  end subroutine prg_sp2_alg2_genseq_c
856 
857  subroutine prg_sp2_alg2_seq_c(h_bml_c, rho_bml_c, threshold, pp, icount, vv, verbose)&
858  bind(C, name="prg_sp2_alg2_seq")
859  integer(c_int), value :: icount
860  integer(c_int), target :: pp(:)
861  real(c_double), value :: threshold
862  real(c_double), target :: vv(:)
863  type(c_ptr),value :: h_bml_c
864  type(bml_matrix_t) :: h_bml
865  type(c_ptr),value :: rho_bml_c
866  type(bml_matrix_t) :: rho_bml
867  integer(c_int) :: verbose
868  h_bml%ptr = h_bml_c
869  rho_bml%ptr = rho_bml_c
870  call prg_sp2_alg2_seq(h_bml, rho_bml, threshold, pp, icount, vv, verbose)
871  end subroutine prg_sp2_alg2_seq_c
872 
873  subroutine prg_prg_sp2_alg2_seq_inplace_c(rho_bml_c, threshold, pp, icount, vv, mineval, maxeval,&
874  verbose) bind(C, name="prg_prg_sp2_alg2_seq_inplace")
875  integer(c_int), value :: icount
876  integer(c_int), target :: pp(:)
877  real(c_double), value :: threshold
878  real(c_double), target :: vv(:)
879  real(c_double) :: mineval
880  real(c_double) :: maxeval
881  type(c_ptr),value :: rho_bml_c
882  type(bml_matrix_t) :: rho_bml
883  integer(c_int) :: verbose
884  rho_bml%ptr = rho_bml_c
885  call prg_prg_sp2_alg2_seq_inplace(rho_bml, threshold, pp, icount, vv, mineval, maxeval,verbose)
886  end subroutine prg_prg_sp2_alg2_seq_inplace_c
887 
888  subroutine prg_sp2_alg1_c(h_bml_c, rho_bml_c, threshold, bndfil, minsp2iter, maxsp2iter,&
889  sp2conv, idemtol, verbose) bind(C, name="prg_sp2_alg1")
890  integer(c_int), value :: minsp2iter
891  integer(c_int), value :: maxsp2iter
892  integer(c_int), value :: verbose
893  real(c_double), value :: threshold
894  real(c_double), value :: bndfil
895  real(c_double), value :: idemtol
896  character(c_char), value :: sp2conv
897  type(c_ptr),value :: h_bml_c
898  type(bml_matrix_t) :: h_bml
899  type(c_ptr),value :: rho_bml_c
900  type(bml_matrix_t) :: rho_bml
901  h_bml%ptr = h_bml_c
902  rho_bml%ptr = rho_bml_c
903 
904  call prg_sp2_alg1(h_bml, rho_bml, threshold, bndfil, minsp2iter, maxsp2iter, sp2conv,&
905  idemtol, verbose)
906  end subroutine prg_sp2_alg1_c
907 
908  subroutine prg_sp2_alg1_seq_c(h_bml_c, rho_bml_c, threshold, pp, icount, vv)&
909  bind(C, name="prg_sp2_alg1_seq")
910  integer(c_int), value :: icount
911  integer(c_int), target :: pp(:)
912  real(c_double), value :: threshold
913  real(c_double), target :: vv(:)
914  type(c_ptr),value :: h_bml_c
915  type(bml_matrix_t) :: h_bml
916  type(c_ptr),value :: rho_bml_c
917  type(bml_matrix_t) :: rho_bml
918  h_bml%ptr = h_bml_c
919  rho_bml%ptr = rho_bml_c
920  call prg_sp2_alg1_seq(h_bml, rho_bml, threshold, pp, icount, vv)
921  end subroutine prg_sp2_alg1_seq_c
922 
923  subroutine prg_prg_sp2_alg1_seq_inplace_c(rho_bml_c, threshold, pp, icount, vv, mineval, maxeval)&
924  bind(C, name="prg_prg_sp2_alg1_seq_inplace")
925  integer(c_int), value :: icount
926  integer(c_int), target :: pp(:)
927  real(c_double), value :: threshold
928  real(c_double), target :: vv(:)
929  real(c_double), value :: mineval
930  real(c_double), value :: maxeval
931  type(c_ptr),value :: rho_bml_c
932  type(bml_matrix_t) :: rho_bml
933  rho_bml%ptr = rho_bml_c
934  call prg_prg_sp2_alg1_seq_inplace(rho_bml, threshold, pp, icount, vv, mineval, maxeval)
935  end subroutine prg_prg_sp2_alg1_seq_inplace_c
936 
937  subroutine prg_sp2_submatrix_c(ham_bml_c, rho_bml_c, threshold, pp, icount, vv, mineval, maxeval,&
938  core_size) bind(C, name="prg_sp2_submatrix")
939  integer(c_int), value :: icount
940  integer(c_int), target :: pp(:)
941  integer(c_int), value :: core_size
942  real(c_double), value :: threshold
943  real(c_double), target :: vv(:)
944  real(c_double), value :: mineval
945  real(c_double), value :: maxeval
946  type(c_ptr),value :: ham_bml_c
947  type(bml_matrix_t) :: ham_bml
948  type(c_ptr),value :: rho_bml_c
949  type(bml_matrix_t) :: rho_bml
950  ham_bml%ptr = ham_bml_c
951  rho_bml%ptr = rho_bml_c
952  call prg_sp2_submatrix(ham_bml, rho_bml, threshold, pp, icount, vv, mineval, maxeval, core_size)
953  end subroutine prg_sp2_submatrix_c
954 
955  subroutine prg_sp2_submatrix_inplace_c(rho_bml_c, threshold, pp, icount, vv, mineval, maxeval,&
956  core_size) bind(C, name="prg_sp2_submatrix_inplace")
957  integer(c_int), value :: icount
958  integer(c_int), target :: pp(:)
959  integer(c_int), value :: core_size
960  real(c_double), value :: threshold
961  real(c_double), target :: vv(:)
962  real(c_double), value :: mineval
963  real(c_double), value :: maxeval
964  type(c_ptr),value :: rho_bml_c
965  type(bml_matrix_t) :: rho_bml
966  rho_bml%ptr = rho_bml_c
967  call prg_sp2_submatrix_inplace(rho_bml, threshold, pp, icount, vv, mineval, maxeval, core_size)
968  end subroutine prg_sp2_submatrix_inplace_c
969 
970  !------------------------------------------------
971  ! prg_timer_mod
972  !------------------------------------------------
973 
974  subroutine timer_prg_init_c() bind(C, name="timer_prg_init")
975  call timer_prg_init()
976  end subroutine timer_prg_init_c
977 
978  subroutine prg_timer_shutdown_c() bind(C, name="prg_timer_shutdown")
979  call prg_timer_shutdown()
980  end subroutine prg_timer_shutdown_c
981 
982  subroutine prg_timer_start_c(itimer, tag) bind(C, name="prg_timer_start")
983  integer(c_int) :: itimer
984  character(c_char), value :: tag
985  call prg_timer_start(itimer, tag)
986  end subroutine prg_timer_start_c
987 
988  subroutine prg_timer_stop_c(itimer, verbose) bind(C, name="prg_timer_stop")
989  integer(c_int) :: itimer, verbose
990  call prg_timer_stop(itimer, verbose)
991  end subroutine prg_timer_stop_c
992 
993  subroutine prg_timer_collect_c() bind(C, name="prg_timer_collect")
994  call prg_timer_collect()
995  end subroutine prg_timer_collect_c
996 
997  subroutine prg_timer_results_c() bind(C, name="prg_timer_results")
998  call prg_timer_results()
999  end subroutine prg_timer_results_c
1000 
1001  subroutine prg_print_date_and_time_c(tag) bind(C, name="prg_print_date_and_time")
1002  character(c_char), value :: tag
1003  call prg_print_date_and_time(tag)
1004  end subroutine prg_print_date_and_time_c
1005 
1006 
1007 
1008  !------------------------------------------------
1009  ! prg_openfiles_mod
1010  !------------------------------------------------
1011 
1012  subroutine prg_open_file_c(io, name) bind(C, name="prg_open_file")
1013  character(c_char), value :: name
1014  integer(c_int), value :: io
1015  call prg_open_file(io, name)
1016  end subroutine prg_open_file_c
1017 
1018  subroutine prg_open_file_to_read_c(io, name) bind(C, name="prg_open_file_to_read")
1019  character(c_char), value :: name
1020  integer(c_int), value :: io
1021  call prg_open_file_to_read(io, name)
1022  end subroutine prg_open_file_to_read_c
1023 
1024 
1025 end module prg_c_interface
subroutine prg_timer_results_c()
subroutine prg_sp2_alg2_seq_c(h_bml_c, rho_bml_c, threshold, pp, icount, vv, verbose)
subroutine prg_sp2_fermi_init_norecs_c(h_bml_c, nsteps, nocc, tscale, threshold, occErrLimit, traceLimit, x_bml_c, mu, beta, h1, hN, sgnlist, verbose)
subroutine prg_timer_collect_c()
subroutine prg_normalize_cheb_c(h_bml_c, mu, emin, emax, alpha, scaledmu)
subroutine prg_sp2_submatrix_c(ham_bml_c, rho_bml_c, threshold, pp, icount, vv, mineval, maxeval, core_size)
subroutine ewald_real_space_single_c(COULOMBV, FCOUL, I, RX, RY, RZ, LBox, DELTAQ, J, U, Element_Type, Nr_atoms, COULACC, TIMERATIO, HDIM, Max_Nr_Neigh)
subroutine prg_timer_start_c(itimer, tag)
subroutine ewald_real_space_c(COULOMBV, FCOUL, I, RX, RY, RZ, LBox, DELTAQ, U, Element_Type, Nr_atoms, COULACC, TIMERATIO, nnRx, nnRy, nnRz, nrnnlist, nnType, HDIM, Max_Nr_Neigh)
subroutine, public prg_build_density_t_ed_c(norbs, ham_bml_c, rho_bml_c, evects_bml_c, threshold, bndfil, kbt, ef, evals_out, dvals_out, hindex_out, llsize, verbose)
subroutine prg_get_hscf_v2_c(nats, ham0_bml_c, over_bml_c, ham_bml_c, spindex, hindex, hubbardu, charges, coulomb_pot_r, coulomb_pot_k, mdimin, threshold)
subroutine ewald_real_space_latte_c(COULOMBV, I, RXYZ, Box, DELTAQ, U, Element_Pointer, Nr_atoms, COULACC, nebcoul, totnebcoul, HDIM, Max_Nr_Neigh, Nr_Elem)
subroutine prg_sp2_submatrix_inplace_c(rho_bml_c, threshold, pp, icount, vv, mineval, maxeval, core_size)
subroutine prg_open_file_c(io, name)
subroutine, public prg_progress_shutdown_c()
subroutine ewald_real_space_single_latte_c(COULOMBV, I, RXYZ, Box, Nr_elem, DELTAQ, J, U, Element_Pointer, Nr_atoms, COULACC, HDIM, Max_Nr_Neigh)
subroutine, public prg_version_c()
subroutine prg_normalize_c(h_bml_c)
subroutine, public prg_build_density_t_c(norbs, ham_bml_c, rho_bml_c, threshold, bndfil, kbt, ef, eigenvalues_out)
subroutine, public prg_build_density_t0_c(norbs, ham_bml_c, rho_bml_c, threshold, bndfil, eigenvalues_out)
subroutine timer_prg_init_c()
subroutine prg_normalize_fermi_c(h_bml_c, h1, hN, mu)
subroutine prg_prg_sp2_alg1_seq_inplace_c(rho_bml_c, threshold, pp, icount, vv, mineval, maxeval)
subroutine prg_sp2_entropy_function_c(mu, h1, hN, nsteps, sgnlist, GG, ee)
subroutine, public prg_build_density_t_fermi_c(ham_bml_c, rho_bml_c, threshold, kbt, ef, verbose, drho)
subroutine, public prg_build_atomic_density_c(rhoat_bml_c, numel, hindex, spindex, norb, bml_type)
subroutine prg_build_density_cheb_c(ham_bml_c, rho_bml_c, athr, threshold, ncoeffs, kbt, ef, bndfil, jon, verbose)
subroutine, public prg_get_flevel_nt_c(norbs, eigenvalues, kbt, bndfil, tol, ef, verbose)
subroutine, public prg_build_density_t_fulldata_c(norbs, ham_bml_c, rho_bml_c, threshold, bndfil, kbt, ef, eigenvalues_out, evects_bml_c, fvals_out)
subroutine prg_prg_sp2_alg2_seq_inplace_c(rho_bml_c, threshold, pp, icount, vv, mineval, maxeval, verbose)
subroutine prg_sp2_alg1_c(h_bml_c, rho_bml_c, threshold, bndfil, minsp2iter, maxsp2iter, sp2conv, idemtol, verbose)
subroutine prg_get_hscf_c(nats, ham0_bml_c, over_bml_c, ham_bml_c, spindex, hindex, hubbardu, charges, coulomb_pot_r, coulomb_pot_k, mdimin, threshold)
subroutine prg_print_date_and_time_c(tag)
subroutine ewald_real_space_matrix_latte_c(E, RXYZ, Box, U, Element_Pointer, Nr_atoms, COULACC, nebcoul, totnebcoul, HDIM, Max_Nr_Neigh, Nr_Elem)
subroutine ewald_real_space_test_c(COULOMBV, I, RX, RY, RZ, LBox, DELTAQ, U, Element_Type, Nr_atoms, COULACC, nnRx, nnRy, nnRz, nrnnlist, nnType, Max_Nr_Neigh)
subroutine prg_write_tdos_c(nstates, eigenvals, gamma, npts, emin, emax, filename)
subroutine, public prg_tocanonicalspace_c(mat_bml_c, matCan_bml_c, evects_bml_c, threshold, verbose)
subroutine prg_get_charges_c(nats, norbs, rho_bml_c, over_bml_c, hindex, charges, numel, spindex, mdimin, threshold)
subroutine, public prg_toeigenspace_c(mat_bml_c, matEig_bml_c, evects_bml_c, threshold, verbose)
subroutine, public prg_get_eigenvalues_c(norbs, ham_bml_c, eigenvalues_out, verbose)
subroutine, public prg_check_idempotency_c(mat_bml_c, threshold, idempotency)
subroutine prg_sp2_basic_c(h_bml_c, rho_bml_c, threshold, bndfil, minsp2iter, maxsp2iter, sp2conv, idemtol, verbose)
subroutine prg_sp2_alg2_genseq_c(h_bml_c, rho_bml_c, threshold, bndfil, minsp2iter, maxsp2iter, sp2conv, idemtol, pp, icount, vv, verbose)
subroutine, public prg_build_density_fromevalsandevects_c(norbs, evects_bml_c, evals, rho_bml_c, threshold, bndfil, kbt, ef, verbose)
subroutine prg_timer_shutdown_c()
subroutine, public prg_get_flevel_c(norbs, eigenvalues, kbt, bndfil, tol, Ef)
subroutine, public canon_dm_prt_c(P1, H1, Nocc, T, Q, e, mu0, m, HDIM)
subroutine prg_sp2_basic_tcore_c(h_bml_c, rho_bml_c, rhofull_bml_c, threshold, bndfil, minsp2iter, maxsp2iter, sp2conv, idemtol, verbose)
subroutine prg_sp2_alg1_seq_c(h_bml_c, rho_bml_c, threshold, pp, icount, vv)
subroutine prg_sp2_fermi_init_c(h_bml_c, nsteps, nocc, tscale, threshold, occErrLimit, traceLimit, x_bml_c, mu, beta, h1, hN, sgnlist)
subroutine prg_open_file_to_read_c(io, name)
subroutine prg_normalize_implicit_fermi_c(h_bml_c, cnst, mu)
subroutine prg_timer_stop_c(itimer, verbose)
subroutine, public prg_get_evalsdvalsevects_c(norbs, ham_bml_c, threshold, hindex_in, llsize, evals_out, dvals_out, evects_bml_c, verbose)
subroutine prg_sp2_alg2_c(h_bml_c, rho_bml_c, threshold, bndfil, minsp2iter, maxsp2iter, sp2conv, idemtol, verbose)
subroutine, public prg_progress_init_c()
subroutine prg_build_density_cheb_fermi_c(ham_bml_c, rho_bml_c, athr, threshold, ncoeffs, kbt, ef, bndfil, getef, fermitol, jon, npts, trkfunc, verbose)
subroutine prg_sp2_fermi_c(h_bml_c, osteps, nsteps, nocc, mu, beta, h1, hN, sgnlist, threshold, eps, traceLimit, x_bml_c)
A module to compute the Mulliken charges of a chemical system.
subroutine, public prg_get_hscf(ham0_bml, over_bml, ham_bml, spindex, hindex, hubbardu, charges, coulomb_pot_r, coulomb_pot_k, mdimin, threshold)
Constructs the SCF Hamiltonian given H0, HubbardU and charges. This routine does: ,...
subroutine, public prg_get_hscf_v2(ham0_bml, over_bml, ham_bml, spindex, hindex, hubbardu, charges, coulomb_pot_r, coulomb_pot_k, mdimin, threshold)
subroutine, public prg_get_charges(rho_bml, over_bml, hindex, charges, numel, spindex, mdimin, threshold)
Constructs the charges from the density matrix.
Module to obtain the density matrix by applying a Chebyshev polynomial expansion.
subroutine, public prg_build_density_cheb_fermi(ham_bml, rho_bml, athr, threshold, ncoeffs, kbt, ef, bndfil, getef, fermitol, jon, npts, trkfunc, verbose)
Builds the density matrix from for a Fermi function approximated with a Chebyshev polynomial expansi...
subroutine, public prg_build_density_cheb(ham_bml, rho_bml, athr, threshold, ncoeffs, kbt, ef, bndfil, jon, verbose)
Builds the density matrix from for a Fermi function approximated with a Chebyshev polynomial expansi...
Module to obtain the density matrix by diagonalizing an orthogonalized Hamiltonian.
subroutine, public prg_get_flevel_nt(eigenvalues, kbt, bndfil, tol, ef, err, verbose)
Routine to compute the Fermi level given a set of eigenvalues and a temperature. It applies the Newto...
subroutine, public prg_build_density_t(ham_bml, rho_bml, threshold, bndfil, kbt, ef, eigenvalues_out)
Builds the density matrix from for electronic temperature T. Where, is the matrix eigenvector and ...
subroutine, public prg_build_density_t_fermi(ham_bml, rho_bml, threshold, kbt, ef, verbose, drho)
Builds the density matrix from for electronic temperature T. Where, is the matrix eigenvector and ...
subroutine, public prg_build_density_t0(ham_bml, rho_bml, threshold, bndfil, eigenvalues_out)
Builds the density matrix from for zero electronic temperature. Where, is the matrix eigenvector a...
subroutine, public prg_build_density_t_ed(ham_bml, rho_bml, evects_bml, threshold, bndfil, kbt, ef, evals, dvals, hindex, llsize, verbose)
Builds the density matrix from for electronic temperature T. Where, is the matrix eigenvector and ...
subroutine, public prg_get_eigenvalues(ham_bml, eigenvalues, verbose)
Gets the eigenvalues of the Orthogonalized Hamiltonian.
subroutine, public prg_tocanonicalspace(mat_bml, matCan_bml, evects_bml, threshold, verbose)
Change an operator into the eigenspace representation.
subroutine, public prg_check_idempotency(mat_bml, threshold, idempotency)
To check the idempotency error of a matrix. This is calculated as the Frobenius norm of .
subroutine, public prg_build_atomic_density(rhoat_bml, numel, hindex, spindex, norb, bml_type)
Builds the atomic density matrix. Where, is the number of electrons for orbital i.
subroutine, public prg_build_density_t_fulldata(ham_bml, rho_bml, threshold, bndfil, kbt, ef, eigenvalues_out, evects_bml, fvals)
Builds the density matrix from for electronic temperature T. Where, is the matrix eigenvector and ...
subroutine, public canon_dm_prt(P1, H1, Nocc, T, Q, e, mu0, m, HDIM)
subroutine, public prg_get_evalsdvalsevects(ham_bml, threshold, hindex, llsize, evals, dvals, evects_bml, verbose)
Gets the eigenvalues and eigenvectors and the core contribution to each eigenvalue (dvals) .
subroutine, public prg_toeigenspace(mat_bml, matEig_bml, evects_bml, threshold, verbose)
Change an operator into the eigenspace representation.
subroutine, public prg_build_density_fromevalsandevects(evects_bml, evals, rho_bml, threshold, bndfil, kbt, ef, verbose)
Builds the density matrix from the evects and evals for electronic temperature T.
subroutine, public prg_get_flevel(eigenvalues, kbt, bndfil, tol, Ef, err)
Routine to compute the Fermi level given a set of eigenvalues and a temperature. It applies the Bisec...
A module to compute the Density of state (DOS) and lDOS.
Definition: prg_dos_mod.F90:8
subroutine, public prg_write_tdos(eigenvals, gamma, npts, emin, emax, filename)
Writes the total DOS into a file. Where .
Definition: prg_dos_mod.F90:35
subroutine, public ewald_real_space_single_latte(COULOMBV, I, RXYZ, Box, Nr_elem, DELTAQ, J, U, Element_Pointer, Nr_atoms, COULACC, HDIM, Max_Nr_Neigh)
Find Coulomb potential on site I from single charge at site J.
subroutine, public ewald_real_space(COULOMBV, FCOUL, I, RX, RY, RZ, LBox, DELTAQ, U, Element_Type, Nr_atoms, COULACC, TIMERATIO, nnRx, nnRy, nnRz, nrnnlist, nnType, HDIM, Max_Nr_Neigh)
subroutine, public ewald_real_space_test(COULOMBV, I, RX, RY, RZ, LBox, DELTAQ, U, Element_Type, Nr_atoms, COULACC, nnRx, nnRy, nnRz, nrnnlist, nnType, Max_Nr_Neigh)
subroutine, public ewald_real_space_latte(COULOMBV, I, RXYZ, Box, DELTAQ, U, Element_Pointer, Nr_atoms, COULACC, nebcoul, totnebcoul, HDIM, Max_Nr_Neigh, Nr_Elem)
subroutine, public ewald_real_space_matrix_latte(E, RXYZ, Box, U, Element_Pointer, Nr_atoms, COULACC, nebcoul, totnebcoul, HDIM, Max_Nr_Neigh, Nr_Elem)
subroutine, public ewald_real_space_single(COULOMBV, FCOUL, I, RX, RY, RZ, LBox, DELTAQ, J, U, Element_Type, Nr_atoms, COULACC, TIMERATIO, HDIM, Max_Nr_Neigh)
To produce a matrix which is needed to orthogonalize .
Definition: prg_genz_mod.F90:6
The prg_normalize module.
subroutine, public prg_normalize_fermi(h_bml, h1, hN, mu)
Normalize a Hamiltonian matrix prior to running the truncated SP2 algorithm.
subroutine, public prg_normalize(h_bml)
Normalize a Hamiltonian matrix prior to running the SP2 algorithm.
subroutine, public prg_normalize_cheb(h_bml, mu, emin, emax, alpha, scaledmu)
Normalize a Hamiltonian matrix prior to running the Chebyshev algorithm.
subroutine, public prg_normalize_implicit_fermi(h_bml, cnst, mu)
Normalize a Hamiltonian matrix prior to running the implicit fermi dirac algorithm.
Module to handle input output files for the PROGRESS lib.
subroutine, public prg_open_file(io, name)
Opens a file to write.
subroutine, public prg_open_file_to_read(io, name)
Opens a file to read.
The progress module.
subroutine, public prg_progress_init()
Initialize progress.
subroutine, public prg_version()
Print PROGRESS and BML versions.
subroutine, public prg_progress_shutdown()
Shutdown progress.
Produces a matrix to get the Pulay Component of the forces.
The SP2 Fermi module.
subroutine, public prg_sp2_fermi(h_bml, osteps, nsteps, nocc, mu, beta, h1, hN, sgnlist, threshold, eps, traceLimit, x_bml)
Calculate Truncated SP2.
subroutine, public prg_sp2_fermi_init_norecs(h_bml, nsteps, nocc, tscale, threshold, occErrLimit, traceLimit, x_bml, mu, beta, h1, hN, sgnlist, verbose)
Truncated SP2 prg_initialization. This routine also gives back the Number of SP2 recursive steps that...
subroutine, public prg_sp2_fermi_init(h_bml, nsteps, nocc, tscale, threshold, occErrLimit, traceLimit, x_bml, mu, beta, h1, hN, sgnlist)
Truncated SP2 prg_initialization.
subroutine, public prg_sp2_entropy_function(mu, h1, hN, nsteps, sgnlist, GG, ee)
Calculate SP2 entropy function using gaussian quadrature. Note that GG and ee are allocated and retur...
The SP2 module.
Definition: prg_sp2_mod.F90:7
subroutine, public prg_sp2_alg2(h_bml, rho_bml, threshold, bndfil, minsp2iter, maxsp2iter, sp2conv, idemtol, verbose)
subroutine, public prg_sp2_alg2_genseq(h_bml, rho_bml, threshold, bndfil, minsp2iter, maxsp2iter, sp2conv, idemtol, pp, icount, vv, verbose)
subroutine, public prg_sp2_alg1_seq(h_bml, rho_bml, threshold, pp, icount, vv)
subroutine, public prg_sp2_basic_tcore(h_bml, rho_bml, rhofull_bml, threshold, bndfil, minsp2iter, maxsp2iter, sp2conv, idemtol, verbose)
subroutine, public prg_prg_sp2_alg2_seq_inplace(rho_bml, threshold, pp, icount, vv, mineval, maxeval, verbose)
subroutine, public prg_sp2_submatrix(ham_bml, rho_bml, threshold, pp, icount, vv, mineval, maxeval, core_size)
Perform SP2 algorithm using sequence and calculate norm for a submatrix.
subroutine, public prg_sp2_alg2_seq(h_bml, rho_bml, threshold, pp, icount, vv, verbose)
subroutine, public prg_sp2_submatrix_inplace(rho_bml, threshold, pp, icount, vv, mineval, maxeval, core_size)
subroutine, public prg_sp2_basic(h_bml, rho_bml, threshold, bndfil, minsp2iter, maxsp2iter, sp2conv, idemtol, verbose)
Calculates the density matrix from a Hamiltonian matrix by purification. The method implemented here ...
Definition: prg_sp2_mod.F90:51
subroutine, public prg_prg_sp2_alg1_seq_inplace(rho_bml, threshold, pp, icount, vv, mineval, maxeval)
subroutine, public prg_sp2_alg1(h_bml, rho_bml, threshold, bndfil, minsp2iter, maxsp2iter, sp2conv, idemtol, verbose)
A module to read and handle chemical systems.
The timer module.
subroutine, public prg_print_date_and_time(tag)
subroutine, public prg_timer_results()
subroutine, public prg_timer_shutdown()
Done with timers.
subroutine, public timer_prg_init()
Initialize timers.
subroutine, public prg_timer_start(itimer, tag)
Start Timing.
subroutine, public prg_timer_stop(itimer, verbose)
Stop timing.
subroutine, public prg_timer_collect()