# Neural Network Model for Structure Factor of Polymer Systems

Jie Huang  Department of Physics, Wenzhou University, Wenzhou, Zhejiang
325035, China  Xinghua Zhang<EMAIL_ADDRESS>School of Science, Beijing
Jiaotong University, Beijing 100044, China  Gang Huang  Institute of
Theoretical Physics, Chinese Academy of Sciences, Beijing 100190, China
Shiben Li<EMAIL_ADDRESS>Department of Physics, Wenzhou University,
Wenzhou, Zhejiang 325035, China

###### Abstract

As an important physical quantity to understand the internal structure of
polymer chains, the structure factor is being studied both in theory and
experiment. Theoretically, the structure factor of Gaussian chains have been
solved analytically, but for wormlike chains, numerical approaches are often
used, such as Monte Carlo (MC) simulations, solving modified diffusion
equation (MDE), etc. In those works, the structure factor needs to be
calculated differently for different regions of the wave vector and chain
rigidity, and some calculation processes are resource consuming. In this work,
by training a deep neural network (NN), we obtained an efficient model to
calculate the structure factor of polymer chains, without considering
different regions of wavenumber and chain rigidity. Furthermore, based on the
trained neural network model, we predicted the contour and Kuhn length of some
polymer chains by using scattering experimental data, and we found our model
can get pretty reasonable predictions. This work provides a method to obtain
structure factor for polymer chains, which is as good as previous, and with a
more computationally efficient. Also, it provides a potential way for the
experimental researchers to measure the contour and Kuhn length of polymer
chains.

Suggested keywords

††preprint: APS/123-QED

##  I Introduction

The structure factor of a polymer system defined as

$S(\mathbf{k})=\frac{1}{\rho}\int_{V}\langle\rho(\mathbf{r})\rho(0)\rangle\exp(i\mathbf{k}\cdot\mathbf{r})\mathrm{d}\mathbf{r}$
(1)

is a measurable physical property, which characterizes the density–density
correlation of the system.[1] In theory, the structure factor can be used in
field theory calculations. In the Gaussian fluctuation theory [2, 3], the
structure factor of the interacting system is calculated using the structure
factor of the ideal chain. Besides, in the dynamic mean-field theory, the
inter-chain correlation properties in the diffusion process [4, 5, 6] are also
described by the structure factor of the ideal chain. Experimentally, the
basic characteristics of polymers such as the degree of polymerization, the
rigidity, and the chirality can be analyzed by fitting the scattering data
with the structure factor. As for calculation, the structure factor can be
predicted from a microscopic chain model. The well-known expression of the
Gaussian chain model has a Debye function form[7] and can be used to analyze
the experimentally determined structure factor for a $\theta$-point dilute
polymer solution in a moderate to small wavenumber range, $ka\leq 1$, where
$a$ is the Kuhn length.

Besides, there is a large class of semiflexible polymer chains, where the
effects of finite rigidity are important, which cannot be described by the
Gaussian chain model. The wormlike chain model is one of the best semiflexible
chain model. In this model, the polymer is an inextensible thread subject to a
linear-elastic bending energy.[8] The configuration of a wormlike chain of
total length $L$ is described by a smooth space curve with its coordinate
specified by $\mathbf{R}(s)$, where s is an arc-variable continuously varying
from one end ($s=0$) to another ($s=1$).[7, 9, 10] The Boltzmann weight for
such a configuration is given by

$\mathscr{W}[\mathbf{R}(s)]=\exp\left[-\beta H_{0}\right]$ (2)

where

$\beta
H_{0}=\frac{a}{4L}\int_{0}^{1}\mathrm{d}s\left|\frac{\mathrm{d}\mathbf{u}(s)}{\mathrm{d}s}\right|^{2}+\frac{L}{a}\int_{0}^{1}\mathrm{d}sw[\mathbf{R}(s),\mathbf{u}(s)]$
(3)

The tangent vector
$\mathbf{u}(s)\equiv(1/L)\mathrm{d}\mathbf{R}(s)/\mathrm{d}s$ specifies the
local orientation of the polymer chain at location $s$. $u(s)$ is a unit
vector, and $|u(s)|=1$ due to the local inextensible constraint. The first
term describes an energy penalty for a bent curve. Originally, a bending
energy modulus $\beta\varepsilon$ was written as the coefficient; [9] upon
identification of the free-space mean-square radius of gyration with that of a
Gaussian chain in the large $L/a$ limit, we can show that the prefactor can be
written in the current form, where

$a=2\beta\varepsilon$ (4)

for a three-dimensional system. The Kuhn length $a$ is directly used here for
comparison with results calculated from a Gaussian-chain model. The wormlike
chain model involves two characteristic length scales: the length of chain
$L$, and the effective Kuhn length $a$.

The key to calculating the structure factor is the calculation of the Green’s
function (with $w=0$) in Eq.3. As it turns out, no analytic expression of the
Green’s function is available for the wormlike chain model, as indicated
earlier by Stepanow[11, 12], Spakowitz and Wang[13] as well as by Zhang[3,
14].

