# Bind Alternative Shape Derivatives ```{admonition} Experimental feature :class: warning The `jcmsuite.torch` integration is experimental. Its API and behavior can change in future releases. Do not depend on its current interface for production workflows without testing each package update. ``` This tutorial uses inline derivative vectors in a `Layout3D` template to describe the bottom radius, top radius, and cylinder height as three shape derivatives. The matching `DerivativeParameter` sections declare their names and order. The Torch solve binds each differentiable Project Key to one of those names. Unlike a layout that lists `TreeEntry` paths in each `DerivativeParameter`, this form places each derivative vector next to the geometry value. For example, `Circle/Radius = %(radius_bottom)g<1.0, 0.0, 0.0>` assigns the first derivative component to the bottom radius. The top-layer thickness uses `-1.0` for the height component so the top of the computational domain remains fixed. The solve reads the energy flux and uses `torch.autograd.grad` to report its derivatives with respect to all three shape parameters. It requires a JCMsuite runtime that supports first-order shape derivatives for `Scattering` projects. Run it from `demos/documentation_tutorials`: ```bash python derivatives/torch/alternative_jcm_derivatives/run.py ``` ```{literalinclude} ../../../../demos/documentation_tutorials/derivatives/torch/alternative_jcm_derivatives/run.py :language: python ``` ## Project Files
layout.jcmt ```{literalinclude} ../../../../demos/documentation_tutorials/derivatives/torch/alternative_jcm_derivatives/layout.jcmt :language: jcm ```
materials.jcmt ```{literalinclude} ../../../../demos/documentation_tutorials/derivatives/torch/alternative_jcm_derivatives/materials.jcmt :language: jcm ```
project.jcmp ```{literalinclude} ../../../../demos/documentation_tutorials/derivatives/torch/alternative_jcm_derivatives/project.jcmp :language: jcm ```
sources.jcm ```{literalinclude} ../../../../demos/documentation_tutorials/derivatives/torch/alternative_jcm_derivatives/sources.jcm :language: jcm ```