# Prompt Mixing in Diffusion Models using the Black Scholes Algorithm

Divya Kothandaraman, Ming Lin, Dinesh Manocha
Department of Computer Science
University of Maryland College Park, USA

###### Abstract

We introduce a novel approach for prompt mixing, aiming to generate images at
the intersection of multiple text prompts using pre-trained text-to-image
diffusion models. At each time step during diffusion denoising, our algorithm
forecasts predictions w.r.t. the generated image and makes informed text
conditioning decisions. To do so, we leverage the connection between diffusion
models (rooted in non-equilibrium thermodynamics) and the Black-Scholes model
for pricing options in Finance, and draw analogies between the variables in
both contexts to derive an appropriate algorithm for prompt mixing using the
Black Scholes model. Specifically, the parallels between diffusion models and
the Black-Scholes model enable us to leverage properties related to the
dynamics of the Markovian model derived in the Black-Scholes algorithm. Our
prompt-mixing algorithm is data-efficient, meaning it does not need additional
training. Furthermore, it operates without human intervention or
hyperparameter tuning. We highlight the benefits of our approach by comparing
it qualitatively and quantitatively to other prompt mixing techniques,
including linear interpolation, alternating prompts, step-wise prompt
switching, and CLIP-guided prompt selection across various scenarios such as
single object per text prompt, multiple objects per text prompt and objects
against backgrounds. Code is available at
https://github.com/divyakraman/BlackScholesDiffusion2024.

Figure 1: Our method’s results (Black Scholes, last column) are presented
alongside comparisons to prior work. Vanilla stable diffusion (SD) struggles
to capture clear characteristics of individual text prompts (notably missing
distinct features such as those of the parrot, cat, dog/penguin, and
sunset/penguin). Linear interpolation performs poorly due to non-linear
manifolds. Alternating sampling and step-wise switching yield low-quality
results with artifacts, primarily because they lack intelligent prompt
selection during denoising steps (missing characteristics of pizza, artifacts
in cat/muffin and dog/penguin mixing, sunset/northern lights not well
captured). CLIP-min exhibits bias issues by not modeling diffusion denoising
dynamics and prompt selection effectively, which hinders fore-sighted decision
making, the generated images are biased towards one of the text prompts. In
contrast, our Black-Scholes model generates realistic images that meticulously
balance and preserve the characteristics of each individual text prompt. The
images are from set 1, set 2, set 3 and set 4 (Refer Section 5.1)
respectively.

##  1 Introduction

Text-to-image diffusion models [13, 14] such as Imagen [33] by Google, Firefly
[2] by Adobe, DALLE [7] by Microsoft, and Stable Diffusion [31, 11] by
Stability AI can produce photorealistic images from textual descriptions and
are typically trained on vast amounts of data using substantial computational
resources. The latest versions of these models (as of May 2024) have seen
significant improvements in comparison to their initial versions, attributed
to various factors, such as increased training data, enhanced text
understanding networks, improved image generation networks, and optimized
strategies. Data efficient solutions [36], leveraging pre-trained diffusion
models, can enhance results without requiring additional data collection.
Prompt engineering [37] is one effective approach, involving techniques such
as rephrasing prompts to improve model generalization. Another method is using
large language models (LLMs) [23, 38] to parse complex prompts and determine
useful priors for image generation. Attention maps [9] and prompt mixing
techniques [27, 5] also contribute to better results.

Prompt mixing becomes particularly valuable when aiming to generate images
that blend different text-image concepts i.e. when aiming to generate images
at the intersection [27, 30, 28] of different text-image concepts. For
instance, consider generating an image resembling a hybrid of a pink cat and a
dog. Current diffusion models [2, 33, 7, 11] excel at straightforwardly
combining individual text prompts to create visually appealing combinations.
However, these capabilities are often restricted to advanced model versions
(version 3) and rely on large-data techniques.

Data efficient prompt mixing techniques can enhance image generation without
additional data. While linear interpolation [17] of text embeddings from
individual prompts is a simple approach, it may not be optimal due to the
highly non-linear nature of the text-image manifold and potential bias issues.
Alternatives include switching between prompts during diffusion denoising,
either by alternating [18] or using a step-wise technique [27]. However, these
methods often require human involvement and careful prompt engineering for
optimal results.

The question arises: what’s the best way to switch between text prompts for
prompt-mixing? An automated approach considers the model’s varying
capabilities with different prompts. While attention maps [15, 9] and layout
guidance![42, 10] methods excel at guiding the model toward distinct scene
entities, they may not be as effective for blending concepts within the same
entity. To address this, during each step of diffusion denoising, the network
should automatically focus on the text prompt that corresponds to the image’s
deficiencies.

#### Main contributions.

In this paper, we introduce a novel approach to prompt mixing by integrating
concepts from economics and finance. Our objective is to leverage pretrained
diffusion models for prompt-mixing to generate images at the intersection of
various text-image manifolds. During each step of the diffusion denoising
process, our method dynamically conditions on the text prompt that requires
the highest level of attention. To achieve this, our algorithm assesses the
‘cost’ associated with each relevant text prompt and selects the optimal
conditions for the subsequent step of image generation based on the ‘cost’
that requires maximum optimization.

Key Insight: The inspiration for our approach lies in non-equilibrium
thermodynamics [35], which is at the core of the development of diffusion
models. These models share a conceptual foundation with the Black Scholes
model[26], a Nobel Prize-winning mathematical framework extensively employed
in financial markets for pricing European call options[8]. The denoising steps
within a diffusion model, aimed at image generation, constitute a Markovian
time-series. In our analogy, the image itself represents a valuable ‘stock’ or
‘asset’ that we aim to ‘purchase’ (or generate) at the most favorable ‘cost’
(or alignment with the text prompts). During each step of the diffusion
denoising process, we extrapolate the generate latents to compute the ‘stock’
prices at the corresponding time-step, and use the properties of diffusion
models to compute the various variables involved in the Black Scholes
algorithm. Consequently, we leverage the Black Scholes model to predict a
score for each text prompt. This score serves as an indicator of how the image
should be conditioned in the subsequent timestep. By adopting this approach,
our model dynamically focuses on aspects that require attention, ultimately
generating an image that optimally satisfies all relevant text prompts.

We perform experiments on prompts with varying complexities to assess our
method’s ability to seamlessly blend different objects and backgrounds across
scenarios. Through qualitative and quantitative comparisons against several
baselines-such as linear interpolation, prompt switching, and CLIP score-we
highlight the superiority of our approach.

##  2 Related work

#### Prompt mixing.

Prompt mixing is a technique where different text prompts are used at various
steps during the diffusion denoising process. Patashnik et al. [27] follow a
step-wise approach, while Aerial Diffusion [18] alternates between prompts to
create semantically consistent aerial-view images. Tools such as Image Mixer
Diffusion [28] and CLIP Guided Image Mixing [30] follow similar techniques of
prompt switching to blend multiple text prompts. However, these methods often
require complex hyperparameter tuning.

#### Mixing step.

The mixing time or mixing step [22] of a Markov chain refers to the duration
it takes for the chain to reach its steady-state distribution. Mixing time has
found applications in image editing [46] and synthesizing out-of-distribution
(OOD) images [45]. When switching between prompts using mixing time, a step-
wise approach is followed, akin to the work by Patashnik et al. [27]. The
advantage of mixing-time approaches over the method proposed by Patashnik et
al. [27] is that it mathematically determines the optimal switching time
without requiring complex hyperparameter tuning. To approximate the mixing
time, it estimates the radius of the latent space. However, there are a few
limitations to these methods. Firstly, most of these approaches are applied to
diffusion models trained on relatively small, problem-specific datasets.
Secondly, identifying clear boundaries on large-scale foundation models
remains an unsolved challenge. Additionally, these methods lack the
flexibility to choose the most optimal prompt at each timestep.

#### Understanding the latent space.

Tangential to our work, there has been substantial work [16, 1, 12] on
exploring the latent space. These investigations have yielded valuable
insights and practical solutions for downstream tasks such as image editing
and manipulation applications [44, 34, 21, 43, 29]. Furthermore, a deeper
understanding of the latent space within diffusion models has led to
advancements in various methods [31, 21, 40].

##  3 Background

###  3.1 The Black Scholes Model

In this section, we provide a brief overview of the Black Scholes pricing
model [26] used to determine the price of European call options of assets.
which is used to determine the price of European call options on assets. In
simple terms, a European call option allows an investor to lock in the price
of an asset at any time but permits stock purchase (if desired) only upon
expiration. Regardless of whether the stock price moves favorably or
unfavorably over time, this option structure remains consistent. Investors
rely on the Black-Scholes model to predict stock prices over time and make
informed decisions about the optimal timing for stock purchases. The Black
Scholes formula involves $5$ key variables:

  1. 1.

Underlying stock price or spot price $S$: This represents the current price of
the asset.

  2. 2.

Strike price $K$: The strike price is the cost of the asset at the time of
expiry.

  3. 3.

Time to expiration $t$: It measures the time difference between the current
moment and the expiry time.

  4. 4.

Volatility $\sigma$: Volatility reflects the variation in prices of the asset.

  5. 5.

Risk free rate $r$: The risk-free rate is the minimum return on an investment
when the investor faces zero risks.

To obtain the Black Scholes score of purchasing an asset, the spot price $S$
is first multiplied by the standard normal probability distribution function.
From this result, to obtain the final cost $C$, the strike price $K$
multiplied by the cumulative standard distribution function is subtracted.
Mathematically,

$SN(d_{1})-Ke^{-rt}N(d_{2}),$ (1)

where

$d_{1}=\frac{log\frac{S}{K}+(r+\frac{\sigma^{2}}{2})(t)}{\sigma\sqrt{t}},d_{2}=d_{1}-\sigma\sqrt{t}.$
(2)

#### Assumptions made by the Black Scholes Model.

The Black Scholes model makes five assumptions: (i) No dividends are paid out
during the life of an option, (ii) Market movements are somewhat random, (iii)
There are no transaction costs in buying the asset, (iv) The volatility and
risk free rate of the underlying asset are known and constant, (v) The returns
of the underlying asset are normally distributed.

###  3.2 Relation to Diffusion Models

