Polymer Graph Sketcher

Tests

Create 2D sketches of Polymers: With this software, you can sketch bead-spring networks in 2D.

Example: Illustration of a bead-spring model created with this software

Contents

Usage

This app is published here: polymer-graph-sketcher.

It is free to use, but you are asked to cite this repository when you publish images generated with it.

Interface Overview

The Polymer Graph Sketcher interface consists of a canvas where you draw your polymer graphs, and a control panel with various settings and tools.

Note that you can only select vertices/nodes, and not edges. Edges are selected by the two connected vertices/nodes.

Drawing Modes

You can switch between different drawing modes using the dropdown menu or keyboard shortcuts:

Settings

Edge Settings

These settings affect both new as well as edges between the currently selected nodes.

Vertex Settings

These settings affect both new as well as currently selected nodes/vertices.

Canvas Settings

Generators

Random Walk Generator

Side Chain Generator

Tools

[!WARNING]
Many of these tools are non-reversible, as implemented currently. Be sure to export your graph beforehand to have a backup.

Auto-Save and State Persistence

The application automatically saves your work to your browser's local storage:

This feature ensures you never lose your work due to accidental page refreshes or browser closures.

Export Options

These tools and settings allow for the creation of complex polymer graphs, from simple linear chains to branched structures with side chains. The various export options ensure that your work can be saved and used in different formats as needed.

The import of the JSON file is offered at the bottom of the tools.

Movie Recording

Create animated movies of your graph construction and simulation processes.

The Movie Recording feature allows you to:

  1. Record Edge Additions: Capture edges as you add them, then generate smooth animations showing the graph being built
  2. Animate Simulations: Record force balance or position equilibration steps at a controlled speed
  3. Create Combined Movies: Combine multiple animation types into a single video

How to Use

  1. Open the "Movie Recording" accordion section in the controls
  2. Choose your animation type:
    • Edge Addition: Click "Start Recording Edges", add edges in your graph, then "Stop Recording". Adjust duration and create the movie.
    • Simulation: Select nodes, configure simulation parameters, and create a simulation movie
    • Combined: Create movies with both edge additions and simulation steps
  3. Movies are automatically downloaded as WebM video files

Keyboard Shortcuts

The Polymer Graph Sketcher supports the following keyboard shortcuts for quick access to various functions:

General Actions

Interaction Modes

These shortcuts provide quick access to common actions and interaction modes, enhancing the efficiency of working with the Polymer Graph Sketcher.

Development

Steps to code:

  1. Clone this repository, e.g. with git clone git@github.com:GenieTim/polymer-graph-sketcher.git,
  2. Switch the folder to this repository, e.g. with cd polymer-graph-sketcher
  3. Install the dependencies, e.g. with npm install
  4. Build and run, e.g. with npm run dev

Acknowledgement

This development of this code was done for projects supported by the Swiss National Science Foundation (SNSF project 200021_204196).