HTPolyNet 2.17.0__py3-none-any.whl → 2.18.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 +93 -13
- htpolynet/analysis/utils.py +30 -0
- htpolynet/core/configuration.py +6 -1
- htpolynet/cure/curecontroller.py +17 -1
- htpolynet/cure/ringcontroller.py +13 -1
- htpolynet/external/smiles_input.py +266 -8
- htpolynet/resources/claude/SKILL.md +26 -7
- htpolynet/resources/example_depot/0-liquid-styrene.yaml +5 -4
- htpolynet/resources/example_depot/1-polystyrene.yaml +10 -26
- htpolynet/resources/example_depot/2-bisgma-styrene-thermoset.yaml +17 -46
- htpolynet/resources/example_depot/3-pacm-dgeba-epoxy-thermoset.yaml +9 -26
- htpolynet/resources/example_depot/4-dfda-fde-epoxy-thermoset.yaml +9 -25
- htpolynet/resources/example_depot/5-htpb-ipdi.yaml +17 -13
- htpolynet/resources/example_depot/6-cyanate-ester.yaml +8 -2
- htpolynet/schema/base.yaml +41 -0
- {htpolynet-2.17.0.dist-info → htpolynet-2.18.0.dist-info}/METADATA +1 -1
- {htpolynet-2.17.0.dist-info → htpolynet-2.18.0.dist-info}/RECORD +20 -20
- {htpolynet-2.17.0.dist-info → htpolynet-2.18.0.dist-info}/WHEEL +0 -0
- {htpolynet-2.17.0.dist-info → htpolynet-2.18.0.dist-info}/entry_points.txt +0 -0
- {htpolynet-2.17.0.dist-info → htpolynet-2.18.0.dist-info}/licenses/LICENSE +0 -0
htpolynet/analysis/plot.py
CHANGED
|
@@ -667,6 +667,15 @@ def build_plots(args):
|
|
|
667
667
|
# dist_bw_xlinks_plot(am,os.path.join(p,"dist_bw_xlinks.png"))
|
|
668
668
|
|
|
669
669
|
def do_tg_plots(phases,projdirs,outfile='tg.png',save_data='data.csv',n_points=[10,20]):
|
|
670
|
+
"""Tg from each ladder's density curve, by the two-line crossing.
|
|
671
|
+
|
|
672
|
+
The reported Tg is the two-line crossing (:func:`compute_tg`) of the curve averaged
|
|
673
|
+
over builds, with the crossing of each build's own curve giving the between-build
|
|
674
|
+
spread. The whole-curve hyperbola fit (:func:`pooled_tg`) is still computed and
|
|
675
|
+
logged, but only as a diagnostic: its Tg depends on whether density, ln density or
|
|
676
|
+
specific volume is fitted, and drifts with the ladder's top (Cameron, 2026-11-16:
|
|
677
|
+
"for Tg, crossing, not hyperbole").
|
|
678
|
+
"""
|
|
670
679
|
res={}
|
|
671
680
|
means={}
|
|
672
681
|
stds={}
|
|
@@ -675,13 +684,27 @@ def do_tg_plots(phases,projdirs,outfile='tg.png',save_data='data.csv',n_points=[
|
|
|
675
684
|
spread=[]
|
|
676
685
|
span=[]
|
|
677
686
|
whole=[]
|
|
678
|
-
|
|
687
|
+
per_build=[]
|
|
679
688
|
for i,phase in enumerate(phases):
|
|
680
689
|
p=phase['ladder']
|
|
690
|
+
# a ladder that crashed leaves no ladder.csv; it must not take the finished
|
|
691
|
+
# ladders down with it (htpolynet-sweep lost two complete example-3 cooling
|
|
692
|
+
# ladders that way when their heating partners died, job 26725677)
|
|
693
|
+
found=[]
|
|
694
|
+
for d in projdirs:
|
|
695
|
+
f=os.path.join(d,p['subdir'],'ladder.csv')
|
|
696
|
+
if os.path.exists(f):
|
|
697
|
+
found.append(f)
|
|
698
|
+
else:
|
|
699
|
+
logger.warning(f'{f} not found (did this ladder finish?); leaving {d} out of '
|
|
700
|
+
f'ladder {i} ({p["subdir"]})')
|
|
701
|
+
if not found:
|
|
702
|
+
logger.warning(f'no build has ladder {i} ({p["subdir"]}); skipping it')
|
|
703
|
+
continue
|
|
681
704
|
rate.append(p['deltaT']/(p['ps_per_rise']+p['ps_per_run']))
|
|
682
705
|
res[i]=[]
|
|
683
|
-
for
|
|
684
|
-
df=pd.read_csv(
|
|
706
|
+
for f in found:
|
|
707
|
+
df=pd.read_csv(f,index_col=None,header=0)
|
|
685
708
|
t0=p['warmup_ps']
|
|
686
709
|
ps_per_step=p['ps_per_rise']+p['ps_per_run']
|
|
687
710
|
final_ps=df['time(ps)'].iloc[-1]
|
|
@@ -706,13 +729,20 @@ def do_tg_plots(phases,projdirs,outfile='tg.png',save_data='data.csv',n_points=[
|
|
|
706
729
|
|
|
707
730
|
res[i].append(pd.DataFrame({'Temperature':T,'Volume':V,'Density':rho,'Temperature-std':Tstd,'Volume-std':Vstd,'Density-std':rhostd}))
|
|
708
731
|
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
732
|
+
# mean and spread over builds at each rung. Side-by-side concat and stack(), as
|
|
733
|
+
# this used to do, is refused by pandas >= 3 whenever there is more than one build
|
|
734
|
+
# (duplicate column names); do_E_plots had the same break.
|
|
735
|
+
df_concat0=pd.concat(res[i],keys=range(len(res[i])))
|
|
736
|
+
means[i]=df_concat0.groupby(level=1).mean().sort_index(axis=1)
|
|
737
|
+
stds[i]=df_concat0.groupby(level=1).std().sort_index(axis=1)
|
|
712
738
|
means[i]['Volume-std']=stds[i]['Volume']
|
|
713
739
|
means[i]['Density-std']=stds[i]['Density']
|
|
714
740
|
|
|
715
741
|
|
|
742
|
+
if not means:
|
|
743
|
+
logger.warning('no ladder finished in any build; no Tg to report')
|
|
744
|
+
return {'heating':None,'cooling':None,'directions':[],'window_range':[],
|
|
745
|
+
'unquotable':[],'whole_curve':[]}
|
|
716
746
|
fig,ax=plt.subplots(1,max(2,len(means)),figsize=(10,6),sharex=True,sharey=True)
|
|
717
747
|
for i,v in enumerate(means.keys()):
|
|
718
748
|
m=means[v]
|
|
@@ -723,7 +753,7 @@ def do_tg_plots(phases,projdirs,outfile='tg.png',save_data='data.csv',n_points=[
|
|
|
723
753
|
ax[i].set_xlabel('Temperature [K]')
|
|
724
754
|
ax[i].set_title('heating' if rate[i]>0 else 'cooling')
|
|
725
755
|
ax[i].set_ylabel('Density [kg/m$^3$]')
|
|
726
|
-
if
|
|
756
|
+
if len(res[v])<2:
|
|
727
757
|
ax[i].scatter(m['Temperature'],m['Density'])
|
|
728
758
|
else:
|
|
729
759
|
ax[i].errorbar(m['Temperature'],m['Density'],std['Density'])
|
|
@@ -731,9 +761,14 @@ def do_tg_plots(phases,projdirs,outfile='tg.png',save_data='data.csv',n_points=[
|
|
|
731
761
|
Tgs.append(Tg)
|
|
732
762
|
spread.append(tg_window_range(m['Temperature'].values,m['Density'].values))
|
|
733
763
|
curves=[(r['Temperature'].values,r['Density'].values) for r in res[v]]
|
|
764
|
+
per_build.append(_crossing_per_build(curves,n_points))
|
|
734
765
|
w=pooled_tg(curves)
|
|
735
766
|
if len(curves)==1 and w['fit'] is not None and not w['fit']['held_out']:
|
|
736
767
|
w['fit']=fit_tg_hyperbola(*curves[0],n_synth=200)
|
|
768
|
+
f=w['fit']
|
|
769
|
+
w['ceiling_drift']=(ceiling_drift(curves) if f is not None and not f['held_out']
|
|
770
|
+
else None)
|
|
771
|
+
w['rung']=float(np.median(np.abs(np.diff(curves[0][0]))))
|
|
737
772
|
whole.append(w)
|
|
738
773
|
span.append((m['Temperature'].min(),m['Temperature'].max()))
|
|
739
774
|
if Tg!=-1:
|
|
@@ -752,8 +787,12 @@ def do_tg_plots(phases,projdirs,outfile='tg.png',save_data='data.csv',n_points=[
|
|
|
752
787
|
# plan B on example 5, 2026-10-23)
|
|
753
788
|
labels=['heating' if r>0 else 'cooling' for r in rate]
|
|
754
789
|
logger.info(f'{outfile} created.')
|
|
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)'
|
|
790
|
+
for label,Tg,r,b in zip(labels,Tgs,rate,per_build):
|
|
791
|
+
logger.info(f'{label} Tg = {Tg:.2f} K ({(Tg-273.15):.2f} C) at {r:.5f} K/ps ({r*1.e12:.3e} K/s), '
|
|
792
|
+
f'two-line crossing of the mean curve')
|
|
793
|
+
if b['sd'] is not None:
|
|
794
|
+
logger.info(f'{label} Tg, two-line crossing per build: {b["mean"]:.1f} +/- {b["sd"]:.1f} K '
|
|
795
|
+
f'(mean and s.d. over {b["n"]} builds)')
|
|
757
796
|
unquotable=[]
|
|
758
797
|
for label,r,(lo,hi) in zip(labels,spread,span):
|
|
759
798
|
if r is None:
|
|
@@ -767,9 +806,9 @@ def do_tg_plots(phases,projdirs,outfile='tg.png',save_data='data.csv',n_points=[
|
|
|
767
806
|
for label,w in zip(labels,whole):
|
|
768
807
|
f=w['fit']
|
|
769
808
|
if f is None:
|
|
770
|
-
logger.info(f'{label} Tg, whole-curve
|
|
809
|
+
logger.info(f'{label} Tg, whole-curve hyperbola (diagnostic, not the reported Tg): did not converge')
|
|
771
810
|
elif f['held_out']:
|
|
772
|
-
logger.info(f'{label} Tg, whole-curve
|
|
811
|
+
logger.info(f'{label} Tg, whole-curve hyperbola (diagnostic, not the reported Tg): none ({f["reason"]})')
|
|
773
812
|
else:
|
|
774
813
|
if w['Tg_boot_sd'] is not None:
|
|
775
814
|
err=(f'+/- {w["Tg_boot_sd"]:.0f} K (uncertainty of the mean, bootstrap over '
|
|
@@ -781,9 +820,30 @@ def do_tg_plots(phases,projdirs,outfile='tg.png',save_data='data.csv',n_points=[
|
|
|
781
820
|
err=f'+/- {f["Tg_synth_sd"]:.0f} K within this build'
|
|
782
821
|
else:
|
|
783
822
|
err='no error bar'
|
|
784
|
-
logger.info(f'{label} Tg, whole-curve
|
|
823
|
+
logger.info(f'{label} Tg, whole-curve hyperbola (diagnostic, not the reported Tg): {f["Tg"]:.1f} K {err}; tangents at the '
|
|
785
824
|
f'ladder ends cross at {f["Tg_tangents"]:.1f} K'
|
|
786
825
|
+ ('; a sharp break' if f['sharp'] else ''))
|
|
826
|
+
bar=w['Tg_boot_sd'] if w['Tg_boot_sd'] is not None else f.get('Tg_synth_sd')
|
|
827
|
+
# a move smaller than one rung is below what the ladder resolves, whatever the
|
|
828
|
+
# error bar says; a noise-free ladder has an error bar of zero
|
|
829
|
+
bar=max(bar or 0.0,w['rung'])
|
|
830
|
+
drift=w.get('ceiling_drift') or []
|
|
831
|
+
if drift:
|
|
832
|
+
logger.info(f'{label} Tg, whole-curve hyperbola with the top of the ladder cut away: '
|
|
833
|
+
+ '; '.join(f'{d["ceiling"]:.0f} K top: '
|
|
834
|
+
+ (f'{d["Tg"]:.1f} K ({d["Tg"]-f["Tg"]:+.1f})'
|
|
835
|
+
if d['Tg'] is not None else f'none ({d["reason"]})')
|
|
836
|
+
for d in drift))
|
|
837
|
+
first_cut=drift[0]
|
|
838
|
+
if first_cut['Tg'] is None:
|
|
839
|
+
logger.warning(f'the {label} whole-curve hyperbola Tg is lost when the top {first_cut["cut"]:.0f} K of '
|
|
840
|
+
f'the ladder is removed: the ladder only just reaches past this '
|
|
841
|
+
f'transition, so raise its top')
|
|
842
|
+
elif abs(first_cut['Tg']-f['Tg'])>bar:
|
|
843
|
+
logger.warning(f'the {label} whole-curve hyperbola Tg moves {first_cut["Tg"]-f["Tg"]:+.1f} K when the '
|
|
844
|
+
f'top {first_cut["cut"]:.0f} K of the ladder is removed, more than '
|
|
845
|
+
f'{bar:.1f} K, the larger of its error bar and one rung: the ladder is not tall enough for '
|
|
846
|
+
f'this Tg to have settled, so raise its top')
|
|
787
847
|
first={}
|
|
788
848
|
for i,label in enumerate(labels):
|
|
789
849
|
first.setdefault(label,i)
|
|
@@ -793,7 +853,27 @@ def do_tg_plots(phases,projdirs,outfile='tg.png',save_data='data.csv',n_points=[
|
|
|
793
853
|
logger.warning(f'heating and cooling Tg differ by {abs(hTg-cTg):.0f} K; more than rate '
|
|
794
854
|
f'hysteresis explains, so treat at least one as a failed fit')
|
|
795
855
|
return {'heating':hTg,'cooling':cTg,'directions':labels,'window_range':spread,
|
|
796
|
-
'unquotable':unquotable,'whole_curve':whole}
|
|
856
|
+
'unquotable':unquotable,'per_build':per_build,'whole_curve':whole}
|
|
857
|
+
|
|
858
|
+
def _crossing_per_build(curves,n_points):
|
|
859
|
+
"""Two-line crossing Tg of each build's own curve: dict with 'Tgs', 'mean', 'sd', 'n'.
|
|
860
|
+
|
|
861
|
+
'sd' is None with fewer than two builds. A build whose curve is too short for the
|
|
862
|
+
fit windows is left out.
|
|
863
|
+
"""
|
|
864
|
+
tgs=[]
|
|
865
|
+
for T,y in curves:
|
|
866
|
+
o=np.argsort(T)
|
|
867
|
+
T,y=np.asarray(T)[o],np.asarray(y)[o]
|
|
868
|
+
if len(T)<n_points[0]+n_points[1]:
|
|
869
|
+
continue
|
|
870
|
+
try:
|
|
871
|
+
tgs.append(float(compute_tg(T,y,n_points=n_points)[0]))
|
|
872
|
+
except (RuntimeError,ValueError,TypeError):
|
|
873
|
+
continue
|
|
874
|
+
n=len(tgs)
|
|
875
|
+
return {'Tgs':tgs,'n':n,'mean':float(np.mean(tgs)) if n else None,
|
|
876
|
+
'sd':float(np.std(tgs,ddof=1)) if n>1 else None}
|
|
797
877
|
|
|
798
878
|
def do_E_plots(phases,projdirs,outfile='e.png',save_data='E.csv',fit_strain=None):
|
|
799
879
|
"""Fits Young's modulus to the deform stages and plots the mean stress-strain curve.
|
htpolynet/analysis/utils.py
CHANGED
|
@@ -616,6 +616,36 @@ def pooled_tg(curves,n_boot=500,seed=0):
|
|
|
616
616
|
'Tg_boot_sd':sd,'per_build':per,'n_builds':len(curves),'n_kept':len(kept),
|
|
617
617
|
'per_build_sd':float(np.std(kept,ddof=1)) if len(kept)>1 else None}
|
|
618
618
|
|
|
619
|
+
def ceiling_drift(curves,cuts=(50.0,100.0)):
|
|
620
|
+
"""Pooled Tg refitted with the top of the ladder cut away.
|
|
621
|
+
|
|
622
|
+
Passing every check in :func:`fit_tg_hyperbola` says a Tg is not obviously broken,
|
|
623
|
+
not that the ladder was tall enough for it to have settled. Example 1's heating
|
|
624
|
+
Tg moved from 436.4 K on an 800 K ladder to 443.0 K at 700 K and 450.8 K at 650 K,
|
|
625
|
+
kept by every check at each (htpolynet-sweep, plan C, 2026-10-25). How far Tg moves
|
|
626
|
+
as the top comes off is the part of its uncertainty the bootstrap cannot see.
|
|
627
|
+
|
|
628
|
+
Args:
|
|
629
|
+
curves (list): one (T, v) pair of arrays per build
|
|
630
|
+
cuts (tuple): how many K to remove from the top of the ladder, one refit each
|
|
631
|
+
|
|
632
|
+
Returns:
|
|
633
|
+
list: one dict per cut, with cut, ceiling, Tg (None when the refit is held out)
|
|
634
|
+
and reason
|
|
635
|
+
"""
|
|
636
|
+
top=min(float(np.max(t)) for t,_ in curves)
|
|
637
|
+
out=[]
|
|
638
|
+
for cut in cuts:
|
|
639
|
+
ceiling=top-cut
|
|
640
|
+
trimmed=[(np.asarray(t)[np.asarray(t)<=ceiling],np.asarray(y)[np.asarray(t)<=ceiling])
|
|
641
|
+
for t,y in curves]
|
|
642
|
+
r=pooled_tg(trimmed,n_boot=0)
|
|
643
|
+
f=r['fit']
|
|
644
|
+
out.append({'cut':cut,'ceiling':ceiling,'Tg':r['Tg'],
|
|
645
|
+
'reason':None if r['Tg'] is not None
|
|
646
|
+
else (f['reason'] if f is not None else 'did not converge')})
|
|
647
|
+
return out
|
|
648
|
+
|
|
619
649
|
def compute_G(shear_strain,shear_stress,fit_domain=[10,100],fit_strain=None):
|
|
620
650
|
"""Computes the shear modulus by a linear fit to the elastic regime of a simple shear.
|
|
621
651
|
|
htpolynet/core/configuration.py
CHANGED
|
@@ -123,7 +123,12 @@ class Configuration:
|
|
|
123
123
|
self.title = self.basedict.get('Title', 'No title provided')
|
|
124
124
|
self.ncpu = self.basedict.get('ncpu', os.cpu_count())
|
|
125
125
|
self.constituents = self.basedict.get('constituents', {})
|
|
126
|
-
self.reaction_specs = self.basedict.get('reactions', [])
|
|
126
|
+
self.reaction_specs = list(self.basedict.get('reactions', []) or [])
|
|
127
|
+
if any(isinstance(v, dict) and v.get('activate') for v in self.constituents.values()):
|
|
128
|
+
# a constituent given in its real form gets the cap reactions that undo its
|
|
129
|
+
# activation written for it; see external.smiles_input.activate_smiles
|
|
130
|
+
from ..external.smiles_input import activation_cap_reactions
|
|
131
|
+
self.reaction_specs += activation_cap_reactions(self.constituents, self.reaction_specs)
|
|
127
132
|
self.gromacs = self.basedict.get('gromacs', {})
|
|
128
133
|
self.densification = self.basedict.get('densification', {})
|
|
129
134
|
self.precure = self.basedict.get('precure', {})
|
htpolynet/cure/curecontroller.py
CHANGED
|
@@ -296,6 +296,7 @@ class CureController:
|
|
|
296
296
|
'desired_conversion': 0.5,
|
|
297
297
|
'min_allowable_bondcycle_length':-1, # not set
|
|
298
298
|
'min_bonds_per_iteration': 10, # grow radius until >= this many bonds (or max radius)
|
|
299
|
+
'min_bond_fraction_per_iteration': 0.0, # ...or this fraction of 100% conversion, if larger
|
|
299
300
|
'completion_bias': False, # rank bond candidates by B-side completion before distance
|
|
300
301
|
'ncpu' : os.cpu_count()
|
|
301
302
|
},
|
|
@@ -356,6 +357,21 @@ class CureController:
|
|
|
356
357
|
if (d['nstages']>0 or d['increment']>0.0) and d['limit']>0.0:
|
|
357
358
|
self.dragging_enabled=True
|
|
358
359
|
|
|
360
|
+
def bond_floor(self,bond_target,bond_limit):
|
|
361
|
+
"""How many bonds an iteration should find before it stops widening the radius.
|
|
362
|
+
|
|
363
|
+
The larger of ``min_bonds_per_iteration`` and ``min_bond_fraction_per_iteration``
|
|
364
|
+
of the bonds at 100% conversion. A count alone does not scale with the box: a
|
|
365
|
+
larger box finds more candidates at the same concentration and may never widen.
|
|
366
|
+
The fraction defaults to 0, which leaves the count in charge, as before. The floor
|
|
367
|
+
is clamped against the bonds still needed (``bond_target``) and the most the
|
|
368
|
+
iteration will accept (``bond_limit``), and is never below 1.
|
|
369
|
+
"""
|
|
370
|
+
d=self.dicts['controls']
|
|
371
|
+
base=max(int(d.get('min_bonds_per_iteration',1)),
|
|
372
|
+
int(np.floor(float(d.get('min_bond_fraction_per_iteration',0.0))*self.state.max_nxlinkbonds+1.e-9)))
|
|
373
|
+
return max(1,min(base,bond_target,bond_limit))
|
|
374
|
+
|
|
359
375
|
def setup(self,max_nxlinkbonds=0,desired_nxlinkbonds=0,max_search_radius=0.0):
|
|
360
376
|
"""Sets up this CureController object.
|
|
361
377
|
|
|
@@ -497,7 +513,7 @@ class CureController:
|
|
|
497
513
|
# possible) and bond_limit (don't demand more than we'd accept).
|
|
498
514
|
# If we hit max radius with fewer than this many but at least one,
|
|
499
515
|
# we still proceed -- the post-loop branch handles that.
|
|
500
|
-
min_floor=
|
|
516
|
+
min_floor=self.bond_floor(bond_target,bond_limit)
|
|
501
517
|
logger.debug(f'Iteration will grow radius until >= {min_floor} bonds (or max radius)')
|
|
502
518
|
nbdf=pd.DataFrame()
|
|
503
519
|
nbonds=0
|
htpolynet/cure/ringcontroller.py
CHANGED
|
@@ -111,6 +111,7 @@ class RingController:
|
|
|
111
111
|
'desired_conversion': 0.95,
|
|
112
112
|
'max_rings_per_iteration': 0,
|
|
113
113
|
'min_rings_per_iteration': 4,
|
|
114
|
+
'min_ring_fraction_per_iteration': 0.0167,
|
|
114
115
|
'reject_threaded_rings': True,
|
|
115
116
|
'prefilter_threaded_candidates': False,
|
|
116
117
|
'reject_new_threading': True,
|
|
@@ -186,12 +187,23 @@ class RingController:
|
|
|
186
187
|
150 bisphenol A dicyanates, that is conversion 0.40 in eight iterations rather
|
|
187
188
|
than the 0.60 asked for.
|
|
188
189
|
|
|
190
|
+
The floor is the larger of ``min_rings_per_iteration`` and
|
|
191
|
+
``min_ring_fraction_per_iteration`` of the rings the whole system could form. A
|
|
192
|
+
count alone does not scale with the box: at a given concentration of unreacted
|
|
193
|
+
groups a box 8 times larger finds 8 times the candidates, never drops below a floor
|
|
194
|
+
of 4, never widens, and so never reaches the macrocycles a cyanate ester needs
|
|
195
|
+
beyond 75 % conversion. Example 6 at 2880 monomers stalled at 0.75 that way
|
|
196
|
+
(htpolynet-sweep, 2026-11-09). The default fraction, 0.0167, gives 4 at the 360
|
|
197
|
+
monomers the floor of 4 was set on, and 32 at 2880.
|
|
198
|
+
|
|
189
199
|
The floor is clamped against the rings still needed to reach the target, so the
|
|
190
200
|
last iteration does not widen in search of rings it would decline to form.
|
|
191
201
|
"""
|
|
192
202
|
remaining = self.dicts['desired_conversion'] * self.state.total_groups - self.state.groups_consumed
|
|
193
203
|
needed = max(1, int(np.ceil(remaining / 3.0)))
|
|
194
|
-
|
|
204
|
+
scaled = int(np.floor(float(self.dicts.get('min_ring_fraction_per_iteration', 0.0))
|
|
205
|
+
* self.state.total_groups / 3.0 + 1.e-9))
|
|
206
|
+
floor = min(max(int(self.dicts['min_rings_per_iteration']), scaled), needed)
|
|
195
207
|
if self.dicts['max_rings_per_iteration']:
|
|
196
208
|
floor = min(floor, int(self.dicts['max_rings_per_iteration']))
|
|
197
209
|
return max(1, floor)
|
|
@@ -13,6 +13,7 @@ Two code paths are supported:
|
|
|
13
13
|
|
|
14
14
|
Author: Cameron F. Abrams <cfa22@drexel.edu>
|
|
15
15
|
"""
|
|
16
|
+
import json
|
|
16
17
|
import logging
|
|
17
18
|
import os
|
|
18
19
|
import re
|
|
@@ -47,23 +48,66 @@ def materialize_smiles_inputs(constituents, inputs_dir='lib/molecules/inputs'):
|
|
|
47
48
|
continue
|
|
48
49
|
out = os.path.join(inputs_dir, f'{name}.mol2')
|
|
49
50
|
if os.path.exists(out):
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
recorded = _read_source(out)
|
|
52
|
+
if recorded is not None and recorded != _source(spec):
|
|
53
|
+
# Two configs in one directory can give the same name to different
|
|
54
|
+
# molecules -- example 0's real styrene and example 1's activated one
|
|
55
|
+
# are both STY -- and the kept file then silently stands in for the
|
|
56
|
+
# other. Hand edits are why the file is kept; say loudly that it no
|
|
57
|
+
# longer matches.
|
|
58
|
+
logger.warning(f'{name}: {out} was generated from {recorded}, but this config '
|
|
59
|
+
f'asks for {_source(spec)}; using the existing file anyway. '
|
|
60
|
+
f'Delete it, and any {name} parameterization in the library, '
|
|
61
|
+
f'to build from this config\'s SMILES')
|
|
62
|
+
else:
|
|
63
|
+
# info, not debug: a kept file is the one way a SMILES constituent can run
|
|
64
|
+
# on something other than its SMILES, e.g. one generated by an older version
|
|
65
|
+
logger.info(f'{name}: using existing {out} rather than its SMILES; '
|
|
66
|
+
f'delete it to regenerate')
|
|
54
67
|
continue
|
|
55
68
|
_generate(name, spec, out)
|
|
69
|
+
_write_source(out, spec)
|
|
56
70
|
generated.append(name)
|
|
57
71
|
return generated
|
|
58
72
|
|
|
59
73
|
|
|
74
|
+
SOURCE_EXT = 'smiles.json'
|
|
75
|
+
"""Extension of the record written beside a generated mol2, naming what produced it."""
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def _source(spec):
|
|
79
|
+
return {'smiles': spec['smiles'], 'activate': [list(map(int, p)) for p in (spec.get('activate') or [])]}
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def _source_path(mol2_path):
|
|
83
|
+
return os.path.splitext(mol2_path)[0] + '.' + SOURCE_EXT
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
def _write_source(mol2_path, spec):
|
|
87
|
+
with open(_source_path(mol2_path), 'w') as f:
|
|
88
|
+
json.dump(_source(spec), f)
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
def _read_source(mol2_path):
|
|
92
|
+
"""The SMILES and activate a generated mol2 came from, or None if unrecorded."""
|
|
93
|
+
try:
|
|
94
|
+
with open(_source_path(mol2_path)) as f:
|
|
95
|
+
return json.load(f)
|
|
96
|
+
except (OSError, ValueError):
|
|
97
|
+
return None
|
|
98
|
+
|
|
99
|
+
|
|
60
100
|
def _generate(name, spec, output_path):
|
|
61
101
|
"""Dispatch to RDKit or obabel based on spec contents."""
|
|
62
102
|
smiles = spec['smiles']
|
|
103
|
+
activate = spec.get('activate') or []
|
|
63
104
|
rdkit_path_requested = _has_atom_mapping(smiles) and 'reactive_atoms' in spec
|
|
105
|
+
if activate and not rdkit_path_requested:
|
|
106
|
+
raise ValueError(f'{name}: `activate` needs a SMILES with `[*:N]` atom-map labels and a '
|
|
107
|
+
f'`reactive_atoms` map; it names the bonds to open by their labels')
|
|
64
108
|
if rdkit_path_requested:
|
|
65
109
|
try:
|
|
66
|
-
_rdkit_path(name, smiles, spec['reactive_atoms'], output_path)
|
|
110
|
+
_rdkit_path(name, smiles, spec['reactive_atoms'], output_path, activate=activate)
|
|
67
111
|
return
|
|
68
112
|
except ImportError:
|
|
69
113
|
if 'rename_atoms' not in spec:
|
|
@@ -113,14 +157,142 @@ def _obabel_path(name, smiles, rename_atoms, output_path):
|
|
|
113
157
|
logger.info(f'{name}: wrote {output_path}')
|
|
114
158
|
|
|
115
159
|
|
|
116
|
-
def
|
|
160
|
+
def _activation_pairs(name, activate):
|
|
161
|
+
"""Normalizes a constituent's ``activate`` list to (label, label) tuples."""
|
|
162
|
+
pairs = []
|
|
163
|
+
for entry in activate or []:
|
|
164
|
+
if not isinstance(entry, (list, tuple)) or len(entry) != 2:
|
|
165
|
+
raise ValueError(f'{name}: each `activate` entry must be a pair of atom-map labels, '
|
|
166
|
+
f'e.g. [1, 2]; got {entry!r}')
|
|
167
|
+
a, b = (int(x) for x in entry)
|
|
168
|
+
if a == b:
|
|
169
|
+
raise ValueError(f'{name}: `activate` entry {entry!r} pairs an atom with itself')
|
|
170
|
+
pairs.append((a, b))
|
|
171
|
+
return pairs
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
def activated_bonds(name, smiles, activate):
|
|
175
|
+
"""Reports the bond each ``activate`` pair opens, as written in the SMILES.
|
|
176
|
+
|
|
177
|
+
Args:
|
|
178
|
+
name (str): constituent name, for messages
|
|
179
|
+
smiles (str): the constituent's SMILES, in its real (inactive) form
|
|
180
|
+
activate (list): pairs of atom-map labels
|
|
181
|
+
|
|
182
|
+
Returns:
|
|
183
|
+
list: (label_a, label_b, order) with order the bond's order in ``smiles``
|
|
184
|
+
(1, 2 or 3) -- the order a cap reaction restores
|
|
185
|
+
"""
|
|
186
|
+
from rdkit import Chem
|
|
187
|
+
mol = Chem.MolFromSmiles(smiles)
|
|
188
|
+
if mol is None:
|
|
189
|
+
raise ValueError(f'{name}: RDKit could not parse SMILES {smiles!r}')
|
|
190
|
+
m2i = {a.GetAtomMapNum(): a.GetIdx() for a in mol.GetAtoms() if a.GetAtomMapNum()}
|
|
191
|
+
out = []
|
|
192
|
+
for a, b in _activation_pairs(name, activate):
|
|
193
|
+
missing = [x for x in (a, b) if x not in m2i]
|
|
194
|
+
if missing:
|
|
195
|
+
raise ValueError(f'{name}: `activate` names atom-map label(s) {missing} that are not in '
|
|
196
|
+
f'its SMILES {smiles!r}')
|
|
197
|
+
bond = mol.GetBondBetweenAtoms(m2i[a], m2i[b])
|
|
198
|
+
if bond is None:
|
|
199
|
+
raise ValueError(f'{name}: `activate` pair [{a}, {b}] is not bonded in its SMILES; '
|
|
200
|
+
f'only an existing bond can be opened')
|
|
201
|
+
if bond.GetIsAromatic():
|
|
202
|
+
raise ValueError(f'{name}: `activate` pair [{a}, {b}] is an aromatic bond, which '
|
|
203
|
+
f'cannot be opened one bond order at a time')
|
|
204
|
+
order = bond.GetBondTypeAsDouble()
|
|
205
|
+
if order not in (1.0, 2.0, 3.0):
|
|
206
|
+
raise ValueError(f'{name}: `activate` pair [{a}, {b}] has bond order {order}; '
|
|
207
|
+
f'only single, double and triple bonds can be opened')
|
|
208
|
+
if order == 1.0 and not bond.IsInRing():
|
|
209
|
+
raise ValueError(f'{name}: `activate` pair [{a}, {b}] is an acyclic single bond; '
|
|
210
|
+
f'opening it would split the molecule in two')
|
|
211
|
+
out.append((a, b, int(order)))
|
|
212
|
+
return out
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
def activate_mol(name, smiles, activate):
|
|
216
|
+
"""Converts a monomer's real SMILES into its active form.
|
|
217
|
+
|
|
218
|
+
Each pair of atom-map labels names a bond that the cure consumes. The bond
|
|
219
|
+
loses one order -- a double bond becomes single, a triple double, and a
|
|
220
|
+
single bond in a ring is removed, opening the ring -- and each of its two
|
|
221
|
+
atoms gains one hydrogen. That hydrogen is the sacrificial H a cure
|
|
222
|
+
reaction deletes, so the result is the valence-conserving active form
|
|
223
|
+
htpolynet parameterizes: vinyl to ethyl, epoxide to alcohol plus methyl,
|
|
224
|
+
isocyanate to formamide.
|
|
225
|
+
|
|
226
|
+
The result keeps the input's atom order and atom-map labels, so the
|
|
227
|
+
structure generated from it is the one a hand-drawn active SMILES written
|
|
228
|
+
in that order gives. It is a molecule, not a SMILES, because a SMILES
|
|
229
|
+
cannot always keep that order: once an epoxide opens, the order a SMILES
|
|
230
|
+
must follow is set by the new bond graph. The edited molecule is written
|
|
231
|
+
out and parsed again rather than used as edited, because RDKit's ring
|
|
232
|
+
perception of an edited molecule differs from that of a parsed one and
|
|
233
|
+
embeds it ~1e-4 nm away.
|
|
234
|
+
|
|
235
|
+
Args:
|
|
236
|
+
name (str): constituent name, for messages
|
|
237
|
+
smiles (str): real (inactive) SMILES with ``[*:N]`` labels
|
|
238
|
+
activate (list): pairs of atom-map labels
|
|
239
|
+
|
|
240
|
+
Returns:
|
|
241
|
+
rdkit.Chem.Mol: the active form, without explicit hydrogens
|
|
242
|
+
"""
|
|
243
|
+
from rdkit import Chem
|
|
244
|
+
bonds = activated_bonds(name, smiles, activate)
|
|
245
|
+
mol = Chem.MolFromSmiles(smiles)
|
|
246
|
+
m2i = {a.GetAtomMapNum(): a.GetIdx() for a in mol.GetAtoms() if a.GetAtomMapNum()}
|
|
247
|
+
rw = Chem.RWMol(mol)
|
|
248
|
+
lower = {2: Chem.BondType.SINGLE, 3: Chem.BondType.DOUBLE}
|
|
249
|
+
for a, b, _ in bonds:
|
|
250
|
+
i, j = m2i[a], m2i[b]
|
|
251
|
+
bond = rw.GetBondBetweenAtoms(i, j)
|
|
252
|
+
if bond is None:
|
|
253
|
+
raise ValueError(f'{name}: `activate` opens the bond [{a}, {b}] more than once')
|
|
254
|
+
order = int(bond.GetBondTypeAsDouble())
|
|
255
|
+
if order == 1:
|
|
256
|
+
rw.RemoveBond(i, j)
|
|
257
|
+
else:
|
|
258
|
+
bond.SetBondType(lower[order])
|
|
259
|
+
bond.SetStereo(Chem.BondStereo.STEREONONE)
|
|
260
|
+
for k in (i, j):
|
|
261
|
+
atom = rw.GetAtomWithIdx(k)
|
|
262
|
+
nH = atom.GetTotalNumHs()
|
|
263
|
+
atom.SetNoImplicit(True)
|
|
264
|
+
atom.SetNumExplicitHs(nH + 1)
|
|
265
|
+
edited = rw.GetMol()
|
|
266
|
+
Chem.SanitizeMol(edited)
|
|
267
|
+
text = Chem.MolToSmiles(edited, canonical=False)
|
|
268
|
+
written = [int(x) for x in edited.GetProp('_smilesAtomOutputOrder').strip('[], ').split(',') if x.strip()]
|
|
269
|
+
reparsed = Chem.MolFromSmiles(text)
|
|
270
|
+
# reparsed atom k is edited atom written[k]; put every atom back where the input had it
|
|
271
|
+
return Chem.RenumberAtoms(reparsed, [written.index(k) for k in range(edited.GetNumAtoms())])
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
def activate_smiles(name, smiles, activate):
|
|
275
|
+
"""The active form as a SMILES, for messages and checks; see :func:`activate_mol`.
|
|
276
|
+
|
|
277
|
+
Its atom order can differ from the input's, so build structures from
|
|
278
|
+
:func:`activate_mol`, not from this string.
|
|
279
|
+
"""
|
|
280
|
+
from rdkit import Chem
|
|
281
|
+
return Chem.MolToSmiles(activate_mol(name, smiles, activate), canonical=False)
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
def _rdkit_path(name, smiles, reactive_atoms, output_path, activate=()):
|
|
117
285
|
"""Use RDKit to parse, embed, and write a mol2 with mapped atoms renamed."""
|
|
118
286
|
from rdkit import Chem
|
|
119
287
|
from rdkit.Chem import AllChem
|
|
120
288
|
|
|
121
289
|
logger.info(f'{name}: generating mol2 from SMILES via RDKit')
|
|
122
290
|
_t0 = time.monotonic()
|
|
123
|
-
|
|
291
|
+
if activate:
|
|
292
|
+
mol = activate_mol(name, smiles, activate)
|
|
293
|
+
logger.info(f'{name}: active form of {smiles} is {Chem.MolToSmiles(mol, canonical=False)}')
|
|
294
|
+
else:
|
|
295
|
+
mol = Chem.MolFromSmiles(smiles)
|
|
124
296
|
if mol is None:
|
|
125
297
|
raise ValueError(f'{name}: RDKit could not parse SMILES {smiles!r}')
|
|
126
298
|
|
|
@@ -261,4 +433,90 @@ def _rename_by_index(mol2_text, rename_atoms):
|
|
|
261
433
|
parts[1] = rename_atoms[idx]
|
|
262
434
|
line = ' ' + ' '.join(parts)
|
|
263
435
|
out.append(line)
|
|
264
|
-
return '\n'.join(out) + '\n'
|
|
436
|
+
return '\n'.join(out) + '\n'
|
|
437
|
+
|
|
438
|
+
def activation_cap_reactions(constituents, reaction_specs):
|
|
439
|
+
"""Writes the cap reaction that restores each bond ``activate`` opened.
|
|
440
|
+
|
|
441
|
+
After the cure, a group that never reacted is still in its active form: a
|
|
442
|
+
vinyl is an ethyl, an epoxide an alcohol plus a methyl. A cap reaction
|
|
443
|
+
re-forms the opened bond at its original order and deletes the two
|
|
444
|
+
sacrificial hydrogens, restoring the real group. Until now every config
|
|
445
|
+
wrote those reactions by hand; for a constituent declared with ``activate``
|
|
446
|
+
they follow from the declaration, so htpolynet writes them.
|
|
447
|
+
|
|
448
|
+
One reaction is written per opened bond, or per set of opened bonds that
|
|
449
|
+
the constituent's ``symmetry_equivalent_atoms`` makes equivalent (htpolynet
|
|
450
|
+
writes the symmetric copies of a reaction itself), unless the config
|
|
451
|
+
already has a cap reaction on that constituent joining the same two atoms
|
|
452
|
+
or their symmetric equivalents (a hand-written one wins), the constituent sets ``cap_activated: false``, or one of the two
|
|
453
|
+
atoms has no name in ``reactive_atoms`` (a reaction can only name named
|
|
454
|
+
atoms; that bond is left in its active form, with a log line saying so).
|
|
455
|
+
|
|
456
|
+
Args:
|
|
457
|
+
constituents (dict): {name: spec} from the parsed config
|
|
458
|
+
reaction_specs (list): the config's reaction dicts
|
|
459
|
+
|
|
460
|
+
Returns:
|
|
461
|
+
list: new reaction dicts, in the form the config's ``reactions`` takes
|
|
462
|
+
"""
|
|
463
|
+
def canon(mname, names):
|
|
464
|
+
# htpolynet writes the symmetric copies of a reaction itself (from
|
|
465
|
+
# symmetry_equivalent_atoms), so two bonds related by symmetry need one cap
|
|
466
|
+
spec = constituents.get(mname)
|
|
467
|
+
classes = (spec.get('symmetry_equivalent_atoms') or []) if isinstance(spec, dict) else []
|
|
468
|
+
rep = {n: str(c[0]) for c in classes for n in c}
|
|
469
|
+
return (mname, frozenset(rep.get(n, n) for n in names))
|
|
470
|
+
|
|
471
|
+
existing = set()
|
|
472
|
+
for r in reaction_specs:
|
|
473
|
+
if str(r.get('stage', '')) != 'cap':
|
|
474
|
+
continue
|
|
475
|
+
reactants = list((r.get('reactants') or {}).values())
|
|
476
|
+
if len(reactants) != 1:
|
|
477
|
+
continue
|
|
478
|
+
existing.add(canon(reactants[0], [a.get('atom') for a in (r.get('atoms') or {}).values()]))
|
|
479
|
+
taken = {r.get('product') for r in reaction_specs} | set(constituents)
|
|
480
|
+
out = []
|
|
481
|
+
for mname, spec in constituents.items():
|
|
482
|
+
if not isinstance(spec, dict) or not spec.get('activate') or not spec.get('smiles'):
|
|
483
|
+
continue
|
|
484
|
+
if spec.get('cap_activated', True) is False:
|
|
485
|
+
continue
|
|
486
|
+
labels = {int(k): str(v) for k, v in (spec.get('reactive_atoms') or {}).items()}
|
|
487
|
+
bonds = activated_bonds(mname, spec['smiles'], spec['activate'])
|
|
488
|
+
sites = {}
|
|
489
|
+
for a, b, _ in bonds:
|
|
490
|
+
for x in (a, b):
|
|
491
|
+
sites[x] = sites.get(x, 0) + 1
|
|
492
|
+
for a, b, order in bonds:
|
|
493
|
+
unnamed = [x for x in (a, b) if x not in labels]
|
|
494
|
+
if unnamed:
|
|
495
|
+
logger.info(f'{mname}: no cap reaction restores the bond [{a}, {b}] that `activate` '
|
|
496
|
+
f'opened, because label(s) {unnamed} have no name in `reactive_atoms`; '
|
|
497
|
+
f'unreacted, it stays in its active form')
|
|
498
|
+
continue
|
|
499
|
+
A, B = labels[a], labels[b]
|
|
500
|
+
key = canon(mname, (A, B))
|
|
501
|
+
if key in existing:
|
|
502
|
+
continue
|
|
503
|
+
existing.add(key)
|
|
504
|
+
product = f'{mname}-capped-{A}-{B}'
|
|
505
|
+
if product in taken:
|
|
506
|
+
raise ValueError(f'{mname}: the cap reaction for `activate` pair [{a}, {b}] would make '
|
|
507
|
+
f'{product}, a name already in use; rename it or write that cap '
|
|
508
|
+
f'reaction by hand')
|
|
509
|
+
taken.add(product)
|
|
510
|
+
out.append({
|
|
511
|
+
'name': f'{mname}-restore-{A}-{B}',
|
|
512
|
+
'stage': 'cap',
|
|
513
|
+
'reactants': {1: mname},
|
|
514
|
+
'product': product,
|
|
515
|
+
'probability': 1.0,
|
|
516
|
+
'atoms': {'A': {'reactant': 1, 'resid': 1, 'atom': A, 'z': sites[a]},
|
|
517
|
+
'B': {'reactant': 1, 'resid': 1, 'atom': B, 'z': sites[b]}},
|
|
518
|
+
'bonds': [{'atoms': ['A', 'B'], 'order': order}],
|
|
519
|
+
})
|
|
520
|
+
logger.debug(f'{mname}: wrote cap reaction {out[-1]["name"]} restoring {A}-{B} '
|
|
521
|
+
f'at order {order}')
|
|
522
|
+
return out
|
|
@@ -14,7 +14,8 @@ Gromacs topology and coordinate pair plus the analysis to characterize it.
|
|
|
14
14
|
|
|
15
15
|
1. Fetch the bundled example closest in **reaction topology** and run it
|
|
16
16
|
unmodified once.
|
|
17
|
-
2. Edit it into your system.
|
|
17
|
+
2. Edit it into your system. Give htpolynet each monomer's **active form**,
|
|
18
|
+
or the real monomer plus `activate` so htpolynet derives it.
|
|
18
19
|
3. `htpolynet input-check <cfg>` — fast, touches nothing, reports the atom
|
|
19
20
|
count you size a core request against.
|
|
20
21
|
4. `htpolynet run <cfg>`, in the background, or via a batch script.
|
|
@@ -40,27 +41,45 @@ an example that shares a functional group but polymerizes by chain growth.
|
|
|
40
41
|
Run it unmodified first. That confirms the toolchain and gives you a
|
|
41
42
|
known-good log to diff against when your own config misbehaves.
|
|
42
43
|
|
|
43
|
-
##
|
|
44
|
+
## htpolynet cures the active form of a monomer
|
|
44
45
|
|
|
45
46
|
The most common conceptual error, and it produces a build that completes and
|
|
46
47
|
is wrong rather than one that fails.
|
|
47
48
|
|
|
48
49
|
htpolynet conserves valence: when two atoms bond, each gives up a
|
|
49
|
-
**sacrificial hydrogen**. So
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
**sacrificial hydrogen**. So it builds from the monomer with its reactive
|
|
51
|
+
sites already saturated: styrene becomes ethylbenzene, an epoxide an alcohol
|
|
52
|
+
plus a methyl, an isocyanate a formamide. Amines and alcohols are already in
|
|
53
|
+
that form, and an addition that loses no atom (cyclotrimerization, example 6,
|
|
54
|
+
`sacrificial_h: false`) needs none.
|
|
52
55
|
|
|
53
56
|
Prefer SMILES written directly into `constituents` with RDKit atom-map
|
|
54
57
|
labels, which name reactive atoms by chemical identity rather than by file
|
|
55
|
-
index
|
|
58
|
+
index. Write the real monomer and name the bonds the cure consumes in
|
|
59
|
+
`activate`; htpolynet derives the active form and writes the `cap` reactions
|
|
60
|
+
that restore groups left unreacted:
|
|
56
61
|
|
|
57
62
|
```yaml
|
|
58
63
|
constituents:
|
|
59
64
|
STY:
|
|
60
|
-
smiles: "c1ccccc1[
|
|
65
|
+
smiles: "c1ccccc1[CH:1]=[CH2:2]" # styrene, as it is
|
|
61
66
|
reactive_atoms: {1: C1, 2: C2}
|
|
67
|
+
activate: [[1, 2]] # the C=C the cure consumes
|
|
62
68
|
```
|
|
63
69
|
|
|
70
|
+
For an epoxide, pair the ring O with the carbon that is attacked:
|
|
71
|
+
`[CH:2]1[O:3][CH2:1]1` with `activate: [[3, 1]]`. The bundled examples all
|
|
72
|
+
write their monomers this way. A SMILES that spells the active form out
|
|
73
|
+
(`c1ccccc1[CH2:1][CH3:2]`) still works, and a generated cap reaction is skipped
|
|
74
|
+
when the config has its own cap on the same atoms (or their symmetric
|
|
75
|
+
equivalents).
|
|
76
|
+
|
|
77
|
+
Run each example, and each system, in its own directory. A generated
|
|
78
|
+
`lib/molecules/inputs/NAME.mol2` is reused rather than regenerated, and
|
|
79
|
+
examples 0 and 1 both call their molecule `STY` (real styrene in 0,
|
|
80
|
+
activated in 1); htpolynet warns when a kept file came from a different
|
|
81
|
+
SMILES.
|
|
82
|
+
|
|
64
83
|
In SMILES bracket atoms the hydrogen count is explicit: `[C:1]` means *zero*
|
|
65
84
|
implicit hydrogens. For an sp³ carbon you almost always want `[CH2:1]` or
|
|
66
85
|
`[CH3:1]`. A wrong count usually surfaces much later as a missing GAFF angle
|
|
@@ -5,8 +5,9 @@
|
|
|
5
5
|
#
|
|
6
6
|
# htpolynet run -diag diagnostics.log 0-liquid-styrene.yaml
|
|
7
7
|
#
|
|
8
|
-
# This example produces a densified liquid of
|
|
9
|
-
#
|
|
8
|
+
# This example produces a densified liquid of styrene monomers (no curing).
|
|
9
|
+
# Styrene is given as it really is, vinyl group and all: with no cure, there is
|
|
10
|
+
# nothing to activate. After the run completes you can compute properties with
|
|
10
11
|
# `htpolynet analyze` -- save the following as `ck.yaml` and invoke
|
|
11
12
|
# `htpolynet analyze -cfg ck.yaml -ocfg 0-liquid-styrene.yaml -proj proj-0`:
|
|
12
13
|
#
|
|
@@ -37,10 +38,10 @@ gromacs:
|
|
|
37
38
|
mdrun_options:
|
|
38
39
|
gpu_id: 0 # auto-stripped at runtime if gmx is not GPU-capable or no GPU is visible
|
|
39
40
|
ambertools:
|
|
40
|
-
charge_method:
|
|
41
|
+
charge_method: bcc
|
|
41
42
|
constituents:
|
|
42
43
|
STY:
|
|
43
|
-
smiles: "c1ccccc1[
|
|
44
|
+
smiles: "c1ccccc1[CH:1]=[CH2:2]" # styrene
|
|
44
45
|
reactive_atoms: {1: C1, 2: C2}
|
|
45
46
|
count: 1000
|
|
46
47
|
densification:
|
|
@@ -2,9 +2,12 @@
|
|
|
2
2
|
#
|
|
3
3
|
# Self-contained config: the styrene monomer is generated from SMILES by
|
|
4
4
|
# htpolynet itself. The two reactive vinyl carbons are identified inline in
|
|
5
|
-
# the SMILES with atom-map labels [
|
|
5
|
+
# the SMILES with atom-map labels [CH:1] and [CH2:2]; the `reactive_atoms`
|
|
6
6
|
# block maps those labels to the atom names (C1, C2) referenced by the
|
|
7
|
-
# reactions below.
|
|
7
|
+
# reactions below. The SMILES is styrene as it really is; `activate` names the
|
|
8
|
+
# C=C the cure consumes, and htpolynet derives the active form (ethylbenzene)
|
|
9
|
+
# it parameterizes and writes the cap reaction that restores the C=C on any
|
|
10
|
+
# styrene left unreacted. RDKit is a required runtime dependency and is pulled
|
|
8
11
|
# in by any normal htpolynet install.
|
|
9
12
|
#
|
|
10
13
|
# htpolynet run -diag diagnostics.log 1-polystyrene.yaml
|
|
@@ -19,11 +22,12 @@ gromacs:
|
|
|
19
22
|
mdrun_options:
|
|
20
23
|
gpu_id: 0 # auto-stripped at runtime if gmx is not GPU-capable or no GPU is visible
|
|
21
24
|
ambertools:
|
|
22
|
-
charge_method:
|
|
25
|
+
charge_method: bcc
|
|
23
26
|
constituents:
|
|
24
27
|
STY:
|
|
25
|
-
smiles: "c1ccccc1[
|
|
28
|
+
smiles: "c1ccccc1[CH:1]=[CH2:2]" # styrene
|
|
26
29
|
reactive_atoms: {1: C1, 2: C2}
|
|
30
|
+
activate: [[1, 2]] # the C=C the cure consumes
|
|
27
31
|
count: 1000
|
|
28
32
|
densification:
|
|
29
33
|
initial_density: 300.0 # kg/m3
|
|
@@ -146,25 +150,5 @@ reactions:
|
|
|
146
150
|
- A
|
|
147
151
|
- B
|
|
148
152
|
order: 1
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
reactants:
|
|
152
|
-
1: STY
|
|
153
|
-
product: STYCC
|
|
154
|
-
probability: 1.0
|
|
155
|
-
atoms:
|
|
156
|
-
A:
|
|
157
|
-
reactant: 1
|
|
158
|
-
resid: 1
|
|
159
|
-
atom: C1
|
|
160
|
-
z: 1
|
|
161
|
-
B:
|
|
162
|
-
reactant: 1
|
|
163
|
-
resid: 1
|
|
164
|
-
atom: C2
|
|
165
|
-
z: 1
|
|
166
|
-
bonds:
|
|
167
|
-
- atoms:
|
|
168
|
-
- A
|
|
169
|
-
- B
|
|
170
|
-
order: 2
|
|
153
|
+
# No cap reactions: each `activate` above has htpolynet write the one that
|
|
154
|
+
# restores the group on monomers the cure left unreacted.
|
|
@@ -3,6 +3,9 @@
|
|
|
3
3
|
# Self-contained config: STY, BPA, and HIE monomers are generated from SMILES
|
|
4
4
|
# (RDKit path via the atom-mapping syntax). Bis-GMA (GMA) is assembled at
|
|
5
5
|
# runtime from BPA + 2 HIE via the two param-stage reactions defined below.
|
|
6
|
+
# STY and HIE (glycidyl methacrylate) are written as they really are; their
|
|
7
|
+
# `activate` keys name the bonds the cure consumes, and htpolynet derives the
|
|
8
|
+
# active forms and writes the cap reactions that restore unreacted C=C.
|
|
6
9
|
# Run with:
|
|
7
10
|
#
|
|
8
11
|
# htpolynet run -diag diagnostics.log 2-bisgma-styrene-thermoset.yaml
|
|
@@ -17,12 +20,13 @@ gromacs:
|
|
|
17
20
|
mdrun_options:
|
|
18
21
|
gpu_id: 0 # auto-stripped at runtime if gmx is not GPU-capable or no GPU is visible
|
|
19
22
|
ambertools:
|
|
20
|
-
charge_method:
|
|
23
|
+
charge_method: bcc
|
|
21
24
|
constituents:
|
|
22
25
|
STY:
|
|
23
|
-
smiles: "c1ccccc1[
|
|
26
|
+
smiles: "c1ccccc1[CH:1]=[CH2:2]" # styrene
|
|
24
27
|
reactive_atoms: {1: C1, 2: C2}
|
|
25
|
-
|
|
28
|
+
activate: [[1, 2]] # the C=C the cure consumes
|
|
29
|
+
count: 1200
|
|
26
30
|
BPA:
|
|
27
31
|
smiles: "CC(c1ccc([OH:1])cc1)(c1ccc([OH:2])cc1)C"
|
|
28
32
|
reactive_atoms: {1: O1, 2: O2}
|
|
@@ -32,13 +36,19 @@ constituents:
|
|
|
32
36
|
# confuses antechamber into typing it as `c2` (sp2) and the adjacent
|
|
33
37
|
# carbonyl as `c2` instead of `c`, breaking tleap with "no angle parameter
|
|
34
38
|
# for o - c2 - os".
|
|
35
|
-
|
|
39
|
+
# Glycidyl methacrylate. `activate` opens the methacrylate C=C (2-1) and
|
|
40
|
+
# the epoxide's O-C4 bond (5-4), where a BPA hydroxyl attacks. The epoxide
|
|
41
|
+
# O is labeled only so `activate` can name it; with no name in
|
|
42
|
+
# `reactive_atoms`, it gets no cap reaction, and none is needed: every
|
|
43
|
+
# epoxide is consumed building GMA.
|
|
44
|
+
smiles: "[CH2:2]=[C:1]([CH3])C(=O)OC[CH:3]1[O:5][CH2:4]1"
|
|
36
45
|
reactive_atoms: {1: C1, 2: C2, 3: C3, 4: C4}
|
|
46
|
+
activate: [[2, 1], [5, 4]]
|
|
37
47
|
stereocenters:
|
|
38
48
|
- C1
|
|
39
49
|
- C3
|
|
40
50
|
GMA:
|
|
41
|
-
count:
|
|
51
|
+
count: 600
|
|
42
52
|
densification:
|
|
43
53
|
initial_density: 100.0 # kg/m3
|
|
44
54
|
equilibration:
|
|
@@ -260,44 +270,5 @@ reactions:
|
|
|
260
270
|
bonds:
|
|
261
271
|
- atoms: [A, B]
|
|
262
272
|
order: 1
|
|
263
|
-
#
|
|
264
|
-
|
|
265
|
-
stage: cap
|
|
266
|
-
reactants:
|
|
267
|
-
1: STY
|
|
268
|
-
product: STYCC
|
|
269
|
-
probability: 1.0
|
|
270
|
-
atoms:
|
|
271
|
-
A:
|
|
272
|
-
reactant: 1
|
|
273
|
-
resid: 1
|
|
274
|
-
atom: C1
|
|
275
|
-
z: 1
|
|
276
|
-
B:
|
|
277
|
-
reactant: 1
|
|
278
|
-
resid: 1
|
|
279
|
-
atom: C2
|
|
280
|
-
z: 1
|
|
281
|
-
bonds:
|
|
282
|
-
- atoms: [A, B]
|
|
283
|
-
order: 2
|
|
284
|
-
- name: hieCC
|
|
285
|
-
stage: cap
|
|
286
|
-
reactants:
|
|
287
|
-
1: HIE
|
|
288
|
-
product: HIECC
|
|
289
|
-
probability: 1.0
|
|
290
|
-
atoms:
|
|
291
|
-
A:
|
|
292
|
-
reactant: 1
|
|
293
|
-
resid: 1
|
|
294
|
-
atom: C1
|
|
295
|
-
z: 1
|
|
296
|
-
B:
|
|
297
|
-
reactant: 1
|
|
298
|
-
resid: 1
|
|
299
|
-
atom: C2
|
|
300
|
-
z: 1
|
|
301
|
-
bonds:
|
|
302
|
-
- atoms: [A, B]
|
|
303
|
-
order: 2
|
|
273
|
+
# No cap reactions: each `activate` above has htpolynet write the one that
|
|
274
|
+
# restores the group on monomers the cure left unreacted.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# htpolynet -- Example 3 -- PACM/DGEBA Epoxy Thermoset
|
|
2
2
|
#
|
|
3
|
-
# Self-contained config: DGE (DGEBA,
|
|
4
|
-
#
|
|
3
|
+
# Self-contained config: DGE (DGEBA, bisphenol-A diglycidyl ether, written as it
|
|
4
|
+
# really is; `activate` opens its epoxides into the active form) and PAC (PACM, 4,4'-methylenebis(cyclohexylamine)) are generated from
|
|
5
5
|
# SMILES via the RDKit atom-mapping path. Run with:
|
|
6
6
|
#
|
|
7
7
|
# htpolynet run -diag diagnostics.log 3-pacm-dgeba-epoxy-thermoset.yaml
|
|
@@ -16,12 +16,13 @@ gromacs:
|
|
|
16
16
|
mdrun_options:
|
|
17
17
|
gpu_id: 0 # auto-stripped at runtime if gmx is not GPU-capable or no GPU is visible
|
|
18
18
|
ambertools:
|
|
19
|
-
charge_method:
|
|
19
|
+
charge_method: bcc
|
|
20
20
|
constituents:
|
|
21
21
|
DGE:
|
|
22
|
-
smiles: "CC(C)(c1ccc(OC[CH:3]
|
|
22
|
+
smiles: "CC(C)(c1ccc(OC[CH:3]2[O:5][CH2:1]2)cc1)c1ccc(OC[CH:4]2[O:6][CH2:2]2)cc1"
|
|
23
23
|
reactive_atoms: {1: C1, 2: C2, 3: C3, 4: C4, 5: O1, 6: O2}
|
|
24
|
-
|
|
24
|
+
activate: [[5, 1], [6, 2]] # each epoxide's O-CH2 bond, opened by an amine
|
|
25
|
+
count: 1600
|
|
25
26
|
symmetry_equivalent_atoms: [[C1, C2], [C3, C4], [O1, O2]]
|
|
26
27
|
stereocenters: [C3]
|
|
27
28
|
PAC:
|
|
@@ -30,7 +31,7 @@ constituents:
|
|
|
30
31
|
# second copies as C2 / N2.
|
|
31
32
|
smiles: "C1C[CH:1](CCC1CC2CC[CH:2](CC2)[NH2:3])[NH2:4]"
|
|
32
33
|
reactive_atoms: {1: C1, 2: C1, 3: N1, 4: N1}
|
|
33
|
-
count:
|
|
34
|
+
count: 800
|
|
34
35
|
symmetry_equivalent_atoms: [[N1, N2], [C1, C2]]
|
|
35
36
|
stereocenters: [C1]
|
|
36
37
|
densification:
|
|
@@ -173,23 +174,5 @@ reactions:
|
|
|
173
174
|
bonds:
|
|
174
175
|
- atoms: [A, B]
|
|
175
176
|
order: 1
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
1: DGE
|
|
179
|
-
product: DGEC
|
|
180
|
-
stage: cap
|
|
181
|
-
probability: 1.0
|
|
182
|
-
atoms:
|
|
183
|
-
A:
|
|
184
|
-
reactant: 1
|
|
185
|
-
resid: 1
|
|
186
|
-
atom: O1
|
|
187
|
-
z: 1
|
|
188
|
-
B:
|
|
189
|
-
reactant: 1
|
|
190
|
-
resid: 1
|
|
191
|
-
atom: C1
|
|
192
|
-
z: 1
|
|
193
|
-
bonds:
|
|
194
|
-
- atoms: [A, B]
|
|
195
|
-
order: 1
|
|
177
|
+
# No cap reactions: each `activate` above has htpolynet write the one that
|
|
178
|
+
# restores the group on monomers the cure left unreacted.
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
# htpolynet -- Example 4 -- DFDA/FDE Furan-based Epoxy Thermoset
|
|
2
2
|
#
|
|
3
3
|
# Self-contained config: DFA (difurfuryl diamine) and FDE (furfuryl diepoxide)
|
|
4
|
-
# are generated from SMILES via the RDKit atom-mapping path.
|
|
4
|
+
# are generated from SMILES via the RDKit atom-mapping path. FDE is written as
|
|
5
|
+
# it really is; `activate` opens its epoxides into the active form. The original
|
|
5
6
|
# shell script for this example wrote PDB rather than mol2 inputs because mol2
|
|
6
7
|
# atom-numbering was unpredictable for the fused heterocycles; switching to
|
|
7
8
|
# atom-mapped SMILES eliminates that concern, so we generate mol2 like the
|
|
@@ -19,18 +20,19 @@ gromacs:
|
|
|
19
20
|
mdrun_options:
|
|
20
21
|
gpu_id: 0 # auto-stripped at runtime if gmx is not GPU-capable or no GPU is visible
|
|
21
22
|
ambertools:
|
|
22
|
-
charge_method:
|
|
23
|
+
charge_method: bcc
|
|
23
24
|
constituents:
|
|
24
25
|
FDE:
|
|
25
|
-
smiles: "N(Cc1occc1)(C[CH:3]
|
|
26
|
+
smiles: "N(Cc1occc1)(C[CH:3]1[O:5][CH2:1]1)C[CH:4]1[O:6][CH2:2]1"
|
|
26
27
|
reactive_atoms: {1: C1, 2: C2, 3: C3, 4: C4, 5: O1, 6: O2}
|
|
27
|
-
|
|
28
|
+
activate: [[5, 1], [6, 2]] # each epoxide's O-CH2 bond, opened by an amine
|
|
29
|
+
count: 1600
|
|
28
30
|
symmetry_equivalent_atoms: [[C1, C2], [C3, C4], [O1, O2]]
|
|
29
31
|
stereocenters: [C3]
|
|
30
32
|
DFA:
|
|
31
33
|
smiles: "C(c1oc([CH2][NH2:1])cc1)c1oc([CH2][NH2:2])cc1"
|
|
32
34
|
reactive_atoms: {1: N1, 2: N2}
|
|
33
|
-
count:
|
|
35
|
+
count: 800
|
|
34
36
|
symmetry_equivalent_atoms: [[N1, N2]]
|
|
35
37
|
densification:
|
|
36
38
|
initial_density: 300.0 # kg/m3
|
|
@@ -172,23 +174,5 @@ reactions:
|
|
|
172
174
|
bonds:
|
|
173
175
|
- atoms: [A, B]
|
|
174
176
|
order: 1
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
1: FDE
|
|
178
|
-
product: FDEC
|
|
179
|
-
stage: cap
|
|
180
|
-
probability: 1.0
|
|
181
|
-
atoms:
|
|
182
|
-
A:
|
|
183
|
-
reactant: 1
|
|
184
|
-
resid: 1
|
|
185
|
-
atom: O1
|
|
186
|
-
z: 1
|
|
187
|
-
B:
|
|
188
|
-
reactant: 1
|
|
189
|
-
resid: 1
|
|
190
|
-
atom: C1
|
|
191
|
-
z: 1
|
|
192
|
-
bonds:
|
|
193
|
-
- atoms: [A, B]
|
|
194
|
-
order: 1
|
|
177
|
+
# No cap reactions: each `activate` above has htpolynet write the one that
|
|
178
|
+
# restores the group on monomers the cure left unreacted.
|
|
@@ -10,10 +10,10 @@
|
|
|
10
10
|
# isocyanates.
|
|
11
11
|
#
|
|
12
12
|
# Active-form notes:
|
|
13
|
-
# - IPDI
|
|
14
|
-
# -N(H)-C(H)=O so each formyl carbon owns a
|
|
15
|
-
# urethane reaction removes that H along with the
|
|
16
|
-
# to form the C-O bond.
|
|
13
|
+
# - IPDI is written as the real diisocyanate; `activate` turns each
|
|
14
|
+
# -N=C=O into the formamide -N(H)-C(H)=O, so each formyl carbon owns a
|
|
15
|
+
# sacrificial H. The urethane reaction removes that H along with the
|
|
16
|
+
# hydroxyl H on TBO to form the C-O bond.
|
|
17
17
|
# - The 2-butene and 1-butene units are drawn as-is; chain extension
|
|
18
18
|
# consumes one methyl H from each side.
|
|
19
19
|
#
|
|
@@ -31,7 +31,7 @@ gromacs:
|
|
|
31
31
|
mdrun_options:
|
|
32
32
|
gpu_id: 0 # auto-stripped at runtime if gmx is not GPU-capable or no GPU is visible
|
|
33
33
|
ambertools:
|
|
34
|
-
charge_method:
|
|
34
|
+
charge_method: bcc
|
|
35
35
|
GAFF:
|
|
36
36
|
resolve_type_discrepancies:
|
|
37
37
|
- typename: dihedraltypes
|
|
@@ -59,21 +59,25 @@ constituents:
|
|
|
59
59
|
smiles: "[OH:5][CH2:1]/[CH:2]=[CH:3]/[CH3:4]"
|
|
60
60
|
reactive_atoms: {1: C1, 2: C2, 3: C3, 4: C4, 5: O1}
|
|
61
61
|
IPD:
|
|
62
|
-
# Isophorone diisocyanate
|
|
63
|
-
#
|
|
64
|
-
#
|
|
65
|
-
#
|
|
66
|
-
|
|
62
|
+
# Isophorone diisocyanate, as it really is. `activate` opens each N=C
|
|
63
|
+
# (labels 11-1 and 12-2) into the urethane-active formamide
|
|
64
|
+
# -N(H)-C(H)=O, so the formyl carbons (C1, C2) each carry a sacrificial
|
|
65
|
+
# H. The N labels are there only for `activate`; with no names, the Ns
|
|
66
|
+
# keep their element names and get no cap reaction, so isocyanates left
|
|
67
|
+
# unreacted stay formamides, as they always have in this example. C3 is
|
|
68
|
+
# the ring stereocenter (the CH bearing the directly-attached N).
|
|
69
|
+
smiles: "CC1(C[N:12]=[C:2]=O)C[CH:3]([N:11]=[C:1]=O)CC(C)(C)C1"
|
|
67
70
|
reactive_atoms: {1: C1, 2: C2, 3: C3}
|
|
71
|
+
activate: [[12, 2], [11, 1]]
|
|
68
72
|
stereocenters:
|
|
69
73
|
- C3
|
|
70
|
-
count:
|
|
74
|
+
count: 250 # (2*(DHT count) + 3*(THT count)) / 2
|
|
71
75
|
# --- Long-chain HTPB monomers, assembled at runtime ---
|
|
72
76
|
# DHT (linear HTPB) and THT (branched HTPB) are built by the param- and
|
|
73
77
|
# build-stage reactions below; htpolynet treats them as constituents
|
|
74
78
|
# whose structures are derived rather than supplied.
|
|
75
79
|
DHT:
|
|
76
|
-
count:
|
|
80
|
+
count: 100
|
|
77
81
|
conformers:
|
|
78
82
|
count: 6
|
|
79
83
|
generator:
|
|
@@ -84,7 +88,7 @@ constituents:
|
|
|
84
88
|
ps: 100
|
|
85
89
|
pad: 10.0
|
|
86
90
|
THT:
|
|
87
|
-
count:
|
|
91
|
+
count: 100
|
|
88
92
|
conformers:
|
|
89
93
|
count: 6
|
|
90
94
|
generator:
|
|
@@ -36,7 +36,7 @@ gromacs:
|
|
|
36
36
|
mdrun_options:
|
|
37
37
|
gpu_id: 0 # auto-stripped at runtime if gmx is not GPU-capable or no GPU is visible
|
|
38
38
|
ambertools:
|
|
39
|
-
charge_method:
|
|
39
|
+
charge_method: bcc
|
|
40
40
|
constituents:
|
|
41
41
|
BDC:
|
|
42
42
|
# Bisphenol-A dicyanate. Each cyanate's C and N are reactive (z=1 each): the C of
|
|
@@ -45,7 +45,7 @@ constituents:
|
|
|
45
45
|
smiles: "[N:1]#[C:2]Oc1ccc(cc1)C(C)(C)c1ccc(O[C:3]#[N:4])cc1"
|
|
46
46
|
reactive_atoms: {1: N1, 2: C1, 3: C2, 4: N2}
|
|
47
47
|
symmetry_equivalent_atoms: [[C1, C2], [N1, N2]]
|
|
48
|
-
count:
|
|
48
|
+
count: 2880
|
|
49
49
|
densification:
|
|
50
50
|
initial_density: 200.0 # kg/m3
|
|
51
51
|
equilibration:
|
|
@@ -91,6 +91,7 @@ ring_cure:
|
|
|
91
91
|
radial_increment: 0.05 # nm; widen the search by this when an iteration is short of rings
|
|
92
92
|
desired_conversion: 0.97 # fraction of cyanate GROUPS consumed, three per ring
|
|
93
93
|
max_iterations: 150
|
|
94
|
+
min_rings_per_iteration: 32 # 8 x the default 4, for 8 x the box; see below
|
|
94
95
|
closure:
|
|
95
96
|
nstages: 6 # restraint stages that pull each candidate ring shut
|
|
96
97
|
# Every other ring_cure setting is left at its default. Two are worth knowing:
|
|
@@ -101,6 +102,11 @@ ring_cure:
|
|
|
101
102
|
# Each iteration then relaxes at 600 K and re-equilibrates at 300 K and 1 bar, as CURE
|
|
102
103
|
# does, and the cure settles the network once on exit.
|
|
103
104
|
#
|
|
105
|
+
# The ring floor must grow with the box. At a fixed floor of 4 this box finds more
|
|
106
|
+
# candidates than that at every iteration, so the search never widens past 0.5 nm and
|
|
107
|
+
# the cure stalls at about 0.75 (htpolynet-sweep, 2026-11-09). From the next release
|
|
108
|
+
# on, min_ring_fraction_per_iteration scales the floor by default and gives 32 here.
|
|
109
|
+
#
|
|
104
110
|
# Fang & Shimp's end-group arithmetic caps acyclic growth at 75% cyanate conversion,
|
|
105
111
|
# so a network that reaches 0.97 necessarily contains macrocycles. That is the real
|
|
106
112
|
# chemistry, and it is why no cycle-length filter is applied here.
|
htpolynet/schema/base.yaml
CHANGED
|
@@ -168,6 +168,31 @@ attributes:
|
|
|
168
168
|
`required: false` because `external/smiles_input.py:60` selects the
|
|
169
169
|
RDKit path on this key being *present*; an injected empty map would
|
|
170
170
|
take that path with nothing in it.
|
|
171
|
+
- name: activate
|
|
172
|
+
type: list
|
|
173
|
+
required: false
|
|
174
|
+
text: >
|
|
175
|
+
Lets the `smiles` describe the monomer as it really is -- styrene,
|
|
176
|
+
not ethylbenzene -- by naming the bonds the cure consumes, as pairs
|
|
177
|
+
of atom-map labels: `[[1, 2]]` for a vinyl drawn `[CH:1]=[CH2:2]`.
|
|
178
|
+
Each named bond loses one order (a ring single bond is removed,
|
|
179
|
+
opening the ring) and each of its atoms gains the sacrificial H a
|
|
180
|
+
cure reaction deletes, which is the active form htpolynet needs.
|
|
181
|
+
Vinyl `[C:1]=[C:2]`, isocyanate `[N:1]=[C:2]=O` and epoxide
|
|
182
|
+
`[C:1]1[O:2]C1` (pair the attacked carbon with the ring O) are the
|
|
183
|
+
usual cases. A label used here need not appear in
|
|
184
|
+
`reactive_atoms`. Needs the RDKit path (atom-mapped `smiles` plus
|
|
185
|
+
`reactive_atoms`).
|
|
186
|
+
- name: cap_activated
|
|
187
|
+
type: bool
|
|
188
|
+
text: >
|
|
189
|
+
Whether htpolynet writes, for each bond `activate` opens, the cap
|
|
190
|
+
reaction that restores it on groups the cure left unreacted (C=C,
|
|
191
|
+
N=C, the epoxide ring). Only bonds whose two atoms are both named
|
|
192
|
+
in `reactive_atoms` get one, and a hand-written cap reaction on the
|
|
193
|
+
same constituent and atoms replaces it. Set false to leave every
|
|
194
|
+
unreacted group in its active form.
|
|
195
|
+
default: true
|
|
171
196
|
- name: rename_atoms
|
|
172
197
|
type: dict
|
|
173
198
|
value_type: str
|
|
@@ -470,6 +495,14 @@ attributes:
|
|
|
470
495
|
`max_conversion_per_iteration`, so a large value never stalls a
|
|
471
496
|
build. 1 reproduces the un-batched legacy behavior.
|
|
472
497
|
default: 10
|
|
498
|
+
- name: min_bond_fraction_per_iteration
|
|
499
|
+
type: float
|
|
500
|
+
text: >
|
|
501
|
+
The same floor as a fraction of the bonds at 100% conversion; the larger
|
|
502
|
+
of the two applies. A count does not grow with the system, so in a large
|
|
503
|
+
box the radius may never widen; this one does. 0 (the default) leaves
|
|
504
|
+
min_bonds_per_iteration in charge.
|
|
505
|
+
default: 0.0
|
|
473
506
|
- name: max_iterations
|
|
474
507
|
type: int
|
|
475
508
|
text: Absolute maximum number of cure iterations.
|
|
@@ -814,6 +847,14 @@ attributes:
|
|
|
814
847
|
min_bonds_per_iteration, counted in rings. Clamped against the rings still
|
|
815
848
|
needed to reach desired_conversion.
|
|
816
849
|
default: 4
|
|
850
|
+
- name: min_ring_fraction_per_iteration
|
|
851
|
+
type: float
|
|
852
|
+
text: >
|
|
853
|
+
The same floor as a fraction of the rings the whole system could form; the
|
|
854
|
+
larger of the two applies. A count does not grow with the box, and a large
|
|
855
|
+
box that never drops below it never widens and never reaches the macrocycles.
|
|
856
|
+
The default gives 4 at 360 dicyanate monomers and 32 at 2880.
|
|
857
|
+
default: 0.0167
|
|
817
858
|
- name: reject_threaded_rings
|
|
818
859
|
type: bool
|
|
819
860
|
text: >
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: htpolynet
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.18.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/
|
|
@@ -3,13 +3,13 @@ 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=099j7lYuSxtL1PbvzRJUL8surNpLcNkS-xY1T_CIXqM,45933
|
|
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=mc9ptiWaOVY6DO9gWsOJVOn1tjSbbZ2s5cOAPzeVEdk,32966
|
|
10
10
|
htpolynet/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
11
11
|
htpolynet/core/bondtemplate.py,sha256=_1vYMugonDuogysu15IsbpthvxYb6uJKC5ao7pQcWvg,9969
|
|
12
|
-
htpolynet/core/configuration.py,sha256=
|
|
12
|
+
htpolynet/core/configuration.py,sha256=RG7B3ecHP8LQfwVTqP0dsDf8rLR5vKL8WfW2OWPPp3E,5730
|
|
13
13
|
htpolynet/core/coordinates.py,sha256=CGTHkdfw2ikc2ANacA5akRhZ9tOyM2IbELwQ2FVcKRw,23878
|
|
14
14
|
htpolynet/core/molecule.py,sha256=j0I0qsk5mRTg8QMysxJz6U9HxgTRpRSzHEgJ_SRT-jQ,63012
|
|
15
15
|
htpolynet/core/paramcache.py,sha256=37S88gRXZ5_xAdWyUE-Q3Etxc5HMv8L_RHrykkq9YAs,6966
|
|
@@ -20,17 +20,17 @@ htpolynet/core/topocoord.py,sha256=jUgFg9TuUdSm14wo_464xX6dC4okJMrj1FbIzmaoA0Q,1
|
|
|
20
20
|
htpolynet/core/topology.py,sha256=ttdDUuE6noBhC-3B-x-lAfNVsXPOlEe-z4aKefZUOiY,65578
|
|
21
21
|
htpolynet/cure/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
22
22
|
htpolynet/cure/chain.py,sha256=-d5BFE5xUKjFdNkxLfSnCnZIRSJCtr7xuxYzNHBeSgU,5344
|
|
23
|
-
htpolynet/cure/curecontroller.py,sha256=
|
|
23
|
+
htpolynet/cure/curecontroller.py,sha256=Fi-nPuL4bjLfJepEeSXeOkQVCIrykMjjA8y4ikF3YmI,60752
|
|
24
24
|
htpolynet/cure/expandreactions.py,sha256=eN35-SQrzjoo8ftZVLJkiAKxpA_FigERTwZ8jtoxDng,20682
|
|
25
25
|
htpolynet/cure/reaction.py,sha256=_kRJ1JzT_fjLIAF6j9lH_Sft41KD1kVQuWPmXdHia-M,13446
|
|
26
|
-
htpolynet/cure/ringcontroller.py,sha256=
|
|
26
|
+
htpolynet/cure/ringcontroller.py,sha256=gRdGIvYp46WMIyFfyS7YHkqL9ufUFpoJtm1eMAOTD-4,39356
|
|
27
27
|
htpolynet/cure/triplesearch.py,sha256=5XDjwJs4NZNenSwHBRCLE3s-bOlAM6Ba4RJhM74YFBs,18002
|
|
28
28
|
htpolynet/external/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
29
29
|
htpolynet/external/ambertools.py,sha256=NkZ0fP6iqwMnMk2jMD3-EaiGCmutHb1MVFOTFJiQ7WI,6286
|
|
30
30
|
htpolynet/external/command.py,sha256=KYmWV8P4nuw_ciE16WazviorxjGj5un_z7dL62n0TG0,2480
|
|
31
31
|
htpolynet/external/gromacs.py,sha256=0gxm3zcxICyRHvn1ZNt1r3aE2SobpYsl2H_0M0-0P6E,18427
|
|
32
32
|
htpolynet/external/slurm.py,sha256=FvnKyNqFXgDe5bdTDB4Kcn9KU4mxq9Gcw675SzU-4w0,4082
|
|
33
|
-
htpolynet/external/smiles_input.py,sha256=
|
|
33
|
+
htpolynet/external/smiles_input.py,sha256=994kwl_Sjh2P_pepndv8QFRwzA5zSMVfD94OKRo8V1Q,22327
|
|
34
34
|
htpolynet/external/software.py,sha256=Uzd1vkNnLm8C6By9ryFlbAnVPII30oFHLUOxzxdJJmw,10054
|
|
35
35
|
htpolynet/geometry/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
36
36
|
htpolynet/geometry/bondlist.py,sha256=ps6AreIHLz-55zZieJiBg9rbd9zZctw8gPrmQYK0MbI,6144
|
|
@@ -50,14 +50,14 @@ htpolynet/repair/cyanate_cap.py,sha256=d-OqnoRwOMwijYuMLFhGoFkEa2qFyzCdGnICDK69V
|
|
|
50
50
|
htpolynet/repair/topology_surgery.py,sha256=uuS49WTF8se_aNrxWBfyWf203ocv3k9j2ZluM7u15So,13250
|
|
51
51
|
htpolynet/resources/README.md,sha256=epKLyqtcxtQOSzTYvaGlwhz970UA4vAU7r-iSBbbpmA,1432
|
|
52
52
|
htpolynet/resources/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
53
|
-
htpolynet/resources/claude/SKILL.md,sha256=
|
|
54
|
-
htpolynet/resources/example_depot/0-liquid-styrene.yaml,sha256=
|
|
55
|
-
htpolynet/resources/example_depot/1-polystyrene.yaml,sha256=
|
|
56
|
-
htpolynet/resources/example_depot/2-bisgma-styrene-thermoset.yaml,sha256=
|
|
57
|
-
htpolynet/resources/example_depot/3-pacm-dgeba-epoxy-thermoset.yaml,sha256=
|
|
58
|
-
htpolynet/resources/example_depot/4-dfda-fde-epoxy-thermoset.yaml,sha256=
|
|
59
|
-
htpolynet/resources/example_depot/5-htpb-ipdi.yaml,sha256=
|
|
60
|
-
htpolynet/resources/example_depot/6-cyanate-ester.yaml,sha256=
|
|
53
|
+
htpolynet/resources/claude/SKILL.md,sha256=nhs28iP0eVCqurXAOMFHLK6C0VAZPTZzAezzvNWj0yM,8629
|
|
54
|
+
htpolynet/resources/example_depot/0-liquid-styrene.yaml,sha256=Y3PJzm9WFwP3DYIQTP1RuV0_-6mZC8xrx0Wbj2gY1s4,2543
|
|
55
|
+
htpolynet/resources/example_depot/1-polystyrene.yaml,sha256=_t6ZF9XbZDyH_Jn1lZq7DTNauS5-wo019CmA8oG8TMI,3807
|
|
56
|
+
htpolynet/resources/example_depot/2-bisgma-styrene-thermoset.yaml,sha256=A9-7POzguVYLIuoOrrVxgyJUhD7ji1eWrIfL4ZkqeKA,6266
|
|
57
|
+
htpolynet/resources/example_depot/3-pacm-dgeba-epoxy-thermoset.yaml,sha256=5Zz6E4x5swawS1PIUbR6RzjvOhKSJeyeWUg0q5SDJeM,4410
|
|
58
|
+
htpolynet/resources/example_depot/4-dfda-fde-epoxy-thermoset.yaml,sha256=9ZSDhGcmjGofVRpuvq1M7kWDYuUFxwCI7zjPdTzjUvE,4414
|
|
59
|
+
htpolynet/resources/example_depot/5-htpb-ipdi.yaml,sha256=stadBAyHmC1RuPRcOHdTtj9LihnHgVmlk_3oUhshqs8,10933
|
|
60
|
+
htpolynet/resources/example_depot/6-cyanate-ester.yaml,sha256=DO4Qwc6ojmN1THr3sO3eJXuhz37LiAuDW5DAaGBrtKQ,6126
|
|
61
61
|
htpolynet/resources/mdp/README.md,sha256=48RjM7HLRF776FUJXUxQIw8RZxc7z1ti6za3YB7_U80,20
|
|
62
62
|
htpolynet/resources/mdp/drag-min.mdp,sha256=CrMRQIzwtG4TlYRY-nB1P7HPgdwrpwSJJW6yoYdfahY,225
|
|
63
63
|
htpolynet/resources/mdp/drag-npt.mdp,sha256=-SUsGcIPyALsnOU51aerRmy_IVddHbMLUre2NYIIcBU,1080
|
|
@@ -95,7 +95,7 @@ htpolynet/resources/molecules/sample-inputs/STY.mol2,sha256=r1NqpovL6L7E96Kkyc6U
|
|
|
95
95
|
htpolynet/resources/tcl/readbonds.tcl,sha256=l_bh7eMjbxVi44UMPMi32bFntZltij92KmKfXC1qDz4,972
|
|
96
96
|
htpolynet/resources/tcl/readgrx.tcl,sha256=A1KvyIpFC_lwfze3XOqTCPqLIkq7HwmqJ96lZH42W0U,1731
|
|
97
97
|
htpolynet/resources/tcl/render.tcl,sha256=KUszYxzWtfuL7OXdtdk8n6eAQbz8DJfKJrGbb0pOdrI,2379
|
|
98
|
-
htpolynet/schema/base.yaml,sha256=
|
|
98
|
+
htpolynet/schema/base.yaml,sha256=WT-YG6iM9U6MuSKsuPLwwym-vM6ltL7J4H5Ka6IKLn8,48082
|
|
99
99
|
htpolynet/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
100
100
|
htpolynet/utils/banner.py,sha256=hdw6xoHNAo9p6X33LmhW5qyb67qAaQ3hmLnct3ZuDy0,906
|
|
101
101
|
htpolynet/utils/checkpoint.py,sha256=QTZIJ8K777T6o-mNpjPdelTqrpT0amLlQcgpHBiq5V0,2924
|
|
@@ -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.18.0.dist-info/METADATA,sha256=NjAEIJv3fjmZzmMHJ7C1H1iAV86HE7BtvnjrVftva9o,6754
|
|
110
|
+
htpolynet-2.18.0.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
|
|
111
|
+
htpolynet-2.18.0.dist-info/entry_points.txt,sha256=G5tx55llJf-IV9dIe7J8myGdyrhCVggCAhKrVNGP_s0,48
|
|
112
|
+
htpolynet-2.18.0.dist-info/licenses/LICENSE,sha256=piPSGqJdmTGyzF9HOnjlO2KvgOKT8NHwhCuGYM778tY,1071
|
|
113
|
+
htpolynet-2.18.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|