HTPolyNet 2.11.0__py3-none-any.whl → 2.11.1__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.
@@ -18,11 +18,13 @@ from ..core.bondtemplate import BondTemplate, BondTemplateList, ReactionBond, Re
18
18
  from ..core.topocoord import TopoCoord
19
19
  from ..cure.chain import ChainManager
20
20
  from ..cure.reaction import (Reaction, ReactionList, consumes_sacrificial_h, reaction_stage,
21
- spanning_and_closing_bonds)
21
+ spanning_and_closing_bonds, is_ring_closing)
22
22
  from ..external.ambertools import GAFFParameterize
23
23
  from ..external.command import run
24
24
  from ..external.gromacs import mdp_modify,gro_from_trr
25
25
  from ..geometry.matrix4 import Matrix4
26
+ from ..geometry.templategeom import (check_ring_closed,
27
+ relax_geometry as relax_template_geometry)
26
28
  from ..geometry.placement import min_distance, place_group, rotate_about_axis
27
29
  from ..io.gro import GRX_ATTRIBUTES
28
30
 
@@ -510,6 +512,15 @@ class Molecule:
510
512
  # logger.debug(f'Using override input molecules/inputs/{self.name}.{isf} as a generator')
511
513
  # pfs.checkout(f'molecules/inputs/{self.name}.{isf}')
512
514
  # else:
515
+ # A ring closure leaves the template's coordinates describing its reactants
516
+ # rather than its product: the closure ladder cannot beat the reactants' own
517
+ # sp parameters, so the ring bonds are recorded but still ~0.22 nm long.
518
+ # Charges are computed from the geometry, so this has to be put right before
519
+ # antechamber sees it -- see geometry.templategeom.
520
+ if is_ring_closing(R):
521
+ self.TopoCoord.Topology.rebalance_mol2_bond_orders()
522
+ relax_template_geometry(self.TopoCoord, name=self.name)
523
+ check_ring_closed(self.TopoCoord, self.name)
513
524
  self.TopoCoord.write_mol2(filename=f'{self.name}.mol2', molname=self.name)
514
525
  if not do_parameterization:
515
526
  self.TopoCoord.write_gro(f'{self.name}.gro', grotitle=self.name)
htpolynet/core/runtime.py CHANGED
@@ -701,7 +701,12 @@ class Runtime:
701
701
  rc.state.iter += 1
702
702
  continue
703
703
  bdf = triple_bonds_dataframe(chosen, sites, R.product, order=R.bonds[0].get('order', 1))
704
- rc.close_rings(TC, bdf, gromacs_dict=gromacs_dict)
704
+ work = rc.close_rings(TC, bdf, gromacs_dict=gromacs_dict)
705
+ # a ring the ladder could not pull shut would be bonded long and stay that way
706
+ bdf, chosen = rc.accept(bdf, work, chosen)
707
+ if not chosen:
708
+ rc.state.iter += 1
709
+ continue
705
710
  rc.form_rings(TC, bdf, sites, chosen, template, template_resids,
706
711
  name_translations=name_translations, atom_names=arm)
707
712
  rc.relax(TC, gromacs_dict=gromacs_dict)
@@ -1307,6 +1307,11 @@ class TopoCoord:
1307
1307
  # htpolynet-study 2026-09-21: that is the sole reason no cured cyanate-ester
1308
1308
  # network in 96 cells contains an intramolecular 14-ring, while carrying a
1309
1309
  # cycle rank of ~430 on ~938 junctions. Do not "fix" the staleness.
1310
+ # Nor is gelling the whole of it: counting edges and vertices on the
1311
+ # monomer-junction graph, an acyclic network requires a conversion below
1312
+ # 3/4, so above that every further bond MUST close a cycle. A cure that
1313
+ # refused cycle-closing bonds could not reach the conversions this
1314
+ # chemistry is run at (0.97-0.99) at all.
1310
1315
  assert i_resNum!=j_resNum,f'shortcircuit test error {i}-{j} both in residue {i_resNum}?'
1311
1316
  i_neighbors=self.Topology.bondlist.partners_of(i)
1312
1317
  j_neighbors=self.Topology.bondlist.partners_of(j)
