HTPolyNet 2.13.0__py3-none-any.whl → 2.15.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 +109 -26
- htpolynet/analysis/postsim.py +83 -9
- htpolynet/analysis/utils.py +28 -12
- htpolynet/core/projectfilesystem.py +16 -1
- htpolynet/core/runtime.py +8 -2
- htpolynet/core/topology.py +3 -1
- htpolynet/repair/topology_surgery.py +3 -1
- htpolynet/resources/claude/SKILL.md +2 -2
- htpolynet/resources/example_depot/6-cyanate-ester.yaml +62 -162
- htpolynet/resources/mdp/drag-npt.mdp +2 -2
- htpolynet/resources/mdp/drag-nvt.mdp +1 -1
- htpolynet/resources/mdp/npt.mdp +2 -2
- htpolynet/resources/mdp/nvt.mdp +1 -1
- htpolynet/resources/mdp/relax-npt.mdp +2 -2
- htpolynet/resources/mdp/relax-nvt.mdp +1 -1
- htpolynet/resources/mdp/single-molecule-nvt.mdp +1 -1
- {htpolynet-2.13.0.dist-info → htpolynet-2.15.0.dist-info}/METADATA +2 -2
- {htpolynet-2.13.0.dist-info → htpolynet-2.15.0.dist-info}/RECORD +21 -21
- {htpolynet-2.13.0.dist-info → htpolynet-2.15.0.dist-info}/WHEEL +0 -0
- {htpolynet-2.13.0.dist-info → htpolynet-2.15.0.dist-info}/entry_points.txt +0 -0
- {htpolynet-2.13.0.dist-info → htpolynet-2.15.0.dist-info}/licenses/LICENSE +0 -0
htpolynet/analysis/plot.py
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Author: Cameron F. Abrams <cfa22@drexel.edu>
|
|
4
4
|
"""
|
|
5
5
|
import logging
|
|
6
|
+
import re
|
|
6
7
|
|
|
7
8
|
from datetime import datetime
|
|
8
9
|
|
|
@@ -462,6 +463,12 @@ _template_2='2026-05-29 04:29:10,323 htpolynet.cure.curecontroller.do_iter INFO>
|
|
|
462
463
|
_template_2_token_idx=[3,6,7]
|
|
463
464
|
_template_2_data_idx={'iter':(int,5),'conv':(float,8),'nbonds':(int,10)}
|
|
464
465
|
|
|
466
|
+
# The ring cure logs its own pair, and its lines vary in token count (the group
|
|
467
|
+
# tuple), so they are matched by pattern. A ring forms three bonds and consumes
|
|
468
|
+
# three groups, so groups consumed is the bond count.
|
|
469
|
+
_ring_begin_re=re.compile(r' INFO>\s+Ring cure begins: ')
|
|
470
|
+
_ring_iter_re=re.compile(r' INFO> Iteration (\d+): \d+ ring\(s\), (\d+) of \d+ groups consumed \(conversion ([0-9.]+)\)')
|
|
471
|
+
|
|
465
472
|
def _token_match(l,template,pat_idx):
|
|
466
473
|
"""Returns True if tokens indexed by pat_idx in the space-split l and template match.
|
|
467
474
|
|
|
@@ -524,7 +531,21 @@ def diagnostics_graphs(logfiles, filename, **kwargs):
|
|
|
524
531
|
data['time'].append(datetime.strptime(' '.join(l.split()[0:2]),'%Y-%m-%d %H:%M:%S,%f'))
|
|
525
532
|
# print('data tok',f'{l.split()}')
|
|
526
533
|
_parse_data(data,l,_template_2_data_idx)
|
|
527
|
-
|
|
534
|
+
elif _ring_begin_re.search(l):
|
|
535
|
+
counter+=1
|
|
536
|
+
assert not counter>1
|
|
537
|
+
data['time'].append(datetime.strptime(' '.join(l.split()[0:2]),'%Y-%m-%d %H:%M:%S,%f'))
|
|
538
|
+
data['iter'].append(0)
|
|
539
|
+
data['conv'].append(0.0)
|
|
540
|
+
data['nbonds'].append(0)
|
|
541
|
+
elif (m:=_ring_iter_re.search(l)):
|
|
542
|
+
data['time'].append(datetime.strptime(' '.join(l.split()[0:2]),'%Y-%m-%d %H:%M:%S,%f'))
|
|
543
|
+
data['iter'].append(int(m.group(1)))
|
|
544
|
+
data['nbonds'].append(int(m.group(2)))
|
|
545
|
+
data['conv'].append(float(m.group(3)))
|
|
546
|
+
if not data['time']:
|
|
547
|
+
raise ValueError(f'{logfile}: no CURE or ring-cure progress lines found; '
|
|
548
|
+
f'is it a diagnostics log from htpolynet run -diag?')
|
|
528
549
|
df[logfile]=pd.DataFrame(data)
|
|
529
550
|
time_idx=list(df[logfile].columns).index('time')
|
|
530
551
|
# Use dt.total_seconds() instead of .astype(int) — the latter
|
|
@@ -541,23 +562,26 @@ def diagnostics_graphs(logfiles, filename, **kwargs):
|
|
|
541
562
|
ax[0].set_xlabel('runtime (h)')
|
|
542
563
|
ax[0].set_ylabel('conversion')
|
|
543
564
|
ax[1].set_ylabel('runtime (h)')
|
|
544
|
-
ax[1].set_xlabel('
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
565
|
+
ax[1].set_xlabel('cure iteration')
|
|
566
|
+
# plot against the logged iteration, not the row: row 0 is the cure's start
|
|
567
|
+
# (iteration 0), so row+1 put every iteration one place to the right
|
|
568
|
+
niter = int(max(df[lf]['iter'].max() for lf in logfiles))
|
|
569
|
+
ax[1].set_xlim([0, niter])
|
|
570
|
+
ax[1].set_xticks(range(0, niter + 1))
|
|
571
|
+
ax[2].set_xlabel('cure iteration')
|
|
548
572
|
ax[2].set_ylabel('conversion')
|
|
549
573
|
ax[2].set_ylim([0,1])
|
|
550
574
|
ax[2].set_yticks(np.arange(0, 1.1, 0.1))
|
|
551
|
-
ax[2].set_xticks(range(
|
|
552
|
-
ax[2].set_xlim([
|
|
575
|
+
ax[2].set_xticks(range(0, niter + 1))
|
|
576
|
+
ax[2].set_xlim([0, niter])
|
|
553
577
|
if xmax == -1: # use autodetected xmax
|
|
554
578
|
xmax = np.max([df[logfile]['elapsed'].max() for logfile in logfiles])
|
|
555
579
|
ax[0].set_xlim([0,xmax])
|
|
556
580
|
ax[1].set_ylim([0,xmax])
|
|
557
581
|
for logfile in logfiles:
|
|
558
582
|
ax[0].scatter(df[logfile]['elapsed'], df[logfile]['conv'], label=logfile)
|
|
559
|
-
ax[1].scatter(df[logfile]
|
|
560
|
-
ax[2].scatter(df[logfile]
|
|
583
|
+
ax[1].scatter(df[logfile]['iter'], df[logfile]['elapsed'], label=logfile)
|
|
584
|
+
ax[2].scatter(df[logfile]['iter'], df[logfile]['conv'], label=logfile)
|
|
561
585
|
# plt.legend()
|
|
562
586
|
plt.savefig(filename)
|
|
563
587
|
plt.close(fig)
|
|
@@ -718,22 +742,69 @@ def do_tg_plots(phases,projdirs,outfile='tg.png',save_data='data.csv',n_points=[
|
|
|
718
742
|
logger.info(f'heating Tg = {hTg:.2f} K ({(hTg-273.15):.2f} C) at {rate[0]:.5f} K/ps ({rate[0]*1.e12:.3e} K/s)')
|
|
719
743
|
logger.info(f'cooling Tg = {cTg:.2f} K ({(cTg-273.15):.2f} C) at {rate[1]:.5f} K/ps ({rate[1]*1.e12:.3e} K/s)')
|
|
720
744
|
|
|
721
|
-
def do_E_plots(phases,projdirs,outfile='e.png',
|
|
745
|
+
def do_E_plots(phases,projdirs,outfile='e.png',save_data='E.csv',fit_strain=None):
|
|
746
|
+
"""Fits Young's modulus to the deform stages and plots the mean stress-strain curve.
|
|
747
|
+
|
|
748
|
+
Every pull -- each direction, each replica, each project -- is fitted on its own over
|
|
749
|
+
the same strain window, and E is reported as the mean of those fits with the standard
|
|
750
|
+
error between them, which is the uncertainty a single fit's own statistics cannot
|
|
751
|
+
give. The mean curve is plotted, and fitted too for comparison.
|
|
752
|
+
|
|
753
|
+
Args:
|
|
754
|
+
phases (list): the ``deform`` stanzas from the postsim config
|
|
755
|
+
projdirs (list): project directories
|
|
756
|
+
outfile (str): plot file, defaults to 'e.png'
|
|
757
|
+
save_data (str): mean-curve data file, defaults to 'E.csv'; the per-pull fits go
|
|
758
|
+
to the same name with ``-fits`` appended
|
|
759
|
+
fit_strain (list): [lo, hi] strain window; defaults to the stanzas' ``fit_strain``
|
|
760
|
+
"""
|
|
761
|
+
from ..analysis.postsim import PostSimDeform, replica_subdirs
|
|
722
762
|
MPa_per_bar=1.e-1
|
|
723
|
-
|
|
724
|
-
|
|
763
|
+
if fit_strain is None:
|
|
764
|
+
windows={tuple(p['deform'].get('fit_strain',PostSimDeform.default_params['fit_strain'])) for p in phases}
|
|
765
|
+
if len(windows)>1:
|
|
766
|
+
logger.warning(f'deform stages give different fit_strain windows {sorted(windows)}; using the first')
|
|
767
|
+
fit_strain=list(sorted(windows)[0])
|
|
768
|
+
lo,hi=fit_strain
|
|
769
|
+
curves=[]
|
|
725
770
|
for p in phases:
|
|
726
|
-
params=p['deform']
|
|
771
|
+
params={**PostSimDeform.default_params,**p['deform']}
|
|
727
772
|
dir=params['direction']
|
|
728
773
|
# Box-X-strain,Pres-XX-stress
|
|
729
774
|
strain_name=f'Box-{dir.upper()}-strain'
|
|
730
775
|
stress_name=f'Pres-{dir.upper()}{dir.upper()}-stress'
|
|
731
776
|
for d in projdirs:
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
777
|
+
subs=replica_subdirs(params)
|
|
778
|
+
found=[s for s in subs if os.path.isdir(os.path.join(d,s))]
|
|
779
|
+
if not found and os.path.isdir(os.path.join(d,params['subdir'])):
|
|
780
|
+
# a run from before replicas existed, or one with replicas: 1
|
|
781
|
+
found=[params['subdir']]
|
|
782
|
+
elif len(found)<len(subs):
|
|
783
|
+
logger.warning(f'{d}: found {len(found)} of {len(subs)} replica directories for '
|
|
784
|
+
f'{params["subdir"]}; fitting those')
|
|
785
|
+
for sub in found:
|
|
786
|
+
df=pd.read_csv(os.path.join(d,sub,f'deform-{dir}.csv'),index_col=None,header=0)
|
|
787
|
+
curves.append((os.path.join(d,sub),pd.DataFrame({'strain':df[strain_name],'stress':(df[stress_name]*MPa_per_bar)})))
|
|
788
|
+
reached=min(c['strain'].max() for _,c in curves)
|
|
789
|
+
if reached<hi:
|
|
790
|
+
logger.warning(f'the shortest pull reaches strain {reached:.4f}, short of the fit window\'s '
|
|
791
|
+
f'upper end {hi}; the fit covers [{lo}, {reached:.4f}] only. Lengthen the '
|
|
792
|
+
f'deform stage (ps) to reach it.')
|
|
793
|
+
fits=[]
|
|
794
|
+
for name,c in curves:
|
|
795
|
+
E_i,R2_i=compute_E(c['strain'],c['stress'],fit_strain=fit_strain)
|
|
796
|
+
fits.append({'pull':name,'E_MPa':E_i,'R2':R2_i})
|
|
797
|
+
fits=pd.DataFrame(fits)
|
|
798
|
+
base,ext=os.path.splitext(save_data)
|
|
799
|
+
fits.to_csv(f'{base}-fits{ext}',header=True,index=False,sep=' ')
|
|
800
|
+
|
|
801
|
+
# mean and spread over the curves at each row (strain point). This used to
|
|
802
|
+
# concat side by side and stack(), which pandas >= 3 refuses: every frame has
|
|
803
|
+
# the same two column names. Keying the curves on a new outer level does the
|
|
804
|
+
# same averaging without duplicate columns.
|
|
805
|
+
df_concat=pd.concat([c for _,c in curves],keys=range(len(curves)))
|
|
806
|
+
mean_stress_strains=df_concat.groupby(level=1).mean()
|
|
807
|
+
stds_stress_strains=df_concat.groupby(level=1).std()
|
|
737
808
|
mean_stress_strains['stress-std']=stds_stress_strains['stress']
|
|
738
809
|
mean_stress_strains.to_csv(save_data,header=True,index=False,sep=' ')
|
|
739
810
|
fig,ax=plt.subplots(1,1,figsize=(8,6))
|
|
@@ -742,16 +813,28 @@ def do_E_plots(phases,projdirs,outfile='e.png',fit_domain=[10,200],save_data='E.
|
|
|
742
813
|
ax.set_xlabel('Strain [*]')
|
|
743
814
|
ax.errorbar(mean_stress_strains['strain'],mean_stress_strains['stress'],stds_stress_strains['stress'],alpha=0.2)
|
|
744
815
|
ax.plot(mean_stress_strains['strain'],mean_stress_strains['stress'])
|
|
745
|
-
E,R2=compute_E(mean_stress_strains['strain'],mean_stress_strains['stress'],
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
X=np.array(mean_stress_strains['strain'])[line_domain[0]:line_domain[1]]
|
|
750
|
-
Y=np.array(fitline)[line_domain[0]:line_domain[1]]
|
|
751
|
-
ax.plot(X,Y,'k--',alpha=0.7)
|
|
816
|
+
E,R2=compute_E(mean_stress_strains['strain'],mean_stress_strains['stress'],fit_strain=fit_strain)
|
|
817
|
+
X=np.array([0.0,min(hi,reached)])
|
|
818
|
+
ax.plot(X,E*X,'k--',alpha=0.7)
|
|
819
|
+
ax.axvspan(lo,min(hi,reached),color='grey',alpha=0.1)
|
|
752
820
|
plt.savefig(outfile,bbox_inches='tight')
|
|
753
821
|
plt.close(fig)
|
|
754
|
-
|
|
822
|
+
n=len(fits)
|
|
823
|
+
E_mean=fits['E_MPa'].mean()
|
|
824
|
+
E_sem=fits['E_MPa'].std(ddof=1)/np.sqrt(n) if n>1 else float('nan')
|
|
825
|
+
logger.info(f'{outfile}, {save_data} and {base}-fits{ext} created.')
|
|
826
|
+
logger.info(f'E = {E_mean/1000.0:.3f} +/- {E_sem/1000.0:.3f} GPa: mean and standard error of '
|
|
827
|
+
f'{n} pull(s) fitted over strain [{lo}, {min(hi,reached):.4f}]; the mean curve '
|
|
828
|
+
f'fits to {E/1000.0:.3f} GPa (R^2 {R2:.3f})')
|
|
829
|
+
if n<2:
|
|
830
|
+
logger.warning('one pull gives no error bar; add directions or set `replicas`')
|
|
831
|
+
elif E_sem>0.2*abs(E_mean):
|
|
832
|
+
logger.warning(f'the standard error is {abs(E_sem/E_mean):.0%} of E; pull further '
|
|
833
|
+
f'(a longer deform stage) or add replicas before reporting it')
|
|
834
|
+
# No R^2 gate: single-frame pressure scatters so much that a sound fit to a real
|
|
835
|
+
# trace sits near R^2 0.45 (test_postsim_real_traces). The scatter between pulls is
|
|
836
|
+
# what says whether E is known.
|
|
837
|
+
return {'E':E_mean,'E_sem':E_sem,'n':n,'E_mean_curve':E,'R2_mean_curve':R2,'fit_strain':[lo,min(hi,reached)]}
|
|
755
838
|
|
|
756
839
|
def post_plots(args):
|
|
757
840
|
n_points=args.n_points
|
htpolynet/analysis/postsim.py
CHANGED
|
@@ -247,7 +247,7 @@ class PostSimLadder(PostSimMD):
|
|
|
247
247
|
}
|
|
248
248
|
mdp_modify(mdpname,mod_dict)
|
|
249
249
|
|
|
250
|
-
def _strain_advice(edot,ps,logger=logger,what='strain'):
|
|
250
|
+
def _strain_advice(edot,ps,logger=logger,what='strain',rate_warning=True):
|
|
251
251
|
"""Says what strain a deformation will reach, and what a modulus from it is worth.
|
|
252
252
|
|
|
253
253
|
The measured warning is not about the rate, it is about replicates. Eight
|
|
@@ -276,10 +276,12 @@ def _strain_advice(edot,ps,logger=logger,what='strain'):
|
|
|
276
276
|
logger.info(f'This run reaches {what} {total:.3f} at {edot:g} ps^-1 over {ps} ps')
|
|
277
277
|
logger.info('One ramp gives a modulus to about 10% but not its uncertainty: eight '
|
|
278
278
|
'replicates of one protocol spanned 1.29 to 1.74 GPa while each fit '
|
|
279
|
-
'reported a much smaller error.
|
|
280
|
-
'between them as the error bar.')
|
|
279
|
+
'reported a much smaller error. Set `replicas` and take the scatter '
|
|
280
|
+
'between them as the error bar; `plots post` reports it.')
|
|
281
281
|
if edot>=1e-3:
|
|
282
|
-
|
|
282
|
+
# uniaxial passes rate_warning=False: its defaults were measured at this rate
|
|
283
|
+
# and fit [0.001, 0.03], inside the window this warning is about
|
|
284
|
+
(logger.warning if rate_warning else logger.info)(
|
|
283
285
|
f'{what} passes 0.02 after only {0.02/edot:.0f} ps at edot={edot:g}, so '
|
|
284
286
|
f'little of this run samples the low strains a modulus would come from; what '
|
|
285
287
|
f'is fitted is a secant over a large window. edot=1e-4 reaches 0.03 in the '
|
|
@@ -308,8 +310,20 @@ class PostSimDeform(PostSimMD):
|
|
|
308
310
|
'direction':'x',
|
|
309
311
|
'T':300.0,
|
|
310
312
|
'P':1.0,
|
|
311
|
-
|
|
312
|
-
|
|
313
|
+
# Defaults measured on example 6 (2026-10-03: 15 pulls to 10% plus 6 at a tenth
|
|
314
|
+
# the rate; see the CHANGELOG). E is flat to 3-4% strain and softens past it; a
|
|
315
|
+
# single pull scatters ~30% over [0.001, 0.03] but ~80% over [0, 0.02], so 2% is
|
|
316
|
+
# too short at any replica count. Nine pulls -- three directions, three
|
|
317
|
+
# replicas -- give E to about 10%.
|
|
318
|
+
'ps': 40, # 4% at the default rate, clearing the fit window
|
|
319
|
+
'edot': 0.001, # strain rate in ps^-1
|
|
320
|
+
# independent pulls of this stage, each in <subdir>-r<k> with its own velocities;
|
|
321
|
+
# `plots post` fits each and reports the scatter between them as the error bar
|
|
322
|
+
'replicas': 3,
|
|
323
|
+
# velocity seed; replica k uses seed+k-1. None leaves Gromacs to pick one
|
|
324
|
+
'seed': None,
|
|
325
|
+
# strain window `plots post` fits E over
|
|
326
|
+
'fit_strain': [0.001, 0.03],
|
|
313
327
|
}
|
|
314
328
|
|
|
315
329
|
def build_mdp(self,mdpname,**kwargs):
|
|
@@ -339,6 +353,9 @@ class PostSimDeform(PostSimMD):
|
|
|
339
353
|
'tau_p':1.0,
|
|
340
354
|
'refcoord_scaling': 'com',
|
|
341
355
|
'pcoupltype': 'anisotropic',
|
|
356
|
+
# the packaged mdp uses C-rescale, which does not support anisotropic
|
|
357
|
+
# coupling; Parrinello-Rahman does and samples the right ensemble too
|
|
358
|
+
'pcoupl': 'Parrinello-Rahman',
|
|
342
359
|
# stress is what this stage exists to measure, so sample it far more often
|
|
343
360
|
# than the packaged npt.mdp does. At 1 ps the frames are already
|
|
344
361
|
# near-independent, so ten times as many cut the standard error on a fitted
|
|
@@ -350,6 +367,8 @@ class PostSimDeform(PostSimMD):
|
|
|
350
367
|
# deformation implies, and grompp refuses the run outright without it
|
|
351
368
|
'deform-init-flow': 'yes'
|
|
352
369
|
}
|
|
370
|
+
if params.get('seed') is not None:
|
|
371
|
+
mod_dict['gen-seed']=int(params['seed'])
|
|
353
372
|
if direction=='x':
|
|
354
373
|
strain_vel=box[0][0]*edot
|
|
355
374
|
mod_dict['ref_p']='0.0 1.0 1.0 0 0 0'
|
|
@@ -377,7 +396,7 @@ class PostSimDeform(PostSimMD):
|
|
|
377
396
|
else:
|
|
378
397
|
logger.error(f'Bad direction for uniaxial strain {direction}')
|
|
379
398
|
return
|
|
380
|
-
_strain_advice(edot,duration)
|
|
399
|
+
_strain_advice(edot,duration,rate_warning=False)
|
|
381
400
|
|
|
382
401
|
mdp_modify(mdpname,mod_dict)
|
|
383
402
|
|
|
@@ -467,6 +486,8 @@ class PostSimShear(PostSimMD):
|
|
|
467
486
|
'tau_p':1.0,
|
|
468
487
|
'refcoord_scaling': 'com',
|
|
469
488
|
'pcoupltype': 'anisotropic',
|
|
489
|
+
# as in PostSimDeform: C-rescale cannot do anisotropic, Parrinello-Rahman can
|
|
490
|
+
'pcoupl': 'Parrinello-Rahman',
|
|
470
491
|
# the Cartesian component the shear moves is uncoupled; the other two
|
|
471
492
|
# normal directions stay at P. Gromacs rejects the run otherwise.
|
|
472
493
|
'ref_p':f'{params["P"]} {params["P"]} {params["P"]} 0 0 0',
|
|
@@ -498,6 +519,29 @@ class PostSimShear(PostSimMD):
|
|
|
498
519
|
_strain_advice(params.get('edot',0.0),params['ps'],what='shear strain')
|
|
499
520
|
mdp_modify(mdpname,mod_dict)
|
|
500
521
|
|
|
522
|
+
def bad_subdirs(stagelist):
|
|
523
|
+
"""The stage directories :func:`pfs.go_to` would refuse, in config order."""
|
|
524
|
+
return [s.params['subdir'] for s in stagelist if not pfs.can_go_to(s.params['subdir'])]
|
|
525
|
+
|
|
526
|
+
|
|
527
|
+
def replica_subdirs(params):
|
|
528
|
+
"""The directories a stage's replicas run in: its ``subdir``, or ``<subdir>-r<k>``.
|
|
529
|
+
|
|
530
|
+
Args:
|
|
531
|
+
params (dict): the stage's parameters, defaults included
|
|
532
|
+
|
|
533
|
+
Returns:
|
|
534
|
+
list: one subdirectory per replica
|
|
535
|
+
"""
|
|
536
|
+
n=params.get('replicas',1)
|
|
537
|
+
n=1 if n is None else int(n)
|
|
538
|
+
if n<1:
|
|
539
|
+
raise ValueError(f'replicas must be at least 1, not {n}')
|
|
540
|
+
if n==1:
|
|
541
|
+
return [params['subdir']]
|
|
542
|
+
return [f"{params['subdir']}-r{k}" for k in range(1,n+1)]
|
|
543
|
+
|
|
544
|
+
|
|
501
545
|
class PostsimConfiguration:
|
|
502
546
|
""" handles reading and parsing a postcure simulation input config file.
|
|
503
547
|
Config file format
|
|
@@ -586,14 +630,40 @@ class PostsimConfiguration:
|
|
|
586
630
|
if parse: inst.parse(**kwargs)
|
|
587
631
|
return inst
|
|
588
632
|
|
|
633
|
+
def check_subdirs(self):
|
|
634
|
+
"""Raises before anything runs if any stage's ``subdir`` cannot be reached.
|
|
635
|
+
|
|
636
|
+
Raises:
|
|
637
|
+
ValueError: naming every unreachable subdir
|
|
638
|
+
"""
|
|
639
|
+
bad=bad_subdirs(self.stagelist)
|
|
640
|
+
if bad:
|
|
641
|
+
raise ValueError(f'{self.cfgFile}: {len(bad)} stage subdir(s) cannot be used: {bad}. '
|
|
642
|
+
f'A subdir must be one name inside a project directory, such as '
|
|
643
|
+
f'postsim/deform-x; nothing deeper.')
|
|
644
|
+
|
|
589
645
|
def parse(self,**kwargs):
|
|
590
|
-
"""Parses a PostsimConfiguration file to build the list of stages to run.
|
|
646
|
+
"""Parses a PostsimConfiguration file to build the list of stages to run.
|
|
647
|
+
|
|
648
|
+
A ``deform`` stanza with ``replicas: N`` becomes N stages, in ``<subdir>-r1`` to
|
|
649
|
+
``<subdir>-rN``, each generating its own velocities.
|
|
650
|
+
"""
|
|
591
651
|
for p in self.baselist:
|
|
592
652
|
assert len(p)==1,f'Poorly formatted {self.cfgFile}; each stanza may have only one keyword'
|
|
593
653
|
simtype=list(p.keys())[0]
|
|
594
654
|
assert simtype in self.default_classes,f'Simulation type "{simtype}" in {self.cfgFile} not understood.'
|
|
595
655
|
logger.info(f'passing in {p[simtype]}')
|
|
596
|
-
self.
|
|
656
|
+
cls=self.default_classes[simtype]
|
|
657
|
+
if 'replicas' not in cls.default_params:
|
|
658
|
+
self.stagelist.append(cls(p[simtype]))
|
|
659
|
+
continue
|
|
660
|
+
stanza=dict(p[simtype])
|
|
661
|
+
subdirs=replica_subdirs({**cls.default_params,**stanza})
|
|
662
|
+
for k,subdir in enumerate(subdirs):
|
|
663
|
+
rep=dict(stanza,subdir=subdir)
|
|
664
|
+
if stanza.get('seed') is not None:
|
|
665
|
+
rep['seed']=int(stanza['seed'])+k
|
|
666
|
+
self.stagelist.append(cls(rep))
|
|
597
667
|
|
|
598
668
|
def postsim(args):
|
|
599
669
|
"""Handles the postsim subcommand for managing post-cure production MD simulations.
|
|
@@ -614,6 +684,10 @@ def postsim(args):
|
|
|
614
684
|
logger.debug(f'ogromacs {ogromacs}')
|
|
615
685
|
for d in args.proj:
|
|
616
686
|
pfs.pfs_setup(root=os.getcwd(),topdirs=pfs.Dirs.postsim_topdirs,verbose=True,projdir=d,reProject=False,userlibrary=pfs.resolve_user_library(args.lib))
|
|
687
|
+
# every stage's directory is checked before any of them runs: a bad one used
|
|
688
|
+
# to surface only when its turn came, after the stages before it had spent
|
|
689
|
+
# their allocation
|
|
690
|
+
cfg.check_subdirs()
|
|
617
691
|
pfs.go_to(pfs.Dirs.postsim)
|
|
618
692
|
for stage in cfg.stagelist:
|
|
619
693
|
stage.do(mdp_pfx='local',**ogromacs)
|
htpolynet/analysis/utils.py
CHANGED
|
@@ -375,7 +375,7 @@ def compute_tg(T,v,n_points=[10,20]):
|
|
|
375
375
|
Tg=-(hot_par[1]-cold_par[1])/(hot_par[0]-cold_par[0])
|
|
376
376
|
return Tg,cold_par,hot_par
|
|
377
377
|
|
|
378
|
-
def compute_G(shear_strain,shear_stress,fit_domain=[10,100]):
|
|
378
|
+
def compute_G(shear_strain,shear_stress,fit_domain=[10,100],fit_strain=None):
|
|
379
379
|
"""Computes the shear modulus by a linear fit to the elastic regime of a simple shear.
|
|
380
380
|
|
|
381
381
|
The same fit as :func:`compute_E`, named separately because the inputs are not the
|
|
@@ -387,32 +387,48 @@ def compute_G(shear_strain,shear_stress,fit_domain=[10,100]):
|
|
|
387
387
|
Args:
|
|
388
388
|
shear_strain (numpy.array): engineering shear strain, dimensionless
|
|
389
389
|
shear_stress (numpy.array): shear stress, in the units of the pressure trace
|
|
390
|
-
fit_domain (list): domain over which the fit is made, defaults to [10,100]
|
|
390
|
+
fit_domain (list): domain over which the fit is made, in rows, defaults to [10,100]
|
|
391
|
+
fit_strain (list): [lo, hi] strain window to fit instead; overrides fit_domain
|
|
391
392
|
|
|
392
393
|
Returns:
|
|
393
394
|
tuple(float,float): G and R2 from the fit
|
|
394
395
|
"""
|
|
395
|
-
return compute_E(shear_strain,shear_stress,fit_domain=fit_domain)
|
|
396
|
+
return compute_E(shear_strain,shear_stress,fit_domain=fit_domain,fit_strain=fit_strain)
|
|
396
397
|
|
|
397
|
-
def compute_E(strain,stress,fit_domain=[10,100]):
|
|
398
|
+
def compute_E(strain,stress,fit_domain=[10,100],fit_strain=None):
|
|
398
399
|
"""Computes the Young's modulus by performing a linear fit to an elastic regime in stress-vs-strain data.
|
|
399
400
|
|
|
400
401
|
Args:
|
|
401
402
|
strain (numpy.array): strain values
|
|
402
403
|
stress (numpy.array): stress values
|
|
403
|
-
fit_domain (list): domain over which fit is made, defaults to [10,100]
|
|
404
|
+
fit_domain (list): domain over which fit is made, in rows, defaults to [10,100]
|
|
405
|
+
fit_strain (list): [lo, hi] strain window to fit instead; overrides fit_domain.
|
|
406
|
+
A window in rows covers a different strain whenever the rate, the run
|
|
407
|
+
length or the energy output interval changes; a strain window does not.
|
|
404
408
|
|
|
405
409
|
Returns:
|
|
406
410
|
tuple(float,float): E and R2 from fit
|
|
407
411
|
"""
|
|
408
|
-
|
|
409
|
-
|
|
412
|
+
if fit_strain is not None:
|
|
413
|
+
lo,hi=fit_strain
|
|
414
|
+
s=np.asarray(strain,dtype=float)
|
|
415
|
+
mask=(s>=lo)&(s<=hi)
|
|
416
|
+
if mask.sum()<2:
|
|
417
|
+
raise ValueError(f'fewer than two points with strain in [{lo}, {hi}]; '
|
|
418
|
+
f'the data reach {s.max():.4g}')
|
|
419
|
+
x=s[mask]
|
|
420
|
+
y=np.asarray(stress,dtype=float)[mask]
|
|
421
|
+
else:
|
|
422
|
+
x=np.array(strain[fit_domain[0]:fit_domain[1]])
|
|
423
|
+
y=np.array(stress[fit_domain[0]:fit_domain[1]])
|
|
410
424
|
# logger.info(f'x: {x[0]} -> {x[-1]}')
|
|
411
425
|
# logger.info(f'y: {y[0]} -> {y[-1]}')
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
426
|
+
# The intercept is free. A modulus is the slope; forcing the line through the
|
|
427
|
+
# origin assumes the structure starts unstressed, and a glass equilibrated for
|
|
428
|
+
# tens of ps does not -- example 6's reference structure started at +150-200 bar,
|
|
429
|
+
# which through the origin adds offset/strain to E, about +1 GPa over a 2% window.
|
|
430
|
+
a,b=np.polyfit(x,y,1)
|
|
431
|
+
sse=(y-(a*x+b))**2
|
|
416
432
|
sst=(y-y.mean())**2
|
|
417
433
|
r2=1-sse.sum()/sst.sum()
|
|
418
|
-
return
|
|
434
|
+
return a,r2
|
|
@@ -588,6 +588,20 @@ def go_root():
|
|
|
588
588
|
_PFS_.cdroot()
|
|
589
589
|
|
|
590
590
|
|
|
591
|
+
def can_go_to(pathstr):
|
|
592
|
+
"""Whether :func:`go_to` can reach pathstr: a registered project directory, or one
|
|
593
|
+
name inside one. Nothing deeper -- ``postsim/a/b`` is refused.
|
|
594
|
+
|
|
595
|
+
Args:
|
|
596
|
+
pathstr (str): directory path relative to project root
|
|
597
|
+
|
|
598
|
+
Returns:
|
|
599
|
+
bool: True if go_to would accept it
|
|
600
|
+
"""
|
|
601
|
+
dirname = os.path.dirname(pathstr) or pathstr
|
|
602
|
+
return dirname in _PFS_.projSubPaths
|
|
603
|
+
|
|
604
|
+
|
|
591
605
|
def go_to(pathstr):
|
|
592
606
|
"""Changes the current working directory to pathstr relative to the project root.
|
|
593
607
|
|
|
@@ -601,7 +615,8 @@ def go_to(pathstr):
|
|
|
601
615
|
dirname = os.path.dirname(pathstr)
|
|
602
616
|
if dirname == '':
|
|
603
617
|
dirname = pathstr
|
|
604
|
-
assert
|
|
618
|
+
assert can_go_to(pathstr), (f'Error: cannot navigate using pathstring {pathstr}: a path must be '
|
|
619
|
+
f'a project directory or one name inside one ({sorted(_PFS_.projSubPaths)})')
|
|
605
620
|
reentry = os.path.exists(pathstr)
|
|
606
621
|
if not os.path.exists(dirname):
|
|
607
622
|
os.mkdir(dirname)
|
htpolynet/core/runtime.py
CHANGED
|
@@ -341,7 +341,9 @@ class Runtime:
|
|
|
341
341
|
N[res]+=molecule_count
|
|
342
342
|
Bonds=[]
|
|
343
343
|
Atoms=[]
|
|
344
|
-
|
|
344
|
+
# a ring-closing reaction's conversion is counted in groups by the ring cure;
|
|
345
|
+
# this pairwise count would only misstate it (BADCy: 1080 "bonds" for 720 bonds)
|
|
346
|
+
for R in [x for x in self.reactions if x.stage==reaction_stage.cure and not is_ring_closing(x)]:
|
|
345
347
|
for b in R.bonds:
|
|
346
348
|
A,B=b['atoms']
|
|
347
349
|
a,b=R.atoms[A],R.atoms[B]
|
|
@@ -430,7 +432,11 @@ class Runtime:
|
|
|
430
432
|
cmp_msg=", ".join([(x["molecule"]+" "+str(x["count"])) for x in self.cfg.initial_composition if x["count"]>0])
|
|
431
433
|
logger.info(f'Initial composition is {cmp_msg}')
|
|
432
434
|
self._calculate_maximum_conversion()
|
|
433
|
-
|
|
435
|
+
if self.maxconv or not self._ring_reactions():
|
|
436
|
+
logger.info(f'100% conversion is {self.maxconv} bonds')
|
|
437
|
+
else:
|
|
438
|
+
logger.info('Conversion is counted in reactive groups by the ring cure; '
|
|
439
|
+
'see "Ring cure begins" for the total')
|
|
434
440
|
|
|
435
441
|
logger.debug(f'Reaction bond(s) in each molecular template:')
|
|
436
442
|
for M in self.molecules.values():
|
htpolynet/core/topology.py
CHANGED
|
@@ -1069,7 +1069,9 @@ class Topology:
|
|
|
1069
1069
|
iidx = idxorder(tuple(inst_idx))
|
|
1070
1070
|
idx = -1
|
|
1071
1071
|
for i, r in sidf.iterrows():
|
|
1072
|
-
|
|
1072
|
+
# compare in canonical order on both sides: a row stored as (aj, ai)
|
|
1073
|
+
# is the same bond, and missing it left its parameters silently stale
|
|
1074
|
+
jdx = idxorder(tuple([r[a] for a in ins_hashables]))
|
|
1073
1075
|
if iidx == jdx:
|
|
1074
1076
|
idx = i
|
|
1075
1077
|
break
|
|
@@ -164,7 +164,9 @@ def refresh_bond_params(TC, pairs):
|
|
|
164
164
|
TC.Topology.reset_override_from_type('bonds', 'bondtypes',
|
|
165
165
|
inst_idx=(int(ai), int(aj)))
|
|
166
166
|
except Exception as e:
|
|
167
|
-
|
|
167
|
+
# a failure here leaves the bond on its old parameters, which nothing
|
|
168
|
+
# downstream would notice, so it must not be quiet
|
|
169
|
+
logger.warning(f'refresh_bond_params({ai},{aj}) failed, bond keeps its old parameters: {e!r}')
|
|
168
170
|
|
|
169
171
|
|
|
170
172
|
def neutralize_touched_fragments(TC, touched, tol=1e-6):
|
|
@@ -119,8 +119,8 @@ htpolynet analyze analyze.yaml --proj proj-0
|
|
|
119
119
|
```
|
|
120
120
|
|
|
121
121
|
**The postcure NPT plateau is not an equilibrated density.** It is an
|
|
122
|
-
under-relaxed structure, and on the
|
|
123
|
-
about 2.3% below what the same system gives after a melt and slow re-cool.
|
|
122
|
+
under-relaxed structure, and on the cyanate-ester example as it shipped before
|
|
123
|
+
2.15.0 (the pre-formed-triazine stand-in) it sat about 2.3% below what the same system gives after a melt and slow re-cool.
|
|
124
124
|
Do not report a plateau density as a force-field result.
|
|
125
125
|
|
|
126
126
|
## Subcommand routing
|
|
@@ -1,45 +1,26 @@
|
|
|
1
|
-
# htpolynet -- Example 6 --
|
|
1
|
+
# htpolynet -- Example 6 -- Bisphenol-A dicyanate (BADCy) cured by cyclotrimerization
|
|
2
2
|
#
|
|
3
|
-
#
|
|
4
|
-
#
|
|
5
|
-
#
|
|
6
|
-
#
|
|
7
|
-
#
|
|
3
|
+
# Cyanate esters cure by cyclotrimerization: three -O-C#N groups close into one
|
|
4
|
+
# 1,3,5-triazine ring, an addition in which no atom is lost. The triazine rings are the
|
|
5
|
+
# trifunctional crosslink junctions and the bisphenol-A cores are the bridges between
|
|
6
|
+
# them. This example builds that network by the real chemistry, using the `ring_cure`
|
|
7
|
+
# block below in place of CURE's pairwise crosslinking.
|
|
8
8
|
#
|
|
9
|
-
#
|
|
10
|
-
#
|
|
11
|
-
#
|
|
12
|
-
#
|
|
13
|
-
# every monomer enters the box already carrying its ring.
|
|
9
|
+
# One monomer, BDC (N#C-O-C6H4-C(CH3)2-C6H4-O-C#N), carries two cyanate groups. The
|
|
10
|
+
# single reaction `cyclotrimerize` takes three of them and forms three new bonds,
|
|
11
|
+
# N1-C2, N2-C3 and N3-C1, which close the ring. htpolynet builds and parameterizes the
|
|
12
|
+
# trimer template once, at setup, and splices it into the system for every ring.
|
|
14
13
|
#
|
|
15
|
-
#
|
|
16
|
-
#
|
|
17
|
-
#
|
|
18
|
-
#
|
|
19
|
-
# permutations. The resulting network has triazine rings as trifunctional
|
|
20
|
-
# nodes, BPA bridges as difunctional spacers, and aryl-ether linkages between
|
|
21
|
-
# them -- structurally identical to a fully cured BADCy thermoset.
|
|
14
|
+
# Conversion is counted in cyanate groups consumed -- three per ring -- which is the
|
|
15
|
+
# quantity FTIR measures and the literature reports. A group that never finds two
|
|
16
|
+
# partners simply stays -O-C#N, which is what real under-cured BADCy contains, so no
|
|
17
|
+
# post-cure repair is needed.
|
|
22
18
|
#
|
|
23
|
-
#
|
|
24
|
-
#
|
|
25
|
-
#
|
|
26
|
-
#
|
|
27
|
-
#
|
|
28
|
-
# + No in-cure ring closure; no bondcycle bypass; simple A2+B3 step-growth.
|
|
29
|
-
# + No assembled-monomer param stage (BPA and TAZ are inserted directly).
|
|
30
|
-
# - The cure mechanism here is aryl substitution, not cyclotrimerization,
|
|
31
|
-
# so cure-kinetics and intermediate-species questions can't be addressed
|
|
32
|
-
# with this model. The final cured-network *structure* is faithful.
|
|
33
|
-
#
|
|
34
|
-
# Incomplete-cure realism: because cure is deterministic-conversion driven
|
|
35
|
-
# (not chemically rate-limited), at finite desired_conversion < 1 the system
|
|
36
|
-
# can carry leftover BPA-OH and bare triazine C-H sites -- both unphysical
|
|
37
|
-
# in a real BADCy thermoset. The ``postcure_repair`` block below converts
|
|
38
|
-
# those artifacts into chemically-realistic residuals: every incomplete
|
|
39
|
-
# triazine (k<3 bonded BPAs) is dismantled into three -C#N fragments which
|
|
40
|
-
# are reattached either in place (to the BPAs they were already bonded to)
|
|
41
|
-
# or to the nearest free BPA-OH, yielding the BPA-O-C#N end-groups that
|
|
42
|
-
# real undercured BADCy actually contains. Atom conservation is exact.
|
|
19
|
+
# Releases before 2.15.0 built this example with a stand-in model: bisphenol A plus a
|
|
20
|
+
# pre-formed 1,3,5-triazine, joined by aryl-ether bonds, with a postcure repair stage
|
|
21
|
+
# that dismantled incomplete rings into -O-C#N caps. Its final connectivity can match
|
|
22
|
+
# a cured BADCy network, but its triazine rings exist before cure begins, so the way
|
|
23
|
+
# the network forms -- and its gel point -- are not those of the chemistry.
|
|
43
24
|
#
|
|
44
25
|
# Run with:
|
|
45
26
|
#
|
|
@@ -47,7 +28,7 @@
|
|
|
47
28
|
#
|
|
48
29
|
# Cameron F. Abrams -- cfa22@drexel.edu
|
|
49
30
|
|
|
50
|
-
Title:
|
|
31
|
+
Title: Bisphenol-A dicyanate cured by cyclotrimerization
|
|
51
32
|
gromacs:
|
|
52
33
|
gmx: gmx
|
|
53
34
|
gmx_options: -quiet -nobackup
|
|
@@ -57,34 +38,14 @@ gromacs:
|
|
|
57
38
|
ambertools:
|
|
58
39
|
charge_method: gas
|
|
59
40
|
constituents:
|
|
60
|
-
|
|
61
|
-
# Bisphenol-A
|
|
62
|
-
# to the
|
|
63
|
-
|
|
64
|
-
|
|
41
|
+
BDC:
|
|
42
|
+
# Bisphenol-A dicyanate. Each cyanate's C and N are reactive (z=1 each): the C of
|
|
43
|
+
# one group bonds to the N of the next around the ring. The two groups are
|
|
44
|
+
# symmetry-equivalent, so the one reaction below expands to every combination.
|
|
45
|
+
smiles: "[N:1]#[C:2]Oc1ccc(cc1)C(C)(C)c1ccc(O[C:3]#[N:4])cc1"
|
|
46
|
+
reactive_atoms: {1: N1, 2: C1, 3: C2, 4: N2}
|
|
47
|
+
symmetry_equivalent_atoms: [[C1, C2], [N1, N2]]
|
|
65
48
|
count: 360
|
|
66
|
-
symmetry_equivalent_atoms: [[O1, O2]]
|
|
67
|
-
TAZ:
|
|
68
|
-
# 1,3,5-triazine (s-triazine): aromatic ring of alternating C and N,
|
|
69
|
-
# three reactive ring C-H sites (z=1 each). Each C loses its one
|
|
70
|
-
# aromatic H to form an aryl-ether bond with a BPA phenolic O. The
|
|
71
|
-
# N atoms are mapped to give them distinct names (N1/N2/N3) so the
|
|
72
|
-
# postcure_repair driver can refer to them by name when dismantling
|
|
73
|
-
# incomplete rings.
|
|
74
|
-
smiles: "[cH:1]1[n:4][cH:2][n:5][cH:3][n:6]1"
|
|
75
|
-
reactive_atoms: {1: C1, 2: C2, 3: C3, 4: N1, 5: N2, 6: N3}
|
|
76
|
-
count: 240
|
|
77
|
-
symmetry_equivalent_atoms: [[C1, C2, C3], [N1, N2, N3]]
|
|
78
|
-
CYN:
|
|
79
|
-
# Hydrogen cyanide as the cap-template building block. Not inserted
|
|
80
|
-
# into the simulation box -- exists only so that the linked-product
|
|
81
|
-
# template ``BPA~O1-C1~CYN`` can be auto-parameterized at setup time
|
|
82
|
-
# for use by the postcure_repair stage (see below). The C carries
|
|
83
|
-
# z=1 (loses one H to bond with BPA-O); the N is terminal but mapped
|
|
84
|
-
# so it lands in the mol2 as N1 (not the default element-only name);
|
|
85
|
-
# the repair driver looks up cap atoms by name, so both must be unique.
|
|
86
|
-
smiles: "[CH:1]#[N:2]"
|
|
87
|
-
reactive_atoms: {1: C1, 2: N1}
|
|
88
49
|
densification:
|
|
89
50
|
initial_density: 200.0 # kg/m3
|
|
90
51
|
equilibration:
|
|
@@ -125,53 +86,24 @@ precure:
|
|
|
125
86
|
temperature: 300 # K
|
|
126
87
|
pressure: 1 # bar
|
|
127
88
|
ps: 100
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
increment: 0.08 # nm
|
|
147
|
-
limit: 0.3 # nm
|
|
148
|
-
equilibration:
|
|
149
|
-
- ensemble: min
|
|
150
|
-
- ensemble: nvt
|
|
151
|
-
temperature: 600
|
|
152
|
-
nsteps: 1000
|
|
153
|
-
- ensemble: npt
|
|
154
|
-
temperature: 600
|
|
155
|
-
pressure: 1
|
|
156
|
-
nsteps: 2000
|
|
157
|
-
relax:
|
|
158
|
-
increment: 0.08 # nm
|
|
159
|
-
equilibration:
|
|
160
|
-
- ensemble: min
|
|
161
|
-
- ensemble: nvt
|
|
162
|
-
temperature: 600
|
|
163
|
-
nsteps: 1000
|
|
164
|
-
- ensemble: npt
|
|
165
|
-
temperature: 600
|
|
166
|
-
pressure: 1
|
|
167
|
-
nsteps: 2000
|
|
168
|
-
equilibrate:
|
|
169
|
-
ensemble: npt
|
|
170
|
-
temperature: 300 # K
|
|
171
|
-
pressure: 1 # bar
|
|
172
|
-
ps: 100
|
|
173
|
-
gromacs:
|
|
174
|
-
rdefault: 0.9 # nm
|
|
89
|
+
ring_cure:
|
|
90
|
+
search_radius: 0.5 # nm; longest new bond a candidate ring may need
|
|
91
|
+
radial_increment: 0.05 # nm; widen the search by this when an iteration is short of rings
|
|
92
|
+
desired_conversion: 0.97 # fraction of cyanate GROUPS consumed, three per ring
|
|
93
|
+
max_iterations: 150
|
|
94
|
+
closure:
|
|
95
|
+
nstages: 6 # restraint stages that pull each candidate ring shut
|
|
96
|
+
# Every other ring_cure setting is left at its default. Two are worth knowing:
|
|
97
|
+
# reject_threaded_rings, reject_new_threading (both true) decline a ring that would
|
|
98
|
+
# close around an existing bond, or that leaves a dragged monomer's bond threading an
|
|
99
|
+
# existing ring. A threaded ring is permanent -- no later relaxation can undo it --
|
|
100
|
+
# so it is refused rather than repaired. `htpolynet piercings` counts any that remain.
|
|
101
|
+
# Each iteration then relaxes at 600 K and re-equilibrates at 300 K and 1 bar, as CURE
|
|
102
|
+
# does, and the cure settles the network once on exit.
|
|
103
|
+
#
|
|
104
|
+
# Fang & Shimp's end-group arithmetic caps acyclic growth at 75% cyanate conversion,
|
|
105
|
+
# so a network that reaches 0.97 necessarily contains macrocycles. That is the real
|
|
106
|
+
# chemistry, and it is why no cycle-length filter is applied here.
|
|
175
107
|
postcure:
|
|
176
108
|
anneal:
|
|
177
109
|
ncycles: 2
|
|
@@ -195,58 +127,26 @@ postcure:
|
|
|
195
127
|
pressure: 1 # bar
|
|
196
128
|
ps: 100
|
|
197
129
|
reactions:
|
|
198
|
-
|
|
199
|
-
# triazine ring carbons, each side losing one H. The single reaction
|
|
200
|
-
# below is auto-expanded by htpolynet (via symmetry_equivalent_atoms on
|
|
201
|
-
# both monomers) into all 2 x 3 = 6 (O, C) permutations. htpolynet also
|
|
202
|
-
# builds 18 templates for bonds to rings that already carry one or two
|
|
203
|
-
# BPAs, so later bonds on a ring do not reset the charges of its
|
|
204
|
-
# already-reacted carbons.
|
|
205
|
-
- name: etherify
|
|
130
|
+
- name: cyclotrimerize
|
|
206
131
|
stage: cure
|
|
207
|
-
reactants: {1:
|
|
208
|
-
product:
|
|
132
|
+
reactants: {1: BDC, 2: BDC, 3: BDC}
|
|
133
|
+
product: BDC3
|
|
209
134
|
probability: 1.0
|
|
210
135
|
atoms:
|
|
211
|
-
|
|
212
|
-
|
|
136
|
+
N1: {reactant: 1, resid: 1, atom: N1, z: 1}
|
|
137
|
+
C1: {reactant: 1, resid: 1, atom: C1, z: 1}
|
|
138
|
+
N2: {reactant: 2, resid: 1, atom: N1, z: 1}
|
|
139
|
+
C2: {reactant: 2, resid: 1, atom: C1, z: 1}
|
|
140
|
+
N3: {reactant: 3, resid: 1, atom: N1, z: 1}
|
|
141
|
+
C3: {reactant: 3, resid: 1, atom: C1, z: 1}
|
|
213
142
|
bonds:
|
|
214
|
-
|
|
143
|
+
# An addition: no hydrogen is lost, so no sacrificial H.
|
|
144
|
+
- atoms: [N1, C2]
|
|
215
145
|
order: 1
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
- name: cap_with_cyanate
|
|
222
|
-
stage: repair
|
|
223
|
-
reactants: {1: BPA, 2: CYN}
|
|
224
|
-
product: BPA~O1-C1~CYN
|
|
225
|
-
probability: 1.0
|
|
226
|
-
atoms:
|
|
227
|
-
A: {reactant: 1, resid: 1, atom: O1, z: 1}
|
|
228
|
-
B: {reactant: 2, resid: 1, atom: C1, z: 1}
|
|
229
|
-
bonds:
|
|
230
|
-
- atoms: [A, B]
|
|
146
|
+
sacrificial_h: false
|
|
147
|
+
- atoms: [N2, C3]
|
|
148
|
+
order: 1
|
|
149
|
+
sacrificial_h: false
|
|
150
|
+
- atoms: [N3, C1]
|
|
231
151
|
order: 1
|
|
232
|
-
|
|
233
|
-
# Convert every incomplete triazine into chemically-realistic BADCy
|
|
234
|
-
# residual species. Each TAZ ring with fewer than 3 bonded BPAs is
|
|
235
|
-
# dismantled into 3 separate -C#N fragments: those already attached to
|
|
236
|
-
# a BPA become BPA-O-C#N caps in place; the rest are transferred to
|
|
237
|
-
# the nearest unreacted BPA-OH within `cap_search_radius`. Atom
|
|
238
|
-
# conservation is exact across the system. Linked-product template
|
|
239
|
-
# `BPA~O1-C1~CYN` (auto-generated from the repair-stage reaction above)
|
|
240
|
-
# supplies the post-repair parameters.
|
|
241
|
-
- type: triazine_to_cyanate_cap
|
|
242
|
-
crosslinker:
|
|
243
|
-
residue: TAZ
|
|
244
|
-
ring_carbon_atoms: [C1, C2, C3]
|
|
245
|
-
ring_nitrogen_atoms: [N1, N2, N3]
|
|
246
|
-
full_bond_count: 3
|
|
247
|
-
bridge:
|
|
248
|
-
residue: BPA
|
|
249
|
-
reactive_oxygen_atoms: [O1, O2]
|
|
250
|
-
cap_residue: CYN
|
|
251
|
-
cap_template: BPA~O1-C1~CYN
|
|
252
|
-
cap_search_radius: 0.6 # nm; expanded up to 10x on miss, falls back to global nearest
|
|
152
|
+
sacrificial_h: false
|
|
@@ -19,11 +19,11 @@ fourierspacing = 0.12
|
|
|
19
19
|
pme_order = 4
|
|
20
20
|
ewald_rtol = 1e-5
|
|
21
21
|
optimize_fft = yes
|
|
22
|
-
tcoupl
|
|
22
|
+
tcoupl = V-rescale ; correct canonical ensemble; Berendsen does not give the right kinetic energy distribution (deprecated 2025+)
|
|
23
23
|
tc-grps = System
|
|
24
24
|
tau_t = 0.1
|
|
25
25
|
ref_t = 300
|
|
26
|
-
pcoupl =
|
|
26
|
+
pcoupl = C-rescale ; correct NPT ensemble and robust far from equilibrium; Berendsen is neither (deprecated 2025+)
|
|
27
27
|
pcoupltype = isotropic ; uniform scaling of x-y-z box vectors
|
|
28
28
|
tau_p = 0.5 ; time constant, in ps
|
|
29
29
|
ref_p = 1.0
|
|
@@ -19,7 +19,7 @@ fourierspacing = 0.12
|
|
|
19
19
|
pme_order = 4
|
|
20
20
|
ewald_rtol = 1e-5
|
|
21
21
|
optimize_fft = yes
|
|
22
|
-
tcoupl
|
|
22
|
+
tcoupl = V-rescale ; correct canonical ensemble; Berendsen does not give the right kinetic energy distribution (deprecated 2025+)
|
|
23
23
|
tc-grps = System
|
|
24
24
|
tau_t = 0.1
|
|
25
25
|
ref_t = 300
|
htpolynet/resources/mdp/npt.mdp
CHANGED
|
@@ -18,11 +18,11 @@ fourierspacing = 0.12
|
|
|
18
18
|
pme_order = 4
|
|
19
19
|
ewald_rtol = 1e-5
|
|
20
20
|
optimize_fft = yes
|
|
21
|
-
tcoupl
|
|
21
|
+
tcoupl = V-rescale ; correct canonical ensemble; Berendsen does not give the right kinetic energy distribution (deprecated 2025+)
|
|
22
22
|
tc-grps = System
|
|
23
23
|
tau_t = 0.1
|
|
24
24
|
ref_t = 300
|
|
25
|
-
pcoupl =
|
|
25
|
+
pcoupl = C-rescale ; correct NPT ensemble and robust far from equilibrium; Berendsen is neither (deprecated 2025+)
|
|
26
26
|
pcoupltype = isotropic ; uniform scaling of x-y-z box vectors
|
|
27
27
|
tau_p = 0.5 ; time constant, in ps
|
|
28
28
|
ref_p = 10.0
|
htpolynet/resources/mdp/nvt.mdp
CHANGED
|
@@ -17,7 +17,7 @@ fourierspacing = 0.12
|
|
|
17
17
|
pme_order = 4
|
|
18
18
|
ewald_rtol = 1e-5
|
|
19
19
|
optimize_fft = yes
|
|
20
|
-
tcoupl
|
|
20
|
+
tcoupl = V-rescale ; correct canonical ensemble; Berendsen does not give the right kinetic energy distribution (deprecated 2025+)
|
|
21
21
|
tc-grps = System
|
|
22
22
|
tau_t = 0.1
|
|
23
23
|
ref_t = 300
|
|
@@ -19,11 +19,11 @@ fourierspacing = 0.12
|
|
|
19
19
|
pme_order = 4
|
|
20
20
|
ewald_rtol = 1e-5
|
|
21
21
|
optimize_fft = yes
|
|
22
|
-
tcoupl
|
|
22
|
+
tcoupl = V-rescale ; correct canonical ensemble; Berendsen does not give the right kinetic energy distribution (deprecated 2025+)
|
|
23
23
|
tc-grps = System
|
|
24
24
|
tau_t = 0.1
|
|
25
25
|
ref_t = 300
|
|
26
|
-
pcoupl =
|
|
26
|
+
pcoupl = C-rescale ; correct NPT ensemble and robust far from equilibrium; Berendsen is neither (deprecated 2025+)
|
|
27
27
|
pcoupltype = isotropic ; uniform scaling of x-y-z box vectors
|
|
28
28
|
tau_p = 0.5 ; time constant, in ps
|
|
29
29
|
ref_p = 1.0
|
|
@@ -19,7 +19,7 @@ fourierspacing = 0.12
|
|
|
19
19
|
pme_order = 4
|
|
20
20
|
ewald_rtol = 1e-5
|
|
21
21
|
optimize_fft = yes
|
|
22
|
-
tcoupl
|
|
22
|
+
tcoupl = V-rescale ; correct canonical ensemble; Berendsen does not give the right kinetic energy distribution (deprecated 2025+)
|
|
23
23
|
tc-grps = System
|
|
24
24
|
tau_t = 0.1
|
|
25
25
|
ref_t = 300
|
|
@@ -14,7 +14,7 @@ rcoulomb = 1.0
|
|
|
14
14
|
rvdw = 1.0
|
|
15
15
|
coulombtype = cut-off
|
|
16
16
|
vdw_type = cut-off
|
|
17
|
-
tcoupl
|
|
17
|
+
tcoupl = V-rescale ; correct canonical ensemble; Berendsen does not give the right kinetic energy distribution (deprecated 2025+)
|
|
18
18
|
tc-grps = System
|
|
19
19
|
tau_t = 0.1
|
|
20
20
|
ref_t = 300
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: htpolynet
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.15.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/
|
|
@@ -26,7 +26,7 @@ Requires-Dist: rdkit>=2024.3
|
|
|
26
26
|
Requires-Dist: requests>=2.28
|
|
27
27
|
Requires-Dist: scipy>=1.10
|
|
28
28
|
Requires-Dist: setuptools
|
|
29
|
-
Requires-Dist: ycleptic>=2.4.
|
|
29
|
+
Requires-Dist: ycleptic>=2.4.4
|
|
30
30
|
Provides-Extra: dev
|
|
31
31
|
Requires-Dist: pytest; extra == 'dev'
|
|
32
32
|
Provides-Extra: test
|
|
@@ -3,9 +3,9 @@ htpolynet/cli.py,sha256=MKDArGrCp86xomkvUWKse858vU_uTQlBzNY1zgaDa5g,17682
|
|
|
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=
|
|
7
|
-
htpolynet/analysis/postsim.py,sha256=
|
|
8
|
-
htpolynet/analysis/utils.py,sha256=
|
|
6
|
+
htpolynet/analysis/plot.py,sha256=qHnRzF65TMtHnkNNp6FcSJE2JxmvFzDvvaSfu4duMe8,37844
|
|
7
|
+
htpolynet/analysis/postsim.py,sha256=EgRYZy7Xpmv05hzUEW3tjNKRzjpnynb1UVUZqgjfz3E,30056
|
|
8
|
+
htpolynet/analysis/utils.py,sha256=b8jYPaIoSWbF07hvLyDqPGWNDpPFZk6r-qY0Ttk1trk,19262
|
|
9
9
|
htpolynet/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
10
10
|
htpolynet/core/bondtemplate.py,sha256=_1vYMugonDuogysu15IsbpthvxYb6uJKC5ao7pQcWvg,9969
|
|
11
11
|
htpolynet/core/configuration.py,sha256=j-74qPF_bqZrt9fBivGj-jX85kkVHNkSHM13ewE2ut0,5279
|
|
@@ -13,10 +13,10 @@ htpolynet/core/coordinates.py,sha256=CGTHkdfw2ikc2ANacA5akRhZ9tOyM2IbELwQ2FVcKRw
|
|
|
13
13
|
htpolynet/core/molecule.py,sha256=j0I0qsk5mRTg8QMysxJz6U9HxgTRpRSzHEgJ_SRT-jQ,63012
|
|
14
14
|
htpolynet/core/paramcache.py,sha256=37S88gRXZ5_xAdWyUE-Q3Etxc5HMv8L_RHrykkq9YAs,6966
|
|
15
15
|
htpolynet/core/productsplice.py,sha256=asFVCW8G_rcMIizvO2Sh98MpOsFqzP1kIX1JySei_p8,12816
|
|
16
|
-
htpolynet/core/projectfilesystem.py,sha256=
|
|
17
|
-
htpolynet/core/runtime.py,sha256=
|
|
16
|
+
htpolynet/core/projectfilesystem.py,sha256=40zRje0sBuWAzLPvaNvvzCAnWAwFGi-tbGUju7MWlnY,23159
|
|
17
|
+
htpolynet/core/runtime.py,sha256=JQ2tM4_ThBF8cOtlr9uq5EFmgZ9b5lWqLFj9bbTU5k4,77264
|
|
18
18
|
htpolynet/core/topocoord.py,sha256=jUgFg9TuUdSm14wo_464xX6dC4okJMrj1FbIzmaoA0Q,110520
|
|
19
|
-
htpolynet/core/topology.py,sha256=
|
|
19
|
+
htpolynet/core/topology.py,sha256=ttdDUuE6noBhC-3B-x-lAfNVsXPOlEe-z4aKefZUOiY,65578
|
|
20
20
|
htpolynet/cure/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
21
21
|
htpolynet/cure/chain.py,sha256=-d5BFE5xUKjFdNkxLfSnCnZIRSJCtr7xuxYzNHBeSgU,5344
|
|
22
22
|
htpolynet/cure/curecontroller.py,sha256=eTJc1JqrD7w6XLg4pL5ACHXo5N1oJ6P5pVdzMONxiBU,59756
|
|
@@ -46,29 +46,29 @@ htpolynet/io/mol2.py,sha256=5aU3HmQ5DS0LBF7tBPCNYKzBScwj8V3xfEUcFIrsevk,7314
|
|
|
46
46
|
htpolynet/io/pdb.py,sha256=Np44dTbM0IcEAzfz6OGuH0rdQ63BGps3kOmkzH6syls,5293
|
|
47
47
|
htpolynet/repair/__init__.py,sha256=cP3i-P-Wc6s0MgoFDp63kbLomM-ti3mMGEgeQzUVKuY,1740
|
|
48
48
|
htpolynet/repair/cyanate_cap.py,sha256=d-OqnoRwOMwijYuMLFhGoFkEa2qFyzCdGnICDK69VkQ,39063
|
|
49
|
-
htpolynet/repair/topology_surgery.py,sha256=
|
|
49
|
+
htpolynet/repair/topology_surgery.py,sha256=uuS49WTF8se_aNrxWBfyWf203ocv3k9j2ZluM7u15So,13250
|
|
50
50
|
htpolynet/resources/README.md,sha256=epKLyqtcxtQOSzTYvaGlwhz970UA4vAU7r-iSBbbpmA,1432
|
|
51
51
|
htpolynet/resources/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
52
|
-
htpolynet/resources/claude/SKILL.md,sha256=
|
|
52
|
+
htpolynet/resources/claude/SKILL.md,sha256=5Gn0mLWAA9ZWj6lr4GZl_XAB6IuRFBThghMgjpj_mHQ,7466
|
|
53
53
|
htpolynet/resources/example_depot/0-liquid-styrene.yaml,sha256=lm05zMwBBxmDWeIBBl09v4rZpo3yLE62az2A3uZTUUY,2437
|
|
54
54
|
htpolynet/resources/example_depot/1-polystyrene.yaml,sha256=dRo8vktqHmEy9dSbSp1g1QoFEpLTzXwuXLNPwomM5M4,3702
|
|
55
55
|
htpolynet/resources/example_depot/2-bisgma-styrene-thermoset.yaml,sha256=5pba6IWqUx72oJ4LWmo6FZEHf8L4IMxpgPr2Giv5plU,6133
|
|
56
56
|
htpolynet/resources/example_depot/3-pacm-dgeba-epoxy-thermoset.yaml,sha256=eewz2H3WcAY-f6tbhM1t-HLp5TmSVFiUg4xLJs8vN2k,4471
|
|
57
57
|
htpolynet/resources/example_depot/4-dfda-fde-epoxy-thermoset.yaml,sha256=VSY7EVwJsItcWN77HJlSMgY2VHFpvQXB_N27T7blfk4,4446
|
|
58
58
|
htpolynet/resources/example_depot/5-htpb-ipdi.yaml,sha256=2Ww8N3QMWpstxK2BChPB8Enltl78EFh7pn1vFkXrwhA,10616
|
|
59
|
-
htpolynet/resources/example_depot/6-cyanate-ester.yaml,sha256=
|
|
59
|
+
htpolynet/resources/example_depot/6-cyanate-ester.yaml,sha256=5g8BartIXWMXtBREXaKNpMkH9v0296NchGj3QxY2OQo,5693
|
|
60
60
|
htpolynet/resources/mdp/README.md,sha256=48RjM7HLRF776FUJXUxQIw8RZxc7z1ti6za3YB7_U80,20
|
|
61
61
|
htpolynet/resources/mdp/drag-min.mdp,sha256=CrMRQIzwtG4TlYRY-nB1P7HPgdwrpwSJJW6yoYdfahY,225
|
|
62
|
-
htpolynet/resources/mdp/drag-npt.mdp,sha256
|
|
63
|
-
htpolynet/resources/mdp/drag-nvt.mdp,sha256=
|
|
62
|
+
htpolynet/resources/mdp/drag-npt.mdp,sha256=-SUsGcIPyALsnOU51aerRmy_IVddHbMLUre2NYIIcBU,1080
|
|
63
|
+
htpolynet/resources/mdp/drag-nvt.mdp,sha256=J5f7O4ae0iRzDWbYKMzZtkAzBm1F-4KdHssrH7BNDzQ,759
|
|
64
64
|
htpolynet/resources/mdp/min.mdp,sha256=xIViAc9gTE5rMAsYrPGYCNu1fnit_NWdcsBI786XvZc,226
|
|
65
|
-
htpolynet/resources/mdp/npt.mdp,sha256=
|
|
66
|
-
htpolynet/resources/mdp/nvt.mdp,sha256=
|
|
65
|
+
htpolynet/resources/mdp/npt.mdp,sha256=utfwtzbKwtzvKsRkLs_f6JJjB12_MUwqiHU7_CHRGG4,1214
|
|
66
|
+
htpolynet/resources/mdp/nvt.mdp,sha256=BseL90ACUyCPj5tShEWXKy7JqVEmRvN9iUiDy_-n5B4,804
|
|
67
67
|
htpolynet/resources/mdp/relax-min.mdp,sha256=KsOkmEi3FLBRtAhEUpUPUhuCe_zArfJqTKInKDnl1us,213
|
|
68
|
-
htpolynet/resources/mdp/relax-npt.mdp,sha256
|
|
69
|
-
htpolynet/resources/mdp/relax-nvt.mdp,sha256=
|
|
68
|
+
htpolynet/resources/mdp/relax-npt.mdp,sha256=9x9bmOG9bpdiEV468uHr4F-ObCMNJVLsSQ8hG-DDttA,1088
|
|
69
|
+
htpolynet/resources/mdp/relax-nvt.mdp,sha256=nk0ILrNr5OBg-7zY1Zb7O9w4Np_xKstJu6xU4eD-B7E,767
|
|
70
70
|
htpolynet/resources/mdp/single-molecule-min.mdp,sha256=LinjsbugiKvJrh2fcog9tACaOyWHiUB8lQX5RzTy5xE,211
|
|
71
|
-
htpolynet/resources/mdp/single-molecule-nvt.mdp,sha256=
|
|
71
|
+
htpolynet/resources/mdp/single-molecule-nvt.mdp,sha256=Dm6zGeYnU3q8XHXFhV1sEe_4hi4yOdosYkekcoDXs10,616
|
|
72
72
|
htpolynet/resources/molecules/make-monomers.sh,sha256=klvyRoFxP2AtvQKssgc4KlmvmlCeFx8nohBCFtI0gXg,2437
|
|
73
73
|
htpolynet/resources/molecules/inputs/DFA.pdb,sha256=Fp52MS9C9GjWk78ysyVaA3RXcSRsljK_HIeYvlAo-Bc,4538
|
|
74
74
|
htpolynet/resources/molecules/inputs/DGE.mol2,sha256=18Bctj6GdMtrtS1HErukojUqlPUAlxIuL9aHkhGxWtU,5457
|
|
@@ -105,8 +105,8 @@ htpolynet/utils/logsetup.py,sha256=o0mlVXNzqcfua2SAlJPkGSh4lM_bmI10gWwpb9gqYu8,1
|
|
|
105
105
|
htpolynet/utils/profiling.py,sha256=su7qpGEz6FXVU4KT2HQDWG82bc1sgsfpDQBbAfPpsHc,7331
|
|
106
106
|
htpolynet/utils/stringthings.py,sha256=Mr6o55EM8o4YAaVYpjIJj2IxDToNdbPzb-lpQ3w3jFk,1176
|
|
107
107
|
htpolynet/utils/vmd_viz.py,sha256=Crk3Ln88PKiJ9X7DMMkFEVh2Ru6a1y0RUgj3w6EIgFc,10867
|
|
108
|
-
htpolynet-2.
|
|
109
|
-
htpolynet-2.
|
|
110
|
-
htpolynet-2.
|
|
111
|
-
htpolynet-2.
|
|
112
|
-
htpolynet-2.
|
|
108
|
+
htpolynet-2.15.0.dist-info/METADATA,sha256=CQ407bPBVmIhIoF1vTsk6Bfiv7k2oEPn75FJjHGZQMk,6589
|
|
109
|
+
htpolynet-2.15.0.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
|
|
110
|
+
htpolynet-2.15.0.dist-info/entry_points.txt,sha256=G5tx55llJf-IV9dIe7J8myGdyrhCVggCAhKrVNGP_s0,48
|
|
111
|
+
htpolynet-2.15.0.dist-info/licenses/LICENSE,sha256=piPSGqJdmTGyzF9HOnjlO2KvgOKT8NHwhCuGYM778tY,1071
|
|
112
|
+
htpolynet-2.15.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|