Skip to content

Latest commit

 

History

History
45 lines (30 loc) · 1.44 KB

README.md

File metadata and controls

45 lines (30 loc) · 1.44 KB

PyMTensor

Material tensor Python package for computing the unique tensor elements for material tensors of arbitrary order and arbitrary crystallographic point group.

Copyright 2021 National Technology & Engineering Solutions of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the U.S. Government retains certain rights in this software.

Installation

To get started right away the pymtensor code can be added to your python path:

export PYTHONPATH=$PYTHONPATH:/path/to/pymtensor

The package can also be installed via the setuptools setup.py script:

python setup.py

PyMTensor requires Python 3.5 or higher, NumPy version 1.6 or greater, and SymPy version 1.7 or greater. The optional dependency gmpy2 for SymPy is highly recommended for speed improvements. TODO: add Windows installation instructions

Quick Start

The following code snippet will compute the unique tensor elements of a 5th-rank tensor with indices 1 and 3 interchangeable.

from pymtensor.symmetry import RedSgSymOps
from pymtensor.sym_tensor import SymbolicTensor

# Choose a symmetry group (e.g. '3m')
sg = RedSgSymOps()
symops = sg('3m')

# Create a 5th-rank symbolic tensor with indices 1 and 3 interchangeable
st = SymbolicTensor("abacd", 'c')

# Solve for the unique tensor elements 
fullsol, polyring = st.sol_details(symops)
print(fullsol)

For more examples please refer to the pymtensor/examples/simple_example.py file.