Repository: ipc-sim/ipc-toolkit (language: python)

Issue:
Started adding Python bindings



Discussion / hints:

Fix patch:
diff --git a/python/src/collisions/tangential/edge_edge.cpp b/python/src/collisions/tangential/edge_edge.cpp
index 1d105c88d..cad197047 100644
--- a/python/src/collisions/tangential/edge_edge.cpp
+++ b/python/src/collisions/tangential/edge_edge.cpp
@@ -14,7 +14,7 @@ void define_edge_edge_tangential_collision(py::module_& m)
         .def(
             py::init<
                 const EdgeEdgeNormalCollision&, const VectorMax12d&,
-                const BarrierPotential&, const double>(),
+                const NormalPotential&, const double>(),
             py::arg("collision"), py::arg("positions"),
-            py::arg("barrier_potential"), py::arg("barrier_stiffness"));
+            py::arg("normal_potential"), py::arg("normal_stiffness"));
 }
diff --git a/python/src/collisions/tangential/edge_vertex.cpp b/python/src/collisions/tangential/edge_vertex.cpp
index dc89d4c5a..1ec0a7f28 100644
--- a/python/src/collisions/tangential/edge_vertex.cpp
+++ b/python/src/collisions/tangential/edge_vertex.cpp
@@ -14,7 +14,7 @@ void define_edge_vertex_tangential_collision(py::module_& m)
         .def(
             py::init<
                 const EdgeVertexNormalCollision&, const VectorMax12d&,
-                const BarrierPotential&, const double>(),
+                const NormalPotential&, const double>(),
             py::arg("collision"), py::arg("positions"),
-            py::arg("barrier_potential"), py::arg("barrier_stiffness"));
+            py::arg("normal_potential"), py::arg("normal_stiffness"));
 }
diff --git a/python/src/collisions/tangential/face_vertex.cpp b/python/src/collisions/tangential/face_vertex.cpp
index aca29ad6d..c6c0030ae 100644
--- a/python/src/collisions/tangential/face_vertex.cpp
+++ b/python/src/collisions/tangential/face_vertex.cpp
@@ -14,7 +14,7 @@ void define_face_vertex_tangential_collision(py::module_& m)
         .def(
             py::init<
                 const FaceVertexNormalCollision&, const VectorMax12d&,
-                const BarrierPotential&, const double>(),
+                const NormalPotential&, const double>(),
             py::arg("collision"), py::arg("positions"),
-            py::arg("barrier_potential"), py::arg("barrier_stiffness"));
+            py::arg("normal_potential"), py::arg("normal_stiffness"));
 }
diff --git a/python/src/collisions/tangential/tangential_collisions.cpp b/python/src/collisions/tangential/tangential_collisions.cpp
index 93c599005..352f0dc98 100644
--- a/python/src/collisions/tangential/tangential_collisions.cpp
+++ b/python/src/collisions/tangential/tangential_collisions.cpp
@@ -13,35 +13,35 @@ void define_tangential_collisions(py::module_& m)
             "build",
             py::overload_cast<
                 const CollisionMesh&, const Eigen::MatrixXd&,
-                const NormalCollisions&, const BarrierPotential&, double,
+                const NormalCollisions&, const NormalPotential&, double,
                 double>(&TangentialCollisions::build),
             py::arg("mesh"), py::arg("vertices"), py::arg("collisions"),
-            py::arg("barrier_potential"), py::arg("barrier_stiffness"),
+            py::arg("normal_potential"), py::arg("normal_stiffness"),
             py::arg("mu"))
         .def(
             "build",
             [](TangentialCollisions& self, const CollisionMesh& mesh,
                const Eigen::MatrixXd& vertices,
                const NormalCollisions& collisions,
-               const BarrierPotential& barrier_potential,
-               const double barrier_stiffness, const Eigen::VectorXd& mus) {
+               const NormalPotential& normal_potential,
+               const double normal_stiffness, const Eigen::VectorXd& mus) {
                 self.build(
-                    mesh, vertices, collisions, barrier_potential,
-                    barrier_stiffness, mus);
+                    mesh, vertices, collisions, normal_potential,
+                    normal_stiffness, mus);
             },
             py::arg("mesh"), py::arg("vertices"), py::arg("collisions"),