Kholodenko exploited the similarity between the Green’s function of the
semiflexible polymer model and the propagator of a Dirac’s fermion, in rigid
and flexible limits.[15, 16] The limits for Gaussian-chain and rod expressions
can be reproducible from the formula. It is by far the simplest, in comparison
with the approximations proposed earlier by Yoshizaki and Yamakawa[17] and
later by Pedersen and Schurtenberger.[18]

Pedersen and Schurtenberger performed a series of Monte-Carlo simulations of
such a chain, with and without the excluded-volume interaction between
monomers. The structure factor can then be obtained numerically from the
simulations.[18] They have provided an empirical formula to represent their
simulation data. More recently, Hsu and coworkers calculated the structure
factor of a semiflexible chain model on a simple cubic lattice, using Monte
Carlo simulations.[19, 20]

Spakowitz and Wang proposed an alternative approach; calculating the problem
of constrained one-dimensional random walk, they obtained the Green’s function
of a wormlike chain formally.[13] They re-grouped the random walk trajectories
according to the number of loops in a loop expansion of the problem. Based on
this consideration, the moment expansion can be expressed as an infinite
continued fraction. The calculation of the continued fraction problem is
equivalent to inverting a matrix that has the same format as the matrix used
in Stepanow’s work. To find the structure factor, however, one must go back to
the numerical treatment of the formalism; in particular, an inverse numerical
Laplace transformation is needed.[13, 21]

In our previous work[3], a numerical method to obtain the structure factor of
a homogenous wormlike polymer solution, based on the standard wormlike chain
model was obtained. We calculated the $s$-dependent Green’s function,
utilizing a formal solution to the modified diffuse equation(MDE)[10, 22] that
the Green’s function in Fourier space satisfies, and propagating the solution
as $s$ increases. This method was numerically more straightforward than some
other approaches suggested recently. And the solution captured the correct
physical behavior of the structure factor in the entire parameter space of
$L/a$ and $ka$.

The motivation of this work is twofold. First, we attempt to find a more
efficient formulation of structure factor for wormlike chains in the entire
parameter space of $L/a$ and $ka$, but the more direct way where we don’t need
to do any heavy calculation like Monte Carlo simulations or solve partial
differential equations. Second, we want to build a possible measure tool for
the scattering experiments of polymer chains. If scattering intensity data is
given, the contour length $L$ and Kuhn length $a$ can be easily obtained.

Recently, neural networks (NNs), as an important branch of machine
learning(ML), are widely used in polymer physics, such as classifying phases
of matter[23], solving nonlinear partial differential equations(PDE)[24],
predicting the structure of macromolecules[25], and polymer conformations
classification[26]. Since NN has been proven to be able to approximate almost
any functions[27], we do not need to find structure factor from the
perspective of guessing the analytic formula, but only need to use a NN to
replace it. To ensure the high accuracy of a NN model, a sufficient data set
is needed to train this NN. Fortunately, we can get numerous exact structure
factor data with different $ka$ and $L/a$ by using the method in Ref.[3]. By
training with a data set, we can get a trained NN model to calculate the
structure factor easily.

The outline of the rest of the paper is as follows. We first demonstrate how
to apply NN to structure factor fitting in section II, including the basic
introduction of NNs, the training task, the training process, and the
influence of NN architecture. Following this, we build a method to predict the
contour length $L$ and Kuhn length $a$ of polymer chains in section III by
using the trained NN.

##  II The neural network model for structure factor

###  II.1  A brief introduction to Neural Networks

Figure 1: (a) The mathematical model for a neuron. The unit’s output
activation is $a_{j}=g(\sum_{i=0}^{n}w_{i,j}a_{i})$, where $x_{i}$ is the
output of unit $i$ and $w_{i,j}$ is the weight on the link from unit $i$ to
this unit; (b) A fully connected NN with 3 hidden layers.

To begin with, we introduce some basic concepts of neural networks. NNs, also
called artificial neural networks(ANNs), are computing systems which can learn
to perform different tasks by considering example generally without being
programmed with task-specific rules. A NN is based on a collection of
connected nodes or units called _neurons_. As in Fig. 1, a link from neuron
$i$ to neuron $j$ serves to propagate the activation $a_{i}$ from $i$ to $j$.
Each link also has a numeric weight of $w_{i,j}$ associated with it, which
determines the strength and sign of the connection. And each neuron has a
dummy input $a_{0}=1$ with an associated weight $w_{0,j}$. Each neuron $j$
first computes a weighted sum of its inputs:

$in_{j}=\sum_{i=0}^{n}w_{i,j}a_{i}.$ (5)

Then it applies an activation function $g$ to this sum to derive the
output[28]:

$a_{j}=g(in_{j})=g\left(\sum_{i=0}^{n}w_{i,j}a_{i}\right).$ (6)

The nonlinear activation function is the key to the power of NN that allows it
to approximate almost any function. In this work, the sigmoid function was
used:

$g(z)=\frac{1}{1+e^{-z}}.$ (7)

Having decided on the mathematical model for the individual neurons, then a
fully connected NN can be obtained by connecting them. As shown in Fig. 1, a
fully connected NN is arranged in layers, which can be divided into an input
layer, many hidden layers, and an output layer. Only the input layer doesn’t
participate in the calculation in Eq. 6. There can be many neurons on each
layer. Any neuron in the hidden layer and output layer is connected to all
neurons in the previous layer.

