forked from etmc/tmLQCD
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinvert_clover_eo.c
92 lines (83 loc) · 3.14 KB
/
invert_clover_eo.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/***********************************************************************
* Copyright (C) 2012 Carsten Urbach
*
* This file is part of tmLQCD.
*
* tmLQCD is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* tmLQCD is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with tmLQCD. If not, see <http://www.gnu.org/licenses/>.
*
* invert_clover_eo makes an inversion with EO preconditioned
* clover tm Operator
*
* Even and Odd are the numbers of spinor_field that contain
* the even and the odd sites of the source. The result is stored
* int Even_new and Odd_new.
*
* invert_clover_eo returns the number of iterations needed or -1 if the
* solver did not converge.
*
* Author: Carsten Urbach
*
***********************************************************************/
#ifdef HAVE_CONFIG_H
# include<config.h>
#endif
#include<stdlib.h>
#include"global.h"
#include"su3.h"
#include"linalg_eo.h"
#include"operator/tm_operators.h"
#include"operator/Hopping_Matrix.h"
#include"operator/clovertm_operators.h"
#include"operator/D_psi.h"
#include"gamma.h"
#include"solver/solver.h"
#include"invert_clover_eo.h"
#include "solver/dirac_operator_eigenvectors.h"
int invert_clover_eo(spinor * const Even_new, spinor * const Odd_new,
spinor * const Even, spinor * const Odd,
const double precision, const int max_iter,
const int solver_flag, const int rel_prec,
su3 *** gf, matrix_mult Qsq, matrix_mult Qm) {
int iter;
if(g_proc_id == 0 && g_debug_level > 0) {
printf("# Using even/odd preconditioning!\n"); fflush(stdout);
}
assign_mul_one_sw_pm_imu_inv(EE, Even_new, Even, +g_mu);
Hopping_Matrix(OE, g_spinor_field[DUM_DERI], Even_new);
/* The sign is plus, since in Hopping_Matrix */
/* the minus is missing */
assign_mul_add_r(g_spinor_field[DUM_DERI], +1., Odd, VOLUME/2);
/* Do the inversion with the preconditioned */
/* matrix to get the odd sites */
/* Here we invert the hermitean operator squared */
gamma5(g_spinor_field[DUM_DERI], g_spinor_field[DUM_DERI], VOLUME/2);
if(g_proc_id == 0) {
printf("# Using CG!\n");
printf("# mu = %f, kappa = %f, csw = %f\n",
g_mu/2./g_kappa, g_kappa, g_c_sw);
fflush(stdout);
}
iter = cg_her(Odd_new, g_spinor_field[DUM_DERI], max_iter,
precision, rel_prec,
VOLUME/2, Qsq);
Qm(Odd_new, Odd_new);
/* Reconstruct the even sites */
Hopping_Matrix(EO, g_spinor_field[DUM_DERI], Odd_new);
clover_inv(EE, g_spinor_field[DUM_DERI], +g_mu);
/* The sign is plus, since in Hopping_Matrix */
/* the minus is missing */
assign_add_mul_r(Even_new, g_spinor_field[DUM_DERI], +1., VOLUME/2);
return(iter);
}