-            py::arg("barrier_potential"), py::arg("barrier_stiffness"),
+            py::arg("normal_potential"), py::arg("normal_stiffness"),
             py::arg("mus"))
         .def(
             "build",
             py::overload_cast<
                 const CollisionMesh&, const Eigen::MatrixXd&,
-                const NormalCollisions&, const BarrierPotential&, const double,
+                const NormalCollisions&, const NormalPotential&, const double,
                 const Eigen::VectorXd&,
                 const std::function<double(double, double)>&>(
                 &TangentialCollisions::build),
             py::arg("mesh"), py::arg("vertices"), py::arg("collisions"),
-            py::arg("barrier_potential"), py::arg("barrier_stiffness"),
+            py::arg("normal_potential"), py::arg("normal_stiffness"),
             py::arg("mus"), py::arg("blend_mu"))
         .def(
             "__len__", &TangentialCollisions::size,
diff --git a/python/src/collisions/tangential/vertex_vertex.cpp b/python/src/collisions/tangential/vertex_vertex.cpp
index 799680a29..738db1f3e 100644
--- a/python/src/collisions/tangential/vertex_vertex.cpp
+++ b/python/src/collisions/tangential/vertex_vertex.cpp
@@ -16,7 +16,7 @@ void define_vertex_vertex_tangential_collision(py::module_& m)
         .def(
             py::init<
                 const VertexVertexNormalCollision&, const VectorMax12d&,
-                const BarrierPotential&, const double>(),
+                const NormalPotential&, const double>(),
             py::arg("collision"), py::arg("positions"),
-            py::arg("barrier_potential"), py::arg("barrier_stiffness"));
+            py::arg("normal_potential"), py::arg("normal_stiffness"));
 }
diff --git a/python/src/potentials/tangential_potential.cpp b/python/src/potentials/tangential_potential.cpp
index 8cba5d558..624114921 100644
--- a/python/src/potentials/tangential_potential.cpp
+++ b/python/src/potentials/tangential_potential.cpp
@@ -32,7 +32,7 @@ void define_tangential_potential(py::module_& m)
             py::overload_cast<
                 const TangentialCollisions&, const CollisionMesh&,
                 const Eigen::MatrixXd&, const Eigen::MatrixXd&,
-                const Eigen::MatrixXd&, const BarrierPotential&, const double,
+                const Eigen::MatrixXd&, const NormalPotential&, const double,
                 const double, const bool>(
                 &TangentialPotential::force, py::const_),
             R"ipc_Qu8mg5v7(
@@ -44,8 +44,8 @@ void define_tangential_potential(py::module_& m)
                 rest_positions: Rest positions of the vertices (rowwise).
                 lagged_displacements: Previous displacements of the vertices (rowwise).
                 velocities: Current displacements of the vertices (rowwise).
-                barrier_potential: Barrier potential (used for normal force magnitude).
-                barrier_stiffness: Barrier stiffness (used for normal force magnitude).
+                normal_potential: Normal potential (used for normal force magnitude).
+                normal_stiffness: Normal stiffness (used for normal force magnitude).
                 dmin: Minimum distance (used for normal force magnitude).
                 no_mu: whether to not multiply by mu
 
@@ -54,14 +54,14 @@ void define_tangential_potential(py::module_& m)
             )ipc_Qu8mg5v7",
             py::arg("collisions"), py::arg("mesh"), py::arg("rest_positions"),
             py::arg("lagged_displacements"), py::arg("velocities"),
-            py::arg("barrier_potential"), py::arg("barrier_stiffness"),
+            py::arg("normal_potential"), py::arg("normal_stiffness"),
             py::arg("dmin") = 0, py::arg("no_mu") = false)
         .def(
             "force_jacobian",
             py::overload_cast<
                 const TangentialCollisions&, const CollisionMesh&,
                 const Eigen::MatrixXd&, const Eigen::MatrixXd&,
-                const Eigen::MatrixXd&, const BarrierPotential&, const double,
+                const Eigen::MatrixXd&, const NormalPotential&, const double,
                 const TangentialPotential::DiffWRT, const double>(
                 &TangentialPotential::force_jacobian, py::const_),
             R"ipc_Qu8mg5v7(
@@ -73,8 +73,8 @@ void define_tangential_potential(py::module_& m)
                 rest_positions: Rest positions of the vertices (rowwise).
                 lagged_displacements: Previous displacements of the vertices (rowwise).
                 velocities: Current displacements of the vertices (rowwise).
-                barrier_potential: Barrier potential (used for normal force magnitude).
-                barrier_stiffness: Barrier stiffness (used for normal force magnitude).
+                normal_potential: Normal potential (used for normal force magnitude).
+                normal_stiffness: Normal stiffness (used for normal force magnitude).
                 wrt: The variable to take the derivative with respect to.
                 dmin: Minimum distance (used for normal force magnitude).
 
@@ -83,15 +83,15 @@ void define_tangential_potential(py::module_& m)
             )ipc_Qu8mg5v7",
             py::arg("collisions"), py::arg("mesh"), py::arg("rest_positions"),
             py::arg("lagged_displacements"), py::arg("velocities"),