The main concept behind diffusion models [13] involves iteratively adding
small amounts of random Gaussian noise to transform an initial photorealistic
image $x_{0}$ to noise $x_{T}\sim\mathcal{N}(0,I)$ in $T$ steps. This process
is known as the forward process. The converse of the theorem states that by
starting from random noise $x_{T}\sim\mathcal{N}(0,I)$ and refining it
iteratively for $T$ steps, we can generate a photorealistic image $x_{0}$.
Since diffusion is a gradual process, the value of $T$ is typically large. At
each intermediate timestep, $t\in\\{0....T\\}$, $x_{t}$ satisfies
$x_{t}=\sqrt{\alpha_{t}}x_{0}+\sqrt{1-\alpha_{t}}\epsilon_{t}$.
$0=\alpha_{T}<\alpha_{T-1}....<\alpha_{1}<\alpha_{0}=1$ are the
hyperparameters of the diffusion schedule [13] and
$\epsilon_{T}\sim\mathcal{N}(0,I)$. To obtain $x_{t-1}$ at each refinement
step, the neural network $f_{\theta}(x_{t},t)$ is applied along with the
corresponding random Gaussian noise perturbation. In other words, during each
step of diffusion denoising, the known variance in added noise follows a
Gaussian distribution [13]. In finance, the volatility refers to the standard
deviation in the way stock prices change from one time instant to the next.
The mathematical description of diffusion models, derived from non-equilibrium
thermodynamics [35], shares similarities with the derivation of the Black-
Scholes model [26] used in pricing European call options within financial
markets. Both models emerge from similar assumptions and conditions,
underpinned by a shared mathematical structure. Assumptions (i) and (iii) made
by the Black Scholes model, which talk about dividends and transaction costs,
are irrelevant to diffusion models.

Figure 2: We present more results of our method along with comparisons.
Vanilla SD fails to capture clear characteristics of individual text prompts,
omitting distinct features such as those related to avocado/raccoon, muffin,
parrot, and oil painting style. Linear interpolation generates images not
consistent with the prompts, due to issues with non-linear manifolds. CLIP
Min. generates images biased towards one of the prompts. Alt. and Step prompt
selection methods suffer from artifacts and are not very successful in
blending the characteristics of objects corresponding to the individual text
prompts - the avocado/raccoon, muffin/dog are not blended well. In the
parrot/dog image, the characteristics of the parrot are missing. Alt.
generates artifacts in the Times Square/ oil painting image, while Times
Square is not characterized well in the image generated by Step. In contrast,
the Black-Scholes model adeptly overcomes these limitations, generating
realistic images that meticulously balance and preserve the unique
characteristics of each individual text prompt. The images are from set 1, set
2, set 3 and set 4 (Refer Section 5.1) respectively.

##  4 Prompt Mixing using Black Scholes Model

###  4.1 Problem Formulation

Consider a set of $N$ text prompts denoted as $P_{1},...P_{N}$ and $T$
diffusion denoising steps. Note that text-to-image diffusion architectures
often include a text encoder that maps the text prompt to a joint text-image
space. Starting from random noise and conditioned on the embedding in the
text-image space, the neural network generates the final image.

Our objective is to generate an image that aligns with multiple text prompts
simultaneously i.e. at the intersection of the various text-image manifolds of
the diffusion models. We pose this task as a prompt mixing [27] problem.
During each step of diffusion denoising, our aim is to select the most
relevant text prompt (or the text prompt with respect to which the image
requires further refining) for conditioning the model, ensuring the generation
of an optimal image satisfying all individual text prompts.

###  4.2 Method

Selecting the most effective text prompt to condition a text-to-image
diffusion model can be approached in various ways. Naively switching [18, 27]
between prompts is sub-optimal due to the significant human effort involved.
Moreover, it fails to address the critical issue of prioritizing the most
relevant prompt in an automatic manner. Alternatively, one can compute the
CLIP score at each step and move toward the text prompt with the lowest CLIP
score. While this approach is reasonable, it overlooks essential factors
related to the dynamics [13] of the diffusion denoising process, which
significantly impact the final image generation. Leveraging the Black Scholes
model allows us to model these dynamics effectively.

We utilize the CLIP score to quantify the “price” of the generated image,
treating it as analogous to a stock. The CLIP score has been widely used to
measure text-image alignment, making it a suitable metric for evaluating how
well our generated image aligns with each text prompt. Consider diffusion
denoising at step $i$ out of total steps $T$. We derive the relevant variables
for Black Scholes formula as follows:

  1. 1.

Underlying stock price $S$: The underlying stock price corresponds to the
current value of the asset. Let $z_{t}$ represent the predicted latents at
timestep $t$. We denote $z_{0,t}$ as the latents of the final predicted image
extrapolated from $z_{t}$. In other words, if the denoising process were to
proceed in a straightforward manner following the same direction as computed
for $z_{t}$, the latents of the final predicted image would be $z_{0,t}$. The
underlying stock price, denoted as $S$, is determined by the CLIP score with
respect to text prompt $P_{p}$. This CLIP score can be computed using the
image decoded from $z_{0,t}$. To maintain values within the range of $0$ to
$100$, we multiply the CLIP score by $100$.

  2. 2.

Strike price $K$: This represents the estimated asset price at expiry,
following the last step of diffusion denoising, which predicts the final
image. Based on our experience with diffusion models, where we found that a
CLIP score of approximately $0.25$ indicates reasonable text-image alignment,
we opted for a constant value of $0.25$.

  3. 3.

Time to expiration $t$: $t=T-i$.

  4. 4.

Volatility $\sigma$: We compute the volatility as the square root of the
variance used by the diffusion denoising scheduler at timestep $i$.

  5. 5.

Risk-free rate $r$: $r=1/T$.

During each iteration $i$ of diffusion denoising, we calculate the Black-
Scholes score $b_{i,p}$ for each text prompt $P_{p}$, $p=1...N$ using the
given variables and Equation 1 and Equation 2. Subsequently, during the next
step of diffusion denoising, we condition on the text prompt with the lowest
Black-Scholes score. This approach ensures that the denoising process
prioritizes the text prompt associated with the minimum Black-Scholes score
for generating an optimal image consistent with all prompts. Please refer to
Algorithm 1 for a step-wise description of the method.

Algorithm 1 Black Scholes prompt mixing in backward diffusion enables the
diffusion model generate an optimal image at the intersection of multiple
text-image manifolds.

1:Initialize latents to random Gaussian noise. $z_{T}\sim\mathcal{N}(0,I)$; T
is the total number of diffusion denoising steps.

2:Use the text encoder $\epsilon$ to compute the CLIP embeddings of a
(linguistic) combination of the text prompts $\\{P\\}$.
$e\leftarrow\epsilon_{p}(\cup\\{P\\})$.

3:Initialize Black Scholes variables, strike price $K=0.25\times 100$,
$rater=1/T$.

4:// Diffusion denoising - image prediction/generation loop

5:for $t\leftarrow T$ to $0$ do

6: $z_{t-1}=z_{t}-f(z_{t},t,e)$; f is the diffusion UNet.

7: Use $z_{t-1}$ to compute $z_{0,t-1}$.

8: Variance $\sigma$ at step $t-1$ $\leftarrow$ computed using the scheduler
of the diffusion model.

9: for $i\leftarrow 1$ to $N$ do

10: Spot price $S$ $\leftarrow$ CLIP score With respect to text prompt $P_{i}$

11: Time to expiration $\leftarrow t$

12: Black Scholes score $b_{t,i}$ with respect to prompt $P_{i}$, at timestep
$t$, $\leftarrow$ use Equation 1,2.

13: end for

14: $P_{min}$ $\leftarrow$ Text prompt corresponding to min$\\{B_{t,i}\\}$,
$i=1...N$

15: $e$ $\leftarrow$ $\epsilon_{p}(P_{min})$

16:end for

##  5 Experiments and Results

#### Metrics.

In line with previous research [9], we assess performance using the CLIP
Score. We use two variants of the CLIP Score: (i) CLIP-combined, which
computes the score by comparing the generated image against a combination of
individual text prompts; and (ii) CLIP-add, which averages the CLIP scores for
the generated image across each individual text prompt. To compute our
metrics, we generate five images for each text prompt and use them all in the
computation of our metrics.

#### Baselines.

Our study examines several baselines: (i) Vanilla SD: Prompt engineering, we
use the vanilla stable diffusion model and condition it on a single text
prompt effectively describing all individual text prompts, (ii) Lin. Interp.:
Direct combination of text embeddings, achieved through linear interpolation
between text embeddings [17]. This method equally weights the text embeddings
associated with each text prompt. (iii) Switching between text prompts. We
consider two variations here: (iii-a) Step: Following Patashnik et. al. [27],
we use one text prompt for the initial 7th to 17th denoising steps and then
switch to the other text prompt for the remaining steps, (iii-b) Alt.:
Following Kothandaraman et. al. [18], we alternate between the two text
prompts. (iv) CLIP Min.: Score-based combination, denoted as CLIP-min, where
we select the text prompt corresponding to the lowest CLIP score from the
previous denoising iteration.

#### Backbone architecture.

We use the Stable Diffusion 2.1 backbone model in all our experiments. There
is no training involved, we use the pretrained model to directly perform
inference.

Method | CLIP-combined | CLIP-add
---|---|---
Vanilla | $0.3463$ | $0.3012$
Linear Int. | $0.2885$ | $0.2778$
Alt. Samp. | $0.3445$ | $0.3098$
CLIP Min. | $0.3195$ | $0.2955$
Step | $0.322$ | $0.2997$
Black Scholes | $0.3469$ | $0.3112$

Table 1: We follow prior work [9, 3] and analyze using CLIP Scores. The Black
Scholes algorithm for prompt mixing in diffusion models achieves superior
results, compared to other prompt-mixing techniques, as also evidenced by the
qualitative results.

###  5.1 Experimental Settings

We consider the following experimental settings:

#### Set 1:

Simple text prompts with single objects. In this experiment, we validate our
approach using straightforward scenarios, we use two text prompts, each
describing one class. Specifically, we consider $17$ classes: [‘a rock’, ‘a
coffee mug’, ‘a cute dog’, ‘a pink cat’, ‘a teddy bear’, ‘a robot’, ‘an
alien’, ‘an avocado’, ‘a cute raccoon’, ‘a corgi dog’, ‘a parrot’, ‘a car’, ‘a
squirrel’, ‘a cute rabbit’, ‘pizza’, ‘muffin’, ‘icecream’], and construct
$17c_{2}=136$ text prompts.

#### Set 2:

Multiple objects per text prompt. To add complexity, blend multiple objects,
in the presence of additional objects in the scene. The goal of this
experiment is to assess the models’ capabilities in blending the right objects
in the scene, and preserving the characteristics of the other objects. We work
with three classes of objects: [‘a basket’, ‘a teapot’], [‘apples’, ‘bananas’,
‘a cute cat’, ‘a cute dog’, ‘muffins’], [‘a table’, ‘a carpet’, ‘a bed’] and
construct combinations using the first and second set and the second and third
set. Additionally, we include the data point “a cat in a bathtub” and “a corgi
dog in a bathtub,” resulting in a total of $71$ prompts.

#### Set 3:

