Contact lateral pinch model

This folder contains the batch workflow used to run forward-dynamics simulations of the contact-based lateral pinch model using the optimal activations obtained from the constrained optimization.

The same model structure is used for all contact cases. Simulation conditions differ according to:
(1) the coefficient of friction, defined in the model file, and
(2) the simulation duration, defined in the setup and controls templates.

Folder structure:

- model/:
    Contains model files grouped by friction condition:
    mu_0p29/ and mu_1p0/.
    Each folder includes the corresponding Pinch_Model.osim file, required .obj files, and the Geometry folder.

- templates/:
    Contains template Controls.sto and Pinch_Setup.xml files grouped by simulation duration:
    t_0p2/ and t_0p5/.

- output/:
    Automatically generated folder where simulation-specific outputs are stored.

Execution:

Edit the parameters at the beginning of:
    run_contact_pinch_batch.m

to select:
    - friction condition: mu_0p29 or mu_1p0
    - simulation duration: t_0p2 or t_0p5

Then run:
    run_contact_pinch_batch

All paths are defined relative to the script location.

---------------------------------------------------------------------

Generated outputs:

Running the script creates an output/ folder containing results for the
selected contact condition (friction coefficient and simulation duration).

For each case (e.g., mu_0p29_t_0p5), the following structure is generated:

- output/mu_XXX_t_YYY/
    Folder containing all simulations for the selected condition.

Within this folder:

- contact_batch_summary.mat
    MATLAB file storing:
    - activation vectors used for each simulation
    - forward-dynamics execution times
    - simulation status (ok, error, missing data)

- contact_forward_timing_summary.xlsx
    Excel file summarizing, for each simulation:
    simulation ID, forward-dynamics time, and execution status.

- sim_001/, sim_002/, ..., sim_050/
    One folder per simulation.

Within each simulation folder:

- Pinch_Controls.sto
    Control file containing the constant activation pattern used in the
    forward-dynamics simulation (copied from the constrained optimization).

- Pinch_Setup.xml
    Simulation-specific ForwardTool setup file with updated paths.

- results/
    Folder containing the OpenSim outputs of the forward-dynamics simulation,
    including force and state trajectories.

Notes:

- Only forward-dynamics simulations are performed in this workflow; no
  optimization is executed.
- Simulations that fail (e.g., due to contact loss or numerical issues)
  are flagged in the summary files.