A NN can be viewed as a mapping $h$ from its input $\mathbf{x}$ to its output
$h_{\mathbf{w}}(\mathbf{x})$, where $\mathbf{w}$ is the collection of all the
weights in this NN. By changing $\mathbf{w}$, different $h$’s can be obtained.
The process of tuning $\mathbf{w}$ to approximate another function $f$ is
called _training_ the NN. And we train the NN by showing lots of input-output
pairs repeatedly to the NN so that it can gradually _learn_ the mapping from
the input to output by tuning the $\mathbf{w}$. The input-out pairs constitute
a _training set_ , and this type of learning is called _supervised_ learning.

To be more specific, the training task can be described as follows. Given a
training set of N example input-output pairs
$(\mathbf{x}_{1},y_{1}),...,(\mathbf{x}_{j},y_{j}),...,(\mathbf{x}_{N},y_{N})$,
where $\mathbf{x}_{j}=((L/a)_{j},(ka)_{j})^{T}$, and $y_{j}$ was generated by
the method in [3]

$y=f(\mathbf{x})=(L/a){(ka)}^{2}S(L/a,ka),$ (8)

find a function $h$ that approximates the function $f$. The way to train the
NN is by following. At first, we defined a loss function,

$Loss(\mathbf{w})=\frac{1}{N}\sum_{x}\|f(x)-h_{\mathbf{w}}(x)\|^{2}$ (9)

which indicates how far away the $h$ is from the objective function $f$. By
training the NN, we’d like to find the weights $\mathbf{w}^{*}$ so that the
loss function over the examples could be minimized, i.e.,

$\mathbf{w^{*}}=\arg\min_{\mathbf{w}}Loss(\mathbf{w}).$ (10)

There are many optimization algorithms, also called _optimizer_ s, to find
$\mathbf{w^{*}}$, but the basic idea can be expressed as follows. The weight
$w_{i}$ is updated by

$w_{i}\leftarrow
w_{i}-\alpha\frac{\partial{Loss(\mathbf{w})}}{\partial{w_{i}}},$ (11)

where $\alpha$ is the learning rate. In this work, we use an adaptive learning
rate optimizer called Adam[29] that is designed specifically for training NNs.
To increase training efficiency, the training set is usually divided into many
mini-batches. Each time a mini-batch is used to update $\mathbf{w}$. Besides,
the training set is used to update $\mathbf{w}$ many times. The process of
updating $\mathbf{w}$ using a training set once is also called an _episode_.

The training set for the structure factor of this work comes from the
numerical method in [3] which obtained an excellent agreement between the
structure factor computed from the method of infinite continuous fractions by
Spakowitz and Wang[13]. Compared with other methods like the Dirac propagator
approach[15] or Monte Carlo simulations [18], this method gives rise to the
precise determination of structure factor in the entire $L/a$–$ka$ space
($L/a,ka\in[10^{-2},10^{3}]$), especially in low and large $L/a$ regime, so
that it laid the foundation for reliable training set.

In [3], the polynomial $(L/a)(ka)^{2}S$ is a function with $L/a$ and $ka$ as
arguments. We consider the $\mathbf{x}=(L/a,ka)^{T}$ and the corresponding
$(L/a)(ka)^{2}S$ as a training sample. For each $L/a$, 100 points for $ka$ in
$[10^{-2},10^{3}]$ are uniformly sampled on $\text{ln}(ka)$. Similarly, 100
points for $L/a$ in $[10^{-2},10^{3}]$ are uniformly sampled on
$\text{ln}(L/a)$. Therefore, 10,000 training samples were obtained, which
covers the entire domain of $ka$ and $L/a$ described by wormlike chain model.

###  II.2  Training results of the NN model

By using Tensorflow, we chose Adam optimizer with a fixed learning rate of
$10^{-5}$, $4$ hidden layers, and $25$ neurons per layer. After $6\times
10^{5}$ epochs of training, the loss value $L$ was reduced to $6.9\times
10^{-7}$.

Figure 2: Structure factor comparison between the target values (circles,
triangles, etc) and trained NN predictions (lines) in logarithmic coordinates
with $4$ hidden layers and $25$ nodes on each hidden layer with
$Loss=6.92\times 10^{-7}$.

To demonstrate the effectiveness of the structure factor in the form of NN, in
Fig. 2, we’ve plotted the NN model predictions of 5 different rigidities with
$L/a=10^{-1},10^{0},10^{1},10^{2}$ and $10^{3}$. For comparison, we also made
the solution of the structure factor given by [3] denoted by circles,
triangles, etc. The NN can well represent the structure factor for different
rigidities for the entire $k$ range, and consistent with the exact result
obtained by the method proposed by [3].

Figure 3: Structure factor comparison between the target values (circles,
triangles,etc.) and trained NN predictions (lines) in linear coordinates. (a)
$ka<1$; (b) $ka\in[1,10]$; (c) $ka\in[10,100]$; (d) $ka\in[100,1000]$.