Object actions against backgrounds (prompt mixing w.r.t. object). We
investigate the model’s ability to morph objects while considering object-
level action information and scene or background context. We consider the
following backgrounds, [‘walking in Times Square’, ‘skiing in Times Square’,
‘walking in a beautiful garden’, ‘surfing on the beach’, ‘eating watermelon on
the beach’, ‘sitting on a sofa on the beach’, ‘watching northern lights’,
‘watching sunset at a beach’, ‘admiring the opera house in Sydney’, ‘sleeping
in a cozy bedroom’, ‘admiring a beautiful waterfall in a forest’, ‘walking in
a cherry blossom garden’, ‘walking in a colorful autumn forest’, ‘flying in
the sky at sunset’]. The objects are [‘a kangaroo’, ‘a cute cat’, ‘a corgi
dog’, ‘a parrot’, ‘a teddy bear’, ‘a penguin’]. In total, we create $210$
prompts.

#### Set 4:

Object performing action against a background (prompt mixing w.r.t.
background). In this experiment, we explore how the model blends global
information and backgrounds while considering objects in various scenarios. We
consider the objects [‘a kangaroo’, ‘a cute cat’, ‘a corgi dog’, ‘a parrot’,
‘a teddy bear’, ‘a penguin’]. The backgrounds and style prompts are [‘walking
in Times Square’, ‘sunset’, ‘van gogh style’, ‘oil painting’, ‘a garden with
tulips’, ‘northern lights’]. Overall, we have $90$ prompts in this experiment.

###  5.2 Analysis and Comparisons

We show qualitative results in Figure 1 and Figure 2. More qualitative results
can be found in the appendix. The quantitative comparisons are in Figure 1.
Our quantitative results are averaged across the metrics for each of the four
sets, with $680$, $355$, $1050$, $450$ images respectively. A detailed
analysis of our method and benefits over prior art is as follows:

  * •

Vanilla stable diffusion (SD): Vanilla stable diffusion v2.1 can create
plausible combinations of the provided text prompts. However, due to
hallucination issues, it is constrained by the distributions it learned during
training. As a result, it struggles to capture clear characteristics of
individual text prompts. For example, in Figure 1, the distinct features of
the parrot, cat, dog/penguin, and sunset/penguin are missing. Similarly, in
Figure 2, the avocado/raccoon, muffin, parrot, and oil painting style lack
distinct characteristics. Despite this, the generated images align with the
broad text prompt descriptions, resulting in a considerable CLIP score.

  * •

Linear interpolation [17]: Linear interpolation is ill-suited for generating
an image that combines two text prompts. This limitation arises from the non-
linear nature of the text-image space. While linear interpolation assumes a
simple linear relationship, the actual mapping between textual descriptions
and image features is intricate. Furthermore, linear interpolation can only
traverse a straight path between two points in the latent space, failing to
capture nuanced variations or produce novel features beyond the endpoints.

  * •

Alternating Sampling [18],: Alternating sampling generates features related to
both text prompts in the final output image. However, the objects produced
suffer from poor definition, unrealistic appearance, and low quality in many
instances. Artifacts are prevalent, and several generated images appear
implausible. The underlying issue lies in the algorithm’s routine alternation
between the two text prompts during diffusion denoising, without adequately
emphasizing the most relevant prompt at each step. Despite these limitations,
the model achieves a reasonable CLIP Score by broadly aligning with the
overall image description, akin to vanilla denoising.

  * •

Step-wise switching [18]: Step-wise switching is similarly ineffective for the
same reasons as Alternating sampling.

  * •

CLIP-min: The CLIP-min results exhibit bias toward one of the text prompts in
most cases, preventing the model from generating an image that aligns with the
intersection of both prompts. This bias arises because the model overlooks the
dynamics of diffusion denoising and instead selects the text prompt with the
lowest CLIP score at each step, resulting in bias-related issues.

  * •

Black Scholes algorithm: Our approach based on the Black-Scholes algorithm
effectively generates realistic images that align with the intersection of the
two text prompts. These images exhibit minimal unrealistic artifacts.
Additionally, our algorithm successfully preserves individual characteristics
corresponding to each text prompt. By modeling the dynamics of diffusion
denoising, the algorithm strategically selects the optimal text prompt at each
step, achieving a balanced synthesis of both prompts. Notably, our model
attains superior quantitative results.

In summary, the Black-Scholes model outperforms all previous methods for
prompt mixing by generating realistic images that meticulously preserve and
balance the characteristics of each individual text prompt.

Figure 3: Image variations from our method using the Black Scholes model for a
single prompt, starting from different random Gaussian noise initializations.

##  6 Conclusions, Limitations, and Future Work

In this paper, we introduce a novel perspective on prompt mixing, inspired by
a probablistic prediction model and its theoretical framework from the domain
of Finance. We draw parallels between the Black-Scholes algorithm used in
financial markets and diffusion models. From this comparison, we derive an
algorithm for prompt mixing, aiming to generate images that align with
multiple text prompts. Our extensive analysis showcase both qualitative and
quantitative advantages of our approach. Our study has a few limitations,
which opens avenues for future work: (i) We follow prior work [9, 3] by using
CLIP scores for quantitative evaluation. However, CLIP scores may not be the
optimal evaluation strategy, as they can yield similar scores for images with
significant quality differences. Due to its learned nature, CLIP is vulnerable
to hallucination and bias issues related to its training data. Consequently,
it may assign similar scores to images that exhibit general characteristics of
the text prompt, without focusing on specific details and features of the
scene entities described in the text prompt. To address this, future research
could explore more advanced image-language models [25] for evaluation; the
development of good metrics for the evaluation of generative models is a
widespread issue, and could help better quantify the performance of our
method. (ii) Our study focuses on prompt mixing with two prompts.
Investigating the impact of using more than two prompts could be a promising
direction for future work. (iii) While our method leverages diffusion models,
it may not be applicable to non-Gaussian [6] diffusion models or one-step
diffusion models [41], as demonstrated in recent research.

Moreover, future work on integrating our approach with recent advancements in
attention guidance, layout modeling, and related areas could extend its
applicability to critical downstream tasks such as image editing [17, 39, 4],
compositionality [24, 3], handling complex prompts [23], text-based view
synthesis [18, 19] and personalized image generation [32, 20]. While
recognizing the success of recent text-to-image models like Dalle-3, Stable
Diffusion 3, Firefly 3, and Imagen 3 in generating images from diverse and
complex text prompts, we introduce a data-efficient approach to prompt mixing.
Our method offers advantages over previous techniques for prompt-mixing, and
future extension could explore integrating our model’s benefits into state-of-
the-art text-to-image architectures for data efficient prompt mixing and
downstream applications.

#### Societal impact.

While our method offers valuable tools for generative AI-based content
creation, its potential misuse underscores the need for research in
watermarking and deepfake detection to mitigate risks.

#### Acknowledgements.

This work was supported in part by ARO Grants W911NF2110026, W911NF2310046,
W911NF2310352 and Army Cooperative Agreement W911NF2120076.

