NBlibTest/IntegratorWorks: Initialize x's and v's
authorAndrey Alekseenko <al42and@gmail.com>
Thu, 8 Oct 2020 11:14:07 +0000 (13:14 +0200)
committerAndrey Alekseenko <al42and@gmail.com>
Thu, 8 Oct 2020 11:14:07 +0000 (13:14 +0200)
The coordinates and velocities of the test atom were left uninitialized.
This, on my machine, occasionally caused NbLibIntegratorTests to
timeout, getting stuck indefinitely inside `put_atoms_in_box` function.

api/nblib/tests/integrator.cpp

index a1ee57fe0f86e8fae6f500cb1e4a1f861af6600e..94c64b35505ce09848326301e704f81091f1e2bb 100644 (file)
@@ -77,13 +77,9 @@ TEST(NBlibTest, IntegratorWorks)
     topologyBuilder.addParticleTypesInteractions(interactions);
     Topology topology = topologyBuilder.buildTopology();
 
-    std::vector<Vec3> x(numAtoms);
-    std::vector<Vec3> v(numAtoms);
-    std::vector<Vec3> f(numAtoms);
-
-    f[0][XX] = 1.0;
-    f[0][YY] = 2.0;
-    f[0][ZZ] = 0.0;
+    std::vector<Vec3> x(numAtoms, { 0.0, 0.0, 0.0 });
+    std::vector<Vec3> v(numAtoms, { 0.0, 0.0, 0.0 });
+    std::vector<Vec3> f(numAtoms, { 1.0, 2.0, 0.0 });
 
     Box box(100);