"""
PySpinW - A Python library for spin wave calculations.

This is a Python translation of SpinW (https://spinw.org), a MATLAB library
for calculating spin wave dispersion and neutron scattering cross-sections
using linear spin wave theory.

Key Features
------------
- Crystal lattice and space group handling
- Magnetic structure generation (commensurate and incommensurate)
- Linear spin wave theory calculations
- Neutron scattering cross-sections
- GPU acceleration via PyTorch

Basic Usage
-----------
>>> from pyspinw import SpinW, sw_model
>>> 
>>> # Create a triangular lattice antiferromagnet
>>> sw = sw_model('triAF', 1.0)  # J = 1 meV
>>> 
>>> # Calculate spin wave dispersion
>>> spec = sw.spinwave([[0,0,0], [1,1,0]], n_pts=100)
>>> 
>>> # Plot the dispersion
>>> import matplotlib.pyplot as plt
>>> plt.plot(spec['omega'])
>>> plt.show()

For more complex models:
>>> sw = SpinW()
>>> sw.genlattice(lat_const=[3, 3, 6], angled=[90, 90, 120])
>>> sw.addatom(r=[0, 0, 0], S=1, label='Cu1')
>>> sw.gencoupling(max_distance=5)
>>> sw.addmatrix(label='J1', value=1.0)
>>> sw.addcoupling(mat='J1', bond=1)
>>> sw.genmagstr(mode='helical', k=[1/3, 1/3, 0])
>>> spec = sw.spinwave([[0,0,0], [1,1,0]])

References
----------
SpinW MATLAB: https://spinw.org
Paper: S. Toth and B. Lake, J. Phys.: Condens. Matter 27 166002 (2015)
"""

__version__ = '0.1.0'

from .core import (
    SpinW,
    Lattice,
    SpaceGroup,
    MagneticStructure,
    MagneticAtom,
    Coupling,
    Bond,
    ExchangeMatrix,
    CONSTANTS,
)
from .core.spinw import sw_model
from .backends import get_backend, current_backend

# Utility functions
from .utils import (
    sw_egrid,
    sw_plotspec,
    sw_neutron,
)

__all__ = [
    # Main class
    'SpinW',
    
    # Convenience functions
    'sw_model',
    
    # Core classes
    'Lattice',
    'SpaceGroup',
    'MagneticStructure',
    'MagneticAtom',
    'Coupling',
    'Bond',
    'ExchangeMatrix',
    'CONSTANTS',
    
    # Backends
    'get_backend',
    'current_backend',
    
    # Utilities
    'sw_egrid',
    'sw_plotspec',
    'sw_neutron',
]