-            py::arg("barrier_potential"), py::arg("barrier_stiffness"),
+            py::arg("normal_potential"), py::arg("normal_stiffness"),
             py::arg("wrt"), py::arg("dmin") = 0)
         .def(
             "force",
             py::overload_cast<
                 const TangentialCollision&, const VectorMax12d&,
                 const VectorMax12d&, const VectorMax12d&,
-                const BarrierPotential&, const double, const double,
-                const bool>(&TangentialPotential::force, py::const_),
+                const NormalPotential&, const double, const double, const bool>(
+                &TangentialPotential::force, py::const_),
             R"ipc_Qu8mg5v7(
             Compute the friction force.
 
@@ -100,8 +100,8 @@ void define_tangential_potential(py::module_& m)
                 rest_positions: Rest positions of the vertices (rowwise).
                 lagged_displacements: Previous displacements of the vertices (rowwise).
                 velocities: Current displacements of the vertices (rowwise).
-                barrier_potential: Barrier potential (used for normal force magnitude).
-                barrier_stiffness: Barrier stiffness (used for normal force magnitude).
+                normal_potential: Normal potential (used for normal force magnitude).
+                normal_stiffness: Normal stiffness (used for normal force magnitude).
                 dmin: Minimum distance (used for normal force magnitude).
                 no_mu: Whether to not multiply by mu
 
@@ -110,14 +110,14 @@ void define_tangential_potential(py::module_& m)
             )ipc_Qu8mg5v7",
             py::arg("collision"), py::arg("rest_positions"),
             py::arg("lagged_displacements"), py::arg("velocities"),
-            py::arg("barrier_potential"), py::arg("barrier_stiffness"),
+            py::arg("normal_potential"), py::arg("normal_stiffness"),
             py::arg("dmin") = 0, py::arg("no_mu") = false)
         .def(
             "force_jacobian",
             py::overload_cast<
                 const TangentialCollision&, const VectorMax12d&,
                 const VectorMax12d&, const VectorMax12d&,
-                const BarrierPotential&, const double,
+                const NormalPotential&, const double,
                 const TangentialPotential::DiffWRT, const double>(
                 &TangentialPotential::force_jacobian, py::const_),
             R"ipc_Qu8mg5v7(
@@ -128,8 +128,8 @@ void define_tangential_potential(py::module_& m)
                 rest_positions: Rest positions of the vertices (rowwise).
                 lagged_displacements: Previous displacements of the vertices (rowwise).
                 velocities: Current displacements of the vertices (rowwise).
-                barrier_potential: Barrier potential (used for normal force magnitude).
-                barrier_stiffness: Barrier stiffness (used for normal force magnitude).
+                normal_potential: Normal potential (used for normal force magnitude).
+                normal_stiffness: Normal stiffness (used for normal force magnitude).
                 wrt: Variable to differentiate the friction force with respect to.
                 dmin: Minimum distance (used for normal force magnitude).
 
@@ -138,6 +138,6 @@ void define_tangential_potential(py::module_& m)
             )ipc_Qu8mg5v7",
             py::arg("collision"), py::arg("rest_positions"),
             py::arg("lagged_displacements"), py::arg("velocities"),
-            py::arg("barrier_potential"), py::arg("barrier_stiffness"),
+            py::arg("normal_potential"), py::arg("normal_stiffness"),
             py::arg("wrt"), py::arg("dmin") = 0);
 }
diff --git a/src/ipc/collisions/tangential/edge_edge.cpp b/src/ipc/collisions/tangential/edge_edge.cpp
index 4029ff217..ce9d20439 100644
--- a/src/ipc/collisions/tangential/edge_edge.cpp
+++ b/src/ipc/collisions/tangential/edge_edge.cpp
@@ -18,12 +18,12 @@ EdgeEdgeTangentialCollision::EdgeEdgeTangentialCollision(
 EdgeEdgeTangentialCollision::EdgeEdgeTangentialCollision(
     const EdgeEdgeNormalCollision& collision,
     const VectorMax12d& positions,
-    const BarrierPotential& barrier_potential,
-    const double barrier_stiffness)
+    const NormalPotential& normal_potential,
+    const double normal_stiffness)
     : EdgeEdgeTangentialCollision(collision)
 {
     TangentialCollision::init(
-        collision, positions, barrier_potential, barrier_stiffness);
+        collision, positions, normal_potential, normal_stiffness);
 }
 
 // ============================================================================
diff --git a/src/ipc/collisions/tangential/edge_edge.hpp b/src/ipc/collisions/tangential/edge_edge.hpp
index 476838178..020682e85 100644
--- a/src/ipc/collisions/tangential/edge_edge.hpp
+++ b/src/ipc/collisions/tangential/edge_edge.hpp
@@ -16,8 +16,8 @@ class EdgeEdgeTangentialCollision : public EdgeEdgeCandidate,
     EdgeEdgeTangentialCollision(
         const EdgeEdgeNormalCollision& collision,
         const VectorMax12d& positions,
-        const BarrierPotential& barrier_potential,
-        const double barrier_stiffness);
+        const NormalPotential& normal_potential,
+        const double normal_stiffness);
 
 protected:
     EdgeEdgeDistanceType known_dtype() const override
