HTPolyNet 2.6.1__py3-none-any.whl → 2.6.2__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.
@@ -640,38 +640,68 @@ class CureController:
640
640
  self.state._to_yaml()
641
641
 
642
642
  def check_iterations_vs_functionality(self,TC:TopoCoord):
643
- """Warns if the cure ran too few iterations for its crosslinkers to have completed.
644
-
645
- The bond downselection admits at most one bond per residue per
646
- iteration, so a residue with ``f`` reactive sites cannot be fully
647
- reacted in fewer than ``f`` iterations — whatever the bond conversion
648
- says. A cure that reaches its target conversion in two iterations
649
- therefore leaves *every* trifunctional crosslinker incomplete, and a
650
- system with no complete crosslinker has no junctions: it is a monomer
651
- melt that equilibrates, reports a sensible density, and looks in every
652
- other respect like a cured network.
653
-
654
- Nothing else surfaces this. The conversion the cure reports is a bond
655
- conversion and is perfectly happy; only a postcure repair stage would
656
- notice, and only if one is configured. ``completion_bias`` does not
657
- help — it changes which residues react, not the one-per-residue-per-
658
- iteration rule — which matters because it is the first thing a user
659
- would reach for on seeing a low crosslinker conversion.
643
+ """Warns if the cure produced few or no complete crosslinkers.
644
+
645
+ A system whose crosslinkers did not complete has no junctions: it is a
646
+ monomer melt that equilibrates, reports a sensible density, and looks
647
+ in every other respect like a cured network. Nothing else surfaces
648
+ this. The conversion the cure reports is a *bond* conversion and is
649
+ perfectly happy with it; only a postcure repair stage would notice, and
650
+ only if one is configured.
651
+
652
+ There are two ways to arrive there and this checks for both.
653
+
654
+ The first is a counting constraint. The bond downselection admits at
655
+ most one bond per residue per iteration, so a residue with ``f``
656
+ reactive sites cannot be fully reacted in fewer than ``f`` iterations —
657
+ whatever the bond conversion says — and a cure that reaches its target
658
+ in two iterations leaves *every* trifunctional crosslinker incomplete.
659
+
660
+ The second is ordinary shortfall, and it is not bounded away by any
661
+ iteration count. The bonds a cure forms are not spread evenly across
662
+ its iterations: the per-iteration count decays steeply, and it is the
663
+ *last* iteration that has to supply a crosslinker's final bond. A cure
664
+ that runs exactly ``f`` iterations and spends its last one on almost
665
+ nothing ends up in the same place as one that ran too few, and the
666
+ counting test above passes it in silence. This is not hypothetical —
667
+ a build has reached exactly one complete crosslinker in 240 that way.
668
+ So the completed count itself is checked, which is exact by the time
669
+ this runs and needs no threshold on a proxy for it.
670
+
671
+ ``completion_bias`` is not the remedy for either — it changes which
672
+ residues react, not the one-per-residue-per-iteration rule — which
673
+ matters because it is the first thing a user would reach for on seeing
674
+ a low crosslinker conversion.
660
675
 
661
676
  Args:
662
677
  TC (TopoCoord): global system topology and coordinates
663
678
  """
664
679
  adf=TC.gro_DataFrame('atoms')
665
- if adf is None or not all(c in adf.columns for c in ('resNum','z','nreactions')): return
680
+ if adf is None or not all(c in adf.columns for c in ('resNum','resName','z','nreactions')): return
666
681
  func=residue_functionality(adf)
667
682
  if func.empty: return
668
683
  fmax=int(func.max())
684
+ if fmax<2: return
685
+ names=adf.loc[adf['resNum']==func.idxmax(),'resName']
686
+ resname=names.iloc[0] if len(names) else f'residue {func.idxmax()}'
669
687
  iterations=self.state.iter
670
- if fmax<2 or iterations>=fmax: return
671
- top=func.idxmax()
672
- names=adf.loc[adf['resNum']==top,'resName']
673
- resname=names.iloc[0] if len(names) else f'residue {top}'
674
- logger.warning(f'The cure ran {iterations} iteration(s), but {resname} carries {fmax} reactive sites and the bond search admits at most one bond per residue per iteration. No {resname} can have reacted at all {fmax} of its sites, whatever bond conversion was reached, so this system contains no fully-reacted {resname} and therefore no crosslink junctions. completion_bias does not change this. To spend more iterations reaching the same conversion, lower CURE.controls.max_conversion_per_iteration or min_bonds_per_iteration.')
688
+ if iterations<fmax:
689
+ logger.warning(f'The cure ran {iterations} iteration(s), but {resname} carries {fmax} reactive sites and the bond search admits at most one bond per residue per iteration. No {resname} can have reacted at all {fmax} of its sites, whatever bond conversion was reached, so this system contains no fully-reacted {resname} and therefore no crosslink junctions. completion_bias does not change this. To spend more iterations reaching the same conversion, lower CURE.controls.max_conversion_per_iteration or min_bonds_per_iteration.')
690
+ return
691
+ crosslinkers=func[func==fmax].index
692
+ if not len(crosslinkers): return
693
+ counts=residue_reaction_counts(adf).reindex(crosslinkers).fillna(0)
694
+ complete=int((counts>=fmax).sum())
695
+ fraction=complete/len(crosslinkers)
696
+ logger.info(f'{complete} of {len(crosslinkers)} {resname} are fully reacted ({fraction:.1%})')
697
+ # The crosslinker conversion an ideal randomly-branching network of this
698
+ # functionality would show at its gel point, f_c**f with f_c=1/(f-1).
699
+ # An idealization, used only to decide when to raise the volume: below
700
+ # it a run has too few complete crosslinkers for a percolating network
701
+ # to be assumed, whatever the bond conversion says.
702
+ gel_point=(1.0/(fmax-1))**fmax
703
+ if fraction<gel_point:
704
+ logger.warning(f'The cure ran {iterations} iteration(s) and formed enough bonds to report its bond conversion, but only {complete} of {len(crosslinkers)} {resname} ({fraction:.1%}) ended up reacted at all {fmax} of their sites, and only those are crosslink junctions. That is below the {gel_point:.1%} an ideal randomly-branching network of functionality {fmax} would reach at its gel point, so do not assume this system percolates. The usual cause is a cure whose last iteration formed very few bonds, since that is the iteration that has to supply each crosslinker its final bond; the per-iteration bond count decays steeply, so reaching the target conversion is not enough on its own. completion_bias does not change this. To spread the same conversion over more iterations, lower CURE.controls.max_conversion_per_iteration or min_bonds_per_iteration.')
675
705
 
676
706
  def _completion_bias_counts(self,adf):
677
707
  """Returns per-residue reaction counts when the completion bias is enabled, else None.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: htpolynet
