Skip to content

Repeated magnetic layers not implemented #339

@acaruana2009

Description

@acaruana2009

Currently it is not possible to define a magnetic multilayer in the same way you can specify a non-magnetic multilayer. E.g.:

Si = Material(formula="Si")
Ni = Material(formula="Ni[58]")
Si_ml = Material(formula="Si")


Si_sub = Slab(material=Si, thickness=0, interface=5)
Ni_layer = Slab(material=Ni, thickness=100, interface=5)
Si_layer = Slab(material=Si_ml, thickness=100, interface=5)

# Sample construction/Stack

ML = (Ni_layer(magnetism=Magnetism(rhoM=2.0, interface_above=5, interface_below=5, name="Ni Layer Sample 1"))
      | Si_layer)

sample = (Si_sub
          | ML*2
          | air
          )

Raises: NotImplementedError("Repeated magnetic layers not implemented") from line 162 in refl1d/profile.py

The work around is to define the magnetism in the Slab instantiation, and define the multilayer as a list/tuple: ML = (Ni_layer, Si_layer)
This has the disadvantage that if you are doing multi-fits (say multiple fields), unlinking the magnetism between fits becomes tedious.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions