HTPolyNet 2.16.0__py3-none-any.whl → 2.17.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- htpolynet/analysis/plot.py +43 -8
- htpolynet/analysis/utils.py +218 -0
- {htpolynet-2.16.0.dist-info → htpolynet-2.17.0.dist-info}/METADATA +3 -1
- {htpolynet-2.16.0.dist-info → htpolynet-2.17.0.dist-info}/RECORD +7 -7
- {htpolynet-2.16.0.dist-info → htpolynet-2.17.0.dist-info}/WHEEL +1 -1
- {htpolynet-2.16.0.dist-info → htpolynet-2.17.0.dist-info}/entry_points.txt +0 -0
- {htpolynet-2.16.0.dist-info → htpolynet-2.17.0.dist-info}/licenses/LICENSE +0 -0
htpolynet/analysis/plot.py
CHANGED
|
@@ -674,6 +674,7 @@ def do_tg_plots(phases,projdirs,outfile='tg.png',save_data='data.csv',n_points=[
|
|
|
674
674
|
Tgs=[]
|
|
675
675
|
spread=[]
|
|
676
676
|
span=[]
|
|
677
|
+
whole=[]
|
|
677
678
|
nproj=len(projdirs)
|
|
678
679
|
for i,phase in enumerate(phases):
|
|
679
680
|
p=phase['ladder']
|
|
@@ -712,7 +713,7 @@ def do_tg_plots(phases,projdirs,outfile='tg.png',save_data='data.csv',n_points=[
|
|
|
712
713
|
means[i]['Density-std']=stds[i]['Density']
|
|
713
714
|
|
|
714
715
|
|
|
715
|
-
fig,ax=plt.subplots(1,2,figsize=(10,6),sharex=True,sharey=True)
|
|
716
|
+
fig,ax=plt.subplots(1,max(2,len(means)),figsize=(10,6),sharex=True,sharey=True)
|
|
716
717
|
for i,v in enumerate(means.keys()):
|
|
717
718
|
m=means[v]
|
|
718
719
|
std=stds[v]
|
|
@@ -720,6 +721,7 @@ def do_tg_plots(phases,projdirs,outfile='tg.png',save_data='data.csv',n_points=[
|
|
|
720
721
|
std['Density']=np.zeros(len(std['Density']))
|
|
721
722
|
m.sort_values('Temperature',axis=0,inplace=True)
|
|
722
723
|
ax[i].set_xlabel('Temperature [K]')
|
|
724
|
+
ax[i].set_title('heating' if rate[i]>0 else 'cooling')
|
|
723
725
|
ax[i].set_ylabel('Density [kg/m$^3$]')
|
|
724
726
|
if nproj<2:
|
|
725
727
|
ax[i].scatter(m['Temperature'],m['Density'])
|
|
@@ -728,6 +730,11 @@ def do_tg_plots(phases,projdirs,outfile='tg.png',save_data='data.csv',n_points=[
|
|
|
728
730
|
Tg,c,h=compute_tg(m['Temperature'],m['Density'],n_points=n_points)
|
|
729
731
|
Tgs.append(Tg)
|
|
730
732
|
spread.append(tg_window_range(m['Temperature'].values,m['Density'].values))
|
|
733
|
+
curves=[(r['Temperature'].values,r['Density'].values) for r in res[v]]
|
|
734
|
+
w=pooled_tg(curves)
|
|
735
|
+
if len(curves)==1 and w['fit'] is not None and not w['fit']['held_out']:
|
|
736
|
+
w['fit']=fit_tg_hyperbola(*curves[0],n_synth=200)
|
|
737
|
+
whole.append(w)
|
|
731
738
|
span.append((m['Temperature'].min(),m['Temperature'].max()))
|
|
732
739
|
if Tg!=-1:
|
|
733
740
|
ax[i].plot(m['Temperature'],c[0]*m['Temperature']+c[1],color='blue',alpha=0.5)
|
|
@@ -740,13 +747,15 @@ def do_tg_plots(phases,projdirs,outfile='tg.png',save_data='data.csv',n_points=[
|
|
|
740
747
|
logger.info(f'ladder{v}-{save_data} created.')
|
|
741
748
|
plt.savefig(outfile,bbox_inches='tight')
|
|
742
749
|
plt.close(fig)
|
|
743
|
-
|
|
744
|
-
|
|
750
|
+
# direction from the sign of the ladder's own deltaT, not its position in the
|
|
751
|
+
# config: a config listing cooling first was labeled "heating" (htpolynet-sweep,
|
|
752
|
+
# plan B on example 5, 2026-10-23)
|
|
753
|
+
labels=['heating' if r>0 else 'cooling' for r in rate]
|
|
745
754
|
logger.info(f'{outfile} created.')
|
|
746
|
-
|
|
747
|
-
|
|
755
|
+
for label,Tg,r in zip(labels,Tgs,rate):
|
|
756
|
+
logger.info(f'{label} Tg = {Tg:.2f} K ({(Tg-273.15):.2f} C) at {r:.5f} K/ps ({r*1.e12:.3e} K/s)')
|
|
748
757
|
unquotable=[]
|
|
749
|
-
for label,r,(lo,hi) in zip(
|
|
758
|
+
for label,r,(lo,hi) in zip(labels,spread,span):
|
|
750
759
|
if r is None:
|
|
751
760
|
continue
|
|
752
761
|
logger.info(f'{label} Tg over fit windows of 10-25 points per side: {r[0]:.0f} to {r[1]:.0f} K')
|
|
@@ -755,10 +764,36 @@ def do_tg_plots(phases,projdirs,outfile='tg.png',save_data='data.csv',n_points=[
|
|
|
755
764
|
logger.warning(f'the {label} Tg leaves the ladder\'s {lo:.0f}-{hi:.0f} K range for some fit '
|
|
756
765
|
f'windows, so the glassy and rubbery lines are nearly parallel and no '
|
|
757
766
|
f'{label} Tg can be read off this ladder; equilibrate longer before it')
|
|
758
|
-
|
|
767
|
+
for label,w in zip(labels,whole):
|
|
768
|
+
f=w['fit']
|
|
769
|
+
if f is None:
|
|
770
|
+
logger.info(f'{label} Tg, whole-curve fit: did not converge')
|
|
771
|
+
elif f['held_out']:
|
|
772
|
+
logger.info(f'{label} Tg, whole-curve fit: none ({f["reason"]})')
|
|
773
|
+
else:
|
|
774
|
+
if w['Tg_boot_sd'] is not None:
|
|
775
|
+
err=(f'+/- {w["Tg_boot_sd"]:.0f} K (uncertainty of the mean, bootstrap over '
|
|
776
|
+
f'{w["n_builds"]} builds); {w["n_kept"]} of {w["n_builds"]} builds give a Tg alone'
|
|
777
|
+
+ (f', s.d. {w["per_build_sd"]:.0f} K over those {w["n_kept"]} '
|
|
778
|
+
f'({w["n_kept"]}/{w["n_builds"]} kept)'
|
|
779
|
+
if w['per_build_sd'] is not None else ''))
|
|
780
|
+
elif f.get('Tg_synth_sd') is not None:
|
|
781
|
+
err=f'+/- {f["Tg_synth_sd"]:.0f} K within this build'
|
|
782
|
+
else:
|
|
783
|
+
err='no error bar'
|
|
784
|
+
logger.info(f'{label} Tg, whole-curve fit: {f["Tg"]:.1f} K {err}; tangents at the '
|
|
785
|
+
f'ladder ends cross at {f["Tg_tangents"]:.1f} K'
|
|
786
|
+
+ ('; a sharp break' if f['sharp'] else ''))
|
|
787
|
+
first={}
|
|
788
|
+
for i,label in enumerate(labels):
|
|
789
|
+
first.setdefault(label,i)
|
|
790
|
+
hTg=Tgs[first['heating']] if 'heating' in first else None
|
|
791
|
+
cTg=Tgs[first['cooling']] if 'cooling' in first else None
|
|
792
|
+
if hTg is not None and cTg is not None and abs(hTg-cTg)>50.0:
|
|
759
793
|
logger.warning(f'heating and cooling Tg differ by {abs(hTg-cTg):.0f} K; more than rate '
|
|
760
794
|
f'hysteresis explains, so treat at least one as a failed fit')
|
|
761
|
-
return {'heating':hTg,'cooling':cTg,'
|
|
795
|
+
return {'heating':hTg,'cooling':cTg,'directions':labels,'window_range':spread,
|
|
796
|
+
'unquotable':unquotable,'whole_curve':whole}
|
|
762
797
|
|
|
763
798
|
def do_E_plots(phases,projdirs,outfile='e.png',save_data='E.csv',fit_strain=None):
|
|
764
799
|
"""Fits Young's modulus to the deform stages and plots the mean stress-strain curve.
|
htpolynet/analysis/utils.py
CHANGED
|
@@ -11,6 +11,7 @@ import pandas as pd
|
|
|
11
11
|
|
|
12
12
|
from scipy.constants import physical_constants
|
|
13
13
|
from scipy.optimize import curve_fit
|
|
14
|
+
from scipy.stats import f as f_dist
|
|
14
15
|
|
|
15
16
|
from ..core.coordinates import Coordinates
|
|
16
17
|
from ..core.topocoord import TopoCoord
|
|
@@ -398,6 +399,223 @@ def tg_window_range(T,v,glassy=(10,15,20,25),rubbery=(10,15,20,25)):
|
|
|
398
399
|
tgs=[compute_tg(T,v,n_points=[c,h])[0] for c in glassy for h in rubbery if c+h<=n]
|
|
399
400
|
return (min(tgs),max(tgs)) if tgs else None
|
|
400
401
|
|
|
402
|
+
def _tg_hyperbola(T,rho0,T0,a,b,c):
|
|
403
|
+
"""rho0 + a (T-T0) + b H(T-T0), H(t) = t/2 + sqrt(t^2/4 + exp(c)).
|
|
404
|
+
|
|
405
|
+
Asymptotes: slope a well below T0 (glassy) and a+b well above (rubbery), crossing
|
|
406
|
+
at T0, which is Tg; exp(c/2) sets the width of the transition between them."""
|
|
407
|
+
t=np.asarray(T,dtype=float)-T0
|
|
408
|
+
return rho0+a*t+b*(0.5*t+np.sqrt(0.25*t*t+np.exp(c)))
|
|
409
|
+
|
|
410
|
+
def fit_tg_hyperbola(T,v,width_bounds=(1.0,200.0),P_hat=0.9,n_synth=0,seed=0):
|
|
411
|
+
"""Tg from one hyperbola fitted to the whole density (or volume) curve.
|
|
412
|
+
|
|
413
|
+
The two-line intersection of :func:`compute_tg` fits each side separately and
|
|
414
|
+
intersects them, so how many points each side gets moves Tg -- by 100 K or more on
|
|
415
|
+
some shipped examples. Following Patrone et al., Polymer 87, 246 (2016), a
|
|
416
|
+
hyperbola whose asymptotes are the glassy and rubbery lines is fitted to every point
|
|
417
|
+
at once, weighted by sigma_j proportional to T_j, and Tg is read off it two ways:
|
|
418
|
+
``Tg`` is T0, the hyperbola's center, and ``Tg_tangents`` is where its tangents at
|
|
419
|
+
the two ends of the ladder cross. When the data reach both asymptotes the two
|
|
420
|
+
agree; their gap is the paper's own check that they do.
|
|
421
|
+
|
|
422
|
+
The screening criterion (their Eqs. 4-5): the slope reaches a fraction P_hat of the
|
|
423
|
+
way between its asymptotes at T0 +/- DeltaT, DeltaT = e^(c/2) (2P-1)/sqrt(P(1-P)).
|
|
424
|
+
A ladder that does not extend past that interval on both sides does not contain the
|
|
425
|
+
asymptotic regimes, and its Tg is held out. Also held out: a width on its upper
|
|
426
|
+
bound, and a bend that does not beat a straight line (F-test, p > 0.01) -- a
|
|
427
|
+
straight line otherwise fits as a sharp break at a noise feature. A width on its lower
|
|
428
|
+
bound is kept and flagged ``sharp``: the fit is then a two-line fit with its break
|
|
429
|
+
where the misfit is least.
|
|
430
|
+
|
|
431
|
+
Args:
|
|
432
|
+
T (array-like): temperatures, K
|
|
433
|
+
v (array-like): density or volume
|
|
434
|
+
width_bounds (tuple): allowed e^(c/2), K
|
|
435
|
+
P_hat (float): slope convergence that defines the transition interval
|
|
436
|
+
n_synth (int): synthetic datasets for the within-build uncertainty (their
|
|
437
|
+
section 5.1): residuals give a noise level, rising as T, from which data
|
|
438
|
+
are redrawn about the fit and refitted; 0 skips it
|
|
439
|
+
seed (int): random seed for the synthetic data
|
|
440
|
+
|
|
441
|
+
Returns:
|
|
442
|
+
dict: Tg, Tg_tangents, Tg_se (from the covariance), Tg_synth_sd, glassy and
|
|
443
|
+
rubbery slopes, width, transition (T0-DeltaT, T0+DeltaT), sharp, held_out,
|
|
444
|
+
reason, params; None if the fit does not converge
|
|
445
|
+
"""
|
|
446
|
+
T=np.asarray(T,dtype=float); v=np.asarray(v,dtype=float)
|
|
447
|
+
o=np.argsort(T); T,v=T[o],v[o]
|
|
448
|
+
p,cov=_fit_hyperbola(T,v,width_bounds)
|
|
449
|
+
if p is None:
|
|
450
|
+
return None
|
|
451
|
+
rho0,T0,a,b,c=p
|
|
452
|
+
w_lo,w_hi=width_bounds
|
|
453
|
+
width=float(np.exp(c/2))
|
|
454
|
+
dT=width*(2*P_hat-1)/np.sqrt(P_hat*(1-P_hat))
|
|
455
|
+
sharp=bool(width<=w_lo*1.001)
|
|
456
|
+
# does the bend beat a straight line? An F-test on the weighted residuals, not the
|
|
457
|
+
# covariance of b: at the sharp-width bound that covariance is ill-conditioned and
|
|
458
|
+
# would hold out a real break
|
|
459
|
+
n=len(T)
|
|
460
|
+
ss_h=float(np.sum(((v-_tg_hyperbola(T,*p))/T)**2))
|
|
461
|
+
lin=np.polyfit(T,v,1,w=1.0/T)
|
|
462
|
+
ss_l=float(np.sum(((v-np.polyval(lin,T))/T)**2))
|
|
463
|
+
F=((ss_l-ss_h)/3.0)/(ss_h/(n-5)) if ss_h>0 and n>5 else float('inf')
|
|
464
|
+
p_line=float(f_dist.sf(F,3,n-5)) if np.isfinite(F) else 0.0
|
|
465
|
+
reason=None
|
|
466
|
+
if T0<=T[0]+1.0 or T0>=T[-1]-1.0:
|
|
467
|
+
reason='Tg at the edge of the data'
|
|
468
|
+
elif width>=w_hi*0.999:
|
|
469
|
+
reason=f'transition width at its {w_hi:g} K bound'
|
|
470
|
+
elif p_line>0.01:
|
|
471
|
+
reason=f'no significant change of slope (a straight line fits as well, p = {p_line:.2f})'
|
|
472
|
+
elif T[0]>T0-dT or T[-1]<T0+dT:
|
|
473
|
+
reason=(f'the ladder ({T[0]:.0f}-{T[-1]:.0f} K) does not reach past the transition, '
|
|
474
|
+
f'{T0-dT:.0f}-{T0+dT:.0f} K at {P_hat:.0%} slope convergence')
|
|
475
|
+
Tt=_tangent_crossing(p,T[0],T[-1])
|
|
476
|
+
se=float(np.sqrt(cov[1,1])) if np.isfinite(cov[1,1]) and not sharp else float('nan')
|
|
477
|
+
synth=None
|
|
478
|
+
if n_synth>0:
|
|
479
|
+
resid=v-_tg_hyperbola(T,*p)
|
|
480
|
+
scale=np.sqrt(np.mean((resid/T)**2))
|
|
481
|
+
rng=np.random.default_rng(seed)
|
|
482
|
+
tgs=[]
|
|
483
|
+
for _ in range(n_synth):
|
|
484
|
+
q,_=_fit_hyperbola(T,_tg_hyperbola(T,*p)+rng.normal(0.0,scale*T),width_bounds,p0=p)
|
|
485
|
+
if q is not None:
|
|
486
|
+
tgs.append(q[1])
|
|
487
|
+
synth=float(np.std(tgs,ddof=1)) if len(tgs)>1 else None
|
|
488
|
+
return {'Tg':float(T0),'Tg_tangents':Tt,'Tg_se':se,'Tg_synth_sd':synth,
|
|
489
|
+
'glassy':float(a),'rubbery':float(a+b),'width':width,
|
|
490
|
+
'transition':(float(T0-dT),float(T0+dT)),'sharp':sharp,
|
|
491
|
+
'held_out':reason is not None,'reason':reason,'params':p}
|
|
492
|
+
|
|
493
|
+
def _fit_hyperbola(T,v,width_bounds,p0=None):
|
|
494
|
+
"""Weighted least-squares fit of :func:`_tg_hyperbola`; (params, cov) or (None, None)."""
|
|
495
|
+
w_lo,w_hi=width_bounds
|
|
496
|
+
if p0 is None:
|
|
497
|
+
k=max(3,len(T)//4)
|
|
498
|
+
a0=np.polyfit(T[:k],v[:k],1)[0]
|
|
499
|
+
a1=np.polyfit(T[-k:],v[-k:],1)[0]
|
|
500
|
+
T0=0.5*(T[0]+T[-1])
|
|
501
|
+
p0=[np.interp(T0,T,v),T0,a0,a1-a0,2*np.log(20.0)]
|
|
502
|
+
lo=[-np.inf,T[0],-np.inf,-np.inf,2*np.log(w_lo)]
|
|
503
|
+
hi=[np.inf,T[-1],np.inf,np.inf,2*np.log(w_hi)]
|
|
504
|
+
p0=np.clip(np.asarray(p0,dtype=float),np.array(lo)+1e-9,np.array(hi)-1e-9)
|
|
505
|
+
try:
|
|
506
|
+
# sigma_j ~ T_j: Patrone et al. take sigma_j ~ T_j^p, 1/2 <= p <= 2, and find p
|
|
507
|
+
# barely matters
|
|
508
|
+
return curve_fit(_tg_hyperbola,T,v,p0=p0,sigma=T,bounds=(lo,hi),maxfev=40000)
|
|
509
|
+
except (RuntimeError,ValueError):
|
|
510
|
+
return None,None
|
|
511
|
+
|
|
512
|
+
def _tangent_crossing(p,T_lo,T_hi):
|
|
513
|
+
"""Where the fitted hyperbola's tangents at T_lo and T_hi cross."""
|
|
514
|
+
def tangent(Tx,h=1e-3):
|
|
515
|
+
y=_tg_hyperbola(Tx,*p)
|
|
516
|
+
m=(_tg_hyperbola(Tx+h,*p)-_tg_hyperbola(Tx-h,*p))/(2*h)
|
|
517
|
+
return m,y-m*Tx
|
|
518
|
+
m1,b1=tangent(T_lo)
|
|
519
|
+
m2,b2=tangent(T_hi)
|
|
520
|
+
return float((b2-b1)/(m1-m2)) if abs(m1-m2)>1e-12 else float('nan')
|
|
521
|
+
|
|
522
|
+
def _align_builds(curves,width_bounds=(1.0,200.0)):
|
|
523
|
+
"""Each build's curve shifted onto a common density, by a joint fit.
|
|
524
|
+
|
|
525
|
+
Replica builds of one system differ in density by a few kg/m^3 (3-11 across the
|
|
526
|
+
v2.16.0 replicates), which is as large as the change of slope a Tg fit looks for,
|
|
527
|
+
so pooling raw points turns the offsets into noise and hides the transition. This
|
|
528
|
+
fits one hyperbola -- shared T0, slopes and width -- with a separate rho0 for each
|
|
529
|
+
build, and returns the curves with those offsets removed.
|
|
530
|
+
"""
|
|
531
|
+
Ts=[np.asarray(c[0],dtype=float) for c in curves]
|
|
532
|
+
Vs=[np.asarray(c[1],dtype=float) for c in curves]
|
|
533
|
+
n=len(curves)
|
|
534
|
+
T=np.concatenate(Ts); idx=np.concatenate([np.full(len(t),k) for k,t in enumerate(Ts)])
|
|
535
|
+
V=np.concatenate(Vs)
|
|
536
|
+
means=np.array([v.mean() for v in Vs])
|
|
537
|
+
first=fit_tg_hyperbola(T,V-means[idx]+means.mean(),width_bounds)
|
|
538
|
+
if first is None:
|
|
539
|
+
return None
|
|
540
|
+
_,T0,a0,b0,c0=first['params']
|
|
541
|
+
def model(X,T0,a,b,c,*rho0):
|
|
542
|
+
return np.asarray(rho0)[X[1].astype(int)]+_tg_hyperbola(X[0],0.0,T0,a,b,c)
|
|
543
|
+
w_lo,w_hi=width_bounds
|
|
544
|
+
lo=[T.min(),-np.inf,-np.inf,2*np.log(w_lo)]+[-np.inf]*n
|
|
545
|
+
hi=[T.max(),np.inf,np.inf,2*np.log(w_hi)]+[np.inf]*n
|
|
546
|
+
p0=[T0,a0,b0,c0]+[float(np.mean(v-_tg_hyperbola(t,0.0,T0,a0,b0,c0))) for t,v in zip(Ts,Vs)]
|
|
547
|
+
p0=np.clip(np.asarray(p0,dtype=float),np.array(lo)+1e-9,np.array(hi)-1e-9)
|
|
548
|
+
try:
|
|
549
|
+
p,_=curve_fit(model,np.vstack([T,idx]),V,p0=p0,sigma=T,bounds=(lo,hi),maxfev=40000)
|
|
550
|
+
except (RuntimeError,ValueError):
|
|
551
|
+
return None
|
|
552
|
+
rho0=np.asarray(p[4:])
|
|
553
|
+
return [(t,v-(rho0[k]-rho0.mean())) for k,(t,v) in enumerate(zip(Ts,Vs))]
|
|
554
|
+
|
|
555
|
+
def pooled_tg(curves,n_boot=500,seed=0):
|
|
556
|
+
"""Tg from replica builds' curves fitted together, with a between-build error bar.
|
|
557
|
+
|
|
558
|
+
Each build's curve is noisy on its own; fitting all builds at once uses them as data
|
|
559
|
+
rather than averaging separately fitted answers. Builds are first aligned on
|
|
560
|
+
density (:func:`_align_builds`), since replicas differ by about as much as the
|
|
561
|
+
signal. The points within one build are correlated -- one structure, one
|
|
562
|
+
trajectory -- so the pooled fit's own standard error understates the uncertainty,
|
|
563
|
+
which is taken instead from a bootstrap over builds: resample whole builds with
|
|
564
|
+
replacement, realign, refit. That bootstrap is the uncertainty of the pooled Tg.
|
|
565
|
+
Beside it, ``per_build_sd`` is the s.d. of the Tg of the builds that pass on their
|
|
566
|
+
own, with ``n_kept`` saying how many. It is conditioned on that filter, so it is
|
|
567
|
+
not the scatter of an arbitrary build: on example 3 heating it is 7.7 K over the
|
|
568
|
+
3 of 5 kept, and 73.6 K over all five, one of which the fit puts on the ladder's
|
|
569
|
+
edge. Quote it with k/n. A pooled fit that is sharp when most builds are refused
|
|
570
|
+
on their own is held out.
|
|
571
|
+
Patrone et al. (2016) found exactly this: two
|
|
572
|
+
simulations of one chemistry gave Tg distributions that did not overlap, because
|
|
573
|
+
the structures crosslinking produces differ.
|
|
574
|
+
|
|
575
|
+
Args:
|
|
576
|
+
curves (list): one (T, v) pair of arrays per build
|
|
577
|
+
n_boot (int): bootstrap resamples
|
|
578
|
+
seed (int): random seed for the resampling
|
|
579
|
+
|
|
580
|
+
Returns:
|
|
581
|
+
dict: Tg and fit (the pooled :func:`fit_tg_hyperbola` result), Tg_boot_sd (None
|
|
582
|
+
with one build or too few usable resamples), per_build (each build's own
|
|
583
|
+
fit), n_builds, n_kept, per_build_sd (s.d. over the n_kept kept builds'
|
|
584
|
+
Tg, None with fewer than two)
|
|
585
|
+
"""
|
|
586
|
+
per=[fit_tg_hyperbola(t,y) for t,y in curves]
|
|
587
|
+
def fit_pool(cs):
|
|
588
|
+
aligned=_align_builds(cs) if len(cs)>1 else cs
|
|
589
|
+
if aligned is None:
|
|
590
|
+
return None
|
|
591
|
+
return fit_tg_hyperbola(np.concatenate([c[0] for c in aligned]),
|
|
592
|
+
np.concatenate([c[1] for c in aligned]))
|
|
593
|
+
pool=fit_pool(curves)
|
|
594
|
+
kept=[f['Tg'] for f in per if f is not None and not f['held_out']]
|
|
595
|
+
if (pool is not None and not pool['held_out'] and pool['sharp']
|
|
596
|
+
and len(curves)>1 and 2*len(kept)<len(curves)):
|
|
597
|
+
# pooling n builds buys significance with n: five straight lines can pool into
|
|
598
|
+
# a "sharp" break that none of them shows (example 2 cooling, 2026-10-23: 4 of 5
|
|
599
|
+
# builds refused, pooled kept at width 1 K, local slope showing no step)
|
|
600
|
+
pool['held_out']=True
|
|
601
|
+
pool['reason']=(f'a sharp break in the pool that {len(curves)-len(kept)} of '
|
|
602
|
+
f'{len(curves)} builds do not show on their own')
|
|
603
|
+
sd=None
|
|
604
|
+
if len(curves)>1 and pool is not None and not pool['held_out']:
|
|
605
|
+
rng=np.random.default_rng(seed)
|
|
606
|
+
tgs=[]
|
|
607
|
+
for _ in range(n_boot):
|
|
608
|
+
pick=rng.integers(0,len(curves),len(curves))
|
|
609
|
+
if len(set(pick.tolist()))<2:
|
|
610
|
+
continue
|
|
611
|
+
r=fit_pool([curves[i] for i in pick])
|
|
612
|
+
if r is not None and not r['held_out']:
|
|
613
|
+
tgs.append(r['Tg'])
|
|
614
|
+
sd=float(np.std(tgs,ddof=1)) if len(tgs)>1 else None
|
|
615
|
+
return {'Tg':pool['Tg'] if pool and not pool['held_out'] else None,'fit':pool,
|
|
616
|
+
'Tg_boot_sd':sd,'per_build':per,'n_builds':len(curves),'n_kept':len(kept),
|
|
617
|
+
'per_build_sd':float(np.std(kept,ddof=1)) if len(kept)>1 else None}
|
|
618
|
+
|
|
401
619
|
def compute_G(shear_strain,shear_stress,fit_domain=[10,100],fit_strain=None):
|
|
402
620
|
"""Computes the shear modulus by a linear fit to the elastic regime of a simple shear.
|
|
403
621
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: htpolynet
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.17.0
|
|
4
4
|
Summary: Automated MD System Builder for Amorphous Network Polymers
|
|
5
5
|
Project-URL: Source, https://github.com/cameronabrams/htpolynet
|
|
6
6
|
Project-URL: Documentation, https://htpolynet.readthedocs.io/
|
|
@@ -113,6 +113,8 @@ its published description to that earlier work. When using htpolynet in publish
|
|
|
113
113
|
please cite Huang and Abrams, *SoftwareX* **21**, 101303 (2023),
|
|
114
114
|
[doi:10.1016/j.softx.2022.101303](https://doi.org/10.1016/j.softx.2022.101303), along with
|
|
115
115
|
the GAFF and Gromacs papers listed in the [documentation](https://htpolynet.readthedocs.io/).
|
|
116
|
+
Papers by other groups that have used htpolynet are listed on the
|
|
117
|
+
[Publications Using HTPolyNet](https://htpolynet.readthedocs.io/en/latest/publications.html) page.
|
|
116
118
|
|
|
117
119
|
## Meta
|
|
118
120
|
|
|
@@ -3,10 +3,10 @@ htpolynet/cli.py,sha256=qProWJ0hGgs4lBa1h4etiLCRp3paYPCN-g3XGi_IO-c,20038
|
|
|
3
3
|
htpolynet/analysis/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
4
|
htpolynet/analysis/analyze.py,sha256=vM-FpM7rC6hiXw7VjrKFmpTjrfRzSbWHG9McsaZrhMs,9132
|
|
5
5
|
htpolynet/analysis/piercings.py,sha256=2w8Z98qxyl0oN5UQ0hBUf1Js12xpTLitEQ4UDg6trCI,9132
|
|
6
|
-
htpolynet/analysis/plot.py,sha256=
|
|
6
|
+
htpolynet/analysis/plot.py,sha256=NfowXFXU5mGCvnvO5sW37p-kuLgtm621RPId4q188bY,41171
|
|
7
7
|
htpolynet/analysis/postsim.py,sha256=EgRYZy7Xpmv05hzUEW3tjNKRzjpnynb1UVUZqgjfz3E,30056
|
|
8
8
|
htpolynet/analysis/ringcontacts.py,sha256=r4pVLIMwKp-KsSmhNAbp4FHoa1yRVfsTw-5dbwDVEDE,17118
|
|
9
|
-
htpolynet/analysis/utils.py,sha256=
|
|
9
|
+
htpolynet/analysis/utils.py,sha256=kvRuuBarg5ghGrcpOerlosDHaMJk_Dbuny6APmgDTz4,31629
|
|
10
10
|
htpolynet/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
11
11
|
htpolynet/core/bondtemplate.py,sha256=_1vYMugonDuogysu15IsbpthvxYb6uJKC5ao7pQcWvg,9969
|
|
12
12
|
htpolynet/core/configuration.py,sha256=j-74qPF_bqZrt9fBivGj-jX85kkVHNkSHM13ewE2ut0,5279
|
|
@@ -106,8 +106,8 @@ htpolynet/utils/logsetup.py,sha256=o0mlVXNzqcfua2SAlJPkGSh4lM_bmI10gWwpb9gqYu8,1
|
|
|
106
106
|
htpolynet/utils/profiling.py,sha256=su7qpGEz6FXVU4KT2HQDWG82bc1sgsfpDQBbAfPpsHc,7331
|
|
107
107
|
htpolynet/utils/stringthings.py,sha256=Mr6o55EM8o4YAaVYpjIJj2IxDToNdbPzb-lpQ3w3jFk,1176
|
|
108
108
|
htpolynet/utils/vmd_viz.py,sha256=Crk3Ln88PKiJ9X7DMMkFEVh2Ru6a1y0RUgj3w6EIgFc,10867
|
|
109
|
-
htpolynet-2.
|
|
110
|
-
htpolynet-2.
|
|
111
|
-
htpolynet-2.
|
|
112
|
-
htpolynet-2.
|
|
113
|
-
htpolynet-2.
|
|
109
|
+
htpolynet-2.17.0.dist-info/METADATA,sha256=RF6zs0l22wIDWM3CpqwqboxsOP8ATZOOFo5RI_Pw05E,6754
|
|
110
|
+
htpolynet-2.17.0.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
|
|
111
|
+
htpolynet-2.17.0.dist-info/entry_points.txt,sha256=G5tx55llJf-IV9dIe7J8myGdyrhCVggCAhKrVNGP_s0,48
|
|
112
|
+
htpolynet-2.17.0.dist-info/licenses/LICENSE,sha256=piPSGqJdmTGyzF9HOnjlO2KvgOKT8NHwhCuGYM778tY,1071
|
|
113
|
+
htpolynet-2.17.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|