## References

  * [1] Rameen Abdal, Yipeng Qin, and Peter Wonka.  Image2stylegan: How to embed images into the stylegan latent space?  In Proceedings of the IEEE/CVF international conference on computer vision, pages 4432–4441, 2019.
  * [2] Adobe.  Adobe firefly.  https://firefly.adobe.com/, 2024.
  * [3] Aishwarya Agarwal, Srikrishna Karanam, KJ Joseph, Apoorv Saxena, Koustava Goswami, and Balaji Vasan Srinivasan.  A-star: Test-time attention segregation and retention for text-to-image synthesis.  In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 2283–2293, 2023.
  * [4] Omri Avrahami, Dani Lischinski, and Ohad Fried.  Blended diffusion for text-driven editing of natural images.  In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 18208–18218, 2022.
  * [5] Yogesh Balaji, Seungjun Nah, Xun Huang, Arash Vahdat, Jiaming Song, Qinsheng Zhang, Karsten Kreis, Miika Aittala, Timo Aila, Samuli Laine, et al.  ediff-i: Text-to-image diffusion models with an ensemble of expert denoisers.  arXiv preprint arXiv:2211.01324, 2022.
  * [6] Arpit Bansal, Eitan Borgnia, Hong-Min Chu, Jie Li, Hamid Kazemi, Furong Huang, Micah Goldblum, Jonas Geiping, and Tom Goldstein.  Cold diffusion: Inverting arbitrary image transforms without noise.  Advances in Neural Information Processing Systems, 36, 2024.
  * [7] James Betker, Gabriel Goh, Li Jing, Tim Brooks, Jianfeng Wang, Linjie Li, Long Ouyang, Juntang Zhuang, Joyce Lee, Yufei Guo, et al.  Improving image generation with better captions.  Computer Science. https://cdn. openai. com/papers/dall-e-3. pdf, 2(3):8, 2023.
  * [8] Fischer Black and Myron Scholes.  The pricing of options and corporate liabilities.  In World Scientific Reference on Contingent Claims Analysis in Corporate Finance: Volume 1: Foundations of CCA and Equity Valuation, pages 3–21. World Scientific, 2019.
  * [9] Hila Chefer, Yuval Alaluf, Yael Vinker, Lior Wolf, and Daniel Cohen-Or.  Attend-and-excite: Attention-based semantic guidance for text-to-image diffusion models.  ACM Transactions on Graphics (TOG), 42(4):1–10, 2023.
  * [10] Jiaxin Cheng, Xiao Liang, Xingjian Shi, Tong He, Tianjun Xiao, and Mu Li.  Layoutdiffuse: Adapting foundational diffusion models for layout-to-image generation.  arXiv preprint arXiv:2302.08908, 2023.
  * [11] Patrick Esser, Sumith Kulal, Andreas Blattmann, Rahim Entezari, Jonas Müller, Harry Saini, Yam Levi, Dominik Lorenz, Axel Sauer, Frederic Boesel, et al.  Scaling rectified flow transformers for high-resolution image synthesis.  arXiv preprint arXiv:2403.03206, 2024.
  * [12] Rinon Gal, Or Patashnik, Haggai Maron, Amit H Bermano, Gal Chechik, and Daniel Cohen-Or.  Stylegan-nada: Clip-guided domain adaptation of image generators.  ACM Transactions on Graphics (TOG), 41(4):1–13, 2022.
  * [13] Jonathan Ho, Ajay Jain, and Pieter Abbeel.  Denoising diffusion probabilistic models.  Advances in neural information processing systems, 33:6840–6851, 2020.
  * [14] Jonathan Ho, Chitwan Saharia, William Chan, David J Fleet, Mohammad Norouzi, and Tim Salimans.  Cascaded diffusion models for high fidelity image generation.  Journal of Machine Learning Research, 23(47):1–33, 2022.
  * [15] Susung Hong, Gyuseong Lee, Wooseok Jang, and Seungryong Kim.  Improving sample quality of diffusion models using self-attention guidance.  In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 7462–7471, 2023.
  * [16] Tero Karras, Timo Aila, Samuli Laine, and Jaakko Lehtinen.  Progressive growing of gans for improved quality, stability, and variation.  arXiv preprint arXiv:1710.10196, 2017.
  * [17] Bahjat Kawar, Shiran Zada, Oran Lang, Omer Tov, Huiwen Chang, Tali Dekel, Inbar Mosseri, and Michal Irani.  Imagic: Text-based real image editing with diffusion models.  In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 6007–6017, 2023.
  * [18] Divya Kothandaraman, Tianyi Zhou, Ming Lin, and Dinesh Manocha.  Aerial diffusion: Text guided ground-to-aerial view translation from a single image using diffusion models.  arXiv preprint arXiv:2303.11444, 2023.
  * [19] Divya Kothandaraman, Tianyi Zhou, Ming Lin, and Dinesh Manocha.  Aerialbooth: Mutual information guidance for text controlled aerial view synthesis from a single image.  arXiv preprint arXiv:2311.15478, 2023.
  * [20] Nupur Kumari, Bingliang Zhang, Richard Zhang, Eli Shechtman, and Jun-Yan Zhu.  Multi-concept customization of text-to-image diffusion.  In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 1931–1941, 2023.
  * [21] Mingi Kwon, Jaeseok Jeong, and Youngjung Uh.  Diffusion models already have a semantic latent space.  arXiv preprint arXiv:2210.10960, 2022.
  * [22] David A Levin and Yuval Peres.  Markov chains and mixing times, volume 107.  American Mathematical Soc., 2017.
  * [23] Long Lian, Boyi Li, Adam Yala, and Trevor Darrell.  Llm-grounded diffusion: Enhancing prompt understanding of text-to-image diffusion models with large language models.  arXiv preprint arXiv:2305.13655, 2023.
  * [24] Nan Liu, Shuang Li, Yilun Du, Antonio Torralba, and Joshua B Tenenbaum.  Compositional visual generation with composable diffusion models.  In European Conference on Computer Vision, pages 423–439. Springer, 2022.
  * [25] Yujie Lu, Xianjun Yang, Xiujun Li, Xin Eric Wang, and William Yang Wang.  Llmscore: Unveiling the power of large language models in text-to-image synthesis evaluation.  Advances in Neural Information Processing Systems, 36, 2024.
  * [26] Robert C Merton.  Option pricing when underlying stock returns are discontinuous.  Journal of financial economics, 3(1-2):125–144, 1976.
  * [27] Or Patashnik, Daniel Garibi, Idan Azuri, Hadar Averbuch-Elor, and Daniel Cohen-Or.  Localizing object-level shape variations with text-to-image diffusion models.  In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 23051–23061, 2023.
  * [28] Justin Pinkney.  Image mixer diffusion.  https://www.justinpinkney.com/blog/2024/image-mixer-diffusion/, 2024.
  * [29] Konpat Preechakul, Nattanat Chatthee, Suttisak Wizadwongsa, and Supasorn Suwajanakorn.  Diffusion autoencoders: Toward a meaningful and decodable representation.  In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 10619–10629, 2022.
  * [30] GitHub Repo.  Clip guided images mixing with stable diffusion.  https://github.com/TheDenk/images$\\_$mixing, 2023.
  * [31] Robin Rombach, Andreas Blattmann, Dominik Lorenz, Patrick Esser, and Björn Ommer.  High-resolution image synthesis with latent diffusion models.  In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pages 10684–10695, 2022.
  * [32] Nataniel Ruiz, Yuanzhen Li, Varun Jampani, Yael Pritch, Michael Rubinstein, and Kfir Aberman.  Dreambooth: Fine tuning text-to-image diffusion models for subject-driven generation.  In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 22500–22510, 2023.
  * [33] Chitwan Saharia, William Chan, Saurabh Saxena, Lala Li, Jay Whang, Emily L Denton, Kamyar Ghasemipour, Raphael Gontijo Lopes, Burcu Karagol Ayan, Tim Salimans, et al.  Photorealistic text-to-image diffusion models with deep language understanding.  Advances in neural information processing systems, 35:36479–36494, 2022.
  * [34] Yujun Shen, Jinjin Gu, Xiaoou Tang, and Bolei Zhou.  Interpreting the latent space of gans for semantic face editing.  In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pages 9243–9252, 2020.
  * [35] Jascha Sohl-Dickstein, Eric Weiss, Niru Maheswaranathan, and Surya Ganguli.  Deep unsupervised learning using nonequilibrium thermodynamics.  In International conference on machine learning, pages 2256–2265. PMLR, 2015.
  * [36] Zhendong Wang, Yifan Jiang, Huangjie Zheng, Peihao Wang, Pengcheng He, Zhangyang Wang, Weizhu Chen, Mingyuan Zhou, et al.  Patch diffusion: Faster and more data-efficient training of diffusion models.  Advances in Neural Information Processing Systems, 36, 2024.
  * [37] Sam Witteveen and Martin Andrews.  Investigating prompt engineering in diffusion models.  arXiv preprint arXiv:2211.15462, 2022.
  * [38] Tsung-Han Wu, Long Lian, Joseph E Gonzalez, Boyi Li, and Trevor Darrell.  Self-correcting llm-controlled diffusion models.  arXiv preprint arXiv:2311.16090, 2023.
  * [39] Binxin Yang, Shuyang Gu, Bo Zhang, Ting Zhang, Xuejin Chen, Xiaoyan Sun, Dong Chen, and Fang Wen.  Paint by example: Exemplar-based image editing with diffusion models.  In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 18381–18391, 2023.
  * [40] Yongqi Yang, Ruoyu Wang, Zhihao Qian, Ye Zhu, and Yu Wu.  Diffusion in diffusion: Cyclic one-way diffusion for text-vision-conditioned generation.  arXiv preprint arXiv:2306.08247, 2023.
  * [41] Tianwei Yin, Michaël Gharbi, Richard Zhang, Eli Shechtman, Fredo Durand, William T Freeman, and Taesung Park.  One-step diffusion with distribution matching distillation.  arXiv preprint arXiv:2311.18828, 2023.
  * [42] Guangcong Zheng, Xianpan Zhou, Xuewei Li, Zhongang Qi, Ying Shan, and Xi Li.  Layoutdiffusion: Controllable diffusion model for layout-to-image generation.  In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 22490–22499, 2023.
  * [43] Jiapeng Zhu, Yujun Shen, Deli Zhao, and Bolei Zhou.  In-domain gan inversion for real image editing.  In European conference on computer vision, pages 592–608. Springer, 2020.
  * [44] Jun-Yan Zhu, Philipp Krähenbühl, Eli Shechtman, and Alexei A Efros.  Generative visual manipulation on the natural image manifold.  In Computer Vision–ECCV 2016: 14th European Conference, Amsterdam, The Netherlands, October 11-14, 2016, Proceedings, Part V 14, pages 597–613. Springer, 2016.
  * [45] Ye Zhu, Yu Wu, Zhiwei Deng, Olga Russakovsky, and Yan Yan.  Unseen image synthesis with diffusion models.  arXiv preprint arXiv:2310.09213, 2023.
  * [46] Ye Zhu, Yu Wu, Zhiwei Deng, Olga Russakovsky, and Yan Yan.  Boundary guided learning-free semantic control with diffusion models.  Advances in Neural Information Processing Systems, 36, 2024.

Figure 4: Vanilla stable diffusion (SD) is able to generate images satisfying
both text prompts in many cases, however it misses out on the fine-grained
characteristics of the individual text prompts. For instance, it misses out on
the characteristics of the dog, parrot and ice-cream. Linear interpolation
generates images that are not consistent with the text prompts. CLIP Min.
generates images biased towards one of the text promots. Alternating sampling
and Step wise inference strategies generate images with a lot of artifacts,
and the generated images are perceptually implausible in many cases. For
instance, in order, the issues are: missing characteristics of dog, missing
characteristics of coffee mug and artifacts in teddy bear, artifacts and
missing characteristics of parrot, missing characteristics of teddy bear and
artifacts in teddy bear, missing characteristics of rabbit. Our Black Scholes
method is able to generate images that capture the fine-grained
characteristics of objects corresponding to both text prompts, and the
generated images look realistic with minimal artifacts. The text prompts are
from set 1. Figure 5: Vanilla stable diffusion (SD) is able to generate images
satisfying both text prompts in many cases, however it misses out on the fine-
grained characteristics of the individual text prompts. For instance, it
misses out on the characteristics of the dog, cat, corgi dog and basket/
teapot mixing. Linear interpolation generates images that are not consistent
with the text prompts. CLIP Min. is biased towards one of the text prompts.
Alternating sampling and Step wise inference strategies generate images with a
lot of artifacts, and the generated images are perceptually implausible in
many cases. For instance, in order, the issues are: artifacts in dog/banana
and missing characteristics of dog, missing characteristics of cat, the corgi
dog in the dog/apple image does not describe the dog as well as our Black
Scholes method does, the dog is not well described in the fourth example, the
teapot is not well described in the final image. Our method is able to
generate images that capture the fine-grained characteristics of objects
corresponding to both text prompts, and the generated images look realistic
with minimal artifacts. The text prompts are from set 2. Figure 6: Vanilla
stable diffusion (SD) is able to generate images satisfying both text prompts
in many cases, however it misses out on the fine-grained characteristics of
the individual text prompts. For instance, in the first and fifth image, the
characteristics of the teddy bear are missing, the second, third and fourth
image do not describe the cat well, Linear interpolation generates images that
are not consistent with the text prompts. CLIP Min is again biased towards one
of the text prompts. Alternating sampling and Step wise inference strategies
generate images with a lot of artifacts, and the generated images are
perceptually implausible in many cases. Specifically, the first image does not
describe the subjects well, the second and third images are reasonably
generated but our Black Scholes method generates a clearer image of the
penguin blended cat, and teddy bear blended cat, the results of Alt. for the
fourth case has artifacts and Step does not describe the cat well, the teddy
bear is not well described in the fifth image. Our Black Scholes method is
able to generate images that capture the fine-grained characteristics of
objects corresponding to both text prompts, and the generated images look
realistic with minimal artifacts. The text prompts are from set 3. Figure 7:
Vanilla stable diffusion (SD) is able to generate images satisfying both text
prompts in many cases, however it misses out on the fine-grained
characteristics of the individual text prompts. The first two images are
cartoon-ish, and Northern lights is not clearly depicted. The third image also
misses a clear description of Northern lights. In the fourth image, some of
the billboards in Times Square are green, but there is no sign of Northern
lights. In the fifth image, the sunset is missing. Linear interpolation
generates images that are not consistent with the text prompts. CLIP Min
results are biased towards one of the prompts for all images, except the
second one. Alternating sampling and Step wise inference strategies generate
images with a lot of artifacts, and the generated images are perceptually
implausible in many cases. In the first image, the kangaroo is not generated
well (almost flying in Alt’s result, and the characteristics of the kangaroo
are not well generated by Step). In the second image, the characteristics of
the tulip garden are not well represented. In the third image, notice how our
model generates the characteristics of the sunset and Northern lights better,
while ensuring that they are blended well to form a realistic image. In the
fourth image, Alt and Step miss out on the characteristics of Times Square and
Northern lights respectively. In the fifth image, Alt and Step miss out on the
characteristics of Times Square and the sunset respectively. Our Black Scholes
method is able to generate images that capture the fine-grained
characteristics of objects corresponding to both text prompts, and the
generated images look realistic with minimal artifacts. The text prompts are
from set 4.


