@@ -48,17 +48,19 @@ int test_numgrad(TMolecule &mol, const int charge, const dparam &par) {
4848 mol.xyz (i, c) += step;
4949 get_dispersion (mol, charge, d4, par, cutoff, er, nullptr );
5050
51- mol.xyz (i, c) = mol.xyz (i, c) - 2 * step;
51+ mol.xyz (i, c) = mol.xyz (i, c) - 2 * step;
5252 get_dispersion (mol, charge, d4, par, cutoff, el, nullptr );
5353
5454 mol.xyz (i, c) = mol.xyz (i, c) + step;
5555 numgrad (i, c) = 0.5 * (er - el) / step;
56- }
56+ }
5757 }
5858
5959 // 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+ }
6264 info = get_dispersion (mol, charge, d4, par, cutoff, energy, d4grad);
6365 if (!info == EXIT_SUCCESS ) return info;
6466
@@ -68,8 +70,8 @@ int test_numgrad(TMolecule &mol, const int charge, const dparam &par) {
6870 // compare against numerical gradient
6971 for (int i = 0 ; i < mol.NAtoms ; i++) {
7072 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));
7375 return EXIT_FAILURE ;
7476 }
7577 }
@@ -80,14 +82,14 @@ int test_numgrad(TMolecule &mol, const int charge, const dparam &par) {
8082 return EXIT_SUCCESS ;
8183}
8284
83- int is_trans_invar (const TMolecule& mol, double gradient[]) {
85+ int is_trans_invar (const TMolecule & mol, double gradient[]) {
8486 double xsum{0.0 };
8587 double ysum{0.0 };
8688 double zsum{0.0 };
8789 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 ];
9193 }
9294
9395 if (check (xsum, 0.0 ) != EXIT_SUCCESS ) {
@@ -106,7 +108,6 @@ int is_trans_invar(const TMolecule& mol, double gradient[]) {
106108 return EXIT_SUCCESS ;
107109}
108110
109-
110111int test_pbed4_mb01 () {
111112 // PBE-D4(EEQ) parameters
112113 dparam par;
@@ -120,7 +121,8 @@ int test_pbed4_mb01() {
120121 // assemble molecule
121122 int charge = mb16_43_01_charge;
122123 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);
124126 if (!info == EXIT_SUCCESS ) return info;
125127
126128 return test_numgrad (mol, charge, par);
0 commit comments