diff --git a/src/ipc/collisions/tangential/edge_vertex.cpp b/src/ipc/collisions/tangential/edge_vertex.cpp
index 9d4c61589..1837888cc 100644
--- a/src/ipc/collisions/tangential/edge_vertex.cpp
+++ b/src/ipc/collisions/tangential/edge_vertex.cpp
@@ -18,12 +18,12 @@ EdgeVertexTangentialCollision::EdgeVertexTangentialCollision(
 EdgeVertexTangentialCollision::EdgeVertexTangentialCollision(
     const EdgeVertexNormalCollision& collision,
     const VectorMax12d& positions,
-    const BarrierPotential& barrier_potential,
-    const double barrier_stiffness)
+    const NormalPotential& normal_potential,
+    const double normal_stiffness)
     : EdgeVertexTangentialCollision(collision)
 {
     TangentialCollision::init(
-        collision, positions, barrier_potential, barrier_stiffness);
+        collision, positions, normal_potential, normal_stiffness);
 }
 
 // ============================================================================
diff --git a/src/ipc/collisions/tangential/edge_vertex.hpp b/src/ipc/collisions/tangential/edge_vertex.hpp
index fc5e8ad83..b6e923092 100644
--- a/src/ipc/collisions/tangential/edge_vertex.hpp
+++ b/src/ipc/collisions/tangential/edge_vertex.hpp
@@ -16,8 +16,8 @@ class EdgeVertexTangentialCollision : public EdgeVertexCandidate,
     EdgeVertexTangentialCollision(
         const EdgeVertexNormalCollision& collision,
         const VectorMax12d& positions,
-        const BarrierPotential& barrier_potential,
-        const double barrier_stiffness);
+        const NormalPotential& normal_potential,
+        const double normal_stiffness);
 
 protected:
     MatrixMax<double, 3, 2>
diff --git a/src/ipc/collisions/tangential/face_vertex.cpp b/src/ipc/collisions/tangential/face_vertex.cpp
index 5e6548ec0..18b8c140c 100644
--- a/src/ipc/collisions/tangential/face_vertex.cpp
+++ b/src/ipc/collisions/tangential/face_vertex.cpp
@@ -18,12 +18,12 @@ FaceVertexTangentialCollision::FaceVertexTangentialCollision(
 FaceVertexTangentialCollision::FaceVertexTangentialCollision(
     const FaceVertexNormalCollision& collision,
     const VectorMax12d& positions,
-    const BarrierPotential& barrier_potential,
-    const double barrier_stiffness)
+    const NormalPotential& normal_potential,
+    const double normal_stiffness)
     : FaceVertexTangentialCollision(collision)
 {
     TangentialCollision::init(
-        collision, positions, barrier_potential, barrier_stiffness);
+        collision, positions, normal_potential, normal_stiffness);
 }
 
 // ============================================================================
diff --git a/src/ipc/collisions/tangential/face_vertex.hpp b/src/ipc/collisions/tangential/face_vertex.hpp
index c0791e2b4..8c47cbc03 100644
--- a/src/ipc/collisions/tangential/face_vertex.hpp
+++ b/src/ipc/collisions/tangential/face_vertex.hpp
@@ -16,8 +16,8 @@ class FaceVertexTangentialCollision : public FaceVertexCandidate,
     FaceVertexTangentialCollision(
         const FaceVertexNormalCollision& collision,
         const VectorMax12d& positions,
-        const BarrierPotential& barrier_potential,
-        const double barrier_stiffness);
+        const NormalPotential& normal_potential,
+        const double normal_stiffness);
 
 protected:
     MatrixMax<double, 3, 2>
diff --git a/src/ipc/collisions/tangential/tangential_collision.cpp b/src/ipc/collisions/tangential/tangential_collision.cpp
index c3667662c..76d81fb78 100644
--- a/src/ipc/collisions/tangential/tangential_collision.cpp
+++ b/src/ipc/collisions/tangential/tangential_collision.cpp
@@ -10,7 +10,7 @@ void TangentialCollision::init(
     const NormalCollision& collision,
     const VectorMax12d& positions,
     const NormalPotential& normal_potential,
-    const double barrier_stiffness)
+    const double normal_stiffness)
 {
     // do this to initialize dim()
     const int dim = collision.dim(positions.size());
@@ -19,7 +19,7 @@ void TangentialCollision::init(
     closest_point = compute_closest_point(positions);
     tangent_basis = compute_tangent_basis(positions);
     normal_force_magnitude = normal_potential.force_magnitude(
-        compute_distance(positions), collision.dmin, barrier_stiffness);
+        compute_distance(positions), collision.dmin, normal_stiffness);
 }
 
 } // namespace ipc
diff --git a/src/ipc/collisions/tangential/tangential_collision.hpp b/src/ipc/collisions/tangential/tangential_collision.hpp
index 976a1b6d6..c37701e6a 100644
--- a/src/ipc/collisions/tangential/tangential_collision.hpp
+++ b/src/ipc/collisions/tangential/tangential_collision.hpp
@@ -1,7 +1,7 @@
 #pragma once
 
 #include <ipc/friction/smooth_friction_mollifier.hpp>
-#include <ipc/potentials/barrier_potential.hpp>
+#include <ipc/potentials/normal_potential.hpp>
 #include <ipc/tangent/relative_velocity.hpp>
 #include <ipc/utils/eigen_ext.hpp>
 
