HTPolyNet 2.18.0__py3-none-any.whl → 2.18.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.
@@ -900,6 +900,7 @@ def do_E_plots(phases,projdirs,outfile='e.png',save_data='E.csv',fit_strain=None
900
900
  fit_strain=list(sorted(windows)[0])
901
901
  lo,hi=fit_strain
902
902
  curves=[]
903
+ missing=[]
903
904
  for p in phases:
904
905
  params={**PostSimDeform.default_params,**p['deform']}
905
906
  dir=params['direction']
@@ -912,12 +913,25 @@ def do_E_plots(phases,projdirs,outfile='e.png',save_data='E.csv',fit_strain=None
912
913
  if not found and os.path.isdir(os.path.join(d,params['subdir'])):
913
914
  # a run from before replicas existed, or one with replicas: 1
914
915
  found=[params['subdir']]
916
+ elif not found:
917
+ missing.append(f'{d}/{params["subdir"]}')
918
+ continue
915
919
  elif len(found)<len(subs):
916
920
  logger.warning(f'{d}: found {len(found)} of {len(subs)} replica directories for '
917
921
  f'{params["subdir"]}; fitting those')
918
922
  for sub in found:
919
923
  df=pd.read_csv(os.path.join(d,sub,f'deform-{dir}.csv'),index_col=None,header=0)
920
924
  curves.append((os.path.join(d,sub),pd.DataFrame({'strain':df[strain_name],'stress':(df[stress_name]*MPa_per_bar)})))
925
+ if not curves:
926
+ # no deform stage has run in any project; a ladder-only project is a normal
927
+ # state, and the Tg output already written must not be undone by an error
928
+ # here (htpolynet-sweep, 2026-11-19: min() of an empty list, after the ladder
929
+ # CSVs were written, made plots post exit nonzero)
930
+ logger.warning(f'no deform stage has run ({", ".join(missing)} not found); '
931
+ f'skipping Young\'s modulus')
932
+ return None
933
+ if missing:
934
+ logger.warning(f'deform stages not found, left out of E: {", ".join(missing)}')
921
935
  reached=min(c['strain'].max() for _,c in curves)
922
936
  if reached<hi:
923
937
  logger.warning(f'the shortest pull reaches strain {reached:.4f}, short of the fit window\'s '
@@ -985,6 +999,14 @@ def post_plots(args):
985
999
  mdf=[]
986
1000
  for p in args.proj:
987
1001
  if 'anneal' in phasenames and 'equilibrate' in phasenames:
1002
+ need=[os.path.join(p,'postsim',s,f'{s}.csv') for s in ('anneal','equilibrate')]
1003
+ absent=[f for f in need if not os.path.exists(f)]
1004
+ if absent:
1005
+ # a stage that has not run is reported, not fatal: it used to raise
1006
+ # here, before the ladders and pulls that had run were analyzed
1007
+ logger.warning(f'{", ".join(absent)} not found; leaving {p} out of the '
1008
+ f'anneal/equilibrate density')
1009
+ continue
988
1010
  mdf.append(postsim_density_evolution(p))
989
1011
  if mdf:
990
1012
  multi_trace(mdf,xnames=['time(ps)']*len(mdf),ynames=['Density']*len(mdf),labels=args.proj,ylabel='Density [kg/m$^3$]',outfile='anneal-equil-density.png')
@@ -547,7 +547,14 @@ class Molecule:
547
547
  else:
548
548
  if self.name != self.parentname:
549
549
  logger.info(f'Built {self.name} using topology of {self.parentname}; copying {self.parentname}.top to {self.name}.top')
550
- self.load_top_gro(f'{self.parentname}.top', f'{self.name}.gro', tpxfilename=f'{self.parentname}.tpx', wrap_coords=False)
550
+ # Read back the mol2 this molecule just wrote, for its bond table only
551
+ # (coordinates stay from the gro). Without it the molecule has no
552
+ # mol2_bonds, and a later template that merges it in -- GMAS-4..15 merge
553
+ # GM1S-k -- kept only its other reactant's bonds: 24 of 78 in example 2
554
+ # (htpolynet-sweep, 2026-11-24). Reading it also runs the bond check now.
555
+ own_mol2 = f'{self.name}.mol2' if os.path.exists(f'{self.name}.mol2') else ''
556
+ self.load_top_gro(f'{self.parentname}.top', f'{self.name}.gro', tpxfilename=f'{self.parentname}.tpx',
557
+ mol2filename=own_mol2, wrap_coords=False)
551
558
  shutil.copy(f'{self.parentname}.top', f'{self.name}.top')
552
559
  shutil.copy(f'{self.parentname}.grx', f'{self.name}.grx')
553
560
  shutil.copy(f'{self.parentname}.tpx', f'{self.name}.tpx')
@@ -358,16 +358,23 @@ class Topology:
358
358
  bmi = grobonds.set_index(['ai', 'aj']).index
359
359
  mol2bonds = self.D['mol2_bonds'].sort_values(by=['ai', 'aj'])
360
360
  mbmi = mol2bonds.set_index(['ai', 'aj']).index
361
- check = all([x == y for x, y in zip(bmi, mbmi)])
362
- # logger.debug(f'Result: {check}')
361
+ # zip() used to stop at the shorter list, so a mol2 missing only bonds that
362
+ # sort last compared equal and passed (htpolynet-sweep, 2026-11-24)
363
+ canon = lambda idx: {(min(int(a), int(b)), max(int(a), int(b))) for a, b in idx}
364
+ gset, mset = canon(bmi), canon(mbmi)
365
+ check = len(bmi) == len(mbmi) and gset == mset
363
366
  if not check:
364
- logger.error(f'Gromacs/Mol2 bond inconsistency detected')
367
+ logger.error(f'Gromacs/Mol2 bond inconsistency detected: the topology has {len(bmi)} bonds and '
368
+ f'the mol2 {len(mbmi)}; {len(gset - mset)} topology bonds are missing from the mol2 '
369
+ f'and {len(mset - gset)} mol2 bonds are not in the topology')
365
370
  logger.debug(f'GROMACS:')
366
371
  logger.debug(grobonds[['ai','aj']].head().to_string())
367
372
  logger.debug(f'MOL2:')
368
373
  logger.debug(mol2bonds[['ai','aj']].head().to_string())
369
374
  for x, y in zip(bmi, mbmi):
370
375
  logger.debug(f'{x} {y} {x == y}')
376
+ return check
377
+ return None
371
378
 
372
379
  def shiftatomsidx(self, idxshift, directive, rows=[], idxlabels=[]):
373
380
  """Shifts all atom indexes in a topology directive dataframe.
@@ -1175,9 +1182,36 @@ class Topology:
1175
1182
  for t in L:
1176
1183
  self._myconcat(other, directive=t, drop_duplicates=True)
1177
1184
 
1185
+ def _fill_missing_mol2_bonds(self, other):
1186
+ """Before a merge, gives a mol2 bond table to whichever side has bonds but none.
1187
+
1188
+ ``_myconcat`` skips a directive the incoming side lacks, so merging a molecule
1189
+ with no mol2 table into one that has one kept only the first's bonds: example 2's
1190
+ GMAS-4..15 templates were written with 24 of their 78 bonds (htpolynet-sweep,
1191
+ 2026-11-24). The reverse case adopted the incoming table without shifting its
1192
+ atom indices. The missing table is built from the GROMACS bonds, as single bonds
1193
+ since a topology carries no bond orders, and the gap is logged. Nothing happens
1194
+ when neither side has a table, or when a side has no bonds at all (an empty
1195
+ Topology about to receive its first molecule).
1196
+ """
1197
+ def has_bonds(T):
1198
+ return 'bonds' in T.D and not T.D['bonds'].empty
1199
+ sides = [(self, 'the molecule being built'), (other, 'the molecule merged into it')]
1200
+ if not any('mol2_bonds' in T.D for T, _ in sides):
1201
+ return
1202
+ for T, label in sides:
1203
+ if 'mol2_bonds' not in T.D and has_bonds(T):
1204
+ b = T.D['bonds'][['ai', 'aj']].reset_index(drop=True)
1205
+ T.D['mol2_bonds'] = pd.DataFrame({'bondIdx': range(1, len(b) + 1), 'ai': b['ai'].astype(int),
1206
+ 'aj': b['aj'].astype(int), 'order': '1'})
1207
+ logger.warning(f'{label} has no mol2 bond table; using its {len(b)} topology bonds, '
1208
+ f'as single bonds, so the merged table is complete')
1209
+
1178
1210
  def merge_ex(self, other):
1179
1211
  logger.debug(f' extensive merging...')
1180
1212
  ''' merge EXTENSIVE quantities '''
1213
+ # before any concat: _myconcat shifts the incoming side's indices in place
1214
+ self._fill_missing_mol2_bonds(other)
1181
1215
  idxshift = 0 if 'atoms' not in self.D else len(self.D['atoms'])
1182
1216
  rdxshift = 0 if 'atoms' not in self.D else self.D['atoms'].iloc[-1]['resnr']
1183
1217
  if 'atoms' in other.D:
htpolynet/io/mol2.py CHANGED
@@ -170,7 +170,10 @@ def write(filename, A, mol2_bonds, metadat, name,
170
170
  with open(filename, 'w') as f:
171
171
  f.write('@<TRIPOS>MOLECULE\n')
172
172
  f.write(f'{molname if molname else name}\n')
173
- f.write('{:>6d}{:>6d}{:>3d}{:>3d}{:>3d}\n'.format(
173
+ # each field is a space plus the old width, so the line is byte-identical
174
+ # whenever a value fits; the old fixed widths ran 100+ residues into the
175
+ # bond count (' 3600 3600200') and the header could not be read back
176
+ f.write(' {:>5d} {:>5d} {:>2d} {:>2d} {:>2d}\n'.format(
174
177
  N, nBonds, nSubs,
175
178
  metadat.get('nFeatures', 0),
176
179
  metadat.get('nSets', 0),
@@ -91,7 +91,6 @@ 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
95
94
  closure:
96
95
  nstages: 6 # restraint stages that pull each candidate ring shut
97
96
  # Every other ring_cure setting is left at its default. Two are worth knowing:
@@ -104,8 +103,9 @@ ring_cure:
104
103
  #
105
104
  # The ring floor must grow with the box. At a fixed floor of 4 this box finds more
106
105
  # 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.
106
+ # the cure stalls at about 0.75 (htpolynet-sweep, 2026-11-09). Since 2.18.0,
107
+ # min_ring_fraction_per_iteration (default 0.0167) scales the floor with the box and
108
+ # gives 32 here, so nothing needs setting.
109
109
  #
110
110
  # Fang & Shimp's end-group arithmetic caps acyclic growth at 75% cyanate conversion,
111
111
  # so a network that reaches 0.97 necessarily contains macrocycles. That is the real
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: htpolynet
3
- Version: 2.18.0
3
+ Version: 2.18.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/
@@ -3,7 +3,7 @@ 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=099j7lYuSxtL1PbvzRJUL8surNpLcNkS-xY1T_CIXqM,45933
6
+ htpolynet/analysis/plot.py,sha256=lKduIPEVcl8gvZNn9nxdIdpywGTneBPEfhZsnePPk5U,47168
7
7
  htpolynet/analysis/postsim.py,sha256=EgRYZy7Xpmv05hzUEW3tjNKRzjpnynb1UVUZqgjfz3E,30056
8
8
  htpolynet/analysis/ringcontacts.py,sha256=r4pVLIMwKp-KsSmhNAbp4FHoa1yRVfsTw-5dbwDVEDE,17118
9
9
  htpolynet/analysis/utils.py,sha256=mc9ptiWaOVY6DO9gWsOJVOn1tjSbbZ2s5cOAPzeVEdk,32966
@@ -11,13 +11,13 @@ htpolynet/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
11
  htpolynet/core/bondtemplate.py,sha256=_1vYMugonDuogysu15IsbpthvxYb6uJKC5ao7pQcWvg,9969
12
12
  htpolynet/core/configuration.py,sha256=RG7B3ecHP8LQfwVTqP0dsDf8rLR5vKL8WfW2OWPPp3E,5730
13
13
  htpolynet/core/coordinates.py,sha256=CGTHkdfw2ikc2ANacA5akRhZ9tOyM2IbELwQ2FVcKRw,23878
14
- htpolynet/core/molecule.py,sha256=j0I0qsk5mRTg8QMysxJz6U9HxgTRpRSzHEgJ_SRT-jQ,63012
14
+ htpolynet/core/molecule.py,sha256=pi2CfAtj3BLR_tLpOnqtaUBqfmR3CAz-dl8KFoLw6iI,63601
15
15
  htpolynet/core/paramcache.py,sha256=37S88gRXZ5_xAdWyUE-Q3Etxc5HMv8L_RHrykkq9YAs,6966
16
16
  htpolynet/core/productsplice.py,sha256=asFVCW8G_rcMIizvO2Sh98MpOsFqzP1kIX1JySei_p8,12816
17
17
  htpolynet/core/projectfilesystem.py,sha256=WH8rkQ_CVg-uZF8NZy8e-2V3CfNzyW33hnEIrjkX3jI,24109
18
18
  htpolynet/core/runtime.py,sha256=Z8JUkvAzdD3Cg-5_AeM9hn0TOJjquhFKrsukpogf1eo,77463
19
19
  htpolynet/core/topocoord.py,sha256=jUgFg9TuUdSm14wo_464xX6dC4okJMrj1FbIzmaoA0Q,110520
20
- htpolynet/core/topology.py,sha256=ttdDUuE6noBhC-3B-x-lAfNVsXPOlEe-z4aKefZUOiY,65578
20
+ htpolynet/core/topology.py,sha256=bkV6yT69LJ89-aAc9-T56J4xZu6wF-8_sGGHj9ZlXpU,67879
21
21
  htpolynet/cure/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
22
22
  htpolynet/cure/chain.py,sha256=-d5BFE5xUKjFdNkxLfSnCnZIRSJCtr7xuxYzNHBeSgU,5344
23
23
  htpolynet/cure/curecontroller.py,sha256=Fi-nPuL4bjLfJepEeSXeOkQVCIrykMjjA8y4ikF3YmI,60752
@@ -43,7 +43,7 @@ htpolynet/geometry/ring.py,sha256=dpMajpPRRYTywpMsnwoyXVMNGfWZUZxS1SAx3Qh8E2I,96
43
43
  htpolynet/geometry/templategeom.py,sha256=NO6RXL9_iYnPL6QOFPA9UeSDAaGUgxlbJuN8wnNw9p0,11702
44
44
  htpolynet/io/__init__.py,sha256=nX1-mb5tNRK_FTH1NP55ESWBSmiY_yBBU-43NMgzeA4,160
45
45
  htpolynet/io/gro.py,sha256=QGsAIlTIJlMRxtv_Juo0wdpbICAzyfQvSzzaMWrlMmA,7141
46
- htpolynet/io/mol2.py,sha256=5aU3HmQ5DS0LBF7tBPCNYKzBScwj8V3xfEUcFIrsevk,7314
46
+ htpolynet/io/mol2.py,sha256=heYOwPC7EXEE85iJ2eXCAmBIAgDxyGiEQdcr3iyMpHI,7561
47
47
  htpolynet/io/pdb.py,sha256=Np44dTbM0IcEAzfz6OGuH0rdQ63BGps3kOmkzH6syls,5293
48
48
  htpolynet/repair/__init__.py,sha256=cP3i-P-Wc6s0MgoFDp63kbLomM-ti3mMGEgeQzUVKuY,1740
49
49
  htpolynet/repair/cyanate_cap.py,sha256=d-OqnoRwOMwijYuMLFhGoFkEa2qFyzCdGnICDK69VkQ,39063
@@ -57,7 +57,7 @@ htpolynet/resources/example_depot/2-bisgma-styrene-thermoset.yaml,sha256=A9-7POz
57
57
  htpolynet/resources/example_depot/3-pacm-dgeba-epoxy-thermoset.yaml,sha256=5Zz6E4x5swawS1PIUbR6RzjvOhKSJeyeWUg0q5SDJeM,4410
58
58
  htpolynet/resources/example_depot/4-dfda-fde-epoxy-thermoset.yaml,sha256=9ZSDhGcmjGofVRpuvq1M7kWDYuUFxwCI7zjPdTzjUvE,4414
59
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
60
+ htpolynet/resources/example_depot/6-cyanate-ester.yaml,sha256=HHLudzYT6IeKeFX1k9Y7UiRwpTn7ztDb7nOzwZIBc8g,6084
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
@@ -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.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,,
109
+ htpolynet-2.18.1.dist-info/METADATA,sha256=SbCGBNvwleE7rOEZqMglRT9vFZ6DBjIo5pvBDdhBw0c,6754
110
+ htpolynet-2.18.1.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
111
+ htpolynet-2.18.1.dist-info/entry_points.txt,sha256=G5tx55llJf-IV9dIe7J8myGdyrhCVggCAhKrVNGP_s0,48
112
+ htpolynet-2.18.1.dist-info/licenses/LICENSE,sha256=piPSGqJdmTGyzF9HOnjlO2KvgOKT8NHwhCuGYM778tY,1071
113
+ htpolynet-2.18.1.dist-info/RECORD,,