3
- Version: 2.6.1
3
+ Version: 2.6.2
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/
@@ -17,7 +17,7 @@ htpolynet/core/topocoord.py,sha256=jtQcwzvzPVNjU9VxBF9iXw8g3KiY55_jGDlwAZDOSjs,1
17
17
  htpolynet/core/topology.py,sha256=XcFL96x2E4MsMrUr9upjE211-VcPVwLVoPL9vrV4DOw,56954
18
18
  htpolynet/cure/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
19
19
  htpolynet/cure/chain.py,sha256=-d5BFE5xUKjFdNkxLfSnCnZIRSJCtr7xuxYzNHBeSgU,5344
20
- htpolynet/cure/curecontroller.py,sha256=smuAJYQYysSyIw3QywpwUCzkMwYE1N_i4ZyGR7NvXoU,44383
20
+ htpolynet/cure/curecontroller.py,sha256=4MfJFCb3zOGkuQ3SiwYQ6LXZKjbXOJBhg-n3iVw52Bo,46952
21
21
  htpolynet/cure/expandreactions.py,sha256=_NNsAuOCdgHMBLyEwl6S7VAZyDT5ei-m4OBBXjDE3YQ,13774
22
22
  htpolynet/cure/reaction.py,sha256=S-w60HocYknKnGbq1_uwLpKTL5Fte_o7zxwk3FbyQ1I,10557
23
23
  htpolynet/external/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -96,8 +96,8 @@ htpolynet/utils/logsetup.py,sha256=o0mlVXNzqcfua2SAlJPkGSh4lM_bmI10gWwpb9gqYu8,1
96
96
  htpolynet/utils/profiling.py,sha256=su7qpGEz6FXVU4KT2HQDWG82bc1sgsfpDQBbAfPpsHc,7331
97
97
  htpolynet/utils/stringthings.py,sha256=Mr6o55EM8o4YAaVYpjIJj2IxDToNdbPzb-lpQ3w3jFk,1176
98
98
  htpolynet/utils/vmd_viz.py,sha256=Crk3Ln88PKiJ9X7DMMkFEVh2Ru6a1y0RUgj3w6EIgFc,10867
99
- htpolynet-2.6.1.dist-info/METADATA,sha256=6a8-ltjHSemovupK6L8OJhgOfMMeVDCYj3L-oogwRx4,6557
100
- htpolynet-2.6.1.dist-info/WHEEL,sha256=zOwg4jB6zX2kU910N-cMawjivD6tO8NEWvE12je1bVk,87
101
- htpolynet-2.6.1.dist-info/entry_points.txt,sha256=G5tx55llJf-IV9dIe7J8myGdyrhCVggCAhKrVNGP_s0,48
102
- htpolynet-2.6.1.dist-info/licenses/LICENSE,sha256=piPSGqJdmTGyzF9HOnjlO2KvgOKT8NHwhCuGYM778tY,1071
103
- htpolynet-2.6.1.dist-info/RECORD,,
99
+ htpolynet-2.6.2.dist-info/METADATA,sha256=59nHNxEcAyPm83MJgaAMIkumWfn613H6-pxNK4-INEA,6557
100
+ htpolynet-2.6.2.dist-info/WHEEL,sha256=zOwg4jB6zX2kU910N-cMawjivD6tO8NEWvE12je1bVk,87
101
+ htpolynet-2.6.2.dist-info/entry_points.txt,sha256=G5tx55llJf-IV9dIe7J8myGdyrhCVggCAhKrVNGP_s0,48
102
+ htpolynet-2.6.2.dist-info/licenses/LICENSE,sha256=piPSGqJdmTGyzF9HOnjlO2KvgOKT8NHwhCuGYM778tY,1071
103
+ htpolynet-2.6.2.dist-info/RECORD,,