@@ -12,13 +12,13 @@ class TangentialCollision : virtual public CollisionStencil {
     /// @brief Initialize the collision.
     /// @param collision NormalCollision stencil.
     /// @param positions Collision stencil's vertex positions.
-    /// @param normal_potential Barrier potential used for normal force.
-    /// @param barrier_stiffness Barrier potential stiffness.
+    /// @param normal_potential Normal potential used for normal force.
+    /// @param normal_stiffness Normal potential stiffness.
     void init(
         const NormalCollision& collision,
         const VectorMax12d& positions,
         const NormalPotential& normal_potential,
-        const double barrier_stiffness);
+        const double normal_stiffness);
 
 public:
     virtual ~TangentialCollision() = default;
diff --git a/src/ipc/collisions/tangential/tangential_collisions.cpp b/src/ipc/collisions/tangential/tangential_collisions.cpp
index 959140130..540309e54 100644
--- a/src/ipc/collisions/tangential/tangential_collisions.cpp
+++ b/src/ipc/collisions/tangential/tangential_collisions.cpp
@@ -15,8 +15,8 @@ void TangentialCollisions::build(
     const CollisionMesh& mesh,
     const Eigen::MatrixXd& vertices,
     const NormalCollisions& collisions,
-    const BarrierPotential& barrier_potential,
-    const double barrier_stiffness,
+    const NormalPotential& normal_potential,
+    const double normal_stiffness,
     const Eigen::VectorXd& mus,
     const std::function<double(double, double)>& blend_mu)
 {
@@ -36,8 +36,8 @@ void TangentialCollisions::build(
     FC_vv.reserve(C_vv.size());
     for (const auto& c_vv : C_vv) {
         FC_vv.emplace_back(
-            c_vv, c_vv.dof(vertices, edges, faces), barrier_potential,
-            barrier_stiffness);
+            c_vv, c_vv.dof(vertices, edges, faces), normal_potential,
+            normal_stiffness);
         const auto& [v0i, v1i, _, __] = FC_vv.back().vertex_ids(edges, faces);
 
         FC_vv.back().mu = blend_mu(mus(v0i), mus(v1i));
@@ -46,8 +46,8 @@ void TangentialCollisions::build(
     FC_ev.reserve(C_ev.size());
     for (const auto& c_ev : C_ev) {
         FC_ev.emplace_back(
-            c_ev, c_ev.dof(vertices, edges, faces), barrier_potential,
-            barrier_stiffness);
+            c_ev, c_ev.dof(vertices, edges, faces), normal_potential,
+            normal_stiffness);
         const auto& [vi, e0i, e1i, _] = FC_ev.back().vertex_ids(edges, faces);
 
         const double edge_mu =
@@ -69,8 +69,8 @@ void TangentialCollisions::build(
         }
 
         FC_ee.emplace_back(
-            c_ee, c_ee.dof(vertices, edges, faces), barrier_potential,
-            barrier_stiffness);
+            c_ee, c_ee.dof(vertices, edges, faces), normal_potential,
+            normal_stiffness);
 
         double ea_mu =
             (mus(ea1i) - mus(ea0i)) * FC_ee.back().closest_point[0] + mus(ea0i);
@@ -82,8 +82,8 @@ void TangentialCollisions::build(
     FC_fv.reserve(C_fv.size());
     for (const auto& c_fv : C_fv) {
         FC_fv.emplace_back(
-            c_fv, c_fv.dof(vertices, edges, faces), barrier_potential,
-            barrier_stiffness);
+            c_fv, c_fv.dof(vertices, edges, faces), normal_potential,
+            normal_stiffness);
         const auto& [vi, f0i, f1i, f2i] = FC_fv.back().vertex_ids(edges, faces);
 
         double face_mu = mus(f0i)
diff --git a/src/ipc/collisions/tangential/tangential_collisions.hpp b/src/ipc/collisions/tangential/tangential_collisions.hpp
index 9875d388d..c25a41626 100644
--- a/src/ipc/collisions/tangential/tangential_collisions.hpp
+++ b/src/ipc/collisions/tangential/tangential_collisions.hpp
@@ -26,12 +26,12 @@ class TangentialCollisions {
         const CollisionMesh& mesh,
         const Eigen::MatrixXd& vertices,
         const NormalCollisions& collisions,
-        const BarrierPotential& barrier_potential,
-        double barrier_stiffness,
+        const NormalPotential& normal_potential,
+        double normal_stiffness,
         double mu)
     {
         this->build(
-            mesh, vertices, collisions, barrier_potential, barrier_stiffness,
+            mesh, vertices, collisions, normal_potential, normal_stiffness,
             Eigen::VectorXd::Constant(vertices.rows(), mu));
     }
 
@@ -39,8 +39,8 @@ class TangentialCollisions {
         const CollisionMesh& mesh,
         const Eigen::MatrixXd& vertices,
         const NormalCollisions& collisions,
-        const BarrierPotential& barrier_potential,
-        const double barrier_stiffness,
+        const NormalPotential& normal_potential,
+        const double normal_stiffness,
         const Eigen::VectorXd& mus,
         const std::function<double(double, double)>& blend_mu =
             default_blend_mu);
diff --git a/src/ipc/collisions/tangential/vertex_vertex.cpp b/src/ipc/collisions/tangential/vertex_vertex.cpp
index a6f03fb88..b2aa931c1 100644
--- a/src/ipc/collisions/tangential/vertex_vertex.cpp
+++ b/src/ipc/collisions/tangential/vertex_vertex.cpp
@@ -18,12 +18,12 @@ VertexVertexTangentialCollision::VertexVertexTangentialCollision(
 VertexVertexTangentialCollision::VertexVertexTangentialCollision(
     const VertexVertexNormalCollision& collision,
     const VectorMax12d& positions,
-    const BarrierPotential& barrier_potential,
-    const double barrier_stiffness)
+    const NormalPotential& normal_potential,
+    const double normal_stiffness)
     : VertexVertexTangentialCollision(collision)
 {
     TangentialCollision::init(
-        collision, positions, barrier_potential, barrier_stiffness);
+        collision, positions, normal_potential, normal_stiffness);
 }
 
 // ============================================================================
diff --git a/src/ipc/collisions/tangential/vertex_vertex.hpp b/src/ipc/collisions/tangential/vertex_vertex.hpp
index 419ad7a19..9f7e4a8ab 100644
--- a/src/ipc/collisions/tangential/vertex_vertex.hpp
+++ b/src/ipc/collisions/tangential/vertex_vertex.hpp
@@ -17,8 +17,8 @@ class VertexVertexTangentialCollision : public VertexVertexCandidate,
     VertexVertexTangentialCollision(
         const VertexVertexNormalCollision& collision,
         const VectorMax12d& positions,
-        const BarrierPotential& barrier_potential,
-        const double barrier_stiffness);
+        const NormalPotential& normal_potential,
+        const double normal_stiffness);
 
 protected:
     MatrixMax<double, 3, 2>
diff --git a/src/ipc/potentials/tangential_potential.cpp b/src/ipc/potentials/tangential_potential.cpp
index 0a3204aa7..b1497840e 100644
--- a/src/ipc/potentials/tangential_potential.cpp
+++ b/src/ipc/potentials/tangential_potential.cpp
@@ -10,8 +10,8 @@ Eigen::VectorXd TangentialPotential::force(
     const Eigen::MatrixXd& rest_positions,
     const Eigen::MatrixXd& lagged_displacements,
     const Eigen::MatrixXd& velocities,
-    const BarrierPotential& barrier_potential,
-    const double barrier_stiffness,
+    const NormalPotential& normal_potential,
+    const double normal_stiffness,
     const double dmin,
     const bool no_mu) const
 {
@@ -37,7 +37,7 @@ Eigen::VectorXd TangentialPotential::force(
                     collision, collision.dof(rest_positions, edges, faces),
                     collision.dof(lagged_displacements, edges, faces),
                     collision.dof(velocities, edges, faces), //
-                    barrier_potential, barrier_stiffness, dmin, no_mu);
+                    normal_potential, normal_stiffness, dmin, no_mu);
 
                 const std::array<long, 4> vis =
                     collision.vertex_ids(mesh.edges(), mesh.faces());
@@ -57,8 +57,8 @@ Eigen::SparseMatrix<double> TangentialPotential::force_jacobian(
     const Eigen::MatrixXd& rest_positions,
     const Eigen::MatrixXd& lagged_displacements,
     const Eigen::MatrixXd& velocities,
-    const BarrierPotential& barrier_potential,
-    const double barrier_stiffness,
+    const NormalPotential& normal_potential,
+    const double normal_stiffness,
     const DiffWRT wrt,
     const double dmin) const
 {
@@ -86,7 +86,7 @@ Eigen::SparseMatrix<double> TangentialPotential::force_jacobian(
                     collision, collision.dof(rest_positions, edges, faces),
                     collision.dof(lagged_displacements, edges, faces),
                     collision.dof(velocities, edges, faces), //
-                    barrier_potential, barrier_stiffness, wrt, dmin);
+                    normal_potential, normal_stiffness, wrt, dmin);
 
                 const std::array<long, 4> vis =
                     collision.vertex_ids(mesh.edges(), mesh.faces());
@@ -119,7 +119,7 @@ Eigen::SparseMatrix<double> TangentialPotential::force_jacobian(
                 collision, collision.dof(rest_positions, edges, faces),
                 collision.dof(lagged_displacements, edges, faces),
                 collision.dof(velocities, edges, faces), //
-                barrier_potential, barrier_stiffness, dmin);
+                normal_potential, normal_stiffness, dmin);
             assert(collision.weight != 0);
             local_force /= collision.weight;
 