# Updated High-Temperature Opacities for The Dartmouth Stellar Evolution
Program and their Effect on the Jao Gap Location

Emily M. Boudreaux Department of Physics and Astronomy, Dartmouth College,
Hanover, NH 03755, USA  Brian C. Chaboyer Department of Physics and Astronomy,
Dartmouth College, Hanover, NH 03755, USA

(Received 9/20/2022; Revised 12/12/2022; Revised 1/23/2023; Accepted
1/24/2023)

###### Abstract

The Jao Gap, a 17 percent decrease in stellar density at M${}_{G}\sim$ 10
identified in both Gaia DR2 and EDR3 data, presents a new method to probe the
interior structure of stars near the fully convective transition mass. The Gap
is believed to originate from convective kissing instability wherein
asymmetric production of 3He causes the core convective zone of a star to
periodically expand and contract and consequently the stars’ luminosity to
vary. Modeling of the Gap has revealed a sensitivity in its magnitude to a
population’s metallicity primarily through opacity. Thus far, models of the
Jao Gap have relied on OPAL high-temperature radiative opacities. Here we
present updated synthetic population models tracing the Gap location modeled
with the Dartmouth stellar evolution code using the OPLIB high-temperature
radiative opacities. Use of these updated opacities changes the predicted
location of the Jao Gap by $\sim$0.05 mag as compared to models which use the
OPAL opacities. This difference is likeley too small to be detectable in
empirical data.

Stellar Evolution (1599) — Stellar Evolutionary Models (2046)

††software:  The Dartmouth Stellar Evolution Program (DSEP) (Dotter et al.,
2008), BeautifulSoup (Richardson, 2007), mechanize (Chandra & Varanasi, 2015),
FreeEOS (Irwin, 2012), pyTOPSScrape (Boudreaux, 2022)

##  1 INTRODUCTION

Due to the initial mass requirements of the molecular clouds which collapse to
form stars, star formation is strongly biased towards lower mass, later
spectral class stars when compared to higher mass stars. Partly as a result of
this bias and partly as a result of their extremely long main-sequence
lifetimes, M Dwarfs make up approximately 70 percent of all stars in the
galaxy. Moreover, some planet search campaigns have focused on M Dwarfs due to
the relative ease of detecting small planets in their habitable zones (e.g.
Nutzman & Charbonneau, 2008). M Dwarfs then represent both a key component of
the galactic stellar population as well as the possible set of stars which may
host habitable exoplanets. Given this key location M Dwarfs occupy in modern
astronomy it is important to have a thorough understanding of their structure
and evolution.

Jao et al. (2018) discovered a novel feature in the Gaia Data Release 2 (DR2)
$G_{BP}-G_{RP}$ color-magnitude-diagram. Around $M_{G}=10$ there is an
approximately 17 percent decrease in stellar density of the sample of stars
Jao et al. (2018) considered. Subsequently, this has become known as either
the Jao Gap, or Gaia M Dwarf Gap. Following the initial detection of the Gap
in DR2 the Gap has also potentially been observed in 2MASS (Skrutskie et al.,
2006; Jao et al., 2018); however, the significance of this detection is quite
weak and it relies on the prior of the Gap’s location from Gaia data. Further,
the Gap is also present in Gaia Early Data Release 3 (EDR3) (Jao & Feiden,
2021). These EDR3 and 2MASS data sets then indicate that this feature is not a
bias inherent to DR2.

The Gap is generally attributed to convective instabilities in the cores of
stars straddling the fully convective transition mass (0.3 - 0.35 M⊙) (Baraffe
& Chabrier, 2018). These instabilities interrupt the normal, slow, main
sequence luminosity evolution of a star and result in luminosities lower than
expected from the main sequence mass-luminosity relation (Jao & Feiden, 2020).

The Jao Gap, inherently a feature of M Dwarf populations, provides an enticing
and unique view into the interior physics of these stars (Feiden et al.,
2021). This is especially important as, unlike more massive stars, M Dwarf
seismology is infeasible due to the short periods and extremely small
magnitudes which both radial and low-order low-degree non-radial seismic waves
are predicted to have in such low mass stars (Rodríguez-López, 2019). The Jao
Gap therefore provides one of the only current methods to probe the interior
physics of M Dwarfs.

Despite the early success of modeling the Gap some issues remain. Jao & Feiden
(2020, 2021) identify that the Gap has a wedge shape which has not been
successful reproduced by any current modeling efforts and which implies a
somewhat unusual population composition of young, metal-poor stars. Further,
Jao & Feiden (2020) identify substructure, an additional over density of
stars, directly below the Gap, again a feature not yet fully captured by
current models.

All currently published models of the Jao Gap make use of OPAL high
temperature radiative opacities. Here we investigate the effect of using the
more up-to-date OPLIB high temperature radiative opacities and whether these
opacity tables bring models more in line with observations. In Section 2 we
provide an overview of the physics believed to result in the Jao Gap, in
Section 3 we review the differences between OPAL and OPLIB and describe how we
update DSEP to use OPLIB opacity tables. Section 4 walks through the stellar
evolution and population synthesis modeling we perform. Finally, in Section 5
we present our findings.

##  2 Jao Gap

A theoretical explanation for the Jao Gap (Figure 1) comes from van Saders &
Pinsonneault (2012), who propose that in a star directly above the transition
mass, due to asymmetric production and destruction of 3He during the proton-
proton I chain (ppI), periodic luminosity variations can be induced. This
process is known as convective-kissing instability. Very shortly after the
zero-age main sequence such a star will briefly develop a radiative core;
however, as the core temperature exceeds $7\times 10^{6}$ K, enough energy
will be produced by the ppI chain that the core once again becomes convective.
At this point the star exists with both a convective core and envelope, in
addition to a thin, radiative layer separating the two. Subsequently,
asymmetries in ppI affect the evolution of the star’s convective core.

While kissing instability has been the most widely adopted model to explain
the existence of the Jao Gap, slightly different mechanisms have also been
proposed. MacDonald & Gizis (2018) make use of a fully implicit stellar
evolution suite which treats convective mixing as a diffusive property.
MacDonald & Gizis treat convective mixing this way in order to account for a
core deuterium concentration gradient proposed by Baraffe et al. (1997). Under
this treatment the instability results only in a single mixing event — as
opposed to periodic mixing events. Single mixing events may be more in line
with observations (see section 5 for more details on how periodic mixings can
effect a synthetic population) where there is only well documented evidence of
a single gap. However, recent work by Jao & Feiden (2021) which identify an
second under density of stars below the canonical gap, does leave the door
open for the periodic mixing events.

Figure 1: The Jao Gap (circled) seen in the Gaia Catalogue of Nearby Stars
(Gaia Collaboration et al., 2021).

The proton-proton I chain constitutes three reactions

  1. 1.

$p+p\longrightarrow d+e^{+}+\nu_{e}$

  2. 2.

$p+d\longrightarrow\ ^{3}\text{He}+\gamma$

  3. 3.

${}^{3}\text{He}+^{3}\text{He}\longrightarrow\ ^{3}\text{He}+2p$

Initially, reaction 3 of ppI consumes 3He at a slower rate than it is produced
by reaction 2 and as a result, the core 3He abundance and consequently the
rate of reaction 3, increases with time. The core convective zone expands as
more of the star becomes unstable to convection. This expansion continues
until the core connects with the convective envelope. At this point convective
mixing can transport material throughout the entire star and the high
concentration of 3He rapidly diffuses outward, away from the core, decreasing
energy generation as reaction 3 slows down. Ultimately, this leads to the
convective region around the core pulling back away from the convective
envelope, leaving in place the radiative transition zone, at which point 3He
concentrations grow in the core until it once again expands to meet the
envelope. These periodic mixing events will continue until 3He concentrations
throughout the star reach an equilibrium ultimately resulting in a fully
convective star. Figure 2 traces the evolution of a characteristic star within
the Jao Gap’s mass range.

Figure 2: Diagram for a characteristic stellar model of 0.35625 $M_{\odot}$
which is within the Jao Gap’s mass range. The black shaded regions denote
whether, at a particular model age, a radial shell within the model is
radiative (with white meaning convective). The lines trace the models core
temperature, core 3He mass fraction, fractional luminosity wrt. the zero age
main sequence and fractional radius wrt. the zero age main sequence.

###  2.1 Efforts to Model the Gap

Since the identification of the Gap, stellar modeling has been conducted to
better constrain its location, effects, and exact cause. Both Mansfield &
Kroupa (2021) and Feiden et al. (2021) identify that the Gap’s mass location
is correlated with model metallicity — the mass-luminosity discontinuity in
lower metallicity models being at a commensurately lower mass. Feiden et al.
(2021) suggests this dependence is due to the steep relation of the radiative
temperature gradient, $\nabla_{rad}$, on temperature and, in turn, on stellar
mass.

$\displaystyle\nabla_{rad}\propto\frac{L\kappa}{T^{4}}$ (1)

As metallicity decreases so does opacity, which, by Equation 1, dramatically
lowers the temperature at which radiation will dominate energy transport
(Chabrier & Baraffe, 1997). Since main sequence stars are virialized the core
temperature is proportional to the core density and total mass. Therefore, if
the core temperature where convective-kissing instability is expected
decreases with metallicity, so too will the mass of stars which experience
such instabilities.

The strong opacity dependence of the Jao Gap begs the question: what is the
effect of different opacity calculations on Gap properties. As we can see
above, changing opacity should affect the Gap’s location in the mass-
luminosity relation and therefore in a color-magnitude diagram. Moreover,
current models of the Gap have yet to locate it precisely in the CMD (Feiden
et al., 2021) with an approximate 0.16 G-magnitude difference between the
observed and modeled Gaps. Opacity provides one, as yet unexplored, parameter
which has the potential to resolve these discrepancies.

##  3 Updated Opacities

Multiple groups have released high-temperature opacities including, the
Opacity Project (OP Seaton et al., 1994), Laurence Livermore National Labs
OPAL opacity tables (Iglesias & Rogers, 1996), and Los Alamos National Labs
OPLIB opacity tables (Colgan et al., 2016). OPAL high-temperature radiative
opacity tables in particular are very widely used by current generation
isochrone grids (e.g. Dartmouth, MIST, & StarEvol, Dotter et al., 2008; Choi
et al., 2016; Amard et al., 2019). OPLIB opacity tables (Colgan et al., 2016)
are not widely used but include the most up-to-date plasma modeling.

