Given a set of (x,y) coordinates of a point cloud with N points in 2D, this code creates a network metamaterial by connecting points via the Delaunay triangulation in a bounding box. It then computes the effective resistance across either diagonal of the material, as well as offers the option to return the voltage at each node and the current flow along each edge.
This code is written to run on the data files generated from the code in the config_generate repository.
Main script to use the generated point clouds and compute the effective resistance (and voltage at each node, current at each edge).
find_corners_adjacency_A - finds the northeast (NE) node and makes this node 1, the southwest (SW) node and makes this node N, then connects nodes based on the Delaunay triangulation.
find_corners_adjacency_B - finds the NW node and makes this node 1, the SE node and makes this node N, then connects nodes based on the Delaunay triangulation.
Inspiration for the algorithm to create the network Adjacency matrix was taken from from https://people.sc.fsu.edu/~jburkardt/presentations/voronoi_neighbors.pdf
compute_voltage_Adj - computes the weighted adjacency matrix and computes effective resistance, voltages, and currents. Defines resistance as the reciprocal of the Euclidean distance between connected nodes and applies a current across the network from node 1 to node N. Within, can define parameters for comparison to experimental results:
xarea: the cross-sectional area of one beam of the network in cm^2
tmp: the resistance of each beam of the network in mOhm
find_corners_adjacency_voronoi - can take the place of find_corners_adjacency_A to construct a Voronoi tessellation of the point cloud instead of a Delaunay triangulation.
For a given network, identify two neighboring triangles that form a convex quadrilateral structure with their common edge being one of the two quadrilateral diagonals. Switch the diagonal for the other diagonal and record the resulting change in effective resistance measured from the NE to SW corners and the change in total effective resistance.
edge_flip_test.m - takes in the adjacency matrix and performs the edge flip test.
isConvex_from_coords.m - uses the (x,y) coordinates of the nodes in a quadrilateral and determines if it is convex.
compute_Rs.m - an updated version of compute_voltage_Adj that returns the effective resistance between any two nodes, as well as the total effective resistance.
draw_flip_heatmap_edges_only.m - plotting routine to plot the result of the edge_flip_test on the network. Calls the colormap defined in purple_cmap.m.
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
If you use this code, please also cite Obrero et al., (2025) Electrical transport in tunably disordered metamaterials, Phys. Rev. E 112, 035505 https://doi.org/10.1103/6bph-n6zj
If you use the edge flip test code, additionally cite Wang et al., (2026) ArXiv
