v4.0.5 12 Unit Types GPU Accelerated FEM Simulation ML + RL Ready

FiberNet

Python Toolkit for Fiber Network Design, Simulation & Intelligent Optimization

纤维网络结构生成、力学模拟与智能优化 — Python 3.9+ · MIT · Cross-platform

pip install fibernet
pip install fibernet[full]
GitHub PyPI
12
Unit Types / 基元
94
Features / 特征维度
368D
Parametric Space / 参数空间
3
Platforms / 平台

What is FiberNet? / 是什么

A research-grade Python toolkit for computational design of fiber network metamaterials. Complete closed-loop workflow: parametric generation, GPU-accelerated simulation, feature extraction, machine learning prediction, and reinforcement learning optimization — all through a unified Python API.

面向纤维网络超材料计算设计的 Python 工具包。从参数化生成、GPU 加速模拟、特征提取到机器学习预测与强化学习优化,完整闭环工作流通过统一 API 调用。

BMG-FDU, Fudan University / 复旦大学 生物大分子课题组

Why FiberNet? / 为什么选择

  • One-line APIs — generate, simulate, predict, optimize in a single call
    一行代码完成生成、模拟、预测、优化
  • GPU acceleration — large-scale structural simulation with millisecond latency
    GPU 加速大规模结构模拟
  • Parametric design — continuous parameter space for inverse design and optimization
    连续参数空间支持逆向设计与优化
  • Rich features — structural, topological, and mechanical descriptors out of the box
    内置结构、拓扑与力学特征描述符

Structure Catalog / 结构目录

Square
正方
Triangle
三角
Hexagon
六边
Honeycomb
蜂窝
Kagome
笼目
Voronoi
泰森多边形
Chiral
手性
Reentrant
凹角
Star
星形
Cross
十字
Diamond
钻石
Missing Rib
缺肋
Structure Gallery

12 unit types across 6 architecture families / 12种基元,6大结构家族

Showcase / 展示

Deformation Trajectory

8-frame deformation trajectory: honeycomb under stretch, colored by edge stretch ratio / 蜂窝拉伸8帧形变轨迹

FEM Deformation Showcase

Beam Frame FEM: uniaxial stretch (2x) and compression (0.5x) across topologies and fiber radii. Bright color = high von Mises stress. Welded frames with radius-dependent bending stiffness. / Euler-Bernoulli梁框架FEM:拉伸(2倍)与压缩(0.5倍)模拟,亮色=高von Mises应力

Voronoi Stretch

Voronoi structure under 1.5x uniaxial stretch — deformation and stress distribution / Voronoi 结构 1.5 倍单轴拉伸

ML Analysis

Machine learning analysis: confusion matrix, ROC curves, and learning curves / 机器学习分析面板

RL Reward

Reinforcement learning: reward per episode with monotonically increasing best reward / 强化学习训练曲线

One-Line API / 一行代码


import fibernet as fn

g = fn.pattern_2d(unit="honeycomb", grid=(4,4))
fn.show(g)
r = fn.simulate(g, mode="stretch", strain=1.5)
result = fn.predict_from_csv("data.csv", target="max_force")
best = fn.run_bayesian_optimization(obj, space, n_iter=50)

FEM in 3 Lines / 三行FEM


from fibernet.ml import BeamFrameFEM

solver = BeamFrameFEM(E=1e9, nu=0.3)
g = fn.pattern_2d(unit="honeycomb", box=(10, 10), grid=(4, 4), radius=0.05)
result = solver.stretch_test(g, target_stretch=2.0)

print(f"Max stress: {result['sigma_total'].max()/1e6:.1f} MPa")
print(f"Max displacement: {result['max_displacement']:.4f} m")

Euler-Bernoulli beam frame FEM with welded joints. Stretch and compression tests on any topology. / 欧拉-伯努利梁框架FEM,支持任意拓扑的拉伸与压缩测试。

Installation / 安装


pip install fibernet            # Core / 核心
pip install fibernet[full]      # ML + RL + Viz + Accel
pip install fibernet[ml]        # scikit-learn, pandas
pip install fibernet[rl]        # gymnasium, scikit-optimize
pip install fibernet[accel]     # taichi (GPU)
pip install fibernet[viz]       # pyvista (3D)

Platforms / 平台

Ubuntu / macOS / WindowsPython 3.9 – 3.12

Machine Learning / 机器学习

Built-in feature extraction produces 94-dimensional structural descriptors. predict_from_csv() handles the full pipeline: train/test split, nested cross-validation, model comparison, and visualization — all in one call.

内置特征提取生成94维结构描述符,一行完成训练、交叉验证、模型对比与可视化。

Reinforcement Learning / 强化学习

Built-in optimization engines over a continuous parametric action space of internal node displacements. Automatically closes the loop: generate new structures, simulate their properties, evaluate the objective, and update parameters.

内置优化引擎在连续参数空间中自动搜索最优结构,闭环完成生成、模拟、评估、更新。

Complete Pipeline / 完整流水线


import fibernet as fn
import numpy as np

# 1. Parametric structure generation
displacements = [(np.random.uniform(-0.3,0.3), np.random.uniform(-0.3,0.3))
                 for _ in range(20)]
g = fn.pattern_2d(unit="square", grid=(3,3), n_pts_per_side=5,
                  point_displacements=displacements)

# 2. GPU-accelerated simulation with trajectory recording
engine = fn.TaichiEngine()
r = engine.stretch_test(g, target_stretch=1.5, stiffness=1e5, num_steps=5000)

# 3. Multi-frame stress visualization
fig = fn.render_trajectory(g, r.positions_trajectory, r.edge_stretches, n_frames=6)

# 4. Feature extraction (94-dim vector)
features = fn.GraphFeatureExtractor().extract(g)

# 5. Node manipulation for optimization
g.displace_node(g.get_internal_nodes()[0], [0.1, 0.2])
Generation
生成
Simulation
模拟
Machine Learning
机器学习
Optimization
优化

Under active development. Full tutorial at tutorials/v4_tutorial/. 积极开发中。完整教程见 tutorials/v4_tutorial/