While the overall effect on the CMD of using OPLIB compared to OPAL tables is
small, the strong theoretical opacity dependence of the Jao Gap raises the
potential for these small effects to measurably shift the Gap’s location. We
update DSEP to use high temperature opacity tables based on measurements from
Los Alamos national Labs T-1 group (OPLIB, Colgan et al., 2016). The OPLIB
tables are created with ATOMIC (Magee et al., 2004; Hakel et al., 2006; Fontes
et al., 2015), a modern LTE and non-LTE opacity and plasma modeling code.
These updated tables were initially created in order to incorporate the most
up to date plasma physics at the time (Bahcall et al., 2005).

OPLIB tables include monochromatic Rosseland mean opacities — composed from
bound-bound, bound-free, free-free, and scattering opacities — for elements
hydrogen through zinc over temperatures 0.5eV to 100 keV (5802 K – 1.16$\times
10^{9}$ K) and for mass densities from approximately $10^{-8}$ g cm-3 up to
approximately $10^{4}$ g cm-3 (though the exact mass density range varies as a
function of temperature).

DSEP ramps the Ferguson et al. (2005) low temperature opacities to high
temperature opacities tables between $10^{4.3}$ K and $10^{4.5}$ K; therefore,
only differences between high-temperature opacity sources above $10^{4.3}$ K
can effect model evolution. When comparing OPAL and OPLIB opacity tables
(Figure 3) we find OPLIB opacities are systematically lower than OPAL
opacities for temperatures above $10^{5}$ K. Between $10^{4.3}$ and $10^{5}K$
OPLIB opacities are larger than OPAL opacities. These generally lower
opacities will decrease the radiative temperature gradient throughout much of
the radius of a model.

Figure 3: Rosseland mean opacity with the GS98 solar composition for both OPAL
opacities and OPLIB opacities (top). Residuals between OPLIB opacities and
OPAL opacities (bottom). These opacities are plotted at $\log_{10}(R)=-0.5$,
$X=0.7$, and $Z=0.02$. $\log_{10}(R)=-0.5$ approximates much of the interior a
0.35 M⊙ model. Note how the OPLIB opacities are systematically lower than the
OPAL opacities for temperatures above $10^{5.2}$ K.

###  3.1 Table Querying and Conversion

The high-temperature opacity tables used by DSEP and most other stellar
evolution programs give Rosseland-mean opacity, $\kappa_{R}$, along three
dimensions: temperature, a density proxy $R$ (Equation 2; $T_{6}=T\times
10^{-6}$, $\rho$ is the mass density), and composition.

$\displaystyle R=\frac{\rho}{T_{6}^{3}}$ (2)

OPLIB tables may be queried from a web
interface111https://aphysics2.lanl.gov/apps/; however, OPLIB opacities are
parametrized using mass-density and temperature instead of $R$ and
temperature. It is most efficient for us to convert these tables to the OPAL
format instead of modifying DSEP to use the OPLIB format directly. In order to
generate many tables easily and quickly we develop a web scraper
(pyTOPSScrape, Boudreaux, 2022) which can automatically retrieve all the
tables needed to build an opacity table in the OPAL format.
pyTOPSScrape222https://github.com/tboudreaux/pytopsscrape has been released
under the permissive MIT license with the consent of the Los Alamos T-1 group.
For a detailed discussion of how the web scraper works and how OPLIB tables
are transformed into a format DSEP can use see Appendices A & B.

###  3.2 Solar Calibrated Stellar Models

In order to validate the OPLIB opacities, we generate a solar calibrated
stellar model (SCSM) using these new tables. We first manually calibrate the
surface Z/X abundance to within one part in 100 of the solar value (Grevesse &
Sauval, 1998, Z/X=0.23). Subsequently, we allow both the convective mixing
length parameter, $\alpha_{ML}$, and the initial Hydrogen mass fraction, $X$,
to vary simultaneously, minimizing the difference, to within one part in
$10^{5}$, between resultant models’ final radius and luminosity to those of
the sun. Finally, we confirm that the model’s surface Z/X abundance is still
within one part in 100 of the solar value.

Figure 4: HR Diagram for the two SCSMs, OPAL and OPLIB. OPLIB is shown as a
red dashed line.

Solar calibrated stellar models evolved using GS98 OPAL and OPLIB opacity
tables (Figure 4) differ $\sim 0.5\%$ in the SCSM hydrogen mass fractions and
$\sim 1.5\%$ in the SCSM convective mixing length parameters (Table 1). While
the two evolutionary tracks are very similar, note that the OPLIB SCSM’s
luminosity is systematically lower past the solar age. While at the solar age
the OPLIB SCSM luminosity is effectively the same as the OPAL SCSM. This
luminosity difference between OPAL and OPLIB based models is not inconsistent
with expectations given the more shallow radiative temperature gradient
resulting from the lower OPLIB opacities

Model | $X$ | $\alpha_{ML}$
---|---|---
OPAL | 0.7066 | 1.9333
OPLIB | 0.7107 | 1.9629
Table 1: Optimized parameters for SCSMs evolved using OPAL and OPLIB high
temperature opacity tables.

##  4 Modeling

In order to model the Jao Gap we evolve two extremely finely sampled mass
grids of models. One of these grids uses the OPAL high-temperature opacity
tables while the other uses the OPLIB tables (Figure 5). Each grid evolves a
model every 0.00025 $M_{\odot}$ from 0.2 to 0.4 $M_{\odot}$ and every 0.005
$M_{\odot}$ from 0.4 to 0.8 $M_{\odot}$. All models in both grids use a GS98
solar composition, the (1, 101, 0) FreeEOS (version 2.7) configuration, and
1000 year old pre-main sequence polytropic models, with polytropic index 1.5,
as their initial conditions. We include gravitational settling in our models
where elements are grouped together. Finally, we set a maximum allowed
timestep of 50 million years to assure that we fully resolve the build of of
core 3He in gap stars.

Despite the alternative view of convection provided by MacDonald & Gizis
(2018) discussed in Section 2, given that the mixing timescales in these low
mass stars are so short (between $10^{7}$s and $10^{8}$s per Jermyn et al.,
2022, Figure 2 & Equation 39, which present the averaged velocity over the
convection zone) instantaneous mixing is a valid approximation. Moreover, one
principal motivation for a diffusive model of convective mixing has been to
account for a deuterium concentration gradient which Chabrier & Baraffe (1997)
identify will develop when the deuterium lifetime against proton capture is
significantly shorter than the mixing timescale. However, the treatment of
energy generation used by DSEP (Bahcall et al., 2001) avoides this issue by
computing both the equilibrium deuterium abundance and luminosity of each
shell individually, implicitly accounting for the overall luminosity
discrepancy identified by Chabrier & Baraffe.

Because in this work we are just interested in the location shift of the Gap
as the opacity source varies, we do not model variations in composition.
Mansfield & Kroupa (2021); Jao & Feiden (2020); Feiden et al. (2021) all look
at the effect composition has on Jao Gap location. They find that as
population metallicity increases so too does the mass range and consequently
the magnitude of the Gap. From an extremely low metallicity population
(Z=0.001) to a population with a more solar like metallicity this shift in
mass range can be up to 0.05 M⊙ (Mansfield & Kroupa, 2021).

Figure 5: Mass-luminosity relation at 7 Gyrs for models evolved using OPAL
opacity tables (top) and those evolved using OPLIB opacity tables (bottom).
Note the lower mass range of the OPLIB Gap.

###  4.1 Population Synthesis

In order to compare the Gap to observations we use in house population
synthesis code. We empirically calibrate the relation between G, BP, and RP
magnitudes and their uncertainties along with the parallax/G magnitude
uncertainty relation using the Gaia Catalouge of Nearby Stas (GCNS, Gaia
Collaboration et al., 2021) and Equations 3 & 4. $M_{g}$ is the Gaia G
magnitude while $M_{i}$ is the magnitude in the i${}^{\text{th}}$ band, G, BP,
or RP. The coefficients $a$, $b$, and $c$ determined using a non-linear least
squares fitting routine. Equation 3 then models the relation between G
magnitude and parallax uncertainty while Equation 4 models the relation
between each magnitude and its uncertainty.

$\displaystyle\sigma_{plx}(M_{g})=ae^{bM_{g}}+c$ (3)
$\displaystyle\sigma_{i}(M_{i})=ae^{M_{i}-b}+c$ (4)

The full series of steps in our population synthesis code are:

Figure 6: Probability distribution sampled when assigning true parallaxes to
synthetic stars. This distribution is built from the GCNS and includes all
stars with BP-RP colors between 2.3 and 2.9, the same color range of the Jao
Gap.

  1. 1.

Sample from a Sollima (2019) ($0.25M_{\odot}<M<1M_{\odot}$, $\alpha=-1.34\pm
0.07$) IMF to determine synthetic star mass.

  2. 2.

Find the closest model above and below the synthetic star, lineally
interpolate these models’ $T_{eff}$, $\log(g)$, and $\log(L)$ to those at the
synthetic star mass.

  3. 3.

Convert synthetic star $g$, $T_{eff}$, and $Log(L)$ to Gaia G, BP, and RP
magnitudes using the Gaia (E)DR3 bolometric corrections (Creevey et al., 2022)
along with code obtained thorough personal communication with Aaron Dotter
(Choi et al., 2016).

  4. 4.

Sample from the GCNS parallax distribution (Figure 6), limited to stars within
the BP-RP color range of 2.3 – 2.9, to assign synthetic star a “true”
parallax.

  5. 5.

Use the true parallax to find an apparent magnitude for each filter.

  6. 6.

Evaluate the empirical calibration given in Equation 3 to find an associated
parallax uncertainty. Then sample from a normal distribution with a standard
deviation equal to that uncertainty to adjust the true parallax resulting in
an “observed” parallax.

  7. 7.

Use the “observed” parallax and the apparent magnitude to find an “observed”
magnitude.

  8. 8.

Fit the empirical calibration given in Equation 4 to the GCNS and evaluate it
to give a magnitude uncertainty scale in each band.

  9. 9.

Adjust each magnitude by an amount sampled from a normal distribution with a
standard deviation of the magnitude uncertainty scale found in the previous
step.

This method then incorporates both photometric and astrometric uncertainties
into our population synthesis. An example 7 Gyr old synthetic populations
using OPAL and OPLIB opacities are presented in Figure 7.

Figure 7: Population synthesis results for models evolved with OPAL (left) and
models evolved with OPLIB (right). A Gaussian kernel-density estimate has been
overlaid to better highlight the density variations.

###  4.2 Mixing Length Dependence

In order to test the sensitivity of Gap properties to mixing length we evolve
three separate sets OPLIB of models. The first uses a GS98 solar calibrated
mixing length, the second uses a mixing length of 1.5, and the third uses a
mixing length of 1.0.

