Clang-format tests, examples, libraries, benchmarks, etc.

This commit is contained in:
Antonio Sánchez
2023-12-05 21:22:55 +00:00
committed by Rasmus Munk Larsen
parent 3252ecc7a4
commit 46e9cdb7fe
876 changed files with 33453 additions and 37795 deletions

View File

@@ -19,17 +19,11 @@ typedef Matrix<SCALAR, Eigen::Dynamic, 1> Vec;
using namespace std;
SCALAR E_VDW(const Vec &interactions1, const Vec &interactions2)
{
return (interactions2.cwise()/interactions1)
.cwise().cube()
.cwise().square()
.cwise().square()
.sum();
SCALAR E_VDW(const Vec &interactions1, const Vec &interactions2) {
return (interactions2.cwise() / interactions1).cwise().cube().cwise().square().cwise().square().sum();
}
int main()
{
int main() {
//
// 1 2 3 4 ... (interactions)
// ka . . . . ...
@@ -40,17 +34,17 @@ int main()
// for
// interaction)
//
Vec interactions1(SIZE), interactions2(SIZE); // SIZE is the number of vdw interactions in our system
Vec interactions1(SIZE), interactions2(SIZE); // SIZE is the number of vdw interactions in our system
// SetupCalculations()
SCALAR rab = 1.0;
SCALAR rab = 1.0;
interactions1.setConstant(2.4);
interactions2.setConstant(rab);
// Energy()
SCALAR energy = 0.0;
for (unsigned int i = 0; i<REPEAT; ++i) {
for (unsigned int i = 0; i < REPEAT; ++i) {
energy += E_VDW(interactions1, interactions2);
energy *= 1 + 1e-20 * i; // prevent compiler from optimizing the loop
energy *= 1 + 1e-20 * i; // prevent compiler from optimizing the loop
}
cout << "energy = " << energy << endl;
}