doctype xml
//- To compile:  pug track3p.pug --pretty --extension sbt
    To compile as toplevel, add  -O "{toplevel: 'true'}"
    Note the quotes around 'true'

SMTK_AttributeResource(Version="3")
  Categories
    Cat Track3P
    Cat Track3P-DarkCurrent
    Cat Track3P-Multipacting

  Definitions
    // Particle Definitions
    AttDef(Type="ParticleTrajectories" BaseType="" Version="0")
      ItemDefinitions
        String(Name="ParticleFile" Label="Particle File" Version="0")
          BriefDescription defines the particle file names
          Categories #[Cat Track3P]
          DefaultValue partpath
        Int(Name="Start" Label="Start time step" Version="0")
          BriefDescription Start time step for writing particles
          Categories #[Cat Track3P]
          DefaultValue 0
          RangeInfo #[Min(Inclusive="true") 0]
        Int(Name="Stop" Label="Stop time step" Version="0")
          BriefDescription End time step for writing particles
          Categories #[Cat Track3P]
          DefaultValue 1000000
          RangeInfo #[Min(Inclusive="true") 1]
        Int(Name="Skip" Label="Skip time step" Version="0")
          BriefDescription Skip time step for writing particles. Default is 1 for no skip
          Categories #[Cat Track3P]
          DefaultValue 1
          RangeInfo #[Min(Inclusive="true") 1]
    AttDef(Type="SingleParticleTrajectory" BaseType="" Version="0")
      ItemDefinitions
        Void(Name="SingleParticleTrajectory" Label="Single Particle Trajectory" Version="0"
          Optional="true" IsEnabledByDefault="false")
          BriefDescription specifies if all single particle trajectories will be written in separate files
          Categories #[Cat Track3P]
          DetailedDescription.
            When enabled, each single particle trajectory will be written
            in a file named "particleID". When not enabled, no single particle
            trajectory will be output.
    = '\n'

    // Emitter definitions
    AttDef(Type="Emitter" BaseType="" Version="0")
      AssociationsDef(Name="EmitterAssociations" NumberOfRequiredValues="1" Extensible="true")
        Accepts
          Resource(Name="smtk::model::Resource" Filter="face")
          //- Future: filter faces that are associated to attribute of either:
          //-   * Track3PMaterialMultipactingPrimary
          //-   * Track3PMaterialDarkCurrentPrimary
      ItemDefinitions
        Int(Name="Type" Label="Type" Version="0")
          BriefDescription how the particles are emitted
          Categories #[Cat Track3P]
          ChildrenDefinitions
            Int(Name="N" Label="Min electrons (N)" Version="0")
              BriefDescription Minimum number of electrons in an emitted macro particle
              Categories #[Cat Track3P]
              DefaultValue 1000
              RangeInfo #[Min(Inclusive="true") 1]
            Double(Name="WorkFunction" Label="Work Function" Version="0" Units="eV")
              BriefDescription Work function for field emission
              Categories #[Cat Track3P]
              DefaultValue 4.2
              RangeInfo #[Min(Inclusive="true") 0.0]
            Double(Name="Beta" Label="Beta" Version="0")
              BriefDescription Beta value for field emission
              Categories #[Cat Track3P]
              DefaultValue 120.0
              RangeInfo #[Min(Inclusive="false") 0.0]
          DiscreteInfo(DefaultIndex="0")
            Value(Enum="2: Electronic Surface") 2
            Value(Enum="5: Solid Electronic Surface") 5
            Structure
              Value(Enum="7: Field Emission") 7
              Items
                Item N
                Item WorkFunction
                Item Beta
        Int(Name="Start" Label="Start time in RF cycle (t0)" Version="0")
          BriefDescription Start time when particles are emitted
          Categories #[Cat Track3P]
          DefaultValue 0
          RangeInfo #[Min(Inclusive="true") 0]
        Int(Name="Stop" Label="End time in RF cycle (t1)" Version="0")
          BriefDescription End time when particles are emitted
          Categories #[Cat Track3P]
          DefaultValue 1
          RangeInfo #[Min(Inclusive="true") 1]
        Int(Name="Skip" Label="Skip Time Step" Version="0")
          BriefDescription emission skip time step. Default is 1 for no skip
          Categories #[Cat Track3P]
          DefaultValue 1
          RangeInfo #[Min(Inclusive="true") 1]
        Double(Name="BoundsMin" Label="Region Bounds Min" Version="0" NumberOfRequiredValues="3" Units="m")
          BriefDescription Minimum coordinates of bounding box for particle emission
          Categories #[Cat Track3P]
          DefaultValue 0,0,0
        Double(Name="BoundsMax" Label="Region Bounds Max" Version="0" NumberOfRequiredValues="3" Units="m")
          BriefDescription Maximum coordinates of bounding box for particle emission
          Categories #[Cat Track3P]
          DefaultValue 1,1,1
    = '\n'

    // Field Definitions
    AttDef(Type="FieldScales" BaseType="" Version="0")
      ItemDefinitions
        String(Name="Type" Label="Type" Version="0")
          BriefDescription the parameters for the field levels where track3p simulations are carried out
          Categories #[Cat Track3P]
          ChildrenDefinitions
            Double(Name="Beta" Label="Beta" Units="V/C" Version="0")
              BriefDescription Beta parameter for field calculation
              Categories #[Cat Track3P]
              DefaultValue 1.0
              RangeInfo #[Min(Inclusive="false") 0.0]
            Double(Name="StartPoint" Label="Start Point" Version="0" NumberOfRequiredValues="3" Units="m")
              BriefDescription The coordinates of the start point of the path
              Categories #[Cat Track3P]
              DefaultValue 0,0,0
            Double(Name="EndPoint" Label="End Point" Version="0" NumberOfRequiredValues="3" Units="m")
              BriefDescription The coordinates of the end point of the path
              Categories #[Cat Track3P]
              DefaultValue 0,0,1
            Int(Name="N" Label="Number of inner points (N)" Version="0")
              BriefDescription Number of inner points in the gradient integral line
              Categories #[Cat Track3P]
              DefaultValue 300
              RangeInfo #[Min(Inclusive="true") 1]
          DiscreteInfo(DefaultIndex="0")
            Structure
              Value(Enum="Field Gradient - V/m") FieldGradient
              Items
                Item Beta
                Item StartPoint
                Item EndPoint
                Item N
            Value(Enum="InputPortPower - W") InputPortPower
            Value(Enum="StorEnergy - J")  StorEnergy
        Int(Name="ScanToken" Label="Scan Token" Version="0")
          Categories #[Cat Track3P]
          ChildrenDefinitions
            Double(Name="Minimum" Label="Minimum" Version="0")
              BriefDescription The minimum scanned field level
              Categories #[Cat Track3P]
              DefaultValue 23.e6
            Double(Name="Maximum" Label="Maximum" Version="0")
              BriefDescription The maximum scanned field level
              Categories #[Cat Track3P]
              DefaultValue 25.e6
            Double(Name="Interval" Label="Interval" Version="0")
              BriefDescription The interval for scanned field level
              Categories #[Cat Track3P]
              DefaultValue 1.0e6
            Double(Name="Scale" Label="Scale" Version="0")
              BriefDescription The single field level
              Categories #[Cat Track3P]
              DefaultValue 1.0
          DiscreteInfo(DefaultIndex="1")
            Structure
              Value(Enum="0: Single Field Level") 0
              Items #[Item Scale]
            Structure
              Value(Enum="1: Scan Field Level") 1
              Items
                Item Minimum
                Item Maximum
                Item Interval
    = '\n'

    // Domain  Definitions
    AttDef(Type="Domain" BaseType="" Version="0")
      // Note uses NERSC Directory in ACE3P.sbt
      Categories #[Cat Track3P]
      ItemDefinitions
        Int(Name="TotalTime" Label="Total Particle Tracking Time" Version="0" Units="Cycles")
          BriefDescription Total simulation time in rf cycles
          DefaultValue 20
          RangeInfo #[Min(Inclusive="true") 1]
        Void(Name="OutputImpacts" Label="Write Particles Impact Information" Version="0"
          Optional="true" IsEnabledByDefault="false")
          BriefDescription specifies if particle impact information will be written
        Int(Name="FrequencyScanID" Label="Frequency Scan ID")
          DefaultValue 0
        Int(Name="Mode" Label="Mode Number" Version="0")
          BriefDescription The mode number calculated from the omega3p or s3p imported into track3p
          DefaultValue 0
          RangeInfo #[Min(Inclusive="true") 0]
        Double(Name="dt" Label="Time Step Parameter (dt)" Version="0")
          BriefDescription Parameter used for timestep; timestep = dt/frequency/100
          DefaultValue  1.0
          RangeInfo #[Min(Inclusive="false") 0.0]
        Int(Name="MaxImpacts" Label="Max Impacts" Version="0")
          BriefDescription Maximum impact number, after which particles will die
          DefaultValue 50
          RangeInfo #[Min(Inclusive="true") 1]
        Double(Name="LowEnergy" Label="Low Energy" Version="0" Units="eV")
          BriefDescription the minimum impact energy, beyond which no secondary particles are emitted
          DefaultValue 1.0
          RangeInfo #[Min(Inclusive="true") 0.0]
        Double(Name="HighEnergy" Label="High Energy" Version="0" Units="eV")
          BriefDescription the maximum impact energy, beyond which no secondary particles are emitted
          DefaultValue 5000.0
          RangeInfo #[Min(Inclusive="true") 0.0]
        Double(Name="InitialEnergy" Label="Initial Energy" Version="0" Units="eV")
          BriefDescription the initial energy of emitted particles
          DefaultValue 2.0
          RangeInfo #[Min(Inclusive="true") 0.0]
        Int(Name="Bins" Label="Localize Bins" Version="0")
          BriefDescription Parameter used for localizing particles
          DefaultValue 64
          RangeInfo #[Min(Inclusive="true") 1]
        //- Double(Name="Voltage" Label="External Voltage" Version="0" NumberOfRequiredValues=3 Units="V,m,m")
        //-   BriefDescription External voltage for coax; voltage = a/log(rb/ra)
        //-   ComponentLabels
        //-     Label a
        //-     Label ra
        //-     Label rb
        //-   DefaultValue 0,0,0
        Component(Name="SolidRegion" Label="Solid Region" Version="0"
          NumberOfRequiredValues="1" Optional="true" IsEnabledByDefault="false")
          BriefDescription Non-vacuum region; only used for simulations with rf windows
          Accepts
            Resource(Name="smtk::model::Resource" Filter="volume")
        Component(Name="VacuumRegion" Label="Vacuum Region" Version="0"
          NumberOfRequiredValues="1" Optional="true" IsEnabledByDefault="false")
          BriefDescription Vacuum region; only used for simulations with rf windows
          Accepts
            Resource(Name="smtk::model::Resource" Filter="volume")
        Double(Name="ExternalMagneticField" Label="External Magnetic Field" Version="0" NumberOfRequiredValues=3 Optional="true" IsEnabledByDefault="false" Units="T")
          BriefDescription Uniform external magnetic field
          ComponentLabels
            Label Bx
            Label By
            Label Bz
          DefaultValue 0,0,0
        Group(Name="MagneticFieldMap" Label="Magnetic Field Map" Version="0"
          Optional="true" IsEnabledByDefault="false")
          ItemDefinitions
            File(Name="File" Label="File" Version="0" ShouldExist="true")
              BriefDescription The name of the file containing the external magnetic field map
            Double(Name="Scaling" Label="Field Scaling" Version="0")
              BriefDescription The field scale factor to multiply the fields in the original field map
              DefaultValue 1.0
              RangeInfo #[Min(Inclusive="false") 0.0]
            Double(Name="Units" Label="XYZ Units" Units="m" Version="0")
              BriefDescription The distance scale factor to convert original coordinates in the original field map to meters using in track3p
              DefaultValue 1.0
              RangeInfo #[Min(Inclusive="false") 0.0]
            Double(Name="ZOffset" Label="Z Offset" Version="0" Units="m")
              BriefDescription The z-offset of the origin when importing the original field map into track3p simulation model
              DefaultValue 0.0
              RangeInfo #[Min(Inclusive="true") 0.0]
    = '\n'

    // Material Definitions
    AttDef(Type="Track3PMaterial" BaseType="" Version="1" Abstract="true" Unique="true")
      AssociationsDef(Name="Track3PMaterialAssociations" Version="0" NumberOfRequiredValues="1" Extensible="true")
        MembershipMask volume | face

    AttDef(Type="Track3PAbsorber" BaseType="Track3PMaterial" Label="Absorber" Version="0")
      Categories #[Cat Track3P]

    AttDef(Type="Track3PMaterialMultipactingPrimary" BaseType="Track3PMaterial" Label="Primary" Version="1")
      Categories #[Cat Track3P-Multipacting]
      ItemDefinitions
        Void(Name="Secondary" Label="Secondary" Optional="true" IsEnabledByDefault="false" Version="0")

    AttDef(Type="Track3PMaterialMultipactingSecondary" BaseType="Track3PMaterial" Label="Secondary" Version="0")
      Categories #[Cat Track3P-Multipacting]


    AttDef(Type="Track3PMaterialDarkCurrentPrimary" BaseType="Track3PMaterial" Label="Primary" Version="1")
      Categories #[Cat Track3P-DarkCurrent]
      ItemDefinitions
        Group(Name="Secondary" Label="Secondary" Optional="true" IsEnabledByDefault="false" Version="0")
          ItemDefinitions
            File(Name="SEYFilename" Label="SEY Filename" Version="0" ShouldExist="true")
              BriefDescription File containing secondary emission data for the selected surface

            Int(Name="MinimumNumElectrons" Label="Minimum Number of Electrons" Version="0")
              BriefDescription Minimum number of electrons in each secondary macro particle
              DefaultValue 1000
              RangeInfo #[Min(Inclusive="true") 1]
            Int(Name="ElasticThreshold" Label="Elastic Threshold" Version="0")
              BriefDescription Minimum number of electrons in each secondary reflected-type macro particle
              DefaultValue 1000
              RangeInfo #[Min(Inclusive="true") 1]

    AttDef(Type="Track3PMaterialDarkCurrentSecondary" BaseType="Track3PMaterial" Label="Secondary" Version="1")
      Categories #[Cat Track3P-DarkCurrent]
      ItemDefinitions
        File(Name="SEYFilename" Label="SEY Filename" Version="0" ShouldExist="true")
          BriefDescription File containing secondary emission data for the selected surface

        Int(Name="MinimumNumElectrons" Label="Minimum Number of Electrons" Version="0")
          BriefDescription Minimum number of electrons in each secondary macro particle
          DefaultValue 1000
          RangeInfo #[Min(Inclusive="true") 1]
        Int(Name="ElasticThreshold" Label="Elastic Threshold" Version="0")
          BriefDescription Minimum number of electrons in each secondary reflected-type macro particle
          DefaultValue 1000
          RangeInfo #[Min(Inclusive="true") 1]

    = '\n'

    // Postprocess Definitions
    AttDef(Type="Postprocess" BaseType="" Version="0")
      Categories #[Cat Track3P]
      ItemDefinitions
        Group(Name="Toggle" Label="Toggle" Version="0" Optional="true" IsEnabledByDefault="false")
          BriefDescription Turn on/off the postprocessing procedure
          ItemDefinitions
            Group(Name="ResonantParticles" Lable="Resonant Particles" Version="0"
              Optional="true" IsEnabledByDefault="true")
              ItemDefinitions
                Int(Name="InitialImpacts" Label="Initial Impacts" Version="0")
                  BriefDescription Particles with impact number greater than specified threshold are considered
                  DefaultValue 4
                  RangeInfo #[Min(Inclusive="true") 0]
                Double(Name="EnergyRange" Label="Energy Range" Version="0" NumberOfRequiredValues="2")
                  BriefDescription The energy range to consider if a particle exhibits a resonant trajectory
                  ComponentLabels
                    Label From (E1)
                    Label To (E2)
                  DefaultValue 24,10000
                Double(Name="PhaseTolerance" Label="Phase Tolerance" Version="0")
                  BriefDescription Phase tolerance to determine resonant particles
                  DefaultValue 0.01
                  RangeInfo #[Min(Inclusive="false") 0]
            Group(Name="EnhancementCounter" Label="Enhancement Counter" Version="0"
              Optional="true" IsEnabledByDefault="true")
              ItemDefinitions
                Group(Name="SEYSurface1" Label="SEY Surface 1" Verion="0"
                  Optional="true" IsEnabledByDefault="false")
                  ItemDefinitions
                    Component(Name="BoundarySurface" Label="Boundary Surface" NumberOfRequiredValues="1" Version="0")
                      BriefDescription The boundary surface used for calculating the enhancement counter
                      Accepts
                        Resource(Name="smtk::model::Resource" Filter="face")
                    File(Name="SEYFilename" Label="SEY Filename" Version="0" ShouldExist="true")
                      BriefDescription File containing secondary emission data for the selected surface
                Group(Name="SEYSurface2" Label="SEY Surface 2" Verion="0"
                  Optional="true" IsEnabledByDefault="false")
                  ItemDefinitions
                    Component(Name="BoundarySurface" Label="Boundary Surface" NumberOfRequiredValues="1" Version="0")
                      BriefDescription The boundary surface used for calculating the enhancement counter
                      Accepts
                        Resource(Name="smtk::model::Resource" Filter="face")
                    File(Name="SEYFilename" Label="SEY Filename" Version="0" ShouldExist="true")
                      BriefDescription File containing secondary emission data for the selected surface
                Component(Name="WindowVolume" Label="Window Volume" NumberOfRequiredValues="1" Version="0"
                  Optional="true" IsEnabledByDefault="false")
                  BriefDescription Window volume
                  Accepts
                    Resource(Name="smtk::model::Resource" Filter="face")
                Double(Name="MinimumEC" Label="Minimum Enhancement Counter" Version="0")
                  BriefDescription Minimum enhancement counter, less than which no data will be written to file
                  DefaultValue 10.0
                  RangeInfo #[Min(Inclusive="true") 0.0]
            Group(Name="FaradayCup" Label="Faraday Cup" Optional="true" IsEnabledByDefault="false")
              ItemDefinitions
                Group(Name="BoundarySurfaceGroup" Label="Boundary Surfaces" Extensible="true" NumberOfRequiredValues="1")
                  ItemDefinitions
                    Component(Name="BoundarySurface" Label=" " NumberOfRequiredValues="1" Version="0")
                      Accepts
                        Resource(Name="smtk::model::Resource" Filter="face")
  = '\n'

  // SEY Curve Definition (expression)
  //   AttDef(Type="SimpleExpression" BaseType="" Abstract="true" Version="0")
  //   AttDef(Type="SEYCurve" Label="SEY Curve" BaseType="SimpleExpression" Version="0")
  //     ItemDefinitions
  //       Group(Name="ValuePairs" Label="Value Pairs" NumberOfRequiredGroups="1")
  //         ItemDefinitions
  //           Double(Name="Einit" Label="Impact Energy" Units="eV" NumberOfRequiredValues="0" Extensible="true")
  //             RangeInfo #[Min(Inclusive="true")] 0.0
  //           Double(Name="Sigma0" Label="SEY Yield Coefficient" Version="0" NumberOfRequiredValues="0" Extensible="true")
  //             RangeInfo #[Min(Inclusive="true")] 0.0
  //       String(Name="Sim1DTable" Version="0" NumberOfRequiredValues="1")/

  // = '\n'


  Views
    //- To compile as toplevel:
    //-   * Uncomment this section
    //-   * Add to command line:  -O "{toplevel: 'true'}"
    //-   * Note the quotes around 'true'
    // View(Type="Group" Title="Track3P" TopLevel=toplevel TabPosition="North"
    //     FilterByAdvanceLevel="false")
    //   Views
    //     View(Title="Domain")/
    //     View(Title="Field")/
    //     View(Title="Particles")/
    //     View(Title="Track3P BC")/
    //     View(Title="Track3P Material Model")/
    //     View(Title="Postprocess")/
    //     View(Title="SEY Curves")/
    // = '\n'

    View(Type="Instanced" Title="Domain" Label="Analysis")
      InstancedAttributes
        Att(Name="Domain" Type="Domain")/
    = '\n'

    View(Type="Instanced" Title="Field" Label="Field Scaling")
      InstancedAttributes
        Att(Name="FieldScales" Type="FieldScales")/
    = '\n'

    View(Type="Group" Title="Particles" Style="Tiled" Label="Emitter")
      Views
        View(Title="Particles Trajectories")/
        View(Title="Emitters")/
    View(Type="Instanced" Title="Particles Trajectories")
      InstancedAttributes
        Att(Name="ParticleTrajectories" Type="ParticleTrajectories")/
        Att(Name="SingleParticleTrajectory" Type="SingleParticleTrajectory")/
    View(Type="Attribute" Title="Emitters" DisplaySearchBox="false")
      AttributeTypes
        Att(Type="Emitter")/
    = '\n'

    View(Type="Attribute" Name="Track3P Material Model" Label="Material" DisplaySearchBox="false")
      AttributeTypes
        Att(Type="Track3PMaterial")

    View(Type="ModelEntity" Title="Track3PMultipacting" ModelEntityFilter="rf")
      AttributeTypes
        Att(Type="Track3PMaterialMultipactingPrimary")
        Att(Type="Track3PMaterialMultipactingSecondary")
        Att(Type="Track3PAbsorber")

    View(Type="ModelEntity" Title="Track3PDarkCurrent" ModelEntityFilter="rf")
      AttributeTypes
        Att(Type="Track3PMaterialDarkCurrentPrimary")
        Att(Type="Track3PMaterialDarkCurrentSecondary")
        Att(Type="Track3PAbsorber")
    = '\n'

    View(Type="Instanced" Title="Postprocess")
      InstancedAttributes
        Att(Name="Postprocess" Type="Postprocess")/

    View(Type="SimpleExpression" Title="SEY Curves")
      Att(Type="SEYCurve")

= '\n'