We find a clear inverse correlation between mixing length parameter used and
the magnitude of the Jao Gap Figures 8 & 9 ($\mu_{G}\propto-1.5\alpha_{ML}$,
where $\mu_{G}$ is the mean magnitude of the Gap). This is somewhat surprising
given the long established view that the mixing length parameter is of little
relevance in fully convective stars (Baraffe et al., 1997). We find an
approximate 0.3 magnitude shift in both the color and magnitude comparing a
solar calibrated mixing length to a mixing length of 1.5, despite only a 16K
difference in effective temperature at 7Gyr between two 0.3 solar mass models.
The slight temperature differences between these models are attributable to
the steeper adiabatic temperature gradients just below the atmosphere in the
solar calibrated mixing length model compared to the $\alpha_{ML}=1.5$ model
($\nabla_{ad,solar}-\nabla_{ad,1.5}\approx 0.05$). Despite this relatively
small temperature variance, the large magnitude difference is expected due to
the extreme sensitivity of the bolometric corrections on effective temperature
at these low temperatures. The mixing length then provides a free parameter
which may be used to shift the gap location in order to better match
observations without having a major impact on the effective temperature of
models. Moreover, recent work indicates that using a solar calibrated mixing
length is not appropriate for all stars (e.g. Trampedach et al., 2014; Joyce &
Chaboyer, 2018).

Figure 8: CMD showing OPLIB populations (from left to right) A, B, and C.
Figure 9: Location of the two identified paucities of stars in OPLIB synthetic
populations as a function of the mixing length used.

Given the variability of gap location with mixing length, it is possible that
a better fit to the gap location may be achieved through adjustment of the
convective mixing length parameter. However, calibrations of the mixing length
for stars other than the sun have focused on stars with effective temperature
at or above that of the sun and there are no current calibrations of the
mixing length parameter for M dwarfs. Moreover, there are additional
uncertainties when comparing the predicted gap location to the measured gap
location, such as those in the conversion from effective temperature, surface
gravity, and luminosity to color, which must be considered if the mixing
length is to be used as a gap location free parameter. Given the dangers of
freely adjustable parameters and the lack of an a priori expectation for what
the convective mixing parameter should be for the population of M Dwarfs in
the Gaia DR2 and EDR3 CMD any attempt to use the Jao Gap magnitude to
calibrate a mixing length value must be done with caution, and take into
account the other uncertainties in the stellar models which could affect the
Jao Gap magnitude.

##  5 Results

We quantify the Jao Gap location along the magnitude (Table 2) axis by sub-
sampling our synthetic populations, finding the linear number density along
the magnitude axis of each sub-sample, averaging these linear number
densities, and extracting any peaks above a prominence threshold of 0.1 as
potential magnitudes of the Jao Gap (Figure 10). Gap widths are measured at
50% the height of the peak prominence. We use the python package scipy
(Virtanen et al., 2020) to both identify peaks and measure their widths.

Figure 10: (right panels) OPAL (left) and OPLIB (right) synthetic populations. (left panels) Normalized linear number density along the magnitude axis. A dashed line has been extended from the peak through both panels to make clear where the identified Jao Gap location is wrt. to the population.  Model | Location | Prominence | Width
---|---|---|---
OPAL 1 | 10.138 | 0.593 | 0.027
OPAL 2 | 10.183 | 0.529 | 0.023
OPLIB 1 | 10.188 | 0.724 | 0.032
OPLIB 2 | 10.233 | 0.386 | 0.027
Table 2: Locations identified as potential Gaps.

In both OPAL and OPLIB synthetic populations our Gap identification method
finds two gaps above the prominence threshold. The identification of more than
one gap is not inconsistent with the mass-luminosity relation seen in the
grids we evolve. As noise is injected into a synthetic population smaller
features will be smeared out while larger ones will tend to persist. The mass-
luminosity relations shown in in Figure 5 make it clear that there are: (1),
multiple gaps due to stars of different masses undergoing convective mixing
events at different ages, and (2), the gaps decrease in width moving to lower
masses / redder. Therefore, the multiple gaps we identify are attributable to
the two bluest gaps being wide enough to not smear out with noise. In fact, if
we lower the prominence threshold just slightly from 0.1 to 0.09 we detect a
third gap in both the OPAL and OPLIB datasets where one would be expected.

Previous modeling efforts (e.g. Feiden et al., 2021) have not identified
multiple gaps. This is likely due to two reasons: (1), previous studies have
allowed metallicity to vary across their model grids, further smearing the
gaps out, and (2), previous studies have used more coarse underlying mass
grids, obscuring features smaller than their mass step. While this dual-gap
structure has not been seen in models before, a more complex gap structure is
not totally unprecedented as Jao & Feiden (2021) identifies an additional
under-dense region below the primary gap in EDR3 data. As part of a follow up
series of papers, we are conducting further work to incorporate metallicity
variations while still using the finer mass sampling presented here.

The mean gap location of the OPLIB population is at a fainter magnitude than
the mean gap location of the OPAL population. Consequently, in the OPLIB
sample the convective mixing events which drive the kissing instability begin
happening at lower masses (i.e. the convective transition mass decreases). A
lower mass range will naturally result in a fainter mean gap magnitude.

Figure 11: Portions of 0.3526 $M_{\odot}$ OPAL and OPLIB stellar models
showing the interior shells which are radiative (black region). Note that for
clarity only one convective mixing event from each model is shown. Note how
the radiative zone in the OPLIB model is larger.

Mixing events at lower masses in OPLIB models are attributable to the radially
thicker, at the same mass, radiative zones (Figure 11). This thicker radiative
zone will take more time to break down and is characteristic of OPLIB models
as of a result of their slightly lower opacities. A lower opacity fluid will
have a more shallow radiative temperature gradient than a higher opacity
fluid; however, as the adiabatic temperature gradient remains essentially
unchanged as a function of radius, a larger interior radius of the model will
remain unstable to radiation. This thicker radiative zone will increase the
time it takes the core convective zone to meet up with convective envelope
meaning that lower mass models can sustain a radiative zone for longer than
they could otherwise; thus; lower opacities push the convective transition
mass down. We can additionally see this longer lived radiative zone in the
core 3He mass fraction, in which OPLIB models reach much higher concentrations
— at approximately the same growth rate — for the same mass as OPAL models do
(Figure 12).

The most precise published Gap location comes from Jao & Feiden (2020) who use
EDR3 to locate the Gap at $M_{G}\sim 10.3$, we identify the Gap at a similar
location in the GCNS data. The Gap in populations evolved using OPLIB tables
is closer to this measurement than it is in populations evolved using OPAL
tables (Table 2). It should be noted that the exact location of the observed
Gap is poorly captured by a single value as the Gap visibly compresses across
the width of the main-sequence, wider on the blue edge and narrower on the red
edge such that the observed Gap has downward facing a wedge shape (Figure 1).
This wedge shape is not successfully reproduced by either any current models
or the modeling we preform here. We elect then to specify the Gap location
where this wedge is at its narrowest, on the red edge of the main sequence.

Figure 12: Core 3He mass fraction for 0.3526 $M_{\odot}$ models evolved with
OPAL and OPLIB (within the Jao Gap’s mass range for both). Note how the OPLIB
model’s core 3He mass fraction grows at approximately the same rate as the
OPAL model’s but continues uninterrupted for longer.

The Gaps identified in our modeling have widths of approximately 0.03
magnitudes, while the shift from OPAL to OPLIB opacities is 0.05 magnitudes.
With the prior that the Gaps clearly shift before noise is injected we know
that this shift is real. However, the shift magnitude and Gap width are of
approximately the same size in our synthetic populations. Moreover, Feiden et
al. (2021) identify that the shift in the modeled Gap mass from [Fe/H] = 0 to
[Fe/H] = +0.5 as 0.04$M_{\odot}$, whereas we only see an approximate $0.01$ M⊙
shift between OPAL and OPLIB models. Therefore, the Gap location will likely
not provide a usable constraint on the opacity source.

##  6 Conclusion

The Jao Gap provides an intriguing probe into the interior physics of M Dwarfs
stars where traditional methods of studying interiors break down. However,
before detailed physics may be inferred it is essential to have models which
are well matched to observations. Here we investigate whether the OPLIB
opacity tables reproduce the Jao Gap location and structure more accurately
than the widely used OPAL opacity tables. We find that while the OPLIB tables
do shift the Jao Gap location more in line with observations, by approximately
0.05 magnitudes, the shift is small enough that it is likely not
distinguishable from noise due to population age and chemical variation.
However, future measurement of [Fe/H] for stars within the gap will be helpful
in constraining the degree to which the gap should be smeared by these
theoretical models.

We also find that both the color and magnitude of the Jao Gap are correlated
to the convective mixing length parameter. Specifically, a lower mixing length
parameter will bring the gap in the populations presented in this paper more
in line with the current best estimate for the actual gap magnitude. Using
this relation it may be possible for mixing length to be calibrated for low
mass stars such that models match the Jao Gap location. Further, the Jao gap
location may provide a test of alternative convection models such as entropy
calibrated convection (Spada et al., 2021). Both of these potential uses
require careful handeling of other uncertanties such as the uncertanties in
bolometric correction, popupulation composition, and population age. As we
currently do not have reason to suspect that the mixing length for the low
mass stars in the DR2 and ERD3 CMD is substantially lower than that of the sun
we leave the investigation of these potential additionl uses for future work.

Finally, we do not find that the OPLIB opacity tables help in reproducing the
as yet unexplained wedge shape of the observed Gap.

This work has made use of the NASA astrophysical data system (ADS). We would
like to thank Elisabeth Newton, Aaron Dotter, and Gregory Feiden for their
support and for useful discussion related to the topic of this paper. We would
like to thank our reviewer for their critical eye and their guidance to
investigate to effects of the mixing length on the Gap Location. Additionally,
we would like to thank James Colgan and the Los Alamos T-1 group for their
assistance with the OPLIB opacity tables and support for the public release of
pyTOPSScrape. We acknowledge the support of a NASA grant (No. 80NSSC18K0634).

##  Appendix A pyTOPSScrape

pyTOPSScrape provides an easy to use command line and python interface for the
OPLIB opacity tables accessed through the TOPS web form. Extensive
documentation of both the command line and programmatic interfaces is linked
in the version controlled repository. However, here we provide a brief,
illustrative, example of potential use.

Assuming pyTOPSScrape has been installed and given some working directory
which contains a file describing a base composition (“comp.dat”) and another
file containing a list of rescalings of that base composition
(“rescalings.dat”) (both of these file formats are described in detail in the
documentation), one can query OPLIB opacity tables and convert them to a form
mimicking that of type 1 OPAL high temperature opacity tables using the
following shell command.

    Ψ$ generateTOPStables comp.dat rescalings.dat -d ./TOPSCache -o out.opac -j 20