To further verify the fitting results of the trained NN, we made comparisons
at different scales in linear coordinates. As shown in Fig. 3, $a$, $b$, $c$,
and $d$ respectively correspond to different $ka$ regions
$[10^{-2},10^{-0}],[10^{0},10^{1}],[10^{1},10^{2}],[10^{2},10^{3}]$, where the
solid lines are the values given by the NN model, and the circles, triangles,
etc are the solutions from [3]. It can be concluded that the NN model can give
highly accurate structure factor values in the _entire_ $L/a-ka$ space.
Therefore, our model also has a good description of rigid and semi-rigid
polymer chains, which is of practical significance, such as fluctuation theory
and scattering experiment.

What is more important is that our trained NN model can provide a continuous
function of structure factor in entire $L/a$–$ka$ space through the limited
discrete training samples. As shown in Fig. 4, a continuous $(L/a)(ka)^{2}S$
plane in logarithmic coordinates is obtained. This result indicates that given
_any_ $L/a$–$ka$ pair, the structure factor can be predicted directly. Also,
we can easily calculate the values of _multiple_ structure factors
_simultaneously_ , so the NN model greatly improves the calculation
efficiency.

Figure 4:  The continuous surface of $(L/a)(ka)^{2}S$ generated by the trained
NN model .

###  II.3 The effect of network structure

Hyperparameters, such as the number of neurons, the number of layers,
optimizer, and learning rate, are also important in the training. In this
work, we focused on the effect of the number $H$ of hidden layers and the
number $N$ of neurons in each hidden layer.

To simplify the parameter adjustment process, we have made the number of nodes
on each hidden layer the same. To study the effect of $H$ on the fitting
results, we fixed $N$, then we used four values of $H$ ($1,2,4,8$) to get four
network structures. Finally, we have separately trained the NNs.

Figure 5:  Time dependence of the loss function for different number $H$ of
hidden layers ($N=128$).

Fig. 5 shows the change of $Loss$ in four independent pieces of training when
the total number $N$ of hidden layer nodes is fixed at $128$. At the end of
training, episode $\sim 900000$, the $Loss$ for $H=2,4$ is less than that for
$H=1,8$. This result indicates that when $N$ is fixed, too many or too few
hidden layers will lower the performance of the trained NN model. Therefore,
choosing the appropriate $H$ can help make the model converge faster.

Table 1:  The comparison of $Loss$ for different $N$ and $H$ after $9\times 10^{5}$ episodes of training.  | $N=32$ | $N=64$ | $N=128$ | $N=256$
---|---|---|---|---
$H=1$ | $1.531\times 10^{-5}$ | $8.059\times 10^{-6}$ | $5.607\times 10^{-6}$ | $7.129\times 10^{-6}$
$H=2$ | $1.423\times 10^{-6}$ | $6.197\times 10^{-7}$ | $1.024\times 10^{-6}$ | $1.644\times 10^{-6}$
$H=4$ | $3.847\times 10^{-6}$ | $1.680\times 10^{-6}$ | $9.017\times 10^{-7}$ | $5.411\times 10^{-7}$
$H=8$ | $2.597\times 10^{-4}$ | $1.918\times 10^{-5}$ | $3.109\times 10^{-6}$ | $2.005\times 10^{-6}$

To further test the effect of $N$, we trained the NN with $N=32,64,128$ and
$256$, respectively. In Appendix. B, the corresponding episode dependence of
the $Loss$ for different $N$ are shown. In Table. 1, we listed the $Loss$
values at the end of training when $episode=900000$, with different $N$ and
$H$. From the table, we noticed that for all $N$, the $Loss$ for $H=2,4$ are
smaller than that for $H=1,8$. Therefore, there must be an optimal H value
between $[H_{\text{min}},H_{\text{max}}]$, which is $[1,8]$ in our case. In
addition, as $N$ increases, the loss value decreases more, which means the
training processes can converge faster and can get more accurate prediction
results.

##  III Predict the contour length and Kuhn length of polymer chains

Small-Angle Neutron Scattering (SANS) is a widely used technique to study the
structure of polymers. In SANS, the scattering intensity $I$ is measured as a
function of the length of the scattering vector $q$. The structure factor of
wormlike chains in NN formation developed in present work is an exact
formation. Any previous approximation formations used to analyze the
scattering experiments can be replaced by the NN formation directly. In this
part, we used some public scattering intensity data of polymers from the SANS
experiment as examples to demonstrate the uses of the trained NN model, and
then predicted the two important parameters of polymer chains, the contour
length $L$ and Kuhn length $a$.

###  III.1 Method

The scattering intensity of a polymer chain can be fitted using the following
equation[18, 30]

$I_{p}(q)=cP(q)S(q)$ (12)

where $c$ is a scaling factor and $S(q)$ is structure factor obtained by the
NN model, and

$P(q)=\left[\frac{2J_{1}(Rq)}{Rq}\right]^{2}$ (13)

is the form factor, where $J_{1}(x)$ is the first order Bessel function and
$R$ is the cross-section radius. We approximated the finite cross section of
the polymer chains into a cylinder with a radius of $R$ and a length of
$a$.[18] The structure factor $S$ is determined by the parameter $L$ and $a$,
and the form factor $P$ is determined by $R$. Thus there are four fitting
parameters: contour length $L$, Kuhn length $a$, radius $R$, and the scaling
factor $c$.

