HTPolyNet 2.6.0__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.
- htpolynet/core/runtime.py +1 -0
- htpolynet/cure/curecontroller.py +64 -0
- htpolynet/repair/cyanate_cap.py +185 -18
- {htpolynet-2.6.0.dist-info → htpolynet-2.6.2.dist-info}/METADATA +1 -1
- {htpolynet-2.6.0.dist-info → htpolynet-2.6.2.dist-info}/RECORD +8 -8
- {htpolynet-2.6.0.dist-info → htpolynet-2.6.2.dist-info}/WHEEL +0 -0
- {htpolynet-2.6.0.dist-info → htpolynet-2.6.2.dist-info}/entry_points.txt +0 -0
- {htpolynet-2.6.0.dist-info → htpolynet-2.6.2.dist-info}/licenses/LICENSE +0 -0
htpolynet/core/runtime.py
CHANGED
|
@@ -443,6 +443,7 @@ class Runtime:
|
|
|
443
443
|
cure_finished=cc.is_cured()
|
|
444
444
|
if not cure_finished:
|
|
445
445
|
cure_finished=cc.next_iter()
|
|
446
|
+
cc.check_iterations_vs_functionality(TC)
|
|
446
447
|
''' perform capping if necessary '''
|
|
447
448
|
my_logger(f'Capping begins',logger.info)
|
|
448
449
|
pfs.go_to(pfs.Dirs.systems_capping)
|
htpolynet/cure/curecontroller.py
CHANGED
|
@@ -639,6 +639,70 @@ class CureController:
|
|
|
639
639
|
self.state.current_stage[mode]=0
|
|
640
640
|
self.state._to_yaml()
|
|
641
641
|
|
|
642
|
+
def check_iterations_vs_functionality(self,TC:TopoCoord):
|
|
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.
|
|
675
|
+
|
|
676
|
+
Args:
|
|
677
|
+
TC (TopoCoord): global system topology and coordinates
|
|
678
|
+
"""
|
|
679
|
+
adf=TC.gro_DataFrame('atoms')
|
|
680
|
+
if adf is None or not all(c in adf.columns for c in ('resNum','resName','z','nreactions')): return
|
|
681
|
+
func=residue_functionality(adf)
|
|
682
|
+
if func.empty: return
|
|
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()}'
|
|
687
|
+
iterations=self.state.iter
|
|
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.')
|
|
705
|
+
|
|
642
706
|
def _completion_bias_counts(self,adf):
|
|
643
707
|
"""Returns per-residue reaction counts when the completion bias is enabled, else None.
|
|
644
708
|
|
htpolynet/repair/cyanate_cap.py
CHANGED
|
@@ -145,19 +145,42 @@ def _report_placements(placements, target):
|
|
|
145
145
|
target (float): the clearance in nm that was being aimed for
|
|
146
146
|
|
|
147
147
|
Returns:
|
|
148
|
-
dict: n_transferred, n_direction_searched, n_below_target,
|
|
148
|
+
dict: n_transferred, n_direction_searched, n_below_target,
|
|
149
|
+
n_preferred_out_of_angle, min_clearance_nm and the medians
|
|
149
150
|
"""
|
|
150
151
|
if not placements:
|
|
151
152
|
return {'n_transferred': 0, 'n_direction_searched': 0,
|
|
152
|
-
'n_below_target': 0, '
|
|
153
|
+
'n_below_target': 0, 'n_preferred_out_of_angle': 0,
|
|
154
|
+
'min_clearance_nm': None}
|
|
153
155
|
gaps = np.array([p['clearance'] for p in placements], dtype=float)
|
|
154
156
|
searched = sum(1 for p in placements if not p['kept_o_h_direction'])
|
|
157
|
+
# why the preferred direction was abandoned matters as much as how often.
|
|
158
|
+
# A metric that rejects every preferred direction for a reason unrelated
|
|
159
|
+
# to crowding is what 2.6.0 shipped, and it read as a crowded box; this
|
|
160
|
+
# separates "the site was occupied" from "the O-H vector was not a
|
|
161
|
+
# placeable C-O-C angle", which would point at the angle window instead.
|
|
162
|
+
out_of_window = sum(1 for p in placements if not p.get('blind_in_window', True))
|
|
155
163
|
below = [p for p in placements if p['clearance'] < target]
|
|
156
164
|
logger.info(
|
|
157
165
|
f'triazine_to_cyanate_cap: placed {len(placements)} transferred caps '
|
|
158
166
|
f'({searched} needed a direction search); clearance min/median '
|
|
159
167
|
f'{gaps.min():.3f}/{float(np.median(gaps)):.3f} nm against a target of {target:.3f}'
|
|
160
168
|
)
|
|
169
|
+
blind = np.array([p['blind_clearance'] for p in placements
|
|
170
|
+
if p.get('blind_clearance') is not None], dtype=float)
|
|
171
|
+
if blind.size:
|
|
172
|
+
logger.info(
|
|
173
|
+
f'triazine_to_cyanate_cap: along the O-H vector alone these same caps '
|
|
174
|
+
f'would have had min/median {blind.min():.3f}/{float(np.median(blind)):.3f} nm, '
|
|
175
|
+
f'with {int((blind < 0.10).sum())} under 0.10 nm -- that is what placement '
|
|
176
|
+
f'did before the direction search existed, measured on this box'
|
|
177
|
+
)
|
|
178
|
+
if out_of_window:
|
|
179
|
+
logger.info(
|
|
180
|
+
f'triazine_to_cyanate_cap: {out_of_window} of {len(placements)} preferred '
|
|
181
|
+
f'O-H directions were outside the placeable C-O-C angle window and were '
|
|
182
|
+
f'searched away from for that reason rather than for crowding'
|
|
183
|
+
)
|
|
161
184
|
if below:
|
|
162
185
|
worst = sorted(below, key=lambda p: p['clearance'])[:5]
|
|
163
186
|
detail = ', '.join(f'O {int(p["o"])} at {p["clearance"]:.3f} nm' for p in worst)
|
|
@@ -168,11 +191,19 @@ def _report_placements(placements, target):
|
|
|
168
191
|
f'if the following minimization fails with a huge Lennard-Jones term, '
|
|
169
192
|
f'this is why.'
|
|
170
193
|
)
|
|
194
|
+
# medians as well as minima: a single worst placement says whether this
|
|
195
|
+
# build is in danger, but correlating placement quality against outcomes
|
|
196
|
+
# across a series of runs needs a statistic that is not an extreme value
|
|
171
197
|
return {
|
|
172
198
|
'n_transferred': len(placements),
|
|
173
199
|
'n_direction_searched': searched,
|
|
174
200
|
'n_below_target': len(below),
|
|
201
|
+
'n_preferred_out_of_angle': out_of_window,
|
|
175
202
|
'min_clearance_nm': float(gaps.min()),
|
|
203
|
+
'median_clearance_nm': float(np.median(gaps)),
|
|
204
|
+
'blind_min_clearance_nm': float(blind.min()) if blind.size else None,
|
|
205
|
+
'blind_median_clearance_nm': float(np.median(blind)) if blind.size else None,
|
|
206
|
+
'n_blind_would_overlap': int((blind < 0.10).sum()) if blind.size else None,
|
|
176
207
|
}
|
|
177
208
|
|
|
178
209
|
|
|
@@ -196,6 +227,51 @@ def _sphere_directions(n=48):
|
|
|
196
227
|
np.cos(phi)], axis=1)
|
|
197
228
|
|
|
198
229
|
|
|
230
|
+
def _placement_neighbors(o_xyz, background, background_idx, box,
|
|
231
|
+
bonded=(), locality=_PLACEMENT_LOCALITY):
|
|
232
|
+
"""The atoms a cap hung on this oxygen actually has to stay clear of.
|
|
233
|
+
|
|
234
|
+
Two filters. Distance: an atom farther than ``locality`` from the oxygen
|
|
235
|
+
cannot constrain a group that reaches only ~0.25 nm from it, so it is not
|
|
236
|
+
worth scoring against. Identity: an atom the cap is *bonded* through is
|
|
237
|
+
not an obstacle, and leaving one in silently destroys the metric, because
|
|
238
|
+
its distance to the cap is fixed by the bond geometry rather than by how
|
|
239
|
+
crowded the site is.
|
|
240
|
+
|
|
241
|
+
Both members of ``bonded`` matter and for the same reason. The oxygen
|
|
242
|
+
itself sits at exactly ``oc_len`` from the cap carbon in *every* candidate
|
|
243
|
+
direction, so leaving it in pins :func:`_clearance` at 0.136 nm and the
|
|
244
|
+
search cannot tell directions apart at all. The oxygen's aryl carbon is
|
|
245
|
+
softer but has the same character: with it in, the reachable clearance is
|
|
246
|
+
bounded by the C-O-C geometry at 0.272 nm, so every comfortably-placed cap
|
|
247
|
+
reports that constant instead of a measurement and the median saturates.
|
|
248
|
+
A distance metric cannot do clash detection and bond-angle enforcement at
|
|
249
|
+
once; the angle is enforced separately, in :func:`_choose_cap_placement`.
|
|
250
|
+
|
|
251
|
+
Only *this* cap's bonded atoms are dropped. Every other cap's attachment
|
|
252
|
+
oxygen is a real atom in the way, as is every cap already placed -- those
|
|
253
|
+
carry an index of -1 and are never masked out here.
|
|
254
|
+
|
|
255
|
+
Args:
|
|
256
|
+
o_xyz (numpy.ndarray): position of the oxygen this cap attaches to
|
|
257
|
+
background (numpy.ndarray): (m, 3) candidate obstacle positions
|
|
258
|
+
background_idx (numpy.ndarray): (m,) global indices, -1 for already-placed cap atoms
|
|
259
|
+
bonded (iterable): global indices the cap is bonded through -- the oxygen and its aryl carbon
|
|
260
|
+
box (numpy.ndarray): orthorhombic box lengths, for minimum image
|
|
261
|
+
locality (float): nm; ignore anything farther than this from the oxygen
|
|
262
|
+
|
|
263
|
+
Returns:
|
|
264
|
+
numpy.ndarray: (k, 3) positions to pass to :func:`_choose_cap_placement`
|
|
265
|
+
"""
|
|
266
|
+
if len(background) == 0:
|
|
267
|
+
return background
|
|
268
|
+
near = _min_image_dist(o_xyz, background, box) < locality
|
|
269
|
+
drop = {int(i) for i in bonded if i is not None}
|
|
270
|
+
if drop:
|
|
271
|
+
near &= ~np.isin(np.asarray(background_idx, dtype=int), list(drop))
|
|
272
|
+
return background[near]
|
|
273
|
+
|
|
274
|
+
|
|
199
275
|
def _clearance(c_xyz, n_xyz, neighbors, box):
|
|
200
276
|
"""Smallest distance from either cap atom to any neighbouring atom.
|
|
201
277
|
|
|
@@ -214,8 +290,45 @@ def _clearance(c_xyz, n_xyz, neighbors, box):
|
|
|
214
290
|
_min_image_dist(n_xyz, neighbors, box).min()))
|
|
215
291
|
|
|
216
292
|
|
|
293
|
+
_MIN_COC_ANGLE = 90.0
|
|
294
|
+
_MAX_COC_ANGLE = 150.0
|
|
295
|
+
"""degrees: the window of C-O-C angles a cap may be placed at. An aryl ether
|
|
296
|
+
sits near 120; this is deliberately generous, because placement is a starting
|
|
297
|
+
guess and the angle potential does the rest. What it excludes is the two ends
|
|
298
|
+
that are qualitatively wrong -- a cap folded back onto the ring it hangs off,
|
|
299
|
+
and a linear C-O-C, which is what a pure clearance search converges to since
|
|
300
|
+
antiparallel maximizes distance from the rest of the molecule."""
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
def _angle_window(directions, o_xyz, anchor_xyz,
|
|
304
|
+
min_angle=_MIN_COC_ANGLE, max_angle=_MAX_COC_ANGLE):
|
|
305
|
+
"""Boolean mask of ``directions`` whose C-O-C angle is inside the window.
|
|
306
|
+
|
|
307
|
+
Args:
|
|
308
|
+
directions (numpy.ndarray): (n, 3) unit vectors from the oxygen
|
|
309
|
+
o_xyz (numpy.ndarray): the oxygen's position
|
|
310
|
+
anchor_xyz (numpy.ndarray): the aryl carbon's position, or None for no constraint
|
|
311
|
+
min_angle (float): degrees; below this the cap is folding onto the ring
|
|
312
|
+
max_angle (float): degrees; above this the ether is unphysically extended
|
|
313
|
+
|
|
314
|
+
Returns:
|
|
315
|
+
numpy.ndarray: (n,) boolean, all True when there is no anchor
|
|
316
|
+
"""
|
|
317
|
+
d = np.atleast_2d(np.asarray(directions, dtype=float))
|
|
318
|
+
if anchor_xyz is None:
|
|
319
|
+
return np.ones(len(d), dtype=bool)
|
|
320
|
+
a = np.asarray(anchor_xyz, dtype=float) - np.asarray(o_xyz, dtype=float)
|
|
321
|
+
na = np.linalg.norm(a)
|
|
322
|
+
if na < 1e-8:
|
|
323
|
+
return np.ones(len(d), dtype=bool)
|
|
324
|
+
cosines = d @ (a / na)
|
|
325
|
+
return ((cosines <= np.cos(np.radians(min_angle))) &
|
|
326
|
+
(cosines >= np.cos(np.radians(max_angle))))
|
|
327
|
+
|
|
328
|
+
|
|
217
329
|
def _choose_cap_placement(o_xyz, ref_xyz, neighbors, box, oc_len=0.136,
|
|
218
|
-
cn_len=0.116, target=0.15, n_directions=48
|
|
330
|
+
cn_len=0.116, target=0.15, n_directions=48,
|
|
331
|
+
anchor_xyz=None):
|
|
219
332
|
"""Place a transferred -C#N group in the clearest direction available.
|
|
220
333
|
|
|
221
334
|
The old O-H vector is tried first and kept if it is clear enough, so a
|
|
@@ -225,6 +338,13 @@ def _choose_cap_placement(o_xyz, ref_xyz, neighbors, box, oc_len=0.136,
|
|
|
225
338
|
minimization that could not recover. Bond lengths are held fixed; only
|
|
226
339
|
the direction moves, so the chemistry is unchanged.
|
|
227
340
|
|
|
341
|
+
The search is over directions inside a C-O-C angle window rather than the
|
|
342
|
+
whole sphere. Clearance alone is maximized by a linear ether, since
|
|
343
|
+
antiparallel puts the cap as far as possible from the ring it hangs off,
|
|
344
|
+
so a pure clearance search drifts toward a geometry no aryl ether adopts.
|
|
345
|
+
The window says that explicitly instead of leaving it to a distance metric
|
|
346
|
+
that cannot express it; see :data:`_MIN_COC_ANGLE`.
|
|
347
|
+
|
|
228
348
|
Args:
|
|
229
349
|
o_xyz (numpy.ndarray): position of the bridge oxygen the cap attaches to
|
|
230
350
|
ref_xyz (numpy.ndarray): position defining the preferred direction, normally the O's about-to-be-deleted H
|
|
@@ -232,18 +352,38 @@ def _choose_cap_placement(o_xyz, ref_xyz, neighbors, box, oc_len=0.136,
|
|
|
232
352
|
box (numpy.ndarray): orthorhombic box lengths, for minimum image
|
|
233
353
|
oc_len (float): O-C bond length in nm
|
|
234
354
|
cn_len (float): C#N bond length in nm
|
|
235
|
-
target (float): clearance in nm that counts as good enough to stop searching; the default 0.15 is about what a steepest-descent minimization absorbs without trouble
|
|
355
|
+
target (float): clearance in nm that counts as good enough to stop searching; the default 0.15 is about what a steepest-descent minimization absorbs without trouble. ``neighbors`` must already have the cap's own bonded atoms removed (see :func:`_placement_neighbors`) or this number is meaningless -- with the attachment oxygen left in, every direction scores exactly ``oc_len``
|
|
236
356
|
n_directions (int): how many directions to try when the preferred one is occupied
|
|
357
|
+
anchor_xyz (numpy.ndarray): position of the oxygen's aryl carbon, defining the C-O-C angle; None disables the angular guard
|
|
237
358
|
|
|
238
359
|
Returns:
|
|
239
|
-
|
|
360
|
+
dict: 'c' and 'n' positions, 'clearance' achieved, 'kept_o_h_direction',
|
|
361
|
+
and 'blind_clearance' -- what the O-H direction alone would have given.
|
|
362
|
+
The last is free to compute, since that direction is tried first, and it
|
|
363
|
+
is the only way to measure on a real box what the old blind placement
|
|
364
|
+
was actually doing.
|
|
240
365
|
"""
|
|
241
366
|
o = np.asarray(o_xyz, dtype=float)
|
|
242
367
|
c_xyz, n_xyz = _place_cyn_along(o, ref_xyz, oc_len=oc_len, cn_len=cn_len)
|
|
243
|
-
|
|
244
|
-
if
|
|
245
|
-
|
|
246
|
-
|
|
368
|
+
blind = _clearance(c_xyz, n_xyz, neighbors, box)
|
|
369
|
+
# the O-H direction is kept only if it is both clear enough and a sane
|
|
370
|
+
# C-O-C angle; for a real hydroxyl it always is the latter, but the
|
|
371
|
+
# fallback direction used when the O has no H need not be
|
|
372
|
+
blind_ok = bool(_angle_window((c_xyz - o) / oc_len, o, anchor_xyz)[0])
|
|
373
|
+
if blind_ok and blind >= target:
|
|
374
|
+
return {'c': c_xyz, 'n': n_xyz, 'clearance': blind,
|
|
375
|
+
'kept_o_h_direction': True, 'blind_clearance': blind,
|
|
376
|
+
'blind_in_window': True}
|
|
377
|
+
directions = _sphere_directions(n_directions)
|
|
378
|
+
allowed = directions[_angle_window(directions, o, anchor_xyz)]
|
|
379
|
+
# a window this wide always leaves a good fraction of the sphere, but a
|
|
380
|
+
# caller narrowing it should still get a placement rather than nothing
|
|
381
|
+
if len(allowed) == 0:
|
|
382
|
+
allowed = directions
|
|
383
|
+
best = blind if blind_ok else -1.0
|
|
384
|
+
if not blind_ok:
|
|
385
|
+
c_xyz, n_xyz = None, None
|
|
386
|
+
for u in allowed:
|
|
247
387
|
cc = o + u * oc_len
|
|
248
388
|
nn = cc + u * cn_len
|
|
249
389
|
gap = _clearance(cc, nn, neighbors, box)
|
|
@@ -251,7 +391,9 @@ def _choose_cap_placement(o_xyz, ref_xyz, neighbors, box, oc_len=0.136,
|
|
|
251
391
|
best, c_xyz, n_xyz = gap, cc, nn
|
|
252
392
|
if best >= target:
|
|
253
393
|
break
|
|
254
|
-
return c_xyz, n_xyz, best,
|
|
394
|
+
return {'c': c_xyz, 'n': n_xyz, 'clearance': best,
|
|
395
|
+
'kept_o_h_direction': False, 'blind_clearance': blind,
|
|
396
|
+
'blind_in_window': blind_ok}
|
|
255
397
|
|
|
256
398
|
|
|
257
399
|
# ---------------------------------------------------------------------------
|
|
@@ -450,13 +592,21 @@ def triazine_to_cyanate_cap(TC, moldict, spec, reactions):
|
|
|
450
592
|
for rec in free_records:
|
|
451
593
|
h = _find_bonded_hydrogen(TC, rec['o'])
|
|
452
594
|
rec['o_h'] = h
|
|
595
|
+
# the aryl carbon on the far side of the O: excluded from the
|
|
596
|
+
# clearance metric, since its distance is set by bond geometry,
|
|
597
|
+
# and used instead as the anchor for the C-O-C angle
|
|
598
|
+
rec['o_anchor'] = _find_bonded_heavy(TC, rec['o'])
|
|
453
599
|
if h is not None:
|
|
454
600
|
h_to_delete.add(int(h))
|
|
455
601
|
moving = {int(rec['c']) for rec in free_records} | {int(rec['n']) for rec in free_records}
|
|
456
602
|
A = TC.Coordinates.A
|
|
457
603
|
going = moving | {int(x) for x in h_to_delete}
|
|
458
|
-
|
|
459
|
-
|
|
604
|
+
staying = A.loc[~A['globalIdx'].isin(going),
|
|
605
|
+
['globalIdx', 'posX', 'posY', 'posZ']]
|
|
606
|
+
# indices travel alongside the positions so each cap can drop the
|
|
607
|
+
# atoms it is bonded through; placed caps get -1 and are never dropped
|
|
608
|
+
background_idx = staying['globalIdx'].to_numpy(dtype=int)
|
|
609
|
+
background = staying[['posX', 'posY', 'posZ']].to_numpy(dtype=float)
|
|
460
610
|
for rec in free_records:
|
|
461
611
|
o_xyz = ts.positions(TC, [rec['o']])[0]
|
|
462
612
|
if rec['o_h'] is None:
|
|
@@ -465,17 +615,21 @@ def triazine_to_cyanate_cap(TC, moldict, spec, reactions):
|
|
|
465
615
|
ref_xyz = o_xyz + np.array([1.0, 0.0, 0.0])
|
|
466
616
|
else:
|
|
467
617
|
ref_xyz = ts.positions(TC, [rec['o_h']])[0]
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
618
|
+
local = _placement_neighbors(o_xyz, background, background_idx, box,
|
|
619
|
+
bonded=(rec['o'], rec['o_anchor']))
|
|
620
|
+
anchor_xyz = (ts.positions(TC, [rec['o_anchor']])[0]
|
|
621
|
+
if rec['o_anchor'] is not None else None)
|
|
622
|
+
placed = _choose_cap_placement(o_xyz, ref_xyz, local, box,
|
|
623
|
+
target=target_clearance,
|
|
624
|
+
anchor_xyz=anchor_xyz)
|
|
625
|
+
c_xyz, n_xyz = placed['c'], placed['n']
|
|
473
626
|
ts.set_atom_attributes(TC, rec['c'],
|
|
474
627
|
posX=float(c_xyz[0]), posY=float(c_xyz[1]), posZ=float(c_xyz[2]))
|
|
475
628
|
ts.set_atom_attributes(TC, rec['n'],
|
|
476
629
|
posX=float(n_xyz[0]), posY=float(n_xyz[1]), posZ=float(n_xyz[2]))
|
|
477
630
|
background = np.vstack([background, c_xyz, n_xyz])
|
|
478
|
-
|
|
631
|
+
background_idx = np.concatenate([background_idx, [-1, -1]])
|
|
632
|
+
placements.append({'o': rec['o'], **{k: v for k, v in placed.items() if k not in ('c', 'n')}})
|
|
479
633
|
placement_summary = _report_placements(placements, target_clearance)
|
|
480
634
|
|
|
481
635
|
# ---- Phase 4: splice template params (forms BPA-O-C bond with full
|
|
@@ -556,6 +710,19 @@ def _find_bonded_hydrogen(TC, idx):
|
|
|
556
710
|
return None
|
|
557
711
|
|
|
558
712
|
|
|
713
|
+
def _find_bonded_heavy(TC, idx):
|
|
714
|
+
"""Return globalIdx of the first non-hydrogen atom bonded to ``idx``, or None.
|
|
715
|
+
|
|
716
|
+
For a bridge oxygen about to take a cap this is its aryl carbon, which is
|
|
717
|
+
the anchor the C-O-C angle is measured against.
|
|
718
|
+
"""
|
|
719
|
+
for nbr in TC.Topology.bondlist.partners_of(int(idx)):
|
|
720
|
+
name = ts.get_attr(TC, nbr, 'atomName')
|
|
721
|
+
if not str(name).upper().startswith('H'):
|
|
722
|
+
return int(nbr)
|
|
723
|
+
return None
|
|
724
|
+
|
|
725
|
+
|
|
559
726
|
def _greedy_match(TC, free_caps, unreacted_o, search_radius):
|
|
560
727
|
"""Match each free cap to its nearest available unreacted bridge-O.
|
|
561
728
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: htpolynet
|
|
3
|
-
Version: 2.6.
|
|
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/
|
|
@@ -12,12 +12,12 @@ htpolynet/core/coordinates.py,sha256=CGTHkdfw2ikc2ANacA5akRhZ9tOyM2IbELwQ2FVcKRw
|
|
|
12
12
|
htpolynet/core/molecule.py,sha256=xUA52zkRMyAFCE8LbXvXghweDCPkrgD4rx1mcimddn0,52751
|
|
13
13
|
htpolynet/core/paramcache.py,sha256=3MTG96F4vtT5w-pn1RWNmXic0QKB7WVcwCrD-BSY3B0,4508
|
|
14
14
|
htpolynet/core/projectfilesystem.py,sha256=2U_EToZxN7yUGWu9BIRABVsYdp1AKkOuManwuFBz89k,20983
|
|
15
|
-
htpolynet/core/runtime.py,sha256=
|
|
15
|
+
htpolynet/core/runtime.py,sha256=uyUXLQFRw3Wi7GT_0KahsqYPeJvXbgS-vHXLq-h_HEI,56066
|
|
16
16
|
htpolynet/core/topocoord.py,sha256=jtQcwzvzPVNjU9VxBF9iXw8g3KiY55_jGDlwAZDOSjs,101564
|
|
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=
|
|
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
|
|
@@ -38,7 +38,7 @@ htpolynet/io/gro.py,sha256=QGsAIlTIJlMRxtv_Juo0wdpbICAzyfQvSzzaMWrlMmA,7141
|
|
|
38
38
|
htpolynet/io/mol2.py,sha256=5aU3HmQ5DS0LBF7tBPCNYKzBScwj8V3xfEUcFIrsevk,7314
|
|
39
39
|
htpolynet/io/pdb.py,sha256=Np44dTbM0IcEAzfz6OGuH0rdQ63BGps3kOmkzH6syls,5293
|
|
40
40
|
htpolynet/repair/__init__.py,sha256=cP3i-P-Wc6s0MgoFDp63kbLomM-ti3mMGEgeQzUVKuY,1740
|
|
41
|
-
htpolynet/repair/cyanate_cap.py,sha256=
|
|
41
|
+
htpolynet/repair/cyanate_cap.py,sha256=VdKxBs3oXLBiTZ4eW6oCKCbgOoeowTOdSwj21cSll3g,36476
|
|
42
42
|
htpolynet/repair/topology_surgery.py,sha256=aJ1md2SE4UzVU1YTS-Tiox8QXrr1hZwU6cCuEimlSrU,10030
|
|
43
43
|
htpolynet/resources/README.md,sha256=epKLyqtcxtQOSzTYvaGlwhz970UA4vAU7r-iSBbbpmA,1432
|
|
44
44
|
htpolynet/resources/__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.
|
|
100
|
-
htpolynet-2.6.
|
|
101
|
-
htpolynet-2.6.
|
|
102
|
-
htpolynet-2.6.
|
|
103
|
-
htpolynet-2.6.
|
|
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,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|