Skip to content
This repository was archived by the owner on Jul 3, 2025. It is now read-only.

Commit 1d5f617

Browse files
committed
net rate
1 parent 8a5b37a commit 1d5f617

File tree

3 files changed

+124
-0
lines changed

3 files changed

+124
-0
lines changed

statmechcrack/core.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,3 +451,29 @@ def k_b(self, p_or_v, lambda_, ensemble='isometric'):
451451
elif ensemble == 'isotensional':
452452
k_b = self.k_b_isotensional(p_or_v, lambda_)
453453
return k_b
454+
455+
def k_net(self, p_or_v, ensemble='isometric'):
456+
r"""The nondimensional net reaction rate coefficient
457+
as a function of the nondimensional end force
458+
or the nondimensional end separation.
459+
460+
Args:
461+
p_or_v (array_like):
462+
The nondimensional end force or position. Assumed to be
463+
the end separation for the isometric ensemble and
464+
the end force for the isotensional ensemble.
465+
ensemble (str, optional, default='isotensional'):
466+
The thermodynamic ensemble.
467+
468+
Returns:
469+
numpy.ndarray: The nondimensional net reaction rate.
470+
471+
Note:
472+
Only the asymptotic approach is currently available.
473+
474+
"""
475+
if ensemble == 'isometric':
476+
k_net = self.k_net_isometric(p_or_v)
477+
elif ensemble == 'isotensional':
478+
k_net = self.k_net_isotensional(p_or_v)
479+
return k_net

statmechcrack/isometric.py

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,55 @@ def k_isometric(self, v, approach='asymptotic', **kwargs):
308308
k_isometric = self.k_isometric_monte_carlo(v, **kwargs)
309309
return k_isometric
310310

311+
def k_net_isometric(self, v):
312+
r"""The nondimensional net reaction rate coefficient
313+
as a function of the nondimensional end separation
314+
in the isometric ensemble.
315+
316+
Args:
317+
v (array_like): The nondimensional end separation.
318+
319+
Returns:
320+
numpy.ndarray: The nondimensional net reaction rate.
321+
322+
Example:
323+
Plot the nondimensional net reaction rate coefficient
324+
as a function of the nondimensional end separation
325+
in the isometric ensemble
326+
for an increasing system size:
327+
328+
.. plot::
329+
330+
>>> import numpy as np
331+
>>> import matplotlib.pyplot as plt
332+
>>> from statmechcrack import Crack
333+
>>> Np = np.logspace(-1, np.log(6)/np.log(10), 33)
334+
>>> _ = plt.figure()
335+
>>> for N in [4, 8, 16, 64]:
336+
... model = Crack(N=N)
337+
... v = model.v(Np/N, ensemble='isometric')
338+
... _ = plt.semilogy(
339+
... 3*model.kappa*(v - 1)/N**2,
340+
... model.k_net_isometric(v),
341+
... label=r'$N=$'+str(N))
342+
>>> _ = plt.xlabel(r'$3\kappa\Delta v/N^2$')
343+
>>> _ = plt.ylabel(r'$k^\mathrm{net}/k_\mathrm{ref}$')
344+
>>> _ = plt.legend()
345+
>>> plt.show()
346+
347+
"""
348+
k_isometric = self.k_isometric(v, approach='asymptotic')
349+
model_2 = CrackIsometric(
350+
N=self.N + 1, M=self.M - 1, kappa=self.kappa,
351+
alpha=self.alpha, varepsilon=self.varepsilon
352+
)
353+
k_rev_isometric = (
354+
self.Q_isometric(v, transition_state=True)/model_2.Q_isometric(v)
355+
) / (
356+
self.Q_isometric(1, transition_state=True)/model_2.Q_isometric(1)
357+
)
358+
return k_isometric - k_rev_isometric
359+
311360
def Q_0_isometric(self, v, lambda_):
312361
r"""The nondimensional isometric partition function
313362
as a function of the nondimensional end separation

statmechcrack/isotensional.py

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,55 @@ def k_isotensional(self, p, approach='asymptotic', **kwargs):
304304
k_isotensional = self.k_isotensional_monte_carlo(p, **kwargs)
305305
return k_isotensional
306306

307+
def k_net_isotensional(self, p):
308+
r"""The nondimensional net reaction rate coefficient
309+
as a function of the nondimensional end force
310+
in the isotensional ensemble.
311+
312+
Args:
313+
p (array_like): The nondimensional end force.
314+
315+
Returns:
316+
numpy.ndarray: The nondimensional net reaction rate.
317+
318+
Example:
319+
Plot the nondimensional net reaction rate coefficient
320+
as a function of the nondimensional end force
321+
in the isotensional ensemble
322+
for an increasing system size:
323+
324+
.. plot::
325+
326+
>>> import numpy as np
327+
>>> import matplotlib.pyplot as plt
328+
>>> from statmechcrack import CrackIsotensional
329+
>>> Np = np.logspace(-1, np.log(6)/np.log(10), 33)
330+
>>> _ = plt.figure()
331+
>>> for N in [4, 8, 16, 64]:
332+
... model = CrackIsotensional(N=N)
333+
... _ = plt.semilogy(
334+
... Np, model.k_net_isotensional(Np/N),
335+
... label=r'$N=$'+str(N))
336+
>>> _ = plt.xlabel(r'$Np$')
337+
>>> _ = plt.ylabel(r'$k^\mathrm{net}/k_\mathrm{ref}$')
338+
>>> _ = plt.legend()
339+
>>> plt.show()
340+
341+
"""
342+
k_isotensional = self.k_isotensional(p, approach='asymptotic')
343+
model_2 = CrackIsotensional(
344+
N=self.N + 1, M=self.M - 1, kappa=self.kappa,
345+
alpha=self.alpha, varepsilon=self.varepsilon
346+
)
347+
k_rev_isotensional = (
348+
self.Z_isotensional(p, transition_state=True) /
349+
model_2.Z_isotensional(p)
350+
) / (
351+
self.Z_isotensional(0, transition_state=True) /
352+
model_2.Z_isotensional(0)
353+
)
354+
return k_isotensional - k_rev_isotensional
355+
307356
def Z_0_isotensional(self, p, lambda_):
308357
r"""The nondimensional isotensional partition function
309358
as a function of the nondimensional end force

0 commit comments

Comments
 (0)