For further examples of pyTOPSScrape please visit the repository.

##  Appendix B Interpolating $\rho\rightarrow$ R

OPLIB parameterizes $\kappa_{R}$ as a function of mass density, temperature in
keV, and composition. Type 1 OPAL high temperature opacity tables, which DSEP
and many other stellar evolution programs use, instead parameterizes opacity
as a function of temperature in Kelvin, $R$ (Equation B1), and composition.
The conversion from temperature in keV to Kelvin is trivial (Equation B2).

$\displaystyle R=\frac{\rho}{T_{6}^{3}}$ (B1) $\displaystyle
T_{K}=T_{keV}*11604525.0061657$ (B2)

However, the conversion from mass density to $R$ is more involved. Because $R$
is coupled with both mass density and temperature there there is no way to
directly convert tabulated values of opacity reported in the OPLIB tables to
their equivalents in $R$ space. The TOPS webform does allow for a density
range to be specified at a specific temperature, which allows for R values to
be directly specified. However, issuing a query to the TOPS webform for not
just every composition in a Type 1 OPAL high temperature opacity table but
also every temperature for every composition will increase the number of calls
to the webform by a factor of 70. Therefore, instead of directly specifying R
through the density range we choose to query tables over a broad temperature
and density range and then rotate these tables, interpolating
$\kappa_{R}(\rho,T_{eff})\rightarrow\kappa_{R}(R,T_{eff})$.

To preform this rotation we use the interp2d function within scipy’s
interpolate (Virtanen et al., 2020) module to construct a cubic bivariate
B-spline (Dierckx, 1981) interpolating function $s$, with a smoothing factor
of 0, representing the surface $\kappa_{R}(\rho,T_{eff})$. For each $R^{i}$
and $T^{j}_{eff}$ reported in type 1 OPAL tables, we evaluate Equation B1 to
find $\rho^{ij}=\rho(T^{j}_{eff},R^{i})$. Opacities in $T_{eff}$, $R$ space
are then inferred as
$\kappa^{ij}_{R}(R^{i},T^{j}_{eff})=s(\rho^{ij},T^{j}_{eff})$.

As first-order validation of this interpolation scheme we can preform a
similar interpolation in the opposite direction, rotating the tables back to
$\kappa_{R}(\rho,T_{eff})$ and then comparing the initial, “raw”, opacities to
those which have gone through the interpolations process. Figure 13 shows the
fractional difference between the raw opacities and a set which have gone
through this double interpolation. The red line denotes $\log(R)=-0.79$ where
models near the Jao Gap mass range will tend to sit for much of their radius.
Along the $\log(R)=-0.79$ line the mean fractional difference is
$\langle\delta\rangle=0.005$ with an uncertainty of
$\sigma_{\langle\delta\rangle}=0.013$. One point of note is that, because the
initial rotation into $\log(R)$ space also reduces the domain of the opacity
function, interpolation-edge effects which we avoid initially by extending the
domain past what type 1 OPAL tables include cannot be avoided when
interpolating back into $\rho$ space.

Figure 13: Log Fractional Difference between opacities in
$\kappa_{R}(\rho,T_{eff})$ space directly queried from the OPLIB web-form and
those which have been interpolated into $\log(R)$ space and back. Note that,
due to the temperature grid of type 1 OPAL tables not aligning perfectly which
the temperature grid OPLIB uses there may be edge effects where the
interpolation is poorly constrained. The red line corresponds to
$\log(R)=-0.79$ where much of a stellar model’s radius exists.

## References

  * Amard et al. (2019) Amard, L., Palacios, A., Charbonnel, C., et al. 2019, A&A, 631, A77, doi: 10.1051/0004-6361/201935160
  * Bahcall et al. (2001) Bahcall, J. N., Pinsonneault, M. H., & Basu, S. 2001, ApJ, 555, 990, doi: 10.1086/321493
  * Bahcall et al. (2005) Bahcall, J. N., Serenelli, A. M., & Basu, S. 2005, ApJ, 621, L85, doi: 10.1086/428929
  * Baraffe & Chabrier (2018) Baraffe, I., & Chabrier, G. 2018, A&A, 619, A177, doi: 10.1051/0004-6361/201834062
  * Baraffe et al. (1997) Baraffe, I., Chabrier, G., Allard, F., & Hauschildt, P. H. 1997, A&A, 327, 1054.  https://arxiv.org/abs/astro-ph/9704144
  * Boudreaux (2022) Boudreaux, E. 2022, tboudreaux/pytopsscrape: pyTOPSScrape v1.0, v1.0, Zenodo, doi: 10.5281/zenodo.7094198
  * Chabrier & Baraffe (1997) Chabrier, G., & Baraffe, I. 1997, A&A, 327, 1039.  https://arxiv.org/abs/astro-ph/9704118
  * Chandra & Varanasi (2015) Chandra, R. V., & Varanasi, B. S. 2015, Python requests essentials (Packt Publishing Ltd)
  * Choi et al. (2016) Choi, J., Dotter, A., Conroy, C., et al. 2016, ApJ, 823, 102, doi: 10.3847/0004-637X/823/2/102
  * Colgan et al. (2016) Colgan, J., Kilcrease, D. P., Magee, N. H., et al. 2016, in APS Meeting Abstracts, Vol. 2016, APS Division of Atomic, Molecular and Optical Physics Meeting Abstracts, D1.008
  * Creevey et al. (2022) Creevey, O. L., Sordo, R., Pailler, F., et al. 2022, arXiv e-prints, arXiv:2206.05864.  https://arxiv.org/abs/2206.05864
  * Dierckx (1981) Dierckx, P. 1981, IMA Journal of Numerical Analysis, 1, 267, doi: 10.1093/imanum/1.3.267
  * Dotter et al. (2008) Dotter, A., Chaboyer, B., Jevremović, D., et al. 2008, The Astrophysical Journal Supplement Series, 178, 89
  * Feiden et al. (2021) Feiden, G. A., Skidmore, K., & Jao, W.-C. 2021, ApJ, 907, 53, doi: 10.3847/1538-4357/abcc03
  * Ferguson et al. (2005) Ferguson, J. W., Alexander, D. R., Allard, F., et al. 2005, ApJ, 623, 585, doi: 10.1086/428642
  * Fontes et al. (2015) Fontes, C. J., Zhang, H. L., Abdallah, J., J., et al. 2015, Journal of Physics B Atomic Molecular Physics, 48, 144014, doi: 10.1088/0953-4075/48/14/144014
  * Gaia Collaboration et al. (2021) Gaia Collaboration, Smart, R. L., Sarro, L. M., et al. 2021, A&A, 649, A6, doi: 10.1051/0004-6361/202039498
  * Grevesse & Sauval (1998) Grevesse, N., & Sauval, A. J. 1998, Space Sci. Rev., 85, 161, doi: 10.1023/A:1005161325181
  * Hakel et al. (2006) Hakel, P., Sherrill, M. E., Mazevet, S., et al. 2006, J. Quant. Spec. Radiat. Transf., 99, 265, doi: 10.1016/j.jqsrt.2005.04.007
  * Iglesias & Rogers (1996) Iglesias, C. A., & Rogers, F. J. 1996, ApJ, 464, 943, doi: 10.1086/177381
  * Irwin (2012) Irwin, A. W. 2012, FreeEOS: Equation of State for stellar interiors calculations, Astrophysics Source Code Library, record ascl:1211.002.  http://ascl.net/1211.002
  * Jao & Feiden (2020) Jao, W.-C., & Feiden, G. A. 2020, AJ, 160, 102, doi: 10.3847/1538-3881/aba192
  * Jao & Feiden (2021) —. 2021, Research Notes of the American Astronomical Society, 5, 124, doi: 10.3847/2515-5172/ac053a
  * Jao et al. (2018) Jao, W.-C., Henry, T. J., Gies, D. R., & Hambly, N. C. 2018, ApJ, 861, L11, doi: 10.3847/2041-8213/aacdf6
  * Jermyn et al. (2022) Jermyn, A. S., Bauer, E. B., Schwab, J., et al. 2022, arXiv e-prints, arXiv:2208.03651.  https://arxiv.org/abs/2208.03651
  * Joyce & Chaboyer (2018) Joyce, M., & Chaboyer, B. 2018, ApJ, 864, 99, doi: 10.3847/1538-4357/aad464
  * MacDonald & Gizis (2018) MacDonald, J., & Gizis, J. 2018, MNRAS, 480, 1711, doi: 10.1093/mnras/sty1888
  * Magee et al. (2004) Magee, N. H., Abdallah, J., Colgan, J., et al. 2004, in American Institute of Physics Conference Series, Vol. 730, Atomic Processes in Plasmas: 14th APS Topical Conference on Atomic Processes in Plasmas, ed. J. S. Cohen, D. P. Kilcrease, & S. Mazavet, 168–179, doi: 10.1063/1.1824868
  * Mansfield & Kroupa (2021) Mansfield, S., & Kroupa, P. 2021, A&A, 650, A184, doi: 10.1051/0004-6361/202140536
  * Nutzman & Charbonneau (2008) Nutzman, P., & Charbonneau, D. 2008, PASP, 120, 317, doi: 10.1086/533420
  * Richardson (2007) Richardson, L. 2007, April
  * Rodríguez-López (2019) Rodríguez-López, C. 2019, Frontiers in Astronomy and Space Sciences, 6, 76, doi: 10.3389/fspas.2019.00076
  * Seaton et al. (1994) Seaton, M. J., Yan, Y., Mihalas, D., & Pradhan, A. K. 1994, MNRAS, 266, 805, doi: 10.1093/mnras/266.4.805
  * Skrutskie et al. (2006) Skrutskie, M. F., Cutri, R. M., Stiening, R., et al. 2006, AJ, 131, 1163, doi: 10.1086/498708
  * Sollima (2019) Sollima, A. 2019, Monthly Notices of the Royal Astronomical Society, 489, 2377, doi: 10.1093/mnras/stz2093
  * Spada et al. (2021) Spada, F., Demarque, P., & Kupka, F. 2021, MNRAS, 504, 3128, doi: 10.1093/mnras/stab1106
  * Trampedach et al. (2014) Trampedach, R., Stein, R. F., Christensen-Dalsgaard, J., Nordlund, Å., & Asplund, M. 2014, MNRAS, 445, 4366, doi: 10.1093/mnras/stu2084
  * van Saders & Pinsonneault (2012) van Saders, J. L., & Pinsonneault, M. H. 2012, ApJ, 751, 98, doi: 10.1088/0004-637X/751/2/98
  * Virtanen et al. (2020) Virtanen, P., Gommers, R., Oliphant, T. E., et al. 2020, Nature Methods, 17, 261, doi: 10.1038/s41592-019-0686-2