@@ -209,6 +209,23 @@ def select_topology_type_option(options, typename='dihedraltypes', rule='stiffes
209
209
  return sorted_options[0]
210
210
  return []
211
211
 
212
+
213
+ def _element_of(name, gafftype):
214
+ """Best guess at an atom's element from its GAFF type, falling back to its name.
215
+
216
+ GAFF types are lowercase element-led (``ca``, ``nb``, ``os``, ``hc``), with the
217
+ two-letter halogens the only ambiguity worth handling.
218
+ """
219
+ for src in (str(gafftype), str(name)):
220
+ t = src.strip().upper()
221
+ if not t:
222
+ continue
223
+ if t[:2] in ('CL', 'BR'):
224
+ return t[:2]
225
+ if t[0].isalpha():
226
+ return t[0]
227
+ return ''
228
+
212
229
  class Topology:
213
230
  """ Class for handling gromacs topology data
214
231
  """
@@ -649,6 +666,66 @@ class Topology:
649
666
  to_drop.append(d[(d.ai == ai) & (d.aj == aj)].index.values[0])
650
667
  self.D['bonds'] = self.D['bonds'].drop(to_drop)
651
668
 
669
+ def rebalance_mol2_bond_orders(self, atoms=None):
670
+ """Restores valence after an addition bond, by reducing a multiple bond.
671
+
672
+ A condensation reaction removes a hydrogen from each atom it bonds, so valence
673
+ takes care of itself. An addition removes nothing: ``add_bonds`` records the new
674
+ mol2 bond at order 1 and leaves every existing bond alone, so an atom that already
675
+ carried a multiple bond ends up over-valent. A cyclotrimerization does exactly
676
+ this -- the cyanate carbon keeps its C#N, gains the ring bond, and still carries
677
+ its ester oxygen, for a valence of five.
678
+
679
+ The mol2 bond orders are what antechamber perceives the molecule from, so an
680
+ impossible valence there is not cosmetic. Reducing the shared triple bond fixes
681
+ both of its atoms at once, which is why a bond over-valent at BOTH ends is chosen
682
+ first.
683
+
684
+ Args:
685
+ atoms (iterable): restrict the repair to these atom numbers, normally the ones
686
+ a reaction just bonded; None considers every atom
687
+
688
+ Returns:
689
+ int: how many bond orders were reduced
690
+ """
691
+ mb = self.D.get('mol2_bonds')
692
+ if mb is None or mb.empty:
693
+ return 0
694
+ at = self.D['atoms']
695
+ element = {int(r.nr): _element_of(r.atom, r.type) for r in at.itertuples()}
696
+ limit = {'H': 1, 'C': 4, 'N': 3, 'O': 2, 'F': 1, 'CL': 1, 'BR': 1, 'I': 1}
697
+ order_of = {'1': 1.0, '2': 2.0, '3': 3.0, 'ar': 1.5, 'am': 1.0}
698
+ watch = None if atoms is None else {int(a) for a in atoms}
699
+ reduced = 0
700
+ for _ in range(4 * mb.shape[0]): # each pass reduces one order; bounded
701
+ val = {}
702
+ for r in mb.itertuples():
703
+ o = order_of.get(str(r.order), 1.0)
704
+ val[int(r.ai)] = val.get(int(r.ai), 0.0) + o
705
+ val[int(r.aj)] = val.get(int(r.aj), 0.0) + o
706
+ over = {a: v - limit[element[a]] for a, v in val.items()
707
+ if element.get(a) in limit and v > limit[element[a]] + 0.01
708
+ and (watch is None or a in watch)}
709
+ if not over:
710
+ break
711
+ # a bond over-valent at both ends repairs two atoms at once
712
+ cand = [(i, r) for i, r in enumerate(mb.itertuples())
713
+ if order_of.get(str(r.order), 1.0) >= 2.0
714
+ and (int(r.ai) in over or int(r.aj) in over)]
715
+ if not cand:
716
+ break
717
+ cand.sort(key=lambda x: (-(int(x[1].ai) in over) - (int(x[1].aj) in over),
718
+ -order_of.get(str(x[1].order), 1.0)))
719
+ i, row = cand[0]
720
+ newo = int(order_of[str(row.order)] - 1)
721
+ mb.iat[i, mb.columns.get_loc('order')] = str(newo)
722
+ logger.debug(f'valence repair: bond {row.ai}-{row.aj} order '
723
+ f'{row.order} -> {newo}')
724
+ reduced += 1
725
+ if reduced:
726
+ logger.info(f'Reduced {reduced} bond order(s) to keep valence after an addition')
727
+ return reduced
728
+
652
729
  def add_bonds(self, pairs=[]):
653
730
  """Adds bonds indicated in list pairs to the topology.
654
731
 
@@ -81,7 +81,7 @@ class RingController:
81
81
  'same_residue': False,
82
82
  'relax': [{'ensemble': 'min'},
83
83
  {'ensemble': 'nvt', 'temperature': 300, 'nsteps': 2000}],
84
- 'closure': {'nstages': 8, 'target': 0.15, 'kb': 300000.0,
84
+ 'closure': {'nstages': 8, 'target': 0.15, 'kb': 300000.0, 'max_accept': 0.30,
85
85
  'equilibration': [{'ensemble': 'min'},
86
86
  {'ensemble': 'nvt', 'temperature': 600, 'nsteps': 1000}]},
87
87
  }
@@ -229,11 +229,46 @@ class RingController:
229
229
  TC.add_length_attribute(work, attr_name='final_distance')
230
230
  worst = work['final_distance'].max()
231
231
  logger.info(f'Rings closed to at most {worst:.3f} nm (target {c["target"]:.3f})')
232
- if worst > 2.0 * c['target']:
233
- logger.warning(f'A ring-closing pair is still {worst:.3f} nm apart; its bond will be '
234
- f'formed long and relaxed, which may strain the network')
235
232
  return work
236
233
 
234
+ def accept(self, bdf, work, chosen):
235
+ """Drops any ring the closure ladder could not actually pull shut.
236
+
237
+ Late in a cure the matrix is rigid enough that a ring sometimes stops well short
238
+ -- one batch at conversion 0.95 ended 0.327 nm apart against a target of 0.150.
239
+ Forming the bond anyway leaves it long: two ring bonds survived relaxation and a
240
+ 500 K anneal still 2.6 A apart, strained but stable, which is a defect the
241
+ network then carries for good.
242
+
243
+ Declining costs almost nothing. The groups stay unreacted and are offered again
244
+ next iteration, by which time the neighbourhood has moved; only if they can never
245
+ close does the cure lose them, which is the right outcome.
246
+
247
+ Args:
248
+ bdf (pandas.DataFrame): this iteration's bonds, three rows per ring
249
+ work (pandas.DataFrame): the same pairs with their final distances
250
+ chosen (list): the rings the search accepted
251
+
252
+ Returns:
253
+ tuple: (bdf, chosen) keeping only the rings that closed
254
+ """
255
+ limit = self.dicts['closure']['max_accept']
256
+ if not limit:
257
+ return bdf, chosen
258
+ worst = work['final_distance'].to_numpy().reshape(-1, 3).max(axis=1)
259
+ keep = [n for n in range(len(chosen)) if worst[n] <= limit]
260
+ if len(keep) == len(chosen):
261
+ return bdf, chosen
262
+ for n in range(len(chosen)):
263
+ if n not in keep:
264
+ logger.info(f'Iteration {self.state.iter}: declining a ring still '
265
+ f'{worst[n]:.3f} nm from closing (limit {limit:.3f} nm); its '
266
+ f'groups stay unreacted and will be offered again')
267
+ renumber = {old: new for new, old in enumerate(keep)}
268
+ bdf = bdf[bdf['triple'].isin(keep)].copy()
269
+ bdf['triple'] = [renumber[t] for t in bdf['triple']]
270
+ return bdf.reset_index(drop=True), [chosen[n] for n in keep]
271
+
237
272
  def relax(self, TC, gromacs_dict=None):
238
273
  """Eases a freshly closed ring's bonds in before anything else runs.
239
274
 
@@ -0,0 +1,267 @@
1
+ """Makes a freshly assembled product template a plausible molecule before it is parameterized.
2
+
3
+ A template built by bonding reactants together inherits its geometry from how those
4
+ reactants were placed, not from the chemistry of the product. For a condensation that
5
+ is close enough: one new bond, formed between atoms that were already adjacent, and the
6
+ minimization after parameterization tidies the rest.
7
+
8
+ A ring closure is not close enough. Three cyanate groups pulled toward each other close
9
+ to about 0.22 nm and no further -- the restraint ladder is fighting each group's own
10
+ C#N, whose sp parameters hold it linear, and no force constant wins that. The bonds are
11
+ recorded, so the connectivity says triazine, but the coordinates still say three
12
+ cyanates 2.2 A apart.
13
+
14
+ That matters because charges are computed from the geometry. antechamber repairs the
15
+ connectivity it is given -- it perceives the ring as aromatic and assigns `ca`/`nb`
16
+ correctly -- but AM1-BCC takes Mulliken charges from a semiempirical calculation on the
17
+ coordinates, and on those coordinates the calculation sees three separate cyanates.
18
+ Measured on a methyl cyanate trimer: each ring carbon comes out at +0.699 against
19
+ +0.909 for the same molecule properly embedded, 0.21 e low on every ring carbon, with
20
+ the deficit smeared over the rest of the molecule so the net charge still checks out.
21
+ htpolynet-study measured 0.2113 e on a bisphenol A dicyanate trimer independently.
22
+
23
+ Correcting the bond orders alone does not fix it -- that arm of the experiment was
24
+ bit-identical to the unfixed one, because the QM step does not read bond orders. The
25
+ geometry has to be right before antechamber sees it, which is what this module does.
26
+
27
+ Author: Cameron F. Abrams <cfa22@drexel.edu>
28
+ """
29
+ import logging
30
+
31
+ import numpy as np
32
+
33
+ logger = logging.getLogger(__name__)
34
+
35
+ _ORDER_ = {'1': 1.0, '2': 2.0, '3': 3.0, 'ar': 1.5, 'am': 1.0}
36
+ """mol2 bond order strings as numbers."""
37
+
38
+ _MAX_PLAUSIBLE_ = {1.0: 0.20, 1.5: 0.18, 2.0: 0.18, 3.0: 0.16}
39
+ """Longest believable length, in nm, for a bond of each order between light elements.
40
+
41
+ Generous: the longest ordinary single bond here is C-S at about 0.182 nm, and the point
42
+ is to catch a bond that is not a bond at all, not to police a strained one.
43
+ """
44
+
45
+
46
+ def _has_mol2_bonds(TC):
47
+ """True when a TopoCoord carries the bond orders these checks read.
48
+
49
+ A monomer reaches parameterization with its structure still in a file rather than
50
+ loaded, and a system-scale TopoCoord never carries mol2 bonds at all, so both simply
51
+ have nothing to check here.
52
+ """
53
+ top = getattr(TC, 'Topology', None)
54
+ D = getattr(top, 'D', None) if top is not None else None
55
+ if not D or 'atoms' not in D:
56
+ return False
57
+ mb = D.get('mol2_bonds')
58
+ if mb is None or mb.empty:
59
+ return False
60
+ A = getattr(getattr(TC, 'Coordinates', None), 'A', None)
61
+ return A is not None and not A.empty
62
+
63
+
64
+ def _rdkit_mol(TC):
65
+ """Builds an RDKit molecule from a TopoCoord's elements, mol2 bonds and coordinates.
66
+
67
+ Returns:
68
+ tuple: (mol, index_map) where index_map takes an htpolynet atom number to an
69
+ RDKit atom index, or (None, None) if the molecule cannot be sanitized
70
+ """
71
+ from rdkit import Chem
72
+ from rdkit.Chem import AllChem # noqa: F401 (registers conformer machinery)
73
+ from rdkit.Geometry import Point3D
74
+
75
+ from ..core.topology import _element_of
76
+
77
+ if not _has_mol2_bonds(TC):
78
+ return None, None
79
+ at = TC.Topology.D['atoms']
80
+ mb = TC.Topology.D['mol2_bonds']
81
+ A = TC.Coordinates.A.set_index('globalIdx')
82
+
83
+ bt = {1.0: Chem.BondType.SINGLE, 1.5: Chem.BondType.AROMATIC,
84
+ 2.0: Chem.BondType.DOUBLE, 3.0: Chem.BondType.TRIPLE}
85
+ rw = Chem.RWMol()
86
+ index_map = {}
87
+ for r in at.itertuples():
88
+ e = _element_of(r.atom, r.type)
89
+ e = e.capitalize() if len(e) == 2 else e
90
+ index_map[int(r.nr)] = rw.AddAtom(Chem.Atom(e))
91
+ for r in mb.itertuples():
92
+ rw.AddBond(index_map[int(r.ai)], index_map[int(r.aj)],
93
+ bt[_ORDER_.get(str(r.order), 1.0)])
94
+ mol = rw.GetMol()
95
+ try:
96
+ Chem.SanitizeMol(mol)
97
+ except Exception as e:
98
+ logger.debug(f'RDKit could not sanitize the template: {e}')
99
+ return None, None
100
+
101
+ conf = Chem.Conformer(mol.GetNumAtoms())
102
+ for nr, idx in index_map.items():
103
+ p = A.loc[nr]
104
+ # htpolynet holds coordinates in nm; RDKit force fields want Angstrom
105
+ conf.SetAtomPosition(idx, Point3D(float(p.posX) * 10.0, float(p.posY) * 10.0,
106
+ float(p.posZ) * 10.0))
107
+ mol.AddConformer(conf, assignId=True)
108
+ return mol, index_map
109
+
110
+
111
+ def _minimize(mol, maxIters):
112
+ """Runs MMFF if it has parameters for this molecule, UFF otherwise.
113
+
114
+ Returns:
115
+ tuple: (succeeded, energy before, energy after)
116
+ """
117
+ from rdkit.Chem import AllChem
118
+ try:
119
+ props = AllChem.MMFFGetMoleculeProperties(mol)
120
+ ff = (AllChem.MMFFGetMoleculeForceField(mol, props) if props is not None
121
+ else AllChem.UFFGetMoleculeForceField(mol))
122
+ if ff is None:
123
+ return False, 0.0, 0.0
124
+ before = ff.CalcEnergy()
125
+ ff.Minimize(maxIts=maxIters)
126
+ return True, before, ff.CalcEnergy()
127
+ except Exception as e:
128
+ logger.debug(f'force-field minimization failed: {e}')
129
+ return False, 0.0, 0.0
130
+
131
+
132
+ def relax_geometry(TC, name='', maxIters=5000):
133
+ """Relaxes a template's coordinates against its own connectivity, in place.
134
+
135
+ Tries first from the coordinates the template already has, so a product keeps the
136
+ arrangement its reactants were placed in and only the bonds that were never closed
137
+ actually move. If that minimization cannot get going -- a bond recorded across 2.2 A
138
+ can leave the starting geometry strained enough that the line search fails on its
139
+ first step -- it falls back to embedding the molecule from scratch. A fresh embed
140
+ discards the reactants' arrangement, which is a real loss but a much smaller one than
141
+ parameterizing an open ring: the template's geometry is a starting point that gets
142
+ minimized again under GAFF, while its charges are computed once and kept.
143
+
144
+ Args:
145
+ TC (TopoCoord): the template
146
+ name (str): the molecule's name, for logging
147
+ maxIters (int): force-field iteration cap
148
+
149
+ Returns:
150
+ bool: True if the coordinates were updated
151
+ """
152
+ from rdkit.Chem import AllChem
153
+
154
+ mol, index_map = _rdkit_mol(TC)
155
+ if mol is None:
156
+ logger.warning(f'{name}: template geometry left as built; RDKit could not read it. '
157
+ f'If this product closes a ring, its charges would be computed on an '
158
+ f'open ring.')
159
+ return False
160
+
161
+ ok, before, after = _minimize(mol, maxIters)
162
+ how = 'relaxed against its own bonds'
163
+ if not ok:
164
+ logger.debug(f'{name}: minimizing from the built geometry failed; re-embedding')
165
+ mol.RemoveAllConformers()
166
+ if AllChem.EmbedMolecule(mol, randomSeed=0xC0FFEE) != 0:
167
+ logger.warning(f'{name}: template geometry left as built; RDKit could neither '
168
+ f'minimize nor embed it.')
169
+ return False
170
+ ok, before, after = _minimize(mol, maxIters)
171
+ how = 're-embedded and relaxed'
172
+ if not ok:
173
+ logger.warning(f'{name}: template geometry left as built; no force field would '
174
+ f'run on it.')
175
+ return False
176
+
177
+ conf = mol.GetConformer()
178
+ A = TC.Coordinates.A
179
+ pos = {nr: conf.GetAtomPosition(idx) for nr, idx in index_map.items()}
180
+ for col, comp in (('posX', 'x'), ('posY', 'y'), ('posZ', 'z')):
181
+ A[col] = [getattr(pos[int(g)], comp) / 10.0 if int(g) in pos else v
182
+ for g, v in zip(A['globalIdx'], A[col])]
183
+ logger.info(f'{name}: template geometry {how} ({before:.1f} -> {after:.1f} kcal/mol)')
184
+ return True
185
+
186
+
187
+ def geometry_complaints(TC):
188
+ """Finds what would make a template a bad thing to hand to a charge calculation.
189
+
190
+ Two checks, because they fail independently: an atom whose recorded bond orders
191
+ exceed what its element can carry, and a bond whose length is not credible for its
192
+ order. The second is what catches a ring that never closed -- an aromatic C-N
193
+ recorded at 2.2 A is unmistakable -- and it catches it whether or not the orders
194
+ were ever repaired.
195
+
196
+ Args:
197
+ TC (TopoCoord): the template
198
+
199
+ Returns:
200
+ list: human-readable complaints, empty when the template is fit to parameterize
201
+ """
202
+ from ..core.topology import _element_of
203
+
204
+ out = []
205
+ if not _has_mol2_bonds(TC):
206
+ return out
207
+ mb = TC.Topology.D['mol2_bonds']
208
+ at = TC.Topology.D['atoms']
209
+ element = {int(r.nr): _element_of(r.atom, r.type) for r in at.itertuples()}
210
+ name = {int(r.nr): r.atom for r in at.itertuples()}
211
+ limit = {'H': 1, 'C': 4, 'N': 3, 'O': 2, 'F': 1, 'CL': 1, 'BR': 1, 'I': 1}
212
+
213
+ val = {}
214
+ for r in mb.itertuples():
215
+ o = _ORDER_.get(str(r.order), 1.0)
216
+ val[int(r.ai)] = val.get(int(r.ai), 0.0) + o
217
+ val[int(r.aj)] = val.get(int(r.aj), 0.0) + o
218
+ for a, v in sorted(val.items()):
219
+ e = element.get(a)
220
+ if e in limit and v > limit[e] + 0.01:
221
+ out.append(f'atom {a} ({name[a]}, {e}) has bond orders summing to {v:g}, '
222
+ f'more than {e} can carry')
223
+
224
+ A = TC.Coordinates.A.set_index('globalIdx')
225
+ for r in mb.itertuples():
226
+ i, j = int(r.ai), int(r.aj)
227
+ if i not in A.index or j not in A.index:
228
+ continue
229
+ d = float(np.linalg.norm(A.loc[i, ['posX', 'posY', 'posZ']].to_numpy(dtype=float)
230
+ - A.loc[j, ['posX', 'posY', 'posZ']].to_numpy(dtype=float)))
231
+ o = _ORDER_.get(str(r.order), 1.0)
232
+ if d > _MAX_PLAUSIBLE_.get(o, 0.20):
233
+ out.append(f'bond {name[i]}({i})-{name[j]}({j}) is recorded at order '
234
+ f'{r.order} but is {d * 10:.2f} A long')
235
+ return out
236
+
237
+
238
+ def check_ring_closed(TC, name):
239
+ """Refuses to parameterize a ring-closing product whose ring is still open.
240
+
241
+ Scope matters here. EVERY htpolynet template reaches antechamber with its new bonds
242
+ about 2.2 A long -- a styrene dimer as much as a triazine -- because the bond is
243
+ recorded before anything relaxes it. For a single new bond that has always been
244
+ fine in practice, and this check deliberately says nothing about it: changing how
245
+ those are parameterized would move the charges of every template htpolynet has ever
246
+ built, which is not a thing to do blind. See ROADMAP.md.
247
+
248
+ What is not fine is a ring, because its charges were measured wrong: 0.21 e low on
249
+ every ring carbon, twice, on two different monomers. So after
250
+ :func:`relax_geometry` has had its turn, a ring that is still open means the repair
251
+ did not work and the charges would be silently wrong again.
252
+
253
+ Note that antechamber echoes its input coordinates into its output, so this must be
254
+ checked on what we hand it. Its output geometry is not evidence of anything.
255
+
256
+ Raises:
257
+ RuntimeError: listing every complaint, because they usually share one cause
258
+ """
259
+ complaints = geometry_complaints(TC)
260
+ if not complaints:
261
+ return
262
+ raise RuntimeError(
263
+ f'{name} closes a ring, but after relaxation it is still not a plausible '
264
+ f'molecule, so its charges would be wrong and it will not be parameterized:\n '
265
+ + '\n '.join(complaints) +
266
+ f'\nCharges are computed from the geometry, not from the bond orders, and a ring '
267
+ f'left open is charged as the separate groups it still looks like.')
@@ -543,6 +543,13 @@ attributes:
543
543
  Minimum amount in nm by which the target distance is decreased
544
544
  per stage; with `limit`, this sets the stage count.
545
545
  default: 0.0
546
+ - name: max_accept
547
+ type: float
548
+ text: >
549
+ Refuse to form a ring whose pairs are still further apart than this after
550
+ the closure ladder, in nm. The groups stay unreacted and are offered
551
+ again next iteration. 0 accepts any ring.
552
+ default: 0.30
546
553
  - name: nstages
547
554
  type: int
548
555
  text: Explicit stage count, as an alternative to deriving one from `increment`.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: htpolynet
3
- Version: 2.11.0
3
+ Version: 2.11.1
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/
@@ -9,19 +9,19 @@ htpolynet/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
9
  htpolynet/core/bondtemplate.py,sha256=_1vYMugonDuogysu15IsbpthvxYb6uJKC5ao7pQcWvg,9969
10
10
  htpolynet/core/configuration.py,sha256=j-74qPF_bqZrt9fBivGj-jX85kkVHNkSHM13ewE2ut0,5279
11
11
  htpolynet/core/coordinates.py,sha256=CGTHkdfw2ikc2ANacA5akRhZ9tOyM2IbELwQ2FVcKRw,23878
12
- htpolynet/core/molecule.py,sha256=xidO9SV4mYOKK_TSQWdL2JCwwzqc_XdFGgXpbJEG-Ks,62207
12
+ htpolynet/core/molecule.py,sha256=j0I0qsk5mRTg8QMysxJz6U9HxgTRpRSzHEgJ_SRT-jQ,63012
13
13
  htpolynet/core/paramcache.py,sha256=37S88gRXZ5_xAdWyUE-Q3Etxc5HMv8L_RHrykkq9YAs,6966
14
14
  htpolynet/core/productsplice.py,sha256=asFVCW8G_rcMIizvO2Sh98MpOsFqzP1kIX1JySei_p8,12816
15
15
  htpolynet/core/projectfilesystem.py,sha256=2U_EToZxN7yUGWu9BIRABVsYdp1AKkOuManwuFBz89k,20983
16
- htpolynet/core/runtime.py,sha256=Tg8gcdkUXzHShyFX8Gp42HCOFq1L1aABrwLfbIVvzU8,72145
17
- htpolynet/core/topocoord.py,sha256=R628x3pL2dBe9jcoBXGUud38n0J22eXh8Vxk_GWJu6Q,110156
18
- htpolynet/core/topology.py,sha256=V-QeiSi4AQLnQ9l5dVDowntuv6A_J5FRxoyY5uuMso0,61807
16
+ htpolynet/core/runtime.py,sha256=yBDfo0-ExUKFmfycWNi-ldnV249yR_j_dkUCkZG0sx8,72385
17
+ htpolynet/core/topocoord.py,sha256=jUgFg9TuUdSm14wo_464xX6dC4okJMrj1FbIzmaoA0Q,110520
18
+ htpolynet/core/topology.py,sha256=ASyNbyWxw4bvFUACBmydCr-gGl705o68aB7vGYl7cHk,65405
19
19
  htpolynet/cure/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
20
20
  htpolynet/cure/chain.py,sha256=-d5BFE5xUKjFdNkxLfSnCnZIRSJCtr7xuxYzNHBeSgU,5344
21
21
  htpolynet/cure/curecontroller.py,sha256=eTJc1JqrD7w6XLg4pL5ACHXo5N1oJ6P5pVdzMONxiBU,59756
22
22
  htpolynet/cure/expandreactions.py,sha256=eN35-SQrzjoo8ftZVLJkiAKxpA_FigERTwZ8jtoxDng,20682
23
23
  htpolynet/cure/reaction.py,sha256=_kRJ1JzT_fjLIAF6j9lH_Sft41KD1kVQuWPmXdHia-M,13446
24
- htpolynet/cure/ringcontroller.py,sha256=T6iTyi8vQZ9hLMj1qPuAyCwtDtecGvqprV-vBk6Klhk,14989
24
+ htpolynet/cure/ringcontroller.py,sha256=kfJkHeaezH9HoLWsUHcSP7xX0hixsHlo_IDRwwr8aIw,16752
25
25
  htpolynet/cure/triplesearch.py,sha256=54Dl0RU_LHcwCDa4-0AiRH08eIEA8bTacrA1TDhs5I8,10605
26
26
  htpolynet/external/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
27
27
  htpolynet/external/ambertools.py,sha256=NkZ0fP6iqwMnMk2jMD3-EaiGCmutHb1MVFOTFJiQ7WI,6286
@@ -37,6 +37,7 @@ htpolynet/geometry/linkcell.py,sha256=11AWNugo9QruaVldMBhK23CuU3F-imkbbUvBX2r1kh
37
37
  htpolynet/geometry/matrix4.py,sha256=hXVz9VGXT_0nJ-hI7xk4YZmeq4mntYqPrlJYdD1KFl4,3780
38
38
  htpolynet/geometry/placement.py,sha256=oSg4uFC8oOIm3UpTdGbD3PhgjdPDIvI3QgsVIcazHuk,3968
39
39
  htpolynet/geometry/ring.py,sha256=dpMajpPRRYTywpMsnwoyXVMNGfWZUZxS1SAx3Qh8E2I,9638
40
+ htpolynet/geometry/templategeom.py,sha256=NO6RXL9_iYnPL6QOFPA9UeSDAaGUgxlbJuN8wnNw9p0,11702
40
41
  htpolynet/io/__init__.py,sha256=nX1-mb5tNRK_FTH1NP55ESWBSmiY_yBBU-43NMgzeA4,160
41
42
  htpolynet/io/gro.py,sha256=QGsAIlTIJlMRxtv_Juo0wdpbICAzyfQvSzzaMWrlMmA,7141
42
43
  htpolynet/io/mol2.py,sha256=5aU3HmQ5DS0LBF7tBPCNYKzBScwj8V3xfEUcFIrsevk,7314
@@ -91,7 +92,7 @@ htpolynet/resources/molecules/sample-inputs/STY.mol2,sha256=r1NqpovL6L7E96Kkyc6U
91
92
  htpolynet/resources/tcl/readbonds.tcl,sha256=l_bh7eMjbxVi44UMPMi32bFntZltij92KmKfXC1qDz4,972
92
93
  htpolynet/resources/tcl/readgrx.tcl,sha256=A1KvyIpFC_lwfze3XOqTCPqLIkq7HwmqJ96lZH42W0U,1731
93
94
  htpolynet/resources/tcl/render.tcl,sha256=KUszYxzWtfuL7OXdtdk8n6eAQbz8DJfKJrGbb0pOdrI,2379
94
- htpolynet/schema/base.yaml,sha256=TvLca5gDKdBuNUSXsFuoyqOb5nhREmXMrH72OE88ofs,40057
95
+ htpolynet/schema/base.yaml,sha256=rIAWZDJuiZLIpnVU5DZCv40Z7KmQ5cx8o5RJyOY2i20,40385
95
96
  htpolynet/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
96
97
  htpolynet/utils/banner.py,sha256=hdw6xoHNAo9p6X33LmhW5qyb67qAaQ3hmLnct3ZuDy0,906
97
98
  htpolynet/utils/checkpoint.py,sha256=QTZIJ8K777T6o-mNpjPdelTqrpT0amLlQcgpHBiq5V0,2924
@@ -102,8 +103,8 @@ htpolynet/utils/logsetup.py,sha256=o0mlVXNzqcfua2SAlJPkGSh4lM_bmI10gWwpb9gqYu8,1
102
103
  htpolynet/utils/profiling.py,sha256=su7qpGEz6FXVU4KT2HQDWG82bc1sgsfpDQBbAfPpsHc,7331
103
104
  htpolynet/utils/stringthings.py,sha256=Mr6o55EM8o4YAaVYpjIJj2IxDToNdbPzb-lpQ3w3jFk,1176
104
105
  htpolynet/utils/vmd_viz.py,sha256=Crk3Ln88PKiJ9X7DMMkFEVh2Ru6a1y0RUgj3w6EIgFc,10867
105
- htpolynet-2.11.0.dist-info/METADATA,sha256=YFTSEfaLXFMaipdXAPfSJApCloANGc4beu04PAyiIv4,6589
106
- htpolynet-2.11.0.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
107
- htpolynet-2.11.0.dist-info/entry_points.txt,sha256=G5tx55llJf-IV9dIe7J8myGdyrhCVggCAhKrVNGP_s0,48
108
- htpolynet-2.11.0.dist-info/licenses/LICENSE,sha256=piPSGqJdmTGyzF9HOnjlO2KvgOKT8NHwhCuGYM778tY,1071
109
- htpolynet-2.11.0.dist-info/RECORD,,
106
+ htpolynet-2.11.1.dist-info/METADATA,sha256=PTLVAdHklYafqGf5MONjWD8PZ9u90joApW9uBdS9KYQ,6589
107
+ htpolynet-2.11.1.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
108
+ htpolynet-2.11.1.dist-info/entry_points.txt,sha256=G5tx55llJf-IV9dIe7J8myGdyrhCVggCAhKrVNGP_s0,48
109
+ htpolynet-2.11.1.dist-info/licenses/LICENSE,sha256=piPSGqJdmTGyzF9HOnjlO2KvgOKT8NHwhCuGYM778tY,1071
110
+ htpolynet-2.11.1.dist-info/RECORD,,