Skip to main content

A Python package for generating and plotting Wulff shapes from surface energy data

Project description

OgreWulff

A Python package for generating and plotting Wulff shapes from surface energy data, based on WulffPack.

Installation

From source

pip install -e .

From PyPI

pip install OgreWulff

Usage

Wulff shape from surface energies

from OgreWulff import plot_wulff
from ase.build import bulk

# Define surface energies (in mJ/m^2)
surface_energies = {
    (1, 0, 0): 100.0,
    (1, 1, 0): 85.0,
    (1, 1, 1): 75.0
}

conv = bulk('Cu', 'fcc', a=3.6, cubic=True)

# Interactive HTML (Plotly)
plot_wulff(surface_energies=surface_energies, structure=conv, output_file='cu_wulff.html', interactive=True, legend=True)

# Static PNG (matplotlib)
plot_wulff(surface_energies=surface_energies, structure=conv, output_file='cu_wulff.png', interactive=False, legend=True)

BFDH morphology (no surface energies needed)

The Bravais–Friedel–Donnay–Harker (BFDH) model predicts crystal morphology purely from lattice geometry: facets with larger interplanar spacings grow slower and therefore dominate the crystal habit.

from OgreWulff import plot_wulff_BFDH
from ase.build import bulk

conv = bulk('Cu', 'fcc', a=3.6, cubic=True)

particle = plot_wulff_BFDH(structure=conv, output_file='cu_wulff_bfdh.png', interactive=True, legend=True)

Features

  • Wulff shape construction: Create equilibrium crystal shapes from surface energies
  • Static plotting: Generate high-quality PNG figures using matplotlib
  • Interactive plotting: Create rotatable 3D visualizations with Plotly (optional)
  • Facet filtering: Control which facets to include using max_index parameter
  • Customizable appearance: Control viewing angles, colors, legends, and more

API Reference

plot_wulff

Main function for plotting Wulff shapes.

Parameters:

  • surface_energies (dict): Dictionary mapping Miller index tuples to surface energies (in mJ/m^2)
  • structure: ASE Atoms or pymatgen Structure for the conventional cell
  • output_file (str): Path to save the plot (optional, defaults to 'wulff_shape.png' or 'wulff_shape.html')
  • legend (bool): Whether to show legend (default: False)
  • elevation (int): Viewing elevation angle in degrees (default: 30)
  • azimuth (int): Viewing azimuth angle in degrees (default: -60)
  • use_common_viewing_angle (bool): Use elevation=30 and azimuth=30 (default: False)
  • no_title (bool): Hide the title (default: False)
  • title (str): Custom plot title (optional)
  • max_index (int or dict): Filter facets by Miller index magnitude (optional)
  • interactive (bool): Use Plotly for interactive visualization (default: False)
  • natoms (int): Number of atoms for Wulff construction (default: 1000)
  • symprec (float): Symmetry precision for spglib (default: 0.01)
  • tol (float): Numerical tolerance (default: 1e-5)

Returns:

  • OgreSingleCrystal: The Wulff shape particle object

Dependencies

  • numpy
  • matplotlib
  • plotly
  • ase
  • pymatgen
  • wulffpack
  • tqdm

License

MIT License

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

ogrewulff-0.1.2.tar.gz (14.6 kB view details)

Uploaded Source

Built Distribution

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

ogrewulff-0.1.2-py3-none-any.whl (16.2 kB view details)

Uploaded Python 3

File details

Details for the file ogrewulff-0.1.2.tar.gz.

File metadata

  • Download URL: ogrewulff-0.1.2.tar.gz
  • Upload date:
  • Size: 14.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for ogrewulff-0.1.2.tar.gz
Algorithm Hash digest
SHA256 d0bce15e3d258f840786c7689f8e38fe6d98faade1ed843cb3d0f6990a1c49fd
MD5 ad6c6b74379cd795827bc19a8e6a8e1d
BLAKE2b-256 dea62c663fddf3987c0653c3e433e02ce4512eca87f97b7306e7ea7bcc63eb15

See more details on using hashes here.

File details

Details for the file ogrewulff-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: ogrewulff-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 16.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for ogrewulff-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 4ffae0d306ad76caa93d93e537cc90c63b33179899056d3c1c584771c497840f
MD5 2b4c51f6b303965f900d685163af06a6
BLAKE2b-256 ee4b3e1768a76b8f8ffe5d3d5561fea3812d2120d334b5706c3482b7d44a6e29

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