Skip to main content

Visualization tools for polymer self-assembly simulation data (SCFT/PSCF)

Project description

polymer-visual

gyroid A block gyroid all blocks
Fig. 1: Density profiles generated with polymer-visual showing a double-gyroid morphology.

A Python package for visualizing polymer self-assembly simulation data from PSCF. This is a Python port of the original MATLAB version.

Features

  • 3D Isosurface Plots: Visualize individual or composite density profiles
  • 1D Line Profiles: Plot composition along any direction through the unit cell
  • 2D Contour Plots: Generate contour maps on any plane
  • Scattering Profiles: Predict scattering peak intensities
  • Interactive Visualization: Using Plotly for interactive 3D graphics
  • Command-Line Interface: Easy-to-use CLI for batch processing

Installation

# Using pip
pip install polymer-visual

# Using poetry
poetry add polymer-visual

Quick Start

Command Line

# View file information
polymer-visual info examples/gyr.rf

# Generate all plots
polymer-visual plot examples/gyr.rf -o output/

# Generate specific plot types
polymer-visual plot examples/gyr.rf --composite --individual

# Generate a line profile
polymer-visual line examples/gyr.rf 1 1 1 --start 0 0 0

Python API

from polymer_visual import load_data, plot_all

# Load data from file
data = load_data('examples/gyr.rf')

# Generate all plots
figures = plot_all(data, output_dir='./output', show=True)

# Or use specific plot functions
from polymer_visual import plot_composite_profile, plot_individual_profiles

# Composite profile
plot_composite_profile(
    data['R'], data['x'], data['y'], data['z'],
    save_file='composite.html',
    show_fig=True
)

# Individual profiles for each species
plot_individual_profiles(
    data['R'], data['x'], data['y'], data['z'],
    save_file='individual.html',
    show_fig=True
)

Supported File Formats

The package reads PSCF r-grid files (.rgrid, .rf) containing:

  • Crystal system information
  • Unit cell parameters
  • Grid dimensions
  • Volume fraction data for each monomer species

Crystal Systems

Supported crystal systems include:

  • Cubic, Tetragonal, Orthorhombic
  • Hexagonal
  • Triclinic, Monoclinic
  • Trigonal/Rhombohedral
  • 2D systems: Square, Rectangular, Oblique, Rhombic, Lamellar

Documentation

For detailed documentation, see the docs directory.

Development

# Clone the repository
git clone https://github.com/kdorfmanUMN/polymer_visual.git
cd polymer_visual

# Install development dependencies
poetry install

# Run tests
pytest

# Build package
poetry build

License

This package is licensed under the MIT License. See LICENSE for details.

Authors

  • Original MATLAB code by Naveen Pillai, Akash Arora, Ben Magruder
  • Python port by polymer-visual team

References

For more information about the underlying science, see:

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

polymer_visual-1.0.0.tar.gz (17.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

polymer_visual-1.0.0-py3-none-any.whl (25.5 kB view details)

Uploaded Python 3

File details

Details for the file polymer_visual-1.0.0.tar.gz.

File metadata

  • Download URL: polymer_visual-1.0.0.tar.gz
  • Upload date:
  • Size: 17.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.8

File hashes

Hashes for polymer_visual-1.0.0.tar.gz
Algorithm Hash digest
SHA256 13f7babcd3eb4db0d2737ac07bc27fe5b7cca297940bcf4989bba31957cba8b1
MD5 c85f865e65eccb20cf75bfc0fff167e1
BLAKE2b-256 186c2e154286fc95190da100503c2b66066f4c9499fe9d24dfa2b0fe651608df

See more details on using hashes here.

File details

Details for the file polymer_visual-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: polymer_visual-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 25.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.8

File hashes

Hashes for polymer_visual-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3477df510bb8fc9b807e1895c71ff59e7e0b3d0354e1494051b0643e0e980447
MD5 ac52291c6f9b21273a900ffbf4d34ab0
BLAKE2b-256 a18b8127f5662f4fcaee09876ee925468dae532a7c8722db19406c087c534263

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page