@@ -253,8 +253,8 @@ VectorMax12d TangentialPotential::force(
     const VectorMax12d& rest_positions,       // = x
     const VectorMax12d& lagged_displacements, // = u
     const VectorMax12d& velocities,           // = v
-    const BarrierPotential& barrier_potential,
-    const double barrier_stiffness,
+    const NormalPotential& normal_potential,
+    const double normal_stiffness,
     const double dmin,
     const bool no_mu) const
 {
@@ -275,8 +275,8 @@ VectorMax12d TangentialPotential::force(
     const VectorMax12d lagged_positions = rest_positions + lagged_displacements;
 
     // Compute N(x + u)
-    const double N = barrier_potential.force_magnitude(
-        collision.compute_distance(lagged_positions), dmin, barrier_stiffness);
+    const double N = normal_potential.force_magnitude(
+        collision.compute_distance(lagged_positions), dmin, normal_stiffness);
 
     // Compute P
     const MatrixMax<double, 3, 2> P =
@@ -309,8 +309,8 @@ MatrixMax12d TangentialPotential::force_jacobian(
     const VectorMax12d& rest_positions,       // = x
     const VectorMax12d& lagged_displacements, // = u
     const VectorMax12d& velocities,           // = v
-    const BarrierPotential& barrier_potential,
-    const double barrier_stiffness,
+    const NormalPotential& normal_potential,
+    const double normal_stiffness,
     const DiffWRT wrt,
     const double dmin) const
 {
@@ -337,17 +337,17 @@ MatrixMax12d TangentialPotential::force_jacobian(
     const bool need_jac_N_or_T = wrt != DiffWRT::VELOCITIES;
 
     // Compute N
-    const double N = barrier_potential.force_magnitude(
-        collision.compute_distance(lagged_positions), dmin, barrier_stiffness);
+    const double N = normal_potential.force_magnitude(
+        collision.compute_distance(lagged_positions), dmin, normal_stiffness);
 
     // Compute ∇N
     VectorMax12d grad_N;
     if (need_jac_N_or_T) {
         // ∇ₓN = ∇ᵤN
-        grad_N = barrier_potential.force_magnitude_gradient(
+        grad_N = normal_potential.force_magnitude_gradient(
             collision.compute_distance(lagged_positions),
             collision.compute_distance_gradient(lagged_positions), dmin,
-            barrier_stiffness);
+            normal_stiffness);
         assert(grad_N.array().isFinite().all());
     }
 
diff --git a/src/ipc/potentials/tangential_potential.hpp b/src/ipc/potentials/tangential_potential.hpp
index e58255b67..3dba9d791 100644
--- a/src/ipc/potentials/tangential_potential.hpp
+++ b/src/ipc/potentials/tangential_potential.hpp
@@ -33,8 +33,8 @@ class TangentialPotential : public Potential<TangentialCollisions> {
     /// @param rest_positions Rest positions of the vertices (rowwise).
     /// @param lagged_displacements Previous displacements of the vertices (rowwise).
     /// @param velocities Current displacements of the vertices (rowwise).
-    /// @param barrier_potential Barrier potential (used for normal force magnitude).
-    /// @param barrier_stiffness Barrier stiffness (used for normal force magnitude).
+    /// @param normal_potential Normal potential (used for normal force magnitude).
+    /// @param normal_stiffness Normal stiffness (used for normal force magnitude).
     /// @param dmin Minimum distance (used for normal force magnitude).
     /// @param no_mu whether to not multiply by mu
     /// @return The friction force.
@@ -44,8 +44,8 @@ class TangentialPotential : public Potential<TangentialCollisions> {
         const Eigen::MatrixXd& rest_positions,
         const Eigen::MatrixXd& lagged_displacements,
         const Eigen::MatrixXd& velocities,
-        const BarrierPotential& barrier_potential,
-        const double barrier_stiffness,
+        const NormalPotential& normal_potential,
+        const double normal_stiffness,
         const double dmin = 0,
         const bool no_mu = false) const;
 
@@ -55,8 +55,8 @@ class TangentialPotential : public Potential<TangentialCollisions> {
     /// @param rest_positions Rest positions of the vertices (rowwise).
     /// @param lagged_displacements Previous displacements of the vertices (rowwise).
     /// @param velocities Current displacements of the vertices (rowwise).
-    /// @param barrier_potential Barrier potential (used for normal force magnitude).
-    /// @param barrier_stiffness Barrier stiffness (used for normal force magnitude).
+    /// @param normal_potential Normal potential (used for normal force magnitude).
+    /// @param normal_stiffness Normal stiffness (used for normal force magnitude).
     /// @param wrt The variable to take the derivative with respect to.
     /// @param dmin Minimum distance (used for normal force magnitude).
     /// @return The Jacobian of the friction force wrt the velocities.
@@ -66,8 +66,8 @@ class TangentialPotential : public Potential<TangentialCollisions> {
         const Eigen::MatrixXd& rest_positions,
         const Eigen::MatrixXd& lagged_displacements,
         const Eigen::MatrixXd& velocities,
-        const BarrierPotential& barrier_potential,
-        const double barrier_stiffness,
+        const NormalPotential& normal_potential,
+        const double normal_stiffness,
         const DiffWRT wrt,
         const double dmin = 0) const;
 
@@ -104,8 +104,8 @@ class TangentialPotential : public Potential<TangentialCollisions> {
     /// @param rest_positions Rest positions of the vertices (rowwise).
     /// @param lagged_displacements Previous displacements of the vertices (rowwise).
     /// @param velocities Current displacements of the vertices (rowwise).
-    /// @param barrier_potential Barrier potential (used for normal force magnitude).
-    /// @param barrier_stiffness Barrier stiffness (used for normal force magnitude).
+    /// @param normal_potential Normal potential (used for normal force magnitude).
+    /// @param normal_stiffness Normal stiffness (used for normal force magnitude).
     /// @param dmin Minimum distance (used for normal force magnitude).
     /// @param no_mu Whether to not multiply by mu
     /// @return Friction force
@@ -114,8 +114,8 @@ class TangentialPotential : public Potential<TangentialCollisions> {
         const VectorMax12d& rest_positions,
         const VectorMax12d& lagged_displacements,
         const VectorMax12d& velocities,
-        const BarrierPotential& barrier_potential,
-        const double barrier_stiffness,
+        const NormalPotential& normal_potential,
+        const double normal_stiffness,
         const double dmin = 0,
         const bool no_mu = false) const; //< whether to not multiply by mu
 
@@ -124,8 +124,8 @@ class TangentialPotential : public Potential<TangentialCollisions> {
     /// @param rest_positions Rest positions of the vertices (rowwise).
     /// @param lagged_displacements Previous displacements of the vertices (rowwise).
     /// @param velocities Current displacements of the vertices (rowwise).
-    /// @param barrier_potential Barrier potential (used for normal force magnitude).
-    /// @param barrier_stiffness Barrier stiffness (used for normal force magnitude).
+    /// @param normal_potential Normal potential (used for normal force magnitude).
+    /// @param normal_stiffness Noraml stiffness (used for normal force magnitude).
     /// @param wrt Variable to differentiate the friction force with respect to.
     /// @param dmin Minimum distance (used for normal force magnitude).
     /// @return Friction force Jacobian
@@ -134,8 +134,8 @@ class TangentialPotential : public Potential<TangentialCollisions> {
         const VectorMax12d& rest_positions,
         const VectorMax12d& lagged_displacements,
         const VectorMax12d& velocities,
-        const BarrierPotential& barrier_potential,
-        const double barrier_stiffness,
+        const NormalPotential& normal_potential,
+        const double normal_stiffness,
         const DiffWRT wrt,
         const double dmin = 0) const;
 


Test patch:
diff --git a/tests/src/tests/friction/test_force_jacobian.cpp b/tests/src/tests/friction/test_force_jacobian.cpp
index b0bfc67fc..1a8e52565 100644
--- a/tests/src/tests/friction/test_force_jacobian.cpp
+++ b/tests/src/tests/friction/test_force_jacobian.cpp
@@ -7,6 +7,7 @@
 #include <ipc/ipc.hpp>
 #include <ipc/collisions/tangential/tangential_collisions.hpp>
 #include <ipc/potentials/friction_potential.hpp>
+#include <ipc/potentials/barrier_potential.hpp>
 
 #include <finitediff.hpp>
 #include <igl/edges.h>
diff --git a/tests/src/tests/friction/test_friction.cpp b/tests/src/tests/friction/test_friction.cpp
index ea4d019a6..41979f00b 100644
--- a/tests/src/tests/friction/test_friction.cpp
+++ b/tests/src/tests/friction/test_friction.cpp
@@ -6,6 +6,7 @@
 
 #include <ipc/collisions/tangential/tangential_collisions.hpp>
 #include <ipc/potentials/friction_potential.hpp>
+#include <ipc/potentials/barrier_potential.hpp>
 #include <ipc/utils/logger.hpp>
 
 #include <igl/edges.h>
diff --git a/tests/src/tests/potential/test_adhesion_potentials.cpp b/tests/src/tests/potential/test_adhesion_potentials.cpp
index 0a8cb11c9..552474b94 100644
--- a/tests/src/tests/potential/test_adhesion_potentials.cpp
+++ b/tests/src/tests/potential/test_adhesion_potentials.cpp
@@ -5,6 +5,7 @@
 
 #include <ipc/ipc.hpp>
 #include <ipc/adhesion/adhesion.hpp>
+#include <ipc/potentials/barrier_potential.hpp>
 #include <ipc/potentials/normal_adhesion_potential.hpp>
 #include <ipc/potentials/tangential_adhesion_potential.hpp>
 
diff --git a/tests/src/tests/potential/test_friction_potential.cpp b/tests/src/tests/potential/test_friction_potential.cpp
index 02f0fa6dc..9f8516051 100644
--- a/tests/src/tests/potential/test_friction_potential.cpp
+++ b/tests/src/tests/potential/test_friction_potential.cpp
@@ -6,6 +6,7 @@
 
 #include <ipc/collisions/tangential/tangential_collisions.hpp>
 #include <ipc/potentials/friction_potential.hpp>
+#include <ipc/potentials/barrier_potential.hpp>
 
 #include <finitediff.hpp>