We can use Eq.12 to fit the SANS data by changing the parameters $L,a,R,c$.
Define

$\epsilon(a,L,R,c)=\frac{1}{N}\sum_{i=1}^{N}\left(I_{p}^{i}(a,L,R,c)-I^{i}\right)^{2}$
(14)

as the optimizing target, in which $I$ is the scattering intensity of a
polymer chain obtained by the SANS and $I_{p}$ is the scattering intensity
predicted by our NN model. The parameters $a,L,R,c$ need to be adjusted to
make the predicted scattering intensity $I_{p}(q)$ and the measured one $I(q)$
as close as possible. When $\epsilon$ is small enough, the optimal parameters
$L^{*},a^{*},R^{*},c^{*}$ can be obtained. Therefore, we predicted the contour
length ($L^{*}$) and Kuhn length ($a^{*}$) of the polymer chain.

There are multiple fitting parameters in the formula Eq.14, which will bring
difficulties to the fitting of experimental data, especially in scattering
data with fluctuations. The approximated structure factor of the chain in
solution, Eq.14, is approximated by modified the ideal chain structure factor.
To describe the effects of chain thickness and the solvent-monomer and
monomer-monomer interaction etc, some additional parameters have to be
introduced in the formulation. There are many approximated formulations used
in the scattering experiments in the literatures[18, 31, 32]. The prerequisite
of these formulations is the structure factor of the ideal wormlike chain
model. The major purpose of the present work is to develop an accurate
structure factor formulation of the ideal wormlike chain model.

###  III.2 Discussions

Using the method in III.1, given the SANS intensity data of polymer chains, we
can determine the contour lengths and Kuhn lengths. Two examples are given
below.

####  III.2.1 Polystyrene

The scattering intensity data of atactic polystyrene (PS) in carbon disulfide
(CS2) with different selective deuteration of the polymer have been determined
by Rawiso, Duplessix, and Picot [33] using SANS. As shown in Fig. 6, we have
used two sets of scattering intensity data sets for the phenyl ring
deuterated(Exp1: circle dots) and fully deuterated (Exp2: triangle dots) PS.
In Table 2, the Kuhn lengths $a$ are determined to $22.38$ and $22.17$ Å
respectively , which are in good agreement with the previous determinations
for SANS data($22\sim 27$ Å). And the contour lengths $L$ are $1300$ and
$1574$ Å for Exp1 and Exp2 respectively. These results are also in good
agreement with the values $1360$ and $1810$ Å in [18].

Figure 6:  Scattering intensities comparison between the SANS data and the trained NN model prediction for PS with molecular wight $M_{w}$ of 50000 in CS2. The Exp1 is for the phenylring deuterated PS, and the Exp2 is for fully deuterated PS.  Table 2:  Fig. 6 The predictions of $L$ and $a$ (unit: Å)for PS.  | Upper | Lower
---|---|---
Reasonable Target Value $L$ 111These values was calculated from molecular weights and the structure taking into account the polydispersity.[18] | $1360$ | $1810$
NN $L$ | $1300.03$ | $1573.76$
Reasonable target value $a$ | $22\sim 27$ | $22\sim 27$
NN $a$ | $22.38$ | $22.17$
$\epsilon$ 222$\epsilon$ is fitting error defined in 14 | $0.00068$ | $0.0013$

####  III.2.2 Poly(3-(2’-ethyl)hexylthiophene)

Another set of scattering intensity data of polymer chain P3EHT4 is from the
experiments of Bryan McCulloch et. al.[32] Note that they proposed a very
novel model of SANS intensity, the polydispersity-corrected wormlike chain
model

$I(q)=K\int_{n=0}^{n=\infty}w_{i}g\left(u_{ni}\right)n_{i}\mathrm{d}n_{i}+I_{\mathrm{inc}}$
(15)

where the structure factor is denoted by $g$ in [32]

$\displaystyle g(u)$
$\displaystyle=\frac{2}{u^{2}}\left(u-1+\mathrm{e}^{-u}\right)+$ (16)
$\displaystyle\frac{2}{5q^{2}L^{2}}\left[4u-11u\mathrm{e}^{-u}+7\left(1-\mathrm{e}^{-u}\right)\right],$

$w_{i}$ is the weight fraction at a particular molecular weight, and

$\displaystyle
u=q^{2}R_{\mathrm{g}}^{2}=q^{2}\left[\frac{Ll_{\mathrm{p}}}{3}-l_{\mathrm{p}}+\frac{2l_{\mathrm{p}}^{3}}{L}\left(1-\frac{l_{\mathrm{p}}}{L}+\frac{l_{\mathrm{p}}}{L}\mathrm{e}^{-L/l_{\mathrm{p}}}\right)\right],$

where $l_{p}$ is the persistence length.

