@@ -48,17 +48,19 @@ int test_numgrad(TMolecule &mol, const int charge, const dparam &par) {
48
48
mol.xyz (i, c) += step;
49
49
get_dispersion (mol, charge, d4, par, cutoff, er, nullptr );
50
50
51
- mol.xyz (i, c) = mol.xyz (i, c) - 2 * step;
51
+ mol.xyz (i, c) = mol.xyz (i, c) - 2 * step;
52
52
get_dispersion (mol, charge, d4, par, cutoff, el, nullptr );
53
53
54
54
mol.xyz (i, c) = mol.xyz (i, c) + step;
55
55
numgrad (i, c) = 0.5 * (er - el) / step;
56
- }
56
+ }
57
57
}
58
58
59
59
// analytical gradient
60
- double * d4grad = new double [3 *mol.NAtoms ];
61
- for (int i = 0 ; i < 3 *mol.NAtoms ; i++) d4grad[i] = 0.0 ;
60
+ double *d4grad = new double [3 * mol.NAtoms ];
61
+ for (int i = 0 ; i < 3 * mol.NAtoms ; i++) {
62
+ d4grad[i] = 0.0 ;
63
+ }
62
64
info = get_dispersion (mol, charge, d4, par, cutoff, energy, d4grad);
63
65
if (!info == EXIT_SUCCESS) return info;
64
66
@@ -68,8 +70,8 @@ int test_numgrad(TMolecule &mol, const int charge, const dparam &par) {
68
70
// compare against numerical gradient
69
71
for (int i = 0 ; i < mol.NAtoms ; i++) {
70
72
for (int c = 0 ; c < 3 ; c++) {
71
- if (check (d4grad[3 * i + c], numgrad (i, c), thr) != EXIT_SUCCESS) {
72
- print_fail (" Gradient mismatch" , d4grad[3 * i + c], numgrad (i, c));
73
+ if (check (d4grad[3 * i + c], numgrad (i, c), thr) != EXIT_SUCCESS) {
74
+ print_fail (" Gradient mismatch" , d4grad[3 * i + c], numgrad (i, c));
73
75
return EXIT_FAILURE;
74
76
}
75
77
}
@@ -80,14 +82,14 @@ int test_numgrad(TMolecule &mol, const int charge, const dparam &par) {
80
82
return EXIT_SUCCESS;
81
83
}
82
84
83
- int is_trans_invar (const TMolecule& mol, double gradient[]) {
85
+ int is_trans_invar (const TMolecule & mol, double gradient[]) {
84
86
double xsum{0.0 };
85
87
double ysum{0.0 };
86
88
double zsum{0.0 };
87
89
for (int i = 0 ; i < mol.NAtoms ; i++) {
88
- xsum += gradient[3 * i];
89
- ysum += gradient[3 * i + 1 ];
90
- zsum += gradient[3 * i + 2 ];
90
+ xsum += gradient[3 * i];
91
+ ysum += gradient[3 * i + 1 ];
92
+ zsum += gradient[3 * i + 2 ];
91
93
}
92
94
93
95
if (check (xsum, 0.0 ) != EXIT_SUCCESS) {
@@ -106,7 +108,6 @@ int is_trans_invar(const TMolecule& mol, double gradient[]) {
106
108
return EXIT_SUCCESS;
107
109
}
108
110
109
-
110
111
int test_pbed4_mb01 () {
111
112
// PBE-D4(EEQ) parameters
112
113
dparam par;
@@ -120,7 +121,8 @@ int test_pbed4_mb01() {
120
121
// assemble molecule
121
122
int charge = mb16_43_01_charge;
122
123
TMolecule mol;
123
- int info = get_molecule (mb16_43_01_n, mb16_43_01_atoms, mb16_43_01_coord, mol);
124
+ int info =
125
+ get_molecule (mb16_43_01_n, mb16_43_01_atoms, mb16_43_01_coord, mol);
124
126
if (!info == EXIT_SUCCESS) return info;
125
127
126
128
return test_numgrad (mol, charge, par);
0 commit comments