---
# System prepended metadata

title: Notes

---

[toc]

# Notes


## V2

### Text for users

![LogoV2](https://hackmd.io/_uploads/BJPr9NSOkg.png)


Dear users of TetraX,

We’re thrilled to introduce TetraX.2, a leap forward for our micromagnetic modeling package! This major update brings several improvements, from a complete architectural overhaul of samples to enhanced tools for running experiments and analyzing results. 

Among many structural changes, we have worked hard on a revamped material handling, better organization of numerical experiments, modularized magnetic interactions to ensure smoother, more efficient workflows. In addition, we implement a great deal of new features, such as integrated plotting of numerical results, a more reliable relaxation method using torque minimization, and a completely new geometry type to model axially-symmetric waveguides!


Head over to [www.tetrax.software](http://www.tetrax.software/new_in_v2.html) to discover the big and small changes that come with TetraX.2! We are very excited for you to try out this new version. Let us know what you think! For feedback or help, feel free to join the TetraX user forum at [discussions.tetrax.software](http://discussions.tetrax.software).

Lukas and Attila




### Text for websites

![LogoV2](https://hackmd.io/_uploads/BJPr9NSOkg.png)

**Major update of the TetraX micromagnetic modeling package**

A major new version of the finite-element micromagnetic modeling package TetraX has been released: TetraX.2. This update brings several improvements, from a complete architectural overhaul of samples to enhanced tools for running experiments and analyzing results. With a focus on simplicity, flexibility, and performance, TetraX.2 represents a significant step forward in enabling researchers to model and study spin waves in numerical micromagnetism with ease.

Among many structural changes, improvements in the package include a revamped material handling, better organization of numerical experiments, modularized magnetic interactions to ensure smoother, more efficient workflows. In addition, a great deal of new features have been implemented, such as integrated plotting of numerical results, a more reliable relaxation method using torque minimization, and a completely new geometry type to model axially-symmetric waveguides.


Head over to [www.tetrax.software](http://www.tetrax.software/new_in_v2.html) to discover the big and small changes that come with TetraX.2! 


### Big new things

- sample, mesh, material
- new structure for experiments, results
- interactions
- new geometry: waveguide axial
- new experiment: relax_dynamic

### Smaller new things

- template materials
- examples have been revised, couple of new ones

- more material parameters are now inhomogeneous

- logging tetrax.set_logging(level)
- new MultiStripLineAntenna


### Other changes
- num_cpus = -1 by default
- parallelization has been exchanged with joblib
- frequencies are now stored in Hz by default, wave vectors in rad/m
- depending on the symmetry of the eigenvalue problem, only half of the k space is calculated
- Template geometries cleaned up
- iDMI direction can now be chosen
- proper boundary conditions both for iDMI and bDMI, can be set with open_boundary attribute
- sample.plot is now absorbed in sample.show


## Refactor


### TODO for experiment restructuring

- [x] create alias Bext for sample.external_field
- [x] cannot call experiments when just importing tetrax
- [ ] make plot kwargs usable when using EigenResult.plot()
- [x] make mode indices default to 0 the show_mode() get_mode()
- [x] maybe gray out zero interactions in __repr__ of results


### Sample object

- ideas:
    - sample.get_field("exchange", vect) 
    - sample.get_energy("exchange")
    - 
- a sample object has too many instance variables
    - state
        - 'mag',
    - material parameters (read-write always)
        - 'Aex'
        - 'Dbulk',
        - 'Didmi',
        - 'vector for the Didmi'
        - 'J1',
        - 'Kc1',
        - 'Ku1',
        - 'Ku2',
        - 'Msat',
        - 'alpha',
        - 'e_u',
        - 'gamma',
        - 'k_phi', (can be deleted)
        - 'k_theta', (can be deleted)
        - 'v1Kc',
        - 'v2Kc',
        - 'v3Kc',
    - material parameters (read only)
        - 'Msat_avrg',
        - 'mag_full',
    - material parameters (hidden)
        - '_Aex',
        - '_Msat',
    - fields (read-only)
        - 'Bcub',
        - 'Bdip',
        - 'Bdmi',
        - 'Bexc',
        - 'Bidmi',
        - 'Buni',
    - mesh parameters (read only)
        - 'mesh',
        - 'belm',
        - 'boundary_nodes',
        - 'dA',
        - 'div_x',
        - 'div_y',
        - 'div_z',
        - 'nv',
        - 'pang',
        - 'poisson',
        - 'laplace',
        - 'geom',
        - 'grad_x',
        - 'grad_y',
        - 'grad_z',
        - 'xc' (can be deleted)
        - 'xyz'
        - 'nb',
        - 'nx',
        - 'scale',
    - energies (read-only)
    - interactions (probably hidden)
        - 'N_DMI',
        - 'N_cub',
        - 'N_dip',
        - 'N_exc',
        - 'N_iDMI',
        - 'N_iec',
        - 'N_uDMI',
        - 'N_uni',
    - methods (evaluation)
        - 'average'
        - 'scan_along_curve',
    - methods (io)
        - 'field_to_file',
        - 'read_from_file' (should be included)
    - methods (mesh)
        - 'read_mesh',
        - 'set_geom',
    - methods (viz)
        - 'show',
        - 'plot' (will be deleted)
    - other 
        - 'description',
        - 'name',
        - 'eigensolver'
### Material params

    def update_interactions(name_param, value):
    
        for interaction in interactions:
            if interaction.requires(name_param):
                interaction.update()


    class ExchangeInteraction():
    
        required_material_params = ["Msat", "Aex"]

        def __init__(self):
            self.sample = ...

        def requires(self, name):
            return name in self.required_material_params

        def update(self):


            self.Msat = self.get_material_parameter("Msat")

        def get_material_parameter(self, name):

            if name not in self.required_material_params:
                raise Exception(f"This interaction is not allowed to retrieve the material parameter '{name}'. Allowed parameters"
                                f"need to be specified in self.required_material_params.")
        
            return self.sample["Msat"]
 

# TetraX Release Notes

## Version 1.3.0

### New features

- 3D confined geometries (without dipolar interaction)
- new mesh visualization (showing the "full" mesh)
- field calculation
- sample.average(field) and now be used similar to tx.helpers.math.sample_average(field,sample)
- calculation of linewidths implemented
- curve scans inplemented in helpers and as sample.scan_along_curve
- experimental AFM samles (all possible geometries)
    - all interactions for AFMs
    - addition: uniform DMI (only for AFMs)
    - AFM mode profiles
    - show_mode() for AFM modes
    - operators were internally restructured
- samples with inhomogeneous material parameters


### Bug fixes
- fixed a bug that gave an error when relaxation after least-square method failed
- error related to numpy datatypes and scipy sparse matrices


## Version 1.2.0

### New features

- TetraX now supports **layer samples**, which can be created with ``create_sample(geometry="layer")`` and are represented by 1D line-trace mesh along the normal direction of the layer(s). For this, the plane-wave Fredkin-Koehler method has been expanded to infinitely-extended layers (preprint available at [arXiv](https://arxiv.org/abs/2207.01519), submitted to AIP Advances). See Example ... 
- As templates for layer samples, we added mono, bi and multilayers as possible 1D geometries in  the ``tetrax.geometries`` submodule:
    - ``monolayer_line_trace()``
    - ``bilayer_line_trace()``
    - ``multilayer_line_trace()``
- Bilinear **interlayer-exchange interaction** is now available (only for layered systems), see Example ... The interlayer-exchange constant ``sample.J1`` (in J/m^2) can also have different values between different layers in a multilayered sample, by supplying a list of values (see User Guide).
- The eigenmode calculation ``eigenmodes(k=k_list,...)`` now accepts lists or 1D arrays as a parameter for ``k``, e.g. to specify a non-equidistant wave-vector range.
- **Cubic anistropy** (first order) is now properly implemented and can be used for both waveguides and layer samples.
- Rudimentary **mode-profile visualization** and animation has been added. If available, a mode profile can be visualized using ``ExperimentalSetup.show_mode(k=..., N=...)``. See User Guide for details.
- The numerical experiments implemented in `TetraX` are often based on seminal papers. In order to give credit to these works, when conducting a numerical experiment, `TetraX` now **saves references** important for this experiment to a **bibtex file** called ``references.bib``, found in the sample directory. In this file, each entry contains a ``comment`` field describing how the reference was important for the computation. When publishing results calculated with `TetraX` in your research, please also give credit to the works which are important for the numerical experiments you conducted.

### Minor changes
- When modes at a specificy wave vector cannot be calculated, now, ``NaN``s are inserted into the dispersion dataframe. Previously, this simply caused an error.
- Warning message for magnetization pointing into the z direction removed.
- Addititional geometry added for waveguides, ``round_wire_cross_section_refined`` which supports local mesh refinement (see documentation).

### Bug fixes
- ``ExperimentalSetup.Bext`` is now initialized as MeshVector filled with zeros. Previously, an error occured when not specifying any external field.
- Automatic dispersion saving and perturbate-dispersion analysis have been reimplemented. Somehow they got lost in a previous merge. Saving of dispersions can be controlled with save_disp=True and ``eigenmodes(fname="dispersion.csv",...)``.
- The director of uniaxial anistropy ``e_u`` can now be specified as a triplet, e.g. [0, 0, 1], just like magnetization or external field. Previously, this caused complications with the possiblity to set multiple uniaxial anistropies.

### Other
- To make upcoming implementation of antiferromagnets easier, spherical mesh vectors for FM and AFM, conversion methods to cartesian and back, and local mesh vectors for AFM have been implemented.
- Updated documentation.
- Guides for Windows installation.
- 4 examples added: 
    - thick film dispersion + perturbation and comparison with Kalinikos-Slavin
    - antiferromagnetically coupled films with interlayer exchange
    - mode movie for magnetostatic surface waves in films
    - cubic anisotropy in films