In principle, we can directly use the structure factor $S$ obtained by our
trained NN model to replace $g$ in Eq.15, and then fit the contour length and
Kuhn length of P3EHT4. However, due to the lack of the original absolute
molecular weight distribution of P3ETH4, we did not use Eq. 15 to fit the SANS
intensity data in this work. Alternatively, we have made a comparison chart of
$(L/a)(ka)^{2}S$ and $(L/a)(ka)^{2}g$ with Kuhn length $a=10$, to compare the
structure factor $S$ from NN model and $g$ in Eq. 16.

Figure 7:  The structure factor comparison between trained NN model (lines)
and the wormlike chain model $g$ (circles, triangles, and etc.)[32].

And we found when $L/a>1$, $ka<10$, the $S$ of the NN model and the $g$ in Eq.
16 matched well as shown in Fig. 7. Specifically, because $g$ is deduced from
the formula of the flexible chain model and uses an approximate form at large
$k$. Therefore, for flexible polymer chains($L/a=10^{1},10^{2},10^{3}$), $g$
gives a good description of structure factor when $ka<10^{0}$. But for large
$ka$ ($ka>10^{1}$), $g$ describes the chain not very well. In addition, for
semi-rigid polymer chains ($L/a=10^{0}$), $g$ is good when $k$ is small, but
it is not good enough when $k>10^{0}$. In fact, the semi-rigid chain is the
key in many cases. Besides, $g$ can not describe the structure factor of rigid
chains($L/a<10^{-1}$), because the approximation for the rigid chains is not
good enough. The origin of $g$ here and the structure factor put by
Pedersen[18] and Kholodenko[31] are very similar. But their structure factor
models can provide a better description in the rigid limit and the large $k$
limit.

As described in section II, our NN model can give precise predictions of $S$
in the entire $L/a$–$ka$ space. Therefore, we expect the same fitting results
as [32], if $g$ in the Eq. 15 is replaced by $S$. Nevertheless, the Kuhn
length $a$ of P3EHT4 determined by the intensity model we used in Eq.12 is
$5.013$ Å with $\epsilon$ minimized.

As shown in Fig. 8, the intensity $I_{p}(q)$ calculated from our NN model fits
very well with the SANS intensity $I(q)$.

Figure 8:  Scattering intensities comparison between the SANS data and the
prediction of different model including Debye, Wormlike chain(PDI
Corrected)[32] and the NN model for P3EHT-4.

##  IV Summary

We have developed an efficient model for the structure factor of a wormlike
chain polymer by training a fully connected NN. Our NN model is of the
following characters: (a) High-precision, continuous numerical solutions in
the entire $L/a$–$ka$ space can be obtained easily; (b) It is highly
consistent with the calculations in previous numerical and analytical
method[3]. Besides, we also proposed one application of the model. Combining
SANS intensity data we can determine the contour length and Kuhn length of
polymer chains. Therefore, our NN model may provide a potential tool for
exploring the properties of polymer chains for experimental researchers.

##  Appendix A Structure factor obtained by interpolation

Due to the monotonicity of the $(L/a)(ka)^{2}S$-surface, the structure factor
may also be obtained by using suitable interpolation algorithms. In addition
to using the NN, we also use two interpolation algorithms to accelerate the
computation of the structure factor. In these two interpolation algorithms, we
use the _same_ data points as described in Sec. II.1.

We found that interpolation algorithms approximately give the numerical
solution of the structure factor in the entire $ka$, $L/a$ space. As shown in
Fig.9, (a) uses the nearest-neighbor method, (b) uses the cubic-spline method.
The $(L/a)(ka)^{2}S$-surface obtained by the nearest-neighbor method in Fig. 9
is less smooth than that by the cubic-spline method in Fig. 9. And the
structure factor surface obtained by the cubic-spline method is closer to the
solution of the MDE and the NN model. The interpolation works well at the
small and large $k$ limits where the fractal dimension of wormlike chains can
be well determined. For the medium range $k$ condition and semiflexible chain
condition, $S$ varies rapidly. More data are required for the interpolation.

Figure 9: The surface of $(L/a)(ka)^{2}S$ obtained by interpolation. (a)
Nearest-neighbor method; (b) Cubic-spline method.

##  Appendix B Loss Fuction For Different $N$

Fig.10 shows how the loss function changes for different $N$.

Figure 10: Time dependence of the loss function for different $H$ and $N$ of
the NN. (a) $N=32$; (b) $N=64$; (c) $N=128$ and (d) $N=256$.

##  Appendix C Structure Factor

In this appendix, we list some analytical expressions of the structure factor
in different methods.

###  C.1 Kholodenko

In [15], the structure factor $S$ is obtained which correctly reproduces the
rigid-rod and random-coil limits and is given analytically by

$S(k)=\frac{2}{x}\left[I_{(1)}(x)-\frac{1}{x}I_{(2)}(x)\right]$ (17)

where $I_{(\mathrm{n})}(x)=\int_{0}^{x}f(z)z^{n-1}\mathrm{d}z$, $n=1,2$,
$x=3L/a$,

