atomes 1.3.1
atomes: an atomic scale modeling tool box
Loading...
Searching...
No Matches
skt.F90
Go to the documentation of this file.
1! This file is part of the 'atomes' software.
2!
3! 'atomes' is free software: you can redistribute it and/or modify it under the terms
4! of the GNU Affero General Public License as published by the Free Software Foundation,
5! either version 3 of the License, or (at your option) any later version.
6!
7! 'atomes' is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
8! without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9! See the GNU General Public License for more details.
10!
11! You should have received a copy of the GNU Affero General Public License along with 'atomes'.
12! If not, see <https://www.gnu.org/licenses/>
13!
14! Copyright (C) 2022-2026 by CNRS and University of Strasbourg
15!
16!>
17!! @file skt.F90
18!! @short S(k,t) analysis: dynamic structure factor calculation
19!! @author Sébastien Le Roux <sebastien.leroux@ipcms.unistra.fr>
20!! @author Noël Jakse <noel.jakse@grenoble-inp.fr>
21!
22! Notes:
23!
24! LLM tool (Gemini via Antigravity) was used at few occasions to prepare some sections of this file, including:
25! - To write a first draft version of the 's_of_k_t' function based on my work in the file 'sk.F90'
26! - To write parts of the 'FOURIER_TRANS_QVECT_SKT' routine
27! - To write parts of the 'COMPUTE_SQW' routine
28! Overall the inputs provided by the LLM in these occasions were bad,
29! But because I used them to get the first raw version of the code,
30! I feel compelled to declare it here.
31!
32INTEGER (KIND=c_int) FUNCTION s_of_k_t (NQ_IN, XA_IN, MIN_IN, N_SETS, SETS_T, &
33 DELTA_T, Q_NUM, Q_LIST, N_FREQ) bind (C,NAME='s_of_k_t_')
34
35! Total and Partial Dynamic Structure Factor Calculation
36!
37! S(q,t) = (1/N) * < \sum_{i} \sum_{j} exp( -i * q * ( r_i(t0+t) - r_j(t0) ) ) >
38!
39! Partial:
40!
41! S_ab(q,t) ~ < \rho_a(q, t0+t) * conjg(\rho_b(q, t0)) >
42!
43
44USE parameters
45
46#ifdef OPENMP
47!$ USE OMP_LIB
48#endif
49IMPLICIT NONE
50
51INTEGER (KIND=c_int), INTENT(IN) :: nq_in ! Number of delta q
52INTEGER (KIND=c_int), INTENT(IN) :: xa_in ! How to compute X rays
53INTEGER (KIND=c_int), INTENT(IN) :: min_in ! Minimum value of correlations
54INTEGER (KIND=c_int), INTENT(IN) :: n_sets ! Number of t steps to save, or -1 for all
55INTEGER (KIND=c_int), DIMENSION(N_SETS), INTENT(IN) :: sets_t
56INTEGER (KIND=c_int), INTENT(IN) :: q_num ! Number q compute (q,w) data
57INTEGER (KIND=c_int), INTENT(IN) :: n_freq ! Number of frequency points
58
59real(kind=c_double) :: delta_t
60real(kind=c_double), DIMENSION(Q_NUM), INTENT(IN) :: q_list
61
62INTEGER :: nsq, pid
63INTEGER, DIMENSION(:), ALLOCATABLE :: qid
64INTEGER, DIMENSION(:), ALLOCATABLE :: sqw_qlist
65DOUBLE PRECISION :: factor, xfactor
66DOUBLE PRECISION, DIMENSION (:), ALLOCATABLE :: sqtab, sqw_tab, sqw_qval
67DOUBLE PRECISION, DIMENSION(:,:), ALLOCATABLE :: skt_tab
68DOUBLE PRECISION, DIMENSION(:,:), ALLOCATABLE :: rho_c, rho_s
69DOUBLE PRECISION, DIMENSION(:,:), ALLOCATABLE :: nsqt, xsqt
70DOUBLE PRECISION, DIMENSION(:,:,:), ALLOCATABLE :: localcorr
71DOUBLE PRECISION, DIMENSION(:,:,:,:), ALLOCATABLE :: sqt
72
73INTERFACE
74 DOUBLE PRECISION FUNCTION fqx(TA, Q)
75 INTEGER, INTENT(IN) :: ta
76 DOUBLE PRECISION, INTENT(IN) :: q
77 END FUNCTION
78END INTERFACE
79
80allocate(sqt(nq_in, ns-min_in, nsp, nsp), stat=err)
81if (err .ne. 0) then
82 call show_error ("Impossible to allocate memory"//char(0), &
83 "Function: s_of_k_t"//char(0), "Table: SQT"//char(0))
84 s_of_k_t = 0
85 goto 001
86endif
87sqt(:,:,:,:) = 0.0d0
88
89allocate(nsqt(nq_in, ns-min_in), stat=err)
90if (err .ne. 0) then
91 call show_error ("Impossible to allocate memory"//char(0), &
92 "Function: s_of_k_t"//char(0), "Table: NSQT"//char(0))
93 s_of_k_t = 0
94 goto 001
95endif
96nsqt(:,:) = 0.0d0
97
98allocate(xsqt(nq_in, ns-min_in), stat=err)
99if (err .ne. 0) then
100 call show_error ("Impossible to allocate memory"//char(0), &
101 "Function: s_of_k_t"//char(0), "Table: XSQT"//char(0))
102 s_of_k_t = 0
103 goto 001
104endif
105xsqt(:,:) = 0.0d0
106
107! Allocate density arrays RHO_C and RHO_S
108ALLOCATE(rho_c(ns, nsp), stat=err)
109if (err .ne. 0) then
110 call show_error ("Impossible to allocate memory"//char(0), &
111 "Function: s_of_k_t"//char(0), "Table: RHO_C"//char(0))
112 s_of_k_t = 0
113 goto 001
114endif
115ALLOCATE(rho_s(ns, nsp), stat=err)
116if (err .ne. 0) then
117 call show_error ("Impossible to allocate memory"//char(0), &
118 "Function: s_of_k_t"//char(0), "Table: RHO_S"//char(0))
119 s_of_k_t = 0
120 goto 001
121endif
122ALLOCATE(localcorr(ns-min_in, nsp, nsp), stat=err)
123if (err .ne. 0) then
124 call show_error ("Impossible to allocate memory"//char(0), &
125 "Function: s_of_k_t"//char(0), "Table: LocalCorr"//char(0))
126 s_of_k_t = 0
127 goto 001
128endif
129
130!t0 = OMP_GET_WTIME ()
131call fourier_trans_qvect_skt (min_in) ! Default Q-vector parallelization
132!t1 = OMP_GET_WTIME ()
133!write (*,*) "temps d’excecution QVT 2:", t1-t0
134
135if (allocated(qvectx)) deallocate(qvectx)
136if (allocated(qvecty))deallocate(qvecty)
137if (allocated(qvectz)) deallocate(qvectz)
138if (allocated(modq)) deallocate(modq)
139
140! Normalization and weighting (Neutron/X-ray)
141
142factor=0.0d0
143do i=1, nsp
144 factor=factor + nbspbs(i)*nscattl(i)**2
145enddo
146
147if (xa_in .eq. 1) then
148 xfactor=0.0d0
149 do i=1, nsp
150 xfactor=xfactor + nbspbs(i)*xscattl(i)**2
151 enddo
152endif
153
154do t=1, ns-min_in
155
156 do i=1, nq_in
157
158 if (degeneracy(i) .gt. 0) then
159 do j=1, nsp
160 do k=1, nsp
161 ! Neutrons
162 nsqt(i,t) = nsqt(i,t) + sqt(i,t,j,k) * nscattl(j) * nscattl(k)
163 ! X-rays
164 if (xa_in .eq. 1) then
165 xsqt(i,t) = xsqt(i,t) + sqt(i,t,j,k) * xscattl(j) * xscattl(k)
166 else
167 ! Use form factors FQX
168 xsqt(i,t) = xsqt(i,t) + sqt(i,t,j,k) * fqx(int(xscattl(j)), k_point(i)) * fqx(int(xscattl(k)), k_point(i))
169 endif
170 enddo
171 enddo
172
173 ! Normalization
174 nsqt(i,t) = nsqt(i,t) / (factor * degeneracy(i))
175
176 if (xa_in .eq. 1) then
177 xsqt(i,t) = xsqt(i,t) / (xfactor * degeneracy(i))
178 else
179 ! Function FQX appears in sk.F90
180 xfactor = 0.0d0
181 do k=1, nsp
182 xfactor = xfactor + nbspbs(k) * fqx(int(xscattl(k)), k_point(i))**2
183 enddo
184 xsqt(i,t) = xsqt(i,t) / (xfactor * degeneracy(i))
185 endif
186
187 ! Normalize Partials
188 do j=1, nsp
189 do k=1, nsp
190 sqt(i,t,j,k) = sqt(i,t,j,k) / (degeneracy(i) * sqrt(dble(nbspbs(j)*nbspbs(k))))
191 enddo
192 enddo
193
194 endif
195
196 enddo
197
198enddo
199
200if (allocated(sqtab)) deallocate(sqtab)
201allocate(sqtab(nq_in), stat=err)
202if (err .ne. 0) then
203 call show_error ("Impossible to allocate memory"//char(0), &
204 "Function: s_of_k_t"//char(0), "Table: SQTAB"//char(0))
205 s_of_k_t = 0
206 goto 001
207endif
208
209if (allocated(qid)) deallocate(qid)
210allocate(qid(nq_in), stat=err)
211if (err .ne. 0) then
212 call show_error ("Impossible to allocate memory"//char(0), &
213 "Function: s_of_k_t"//char(0), "Table: QID"//char(0))
214 s_of_k_t = 0
215 goto 001
216endif
217sqtab(:)=0.0d0
218nsq = 0;
219do i=1, nq_in
220 if (degeneracy(i) .gt. 0) then
221 nsq=nsq+1
222 sqtab(nsq)= k_point(i)
223 qid(nsq) = i
224 endif
225enddo
226! Saving k-points
227call save_xsk (nsq, sqtab)
228
229if (skt_save(nsq) .eq. 0) then
230 s_of_k_t = 0
231 goto 001
232endif
233
234pid = 8+4*nsp*nsp
235if (nsp .eq. 2) pid=pid+8
236
237if (n_sets .eq. 1 .and. sets_t(1) .eq. -1) then
238 pid = pid*(ns-min_in)
239else
240 pid = pid*n_sets
241endif
242
243if (q_num .gt. 0) then
244 allocate(sqw_tab(n_freq), stat=err)
245 if (err .ne. 0) then
246 call show_error ("Impossible to allocate memory"//char(0), &
247 "Function: s_of_k_t"//char(0), "Table: SQW_TAB"//char(0))
248 s_of_k_t = 0
249 goto 001
250 endif
251 allocate(sqw_qlist(q_num), stat=err)
252 if (err .ne. 0) then
253 call show_error ("Impossible to allocate memory"//char(0), &
254 "Function: s_of_k_t"//char(0), "Table: SQW_QLIST"//char(0))
255 s_of_k_t = 0
256 goto 001
257 endif
258 allocate(sqw_qval(q_num), stat=err)
259 if (err .ne. 0) then
260 call show_error ("Impossible to allocate memory"//char(0), &
261 "Function: s_of_k_t"//char(0), "Table: SQW_QVAL"//char(0))
262 s_of_k_t = 0
263 goto 001
264 endif
265
266 ! First select all k id for the analysis, as close as possible as the user selection
267 ! write (6, *) "Q_NUM= ",Q_NUM
268 do i=1, q_num
269 j=1
270 do while (sqtab(j).lt.q_list(i))
271 j=j+1
272 enddo
273 if (j .gt. 1) then
274 if ((sqtab(j) - q_list(i)) .gt. (q_list(i) - sqtab(j-1))) then
275 j = j - 1
276 endif
277 endif
278 sqw_qlist(i) = qid(j)
279 sqw_qval(i) = k_point(qid(j))
280 ! write (6, *) "i= ",i,", Q_LIST(i)= ",Q_LIST(i)," j= ",j,", QID(j)= ",QID(j)," K_POINT(QID(j))= ",K_POINT(QID(j))
281 enddo
282 call recup_sqw_list (q_num, sqw_qval)
283 if (allocated(sqw_qval)) deallocate(sqw_qval)
284
285 call compute_sqw (nsqt, q_num, sqw_qlist, pid, 0, 0)
286
287 do i=1, nq_in
288 do j=1, ns-min_in
289 nsqt(i,j) = (nsqt(i,j)-1.0)*k_point(i)
290 enddo
291 enddo
292 call compute_sqw (nsqt, q_num, sqw_qlist, pid+2, 0, 0)
293
294 call compute_sqw (xsqt, q_num, sqw_qlist, pid+4, 0, 0)
295
296 do i=1, nq_in
297 do j=1, ns-min_in
298 xsqt(i,j) = (xsqt(i,j)-1.0)*k_point(i)
299 enddo
300 enddo
301 call compute_sqw (xsqt, q_num, sqw_qlist, pid+6, 0, 0)
302
303 allocate(skt_tab(nq_in, ns-min_in), stat=err)
304 if (err .ne. 0) then
305 call show_error ("Impossible to allocate memory"//char(0), &
306 "Function: s_of_k_t"//char(0), "Table: SKT_TAB"//char(0))
307 s_of_k_t = 0
308 goto 001
309 endif
310
311 pid = pid+8
312 do j=1, nsp
313 do k=1, nsp
314 do l=1, ns-min_in
315 do m=1, nq_in
316 skt_tab(m,l) = sqt(m,l,j,k)
317 enddo
318 enddo
319 call compute_sqw (skt_tab, q_num, sqw_qlist, pid, j, k)
320 pid = pid + 2
321 enddo
322 enddo
323
324endif
325
326s_of_k_t = 1
327
328001 continue
329
330if (allocated(sqtab)) deallocate(sqtab)
331if (allocated(skt_tab)) deallocate(skt_tab)
332if (allocated(sqw_tab)) deallocate(sqw_tab)
333if (allocated(sqw_qlist)) deallocate(sqw_qlist)
334if (allocated(sqt)) deallocate(sqt)
335if (allocated(nsqt)) deallocate(nsqt)
336if (allocated(xsqt)) deallocate(xsqt)
337if (allocated(rho_c)) deallocate(rho_c)
338if (allocated(rho_s)) deallocate(rho_s)
339if (allocated(localcorr)) deallocate(localcorr)
340
341CONTAINS
342
343!************************************************************
344!
345! Compute S(q,t) loops over Q-vectors
346! OpenMP // on Qvect
347!
348SUBROUTINE fourier_trans_qvect_skt (MIN_IN)
349
350 USE parameters
351
352 IMPLICIT NONE
353
354 INTEGER, INTENT(IN) :: min_in
355
356 INTEGER :: q, numcorr, t_n
357 DOUBLE PRECISION :: qx, qy, qz, qtr
358 DOUBLE PRECISION :: corr
359
360#ifdef OPENMP
361 INTEGER :: numth
362 numth = omp_get_max_threads()
363 if (number_of_qvect.lt.numth) numth=number_of_qvect
364 ! OpemMP on Qvect
365 !$OMP PARALLEL NUM_THREADS(NUMTH) DEFAULT (NONE) &
366 !$OMP& PRIVATE(qx, qy, qz, qtr, i, j, k, l, m, n, q, t) &
367 !$OMP& PRIVATE (t_n, NumCorr, RHO_C, RHO_S, LocalCorr, Corr) &
368 !$OMP& SHARED(NUMTH, NUMBER_OF_QVECT, SQT, NQ_IN, modq, qvmin, DELTA_Q) &
369 !$OMP& SHARED(qvectx, qvecty, qvectz, FULLPOS, NS, NSP, NA, LOT, MIN_IN)
370 !$OMP DO SCHEDULE(STATIC,NUMBER_OF_QVECT/NUMTH)
371#endif
372 do q=1, number_of_qvect
373
374 l=anint((modq(q)-qvmin)/delta_q)+1
375 if (l .le. nq_in) then
376
377 rho_c(:,:) = 0.0d0
378 rho_s(:,:) = 0.0d0
379 localcorr(:,:,:) = 0.0d0
380
381 qx=qvectx(q)
382 qy=qvecty(q)
383 qz=qvectz(q)
384
385 do t=1, ns
386 ! Compute density history for this Q vector
387 do i=1, na
388 j = lot(i)
389 qtr = qx*fullpos(i,1,t) + qy*fullpos(i,2,t) + qz*fullpos(i,3,t)
390 rho_c(t, j) = rho_c(t, j) + cos(qtr)
391 rho_s(t, j) = rho_s(t, j) + sin(qtr)
392 enddo
393 enddo
394
395 ! If 'MIN_IN = 0' and 't = 0', then S(t=0) is the static structure factor
396 do t=0, ns-1-min_in
397 numcorr = ns-t-min_in
398 do t_n=1, numcorr
399 do m=1, nsp
400 do n=1, nsp
401 corr = rho_c(t+t_n, m) * rho_c(t_n, n) + rho_s(t+t_n, m) * rho_s(t_n, n)
402 localcorr(t+1, m, n) = localcorr(t+1, m, n) + corr
403 enddo
404 enddo
405 enddo
406 ! Normalize by NumCorr here
407 localcorr(t+1, :, :) = localcorr(t+1, :, :) / dble(numcorr)
408 enddo
409
410#ifdef OPENMP
411 !$OMP CRITICAL
412#endif
413 sqt(l, :, :, :) = sqt(l, :, :, :) + localcorr(:, :, :)
414#ifdef OPENMP
415 !$OMP END CRITICAL
416#endif
417 endif
418
419 enddo
420#ifdef OPENMP
421 !$OMP END DO
422 !$OMP END PARALLEL
423#endif
424
425END SUBROUTINE
426
427!************************************************************
428!
429! Compute S(q,w) loops over frequencies
430!
431SUBROUTINE compute_sqw (SKT_TAB, Q_NUM, Q_LIST, PIC, SPA, SPB)
432
433 USE parameters
434
435 IMPLICIT NONE
436
437 INTEGER, INTENT(IN) :: q_num, pic, spa, spb
438 INTEGER, DIMENSION(Q_NUM), INTENT(IN) :: q_list
439 DOUBLE PRECISION, DIMENSION (NQ_IN,NS-MIN_IN), INTENT(IN) :: skt_tab
440
441 INTEGER :: qid, id_q_num, freq
442 INTEGER :: shift, cid
443 DOUBLE PRECISION :: omega, max_omega, delta_omega, time_val, sqw_val
444
445 max_omega = pi / delta_t
446 ! delta_omega = max_omega / DBLE(N_FREQ)
447 delta_omega = max_omega / dble(n_freq-1)
448
449 shift = 8+4*nsp*nsp
450 if (nsp .eq. 2) shift=shift+8
451 cid = pic
452
453 do qid = 1, q_num ! For all selected q points
454
455 id_q_num = q_list(qid) ! Select the q point ID number as referenced previously
456 do freq = 1, n_freq
457
458 omega = dble(freq-1) * delta_omega
459 sqw_val = 0.5d0 * skt_tab(id_q_num, 1)
460
461 do t = 2, ns-min_in-1
462 time_val = dble(t-1) * delta_t
463 sqw_val = sqw_val + skt_tab(id_q_num, t) * cos(omega * time_val)
464 enddo
465
466 time_val = dble(ns-min_in-1) * delta_t
467 sqw_val = sqw_val + 0.5d0 * skt_tab(id_q_num, ns-min_in) * cos(omega * time_val)
468
469 sqw_val = 2.0d0 * sqw_val * delta_t / pi
470 sqw_tab(freq) = sqw_val
471
472 enddo
473
474 ! Save SQW_TAB here !
475 call save_curve (n_freq, sqw_tab, cid, idskt)
476
477 if (spa .gt. 0 .and. spb .gt. 0) then
478
479 ! For partials only evaluates Faber-Ziman formalism
480 sqw_val = 0.0d0
481 do freq = 1, n_freq
482
483 omega = dble(freq-1) * delta_omega
484 if (spa .eq. spb) then
485 sqw_val = 0.5d0 * (1.0d0 + (skt_tab(id_q_num, 1) - 1.0d0)/xi(spa))
486 else
487 sqw_val = 0.5d0 * (1.0d0 + skt_tab(id_q_num, 1)/sqrt(xi(spa)*xi(spb)))
488 endif
489
490 do t = 2, ns-min_in-1
491 time_val = dble(t-1) * delta_t
492 if (spa .eq. spb) then
493 sqw_val = sqw_val + (1.0d0 + (skt_tab(id_q_num, t) - 1.0d0)/xi(spa)) * cos(omega * time_val)
494 else
495 sqw_val = sqw_val + (1.0d0 + skt_tab(id_q_num, t)/sqrt(xi(spa)*xi(spb))) * cos(omega * time_val)
496 endif
497 enddo
498
499 time_val = dble(ns-min_in-1) * delta_t
500 if (spa .eq. spb) then
501 sqw_val = sqw_val + 0.5d0 * (1.0d0 + (skt_tab(id_q_num, t) - 1.0d0)/xi(spa)) * cos(omega * time_val)
502 else
503 sqw_val = sqw_val + 0.5d0 * (1.0d0 + skt_tab(id_q_num, t)/sqrt(xi(spa)*xi(spb))) * cos(omega * time_val)
504 endif
505 sqw_val = 2.0d0 * sqw_val * delta_t / pi
506 sqw_tab(freq) = sqw_val
507
508 enddo
509
510 ! Save SQW_TAB here !
511 call save_curve (n_freq, sqw_tab, cid+2*nsp*nsp, idskt)
512
513 endif
514
515 cid = cid + shift
516
517 enddo
518
519
520END SUBROUTINE
521
522INTEGER FUNCTION skt_save (NSQ)
523
524USE parameters
525USE mendeleiev
526
527INTEGER, INTENT(IN) :: nsq
528
529INTEGER :: ndt, tps, cid
530DOUBLE PRECISION, DIMENSION (:), ALLOCATABLE :: sqtab
531
532INTERFACE
533 LOGICAL FUNCTION fzbt (NDQ, SQIJ)
534 USE parameters
535 INTEGER, INTENT(IN) :: ndq
536 DOUBLE PRECISION, DIMENSION(NDQ,NSP,NSP), INTENT(IN) :: sqij
537 END FUNCTION
538END INTERFACE
539
540h = 8+4*nsp*nsp
541if (nsp .eq. 2) h=h+8
542
543if (allocated(sqtab)) deallocate(sqtab)
544allocate(sqtab(nq_in), stat=err)
545if (err .ne. 0) then
546 call show_error ("Impossible to allocate memory"//char(0), &
547 "Function: SKT_SAVE"//char(0), "Table: SQTAB"//char(0))
548 skt_save = 0
549 goto 001
550endif
551if(allocated(sij)) deallocate(sij)
552allocate(sij(nq_in,nsp,nsp), stat=err)
553if (err .ne. 0) then
554 call show_error ("Impossible to allocate memory"//char(0), &
555 "Function: SKT_SAVE"//char(0), "Table: Sij"//char(0))
556 skt_save = 0
557 goto 001
558endif
559
560if (nsq .gt. 0) then ! If wave vectors exist
561
562 sqtab(:)=0.0d0
563
564 if (n_sets .eq. 1 .and. sets_t(1) .eq. -1) then
565 ndt = ns-min_in
566 else
567 ndt = n_sets
568 endif
569
570 do t=1, ndt
571
572 cid = (t-1)*sknum
573 if (ndt .eq. ns-min_in) then
574 tps = t
575 else
576 tps = sets_t(t)
577 endif
578
579 i=0
580 do k=1, nq_in
581 if (degeneracy(k) .gt. 0) then
582 i=i+1
583 sqtab(i)= nsqt(k,tps)
584 endif
585 enddo
586 call save_curve (nsq, sqtab, cid, idskt)
587
588 i=0
589 do k=1, nq_in
590 if (degeneracy(k) .gt. 0) then
591 i=i+1
592 sqtab(i)= (nsqt(k,tps)-1.0)*k_point(k)
593 endif
594 enddo
595 call save_curve (nsq, sqtab, cid + 2, idskt)
596
597 i=0
598 do k=1, nq_in
599 if (degeneracy(k) .gt. 0) then
600 i=i+1
601 sqtab(i)= xsqt(k,tps)
602 endif
603 enddo
604 call save_curve (nsq, sqtab, cid + 4, idskt)
605
606 i=0
607 do k=1, nq_in
608 if (degeneracy(k) .gt. 0) then
609 i=i+1
610 sqtab(i)= (xsqt(k,tps)-1.0)*k_point(k)
611 endif
612 enddo
613 call save_curve (nsq, sqtab, cid + 6, idskt)
614
615 sqtab(:)=0.0d0
616 sij(:,:,:)=0.0d0
617 l = 8
618 do i=1, nsp
619 do j=1, nsp
620 m=0
621
622 do k=1, nq_in
623 sij(k,i,j) = sqt(k,tps,i,j)
624 if (degeneracy(k) .gt. 0) then
625 m=m+1
626 sqtab(m)=sij(k,i,j)
627 endif
628 enddo
629 call save_curve (nsq, sqtab, cid + l, idskt)
630 l=l+2
631 enddo
632 enddo
633
634 ! To compute FZ and BT partials
635 if (.not.fzbt(nq_in, sij)) then
636 skt_save = 0
637 goto 001
638 endif
639
640 do i=1, nsp
641 do j=1, nsp
642 m=0
643 do k=1, nq_in
644 if (degeneracy(k) .gt. 0) then
645 m=m+1
646 sqtab(m)= fzsij(k,i,j)
647 endif
648 enddo
649 call save_curve (nsq, sqtab, cid + l, idskt)
650 l=l+2
651 enddo
652 enddo
653 if (nsp .eq. 2) then
654 do i=1, 4
655 k=0
656 do j=1, nq_in
657 if (degeneracy(j) .gt. 0) then
658 k=k+1
659 sqtab(k)= btij(j,i)
660 endif
661 enddo
662 call save_curve (nsq, sqtab, cid + l, idskt)
663 l=l+2
664 enddo
665 endif
666
667 enddo
668
669endif ! If wave vectors exist
670
671skt_save=1
672
673001 continue
674
675if (allocated(fzsij)) deallocate(fzsij)
676if (nsp.eq.2 .and. allocated(btij)) deallocate(btij)
677if (allocated(sqtab)) deallocate(sqtab)
678if(allocated(sij)) deallocate(sij)
679if(allocated(fzsij)) deallocate(fzsij)
680if(allocated(btij)) deallocate(btij)
681
682END FUNCTION
683
684END FUNCTION s_of_k_t
logical function fzbt(ndq, sqij)
Definition fzbt.F90:22
void show_error(char *error, int val, GtkWidget *win)
show error message
Definition interface.c:299
double precision, dimension(:,:,:), allocatable fullpos
double precision qvmin
double precision, dimension(:), allocatable qvectx
double precision, dimension(:), allocatable nscattl
integer number_of_qvect
double precision, dimension(:), allocatable qvecty
double precision delta_q
double precision, dimension(:), allocatable xi
double precision, dimension(:), allocatable k_point
integer, dimension(:), allocatable nbspbs
integer, dimension(:), allocatable degeneracy
integer idskt
integer err
double precision, dimension(:), allocatable modq
double precision, dimension(:), allocatable xscattl
double precision, dimension(:), allocatable qvectz
integer, dimension(:), allocatable lot
integer nsp
double precision, parameter pi
double precision function fqx(ta, q)
Definition sk.F90:470
integer(kind=c_int) function s_of_k_t(nq_in, xa_in, min_in, n_sets, sets_t, delta_t, q_num, q_list, n_freq)
Definition skt.F90:34