Ewald 1D in 3D: jdu spát
[qpms.git] / oldtests / bspectransl.c
blob0210b959c28bbf185fda32dd94db9cfbbba08e10
1 // c99 -g -I.. bspectransl.c ../qpms/translations.c ../qpms/legendre.c ../qpms/vswf.c ../qpms/gaunt.c ../qpms/error.c -lm -lgsl -lblas
2 #include <qpms/translations.h>
3 #include <qpms/vswf.h>
4 #include <complex.h>
5 #include <stdio.h>
7 int main() {
8 cart3_t pos1={0,1,2}, pos2={3,5,2};
9 qpms_vswf_set_spec_t
10 *bspec1 = qpms_vswf_set_spec_from_lMax(1, QPMS_NORMALISATION_POWER),
11 *bspec2 = qpms_vswf_set_spec_from_lMax(2, QPMS_NORMALISATION_POWER);
13 qpms_trans_calculator *c = qpms_trans_calculator_init(3, QPMS_NORMALISATION_POWER);
15 complex double s_2_1[bspec2->n][bspec1->n];
16 complex double s_1_2[bspec1->n][bspec2->n];
17 const double k = 1.8;
19 qpms_trans_calculator_get_trans_array_lc3p(c, s_2_1[0], bspec2, bspec1->n,
20 bspec1, 1, k, pos2, pos1);
22 qpms_trans_calculator_get_trans_array_lc3p(c, s_1_2[0], bspec1, bspec2->n,
23 bspec2, 1, k, pos1, pos2);
25 for(size_t R = 0; R < bspec2->n; ++R) {
26 for(size_t C = 0; C < bspec1->n; ++C)
27 printf("%.3lg+%.3lgj\t", creal(s_2_1[R][C]), cimag(s_2_1[C][R]));
28 putchar('\n');
30 putchar('\n');
32 for(size_t R = 0; R < bspec1->n; ++R) {
33 for(size_t C = 0; C < bspec2->n; ++C)
34 printf("%.3lg+%.3lgj\t", creal(s_1_2[R][C]), cimag(s_1_2[R][C]));
35 putchar('\n');
38 qpms_trans_calculator_free(c);
39 qpms_vswf_set_spec_free(bspec1);
40 qpms_vswf_set_spec_free(bspec2);
41 return 0;