$f(z)=\left\\{\begin{array}[]{ll}\frac{1}{E}\frac{\sinh(Ez)}{\sinh z}&(k\leq
3/2\mathrm{a})\\\ \frac{1}{\hat{E}}\frac{\sin(\hat{E}z)}{\sinh
z}&(k>3/2\mathrm{a})\end{array}\right.$ (18)

and

$E=\left[1-\left(\frac{2}{3}ak\right)^{2}\right]^{1/2},\hat{E}=\left[\left(\frac{2}{3}ak\right)^{2}-1\right]^{1/2}.$
(19)

###  C.2 Pederson and Schurtenberger

In [18] , the structure factor of a semiflexible chain is given by

$S=S_{\mathrm{SB}}P+S_{\mathrm{loc}}(1-P)$ (20)

where

$S_{\mathrm{loc}}=\frac{c_{1}}{Laq^{2}}+\frac{\pi}{Lq}$ (21)

is the approximate scattering function at high $q$ suggested by Burchard and
Kajiwara[34],

$S_{\mathrm{SB}}=S_{\mathrm{Debye}}+\frac{c_{2}a}{L}\left[\frac{4}{15}+\frac{7}{15x}-\left(\frac{11}{15}+\frac{7}{15x}\right)\exp(-x)\right]$
(22)

is the scattering function calculated for the Daniels approximation by Sharp
and Bloomfield[35], and

$P=\exp\left[-\left(\frac{qa}{q_{1}}\right)^{p_{1}}\right]$ (23)

where $q_{1}$ and $p_{1}$ are empirical constants. In Eq. 22,

$S_{\mathrm{Debye}}(x)=\frac{2}{x^{2}}[\exp(-x)+x-1]$ (24)

is the scattering function given by Debye function[36], with $x\equiv
R_{g}^{2}q^{2}$, and

$R_{g}^{2}=\frac{La}{6}\left\\{1-\frac{3a}{2L}+\frac{3a^{2}}{2L^{2}}-\frac{3a^{3}}{4L^{3}}\left[1-\exp\left(-\frac{2L}{a}\right)\right]\right\\}.$
(25)

The parameters depend on the $L/a$. For $L/a>2$,
$c_{1}=1,c_{2}=1,p_{1}=5.33,q_{1}=5.53,R_{g}^{2}=La/6$. For $L/a\leq 2$,
$c_{1}=0.0625,c_{2}=0,p{1}=3.95,q_{1}=11.7a/L$.

###### Acknowledgements.

This research was supported by the Program of National Natural Science
Foundation of China (NSFC) (Grant Nos. 21973070, 21774013, 21574011) and
Beijing Natural Science Foundation (2182057). The authors also wish to express
their appreciation for Jeff Z. Y. Chen for his valuable suggestions. JH thanks
Ying Jiang for his helpful guidance and discussion.

## Data availability statement

The data that support the findings of this study are available from the
corresponding author upon reasonable request.

## References

  * Svergun [1987] D. I. Svergun,  _Structure Analysis by Small-Angle X-Ray and Neutron Scattering_ , edited by G. W. Taylor (1987).
  * Bu and Zhang [2016] X. Bu and X. Zhang, Scattering and gaussian fluctuation theory for semiflexible polymers, Polymers 8, 10.3390/polym8090301 (2016).
  * Zhang  _et al._ [2014] X. Zhang, Y. Jiang, B. Miao, Y. Chen, D. Yan, and J. Z. Chen, The structure factor of a wormlike chain and the random-phase-approximation solution for the spinodal line of a diblock copolymer melt, Soft Matter 10, 5405 (2014).
  * Chen  _et al._ [2020] X. Chen, S. Qi, X. Zhang, and D. Yan, Influence of Small-Scale Correlation on the Interface Evolution of Semiflexible Homopolymer Blends, ACS Omega 5, 7593 (2020).
  * Qi  _et al._ [2010] S. Qi, X. Zhang, and D. Yan, External potential dynamic studies on the formation of interface in polydisperse polymer blends, Journal of Chemical Physics 132, 10.1063/1.3314730 (2010).
  * Zhang  _et al._ [2012] X. Zhang, S. Qi, and D. Yan, Spinodal assisted growing dynamics of critical nucleus in polymer blends, Journal of Chemical Physics 137, 10.1063/1.4765371 (2012).
  * M. Doi; S. F. Edwards [1986] M. Doi; S. F. Edwards,  _Journal of Polymer Science Part C: Polymer Letters_, Vol. 27 (1986) p. 391.
  * Landau  _et al._ [1986] L. D. Landau, E. M. Lifshitz, J. B. Sykes, W. H. Reid, and E. H. Dill,  _Physics Today_ (Pergamon, New York, 1986).
  * Saitô  _et al._ [1967] N. Saitô, K. Takahashi, and Y. Yunoki, The Statistical Mechanical Theory of Stiff Chains, Journal of the Physical Society of Japan 22, 219 (1967).
  * Karl F. Freed [1972] Karl F. Freed, Advances in Chemical Physics Advances in Chemical Physics, 22, 10.1002/9780470143728 (1972).
  * Stepanow [2004] S. Stepanow, Statistical mechanics of semiflexible polymers, European Physical Journal B 39, 499 (2004).
  * Stepanow [2005] S. Stepanow, On the behaviour of the short Kratky–Porod chain, J. Phys.: Condens. Matter 17, 1799 (2005).
  * Spakowitz and Wang [2004] A. J. Spakowitz and Z.-G. Wang, Exact Results for a Semiflexible Polymer Chain in an Aligning Field, Macromolecules 37, 5814 (2004).
  * Yang  _et al._ [2016] Y. Yang, X.-y. Bu, and X. Zhang, Structure factor based on the wormlike-chain model of single semiflexible polymer, Acta Polymerica Sinica , 1002 (2016).
  * Kholodenko [1993] A. L. Kholodenko, Analytical calculation of the scattering function for polymers of arbitrary flexibility using the Dirac propagator, Macromolecules 26, 4179 (1993).
  * Kholodenko [1990] A. L. Kholodenko, Fermi-bose transmutation: From semiflexible polymers to superstrings, Annals of Physics 202, 186 (1990).
  * Yoshizaki and Yamakawa [1980] T. Yoshizaki and H. Yamakawa,  _Macromolecules_, Tech. Rep. (1980).
  * Pedersen and Schurtenberger [1996] J. S. Pedersen and P. Schurtenberger, Scattering functions of semiflexible polymers with and without excluded volume effects, Macromolecules 29, 7602 (1996).
  * Hsu  _et al._ [2012] H. P. Hsu, W. Paul, and K. Binder, Scattering function of semiflexible polymer chains under good solvent conditions, Journal of Chemical Physics 137, 10.1063/1.4764300 (2012).
  * Hsu  _et al._ [2013] H. P. Hsu, W. Paul, and K. Binder, Estimation of persistence lengths of semiflexible polymers: Insight from simulations, Polymer Science - Series C 55, 39 (2013), arXiv:1303.2543 .
  * Mehraeen  _et al._ [2008] S. Mehraeen, B. Sudhanshu, E. F. Koslover, and A. J. Spakowitz, End-to-end distribution for a wormlike chain in arbitrary dimensions, Physical Review E - Statistical, Nonlinear, and Soft Matter Physics 77, 10.1103/PhysRevE.77.061803 (2008).
  * Liang  _et al._ [2013] Q. Liang, J. Li, P. Zhang, and J. Z. Chen, Modified diffusion equation for the wormlike-chain statistics in curvilinear coordinates, Journal of Chemical Physics 138, 10.1063/1.4811515 (2013).
  * Van Nieuwenburg  _et al._ [2017] E. P. Van Nieuwenburg, Y. H. Liu, and S. D. Huber, Learning phase transitions by confusion, Nature Physics 13, 435 (2017), arXiv:1610.02048 .
  * [24] M. Raissi, P. Perdikaris, and G. E. Karniadakis,  _Physics Informed Deep Learning (Part I): Data-driven Solutions of Nonlinear Partial Differential Equations_, Tech. Rep., arXiv:arXiv:1711.10561v1 .
  * Li  _et al._ [2019] J. Li, H. Zhang, and J. Z. Chen, Structural prediction and inverse design by a strongly correlated neural network, Physical Review Letters 123, 108002 (2019).
  * Vandans  _et al._ [2020] O. Vandans, K. Yang, Z. Wu, and L. Dai, Identifying knot types of polymer conformations by machine learning, Physical Review E 101, 1 (2020).
  * Cybenko [1989] G. Cybenko, Approximation by superpositions of a sigmoidal function, Mathematics of Control, Signals, and Systems 2, 303 (1989).
  * Norvig and Russell [2010] P. Norvig and S. J. Russell,  _Artificial Intelligence A modern Approach_ , 3rd ed. (Pearson Education, US, 2010).
  * Kingma and Ba [2015] D. P. Kingma and J. L. Ba, Adam: A method for stochastic optimization, 3rd International Conference on Learning Representations, ICLR 2015 - Conference Track Proceedings , 1 (2015), arXiv:1412.6980 .
  * Hansen [2013] S. Hansen, Approximation of the structure factor for nonspherical hard bodies using polydisperse spheres, Journal of Applied Crystallography 46, 1008 (2013).
  * Kholodenko [1992] A. L. Kholodenko, Persistence length and related conformational properties of semiflexible polymers from Dirac propagator, The Journal of Chemical Physics 96, 700 (1992).
  * McCulloch  _et al._ [2013] B. McCulloch, V. Ho, M. Hoarfrost, C. Stanley, C. Do, W. T. Heller, and R. A. Segalman, Polymer chain shape of poly(3-alkylthiophenes) in solution using small-angle neutron scattering, Macromolecules 46, 1899 (2013).
  * Rawiso  _et al._ [1987] M. Rawiso, R. Duplessix, and C. Picot, Scattering Function of Polystyrene, Macromolecules 20, 630 (1987).
  * Burchard and Kajiwara [1970] W. Burchard and K. Kajiwara, The statistics of stiff chain molecules I. The particle scattering factor, Proceedings of the Royal Society of London. A. Mathematical and Physical Sciences 316, 185 (1970).
  * Sharp and Blooiufield [1968] P. Sharp and V. A. Blooiufield, Light Scattering from Wormlike Chains with Excluded Volume Effects, Biopolymers 1211, 1201 (1968).
  * Debye [1947] P. Debye, Molecular-weight determination by light scattering, Journal of Physical and Colloid Chemistry 51, 18 (1947).