HTPolyNet 2.18.1__py3-none-any.whl → 2.19.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.
@@ -778,8 +778,12 @@ def do_tg_plots(phases,projdirs,outfile='tg.png',save_data='data.csv',n_points=[
778
778
  ax[i].text(Tg,c[0]*Tg+c[1],f' {Tg:.2f} K',verticalalignment='top')
779
779
  means[v]['glassy-line-Density']=c[0]*m['Temperature']+c[1]
780
780
  means[v]['rubbery-line-Density']=h[0]*m['Temperature']+h[1]
781
+ # ladder{v} numbers ladders by config position, so a heating-only config writes
782
+ # its heating branch as ladder0; the direction column says which it is
783
+ # (htpolynet-sweep, 2026-12-02)
784
+ means[v]['direction']='heating' if rate[i]>0 else 'cooling'
781
785
  means[v].to_csv(f'ladder{v}-{save_data}',index=False,header=True,sep=' ')
782
- logger.info(f'ladder{v}-{save_data} created.')
786
+ logger.info(f'ladder{v}-{save_data} ({means[v]["direction"].iloc[0]}) created.')
783
787
  plt.savefig(outfile,bbox_inches='tight')
784
788
  plt.close(fig)
785
789
  # direction from the sign of the ladder's own deltaT, not its position in the
htpolynet/cli.py CHANGED
@@ -83,7 +83,7 @@ def run(args: ap.Namespace):
83
83
  software.sw_setup()
84
84
  my_logger(software.to_string(), logger.info)
85
85
  pfs.pfs_setup(root=os.getcwd(), topdirs=pfs.Dirs.run_topdirs, verbose=True, projdir=args.proj, reProject=args.restart, userlibrary=userlib)
86
- a = Runtime(cfgfile=args.config, restart=args.restart)
86
+ a = Runtime(cfgfile=args.config, restart=args.restart, seed=args.seed)
87
87
  if args.param_only:
88
88
  a.generate_molecules(force_checkin=args.force_checkin, force_parameterization=args.force_parameterization)
89
89
  else:
@@ -166,6 +166,7 @@ def _add_run_options(p, loglevel='debug'):
166
166
  p.add_argument('--force-parameterization',default=False,action='store_true',help='force GAFF parameterization of any input mol2 structures')
167
167
  p.add_argument('--force-checkin',default=False,action='store_true',help='overwrite entries already in the user library (~/.htpolynet, or $HTPOLYNET_CACHE) with newly generated parameter files; a name the library does not yet hold is checked in either way')
168
168
  p.add_argument('--param-only',default=False,action='store_true',help='stop after parameterizing molecules without building the full system')
169
+ p.add_argument('--seed',type=int,default=None,help='seed for every random draw in the build; overrides the config\'s seed; omitted, one is drawn and recorded in seed.txt. Give replicates different seeds, or none')
169
170
  p.add_argument('--loglevel',type=str,default=loglevel,help='log level for the diagnostic file (debug|info)')
170
171
 
171
172
 
@@ -223,6 +224,7 @@ def gen_slurm_script(args: ap.Namespace):
223
224
  'force_parameterization': args.force_parameterization,
224
225
  'force_checkin': args.force_checkin,
225
226
  'param_only': args.param_only,
227
+ 'seed': args.seed,
226
228
  'loglevel': args.loglevel,
227
229
  }
228
230
 
@@ -48,6 +48,7 @@ class Configuration:
48
48
  self.cfgfile = ''
49
49
  self.title = ''
50
50
  self.ncpu = os.cpu_count()
51
+ self.seed = None # None: draw one; see core.seeding
51
52
  self.constituents = {} # {name: {count: N, ...}}
52
53
  self.reaction_specs = [] # raw reaction dicts
53
54
  self.initial_composition = [] # [{'molecule': name, 'count': N}]
@@ -122,6 +123,7 @@ class Configuration:
122
123
  """Populates named attributes from self.basedict."""
123
124
  self.title = self.basedict.get('Title', 'No title provided')
124
125
  self.ncpu = self.basedict.get('ncpu', os.cpu_count())
126
+ self.seed = self.basedict.get('seed', None)
125
127
  self.constituents = self.basedict.get('constituents', {})
126
128
  self.reaction_specs = list(self.basedict.get('reactions', []) or [])
127
129
  if any(isinstance(v, dict) and v.get('activate') for v in self.constituents.values()):
htpolynet/core/runtime.py CHANGED
@@ -4,7 +4,6 @@ Author: Cameron F. Abrams <cfa22@drexel.edu>
4
4
  """
5
5
  import logging
6
6
  import os
7
- import random
8
7
  import shutil
9
8
 
10
9
  import yaml
@@ -21,6 +20,7 @@ from networkx.algorithms import isomorphism
21
20
  from ..analysis.plot import trace
22
21
  from ..core import paramcache
23
22
  from ..core import projectfilesystem as pfs
23
+ from ..core import seeding
24
24
  from ..core.configuration import Configuration
25
25
  from ..core.molecule import Molecule, MoleculeDict
26
26
  from ..core.topocoord import TopoCoord
@@ -139,12 +139,14 @@ class Runtime:
139
139
  }
140
140
  }
141
141
 
142
- def __init__(self,cfgfile='',restart=False):
142
+ def __init__(self,cfgfile='',restart=False,seed=None):
143
143
  """Generates a new Runtime object based on the cfg file.
144
144
 
145
145
  Args:
146
146
  cfgfile (str): name of YAML cfg file, defaults to ''
147
147
  restart (bool): flag indicating if this is a restart
148
+ seed (int | None): build seed from the command line; overrides the
149
+ config's ``seed``, defaults to None
148
150
  """
149
151
  self.cfgfile=cfgfile
150
152
  if cfgfile=='':
@@ -158,6 +160,7 @@ class Runtime:
158
160
  self.restart=restart
159
161
  if restart:
160
162
  logger.info(f'Restarting in {pfs.proj()}')
163
+ self._set_seed(seed)
161
164
  self.frcmods=self._read_frcmods()
162
165
  self.molecules:MoleculeDict={}
163
166
  # molecules reused from a library entry that carries no provenance
@@ -852,6 +855,38 @@ class Runtime:
852
855
  self._do_pap(pfx='postcure')
853
856
  return {c:os.path.basename(x) for c,x in self.TopoCoord.files.items() if c!='mol2'}
854
857
 
858
+ SEED_FILE='seed.txt'
859
+
860
+ def _set_seed(self,cli_seed=None):
861
+ """Sets the build seed and writes it into the project directory.
862
+
863
+ Precedence: ``--seed``, then the config's ``seed``, then (on a restart)
864
+ the seed the project recorded, then a freshly drawn one.
865
+
866
+ Args:
867
+ cli_seed (int | None): seed from the command line, defaults to None
868
+ """
869
+ recorded=os.path.join(pfs.proj(),self.SEED_FILE)
870
+ if cli_seed is not None:
871
+ seeding.set_seed(cli_seed,source='--seed')
872
+ elif self.cfg.seed is not None:
873
+ seeding.set_seed(self.cfg.seed,source=f'seed in {os.path.basename(self.cfgfile)}')
874
+ elif self.restart and os.path.exists(recorded):
875
+ with open(recorded) as f:
876
+ seeding.set_seed(int(f.read().split()[0]),source=f'recorded in {recorded}')
877
+ else:
878
+ seeding.set_seed()
879
+ self._write_seed(recorded)
880
+
881
+ def _write_seed(self,filename):
882
+ """Writes the build seed and its source to a file.
883
+
884
+ Args:
885
+ filename (str): file to write
886
+ """
887
+ with open(filename,'w') as f:
888
+ f.write(f'{seeding.seed()}\n# {seeding.source()}; see htpolynet.core.seeding\n')
889
+
855
890
  @cp.enableCheckpoint
856
891
  def save_data(self,result_name='final'):
857
892
  """Writes 'gro', 'top', 'tpx', and 'grx' files for system, plus a PSF
@@ -874,6 +909,7 @@ class Runtime:
874
909
  TC.write_gro(f'{result_name}.gro')
875
910
  TC.write_top(f'{result_name}.top')
876
911
  TC.write_tpx(f'{result_name}.tpx')
912
+ self._write_seed(self.SEED_FILE)
877
913
  self._write_vmd_viz_files(result_name)
878
914
  return {c:os.path.basename(x) for c,x in TC.files.items() if c!='mol2'}
879
915
 
@@ -1376,7 +1412,7 @@ class Runtime:
1376
1412
  if len(M.conformers)>0:
1377
1413
  nconf=len(M.conformers)
1378
1414
  if tc<nconf:
1379
- c_togromacs.update({u:1 for u in random.sample(M.conformers,tc)})
1415
+ c_togromacs.update({u:1 for u in seeding.sample('conformers',M.conformers,tc)})
1380
1416
  else:
1381
1417
  q,r=divmod(tc,nconf)
1382
1418
  logger.debug(f'divmod({nconf},{tc}) gives {q}, {r}')
@@ -0,0 +1,136 @@
1
+ """One seed per build, from which every random draw in the build is derived.
2
+
3
+ A build draws randomness in four places: which conformers go into the box,
4
+ ``gmx insert-molecules``' packing, the bond search's acceptance dice, and
5
+ initial velocities in every stage that sets ``gen-vel = yes``. Each draws from
6
+ its own named stream, derived from the build seed with
7
+ :class:`numpy.random.SeedSequence`, so the number of draws one stream makes
8
+ cannot shift another.
9
+
10
+ The seed does not reproduce a whole cure. mdrun is not bitwise reproducible
11
+ across thread counts, domain decompositions or GPUs, and the dynamics are
12
+ chaotic, so a cure diverges after its first MD stage. The two tiers are:
13
+
14
+ - **seed and record** -- the conformer choice and ``insert-molecules`` run before
15
+ any MD, so the same seed gives the same starting box, bit for bit, on any
16
+ machine. An outlier build's packing can be rebuilt and cured again.
17
+ - **record only** -- the bond dice and ``gen-seed`` act on coordinates that have
18
+ already been through MD. Their seeds are provenance; they replay only a run
19
+ repeated on the same hardware with ``mdrun -reprod``.
20
+
21
+ When no seed is given, one is drawn from the operating system, never a constant
22
+ (a constant default would make every user's replicates identical), and is
23
+ logged like a given one.
24
+ """
25
+ import logging
26
+ import random
27
+
28
+ import numpy as np
29
+
30
+ logger = logging.getLogger(__name__)
31
+
32
+ #: largest seed; GROMACS reads its seeds as signed 32-bit integers
33
+ MAX_SEED = 2**31 - 1
34
+
35
+ #: the named streams, in a fixed order; a stream's spawn key is its index here,
36
+ #: so add new streams at the end or every existing derived seed changes
37
+ STREAMS = ('conformers', 'insert-molecules', 'bond-search', 'gen-seed')
38
+
39
+ _state = {'seed': None, 'source': None, 'rngs': {}}
40
+
41
+
42
+ def draw_seed():
43
+ """Returns a fresh seed from the operating system's entropy source.
44
+
45
+ Returns:
46
+ int: a seed in [1, MAX_SEED]
47
+ """
48
+ return random.SystemRandom().randint(1, MAX_SEED)
49
+
50
+
51
+ def set_seed(seed=None, source='given'):
52
+ """Sets the build seed and resets every stream.
53
+
54
+ Args:
55
+ seed (int | None): the seed; None draws one
56
+ source (str): where the seed came from, for the log, defaults to 'given'
57
+
58
+ Returns:
59
+ int: the seed in use
60
+ """
61
+ if seed is None:
62
+ seed, source = draw_seed(), 'drawn'
63
+ if isinstance(seed, bool) or not isinstance(seed, (int, np.integer)):
64
+ raise ValueError(f'seed must be an integer, not {seed!r}')
65
+ seed = int(seed)
66
+ if not 0 < seed <= MAX_SEED:
67
+ raise ValueError(f'seed must be between 1 and {MAX_SEED}, not {seed}')
68
+ _state.update(seed=seed, source=source, rngs={})
69
+ logger.info(f'Seed: {seed} ({source})')
70
+ return seed
71
+
72
+
73
+ def seed():
74
+ """Returns the build seed, drawing one first if none is set.
75
+
76
+ Returns:
77
+ int: the build seed
78
+ """
79
+ if _state['seed'] is None:
80
+ set_seed()
81
+ return _state['seed']
82
+
83
+
84
+ def source():
85
+ """Returns where the build seed came from ('drawn', 'config', '--seed', ...), or None."""
86
+ return _state['source']
87
+
88
+
89
+ def rng(stream):
90
+ """Returns the generator for one named stream.
91
+
92
+ Args:
93
+ stream (str): one of STREAMS
94
+
95
+ Returns:
96
+ numpy.random.Generator: the stream's generator; the same object on every call
97
+ """
98
+ if stream not in STREAMS:
99
+ raise KeyError(f'unknown random stream {stream!r}; known: {", ".join(STREAMS)}')
100
+ s = seed()
101
+ if stream not in _state['rngs']:
102
+ ss = np.random.SeedSequence(s, spawn_key=(STREAMS.index(stream),))
103
+ _state['rngs'][stream] = np.random.default_rng(ss)
104
+ return _state['rngs'][stream]
105
+
106
+
107
+ def gmx_seed(stream):
108
+ """Draws the next GROMACS seed from a stream.
109
+
110
+ Args:
111
+ stream (str): one of STREAMS
112
+
113
+ Returns:
114
+ int: a seed in [1, MAX_SEED]; GROMACS treats 0 or -1 as "generate one"
115
+ """
116
+ return int(rng(stream).integers(1, MAX_SEED, endpoint=True))
117
+
118
+
119
+ def sample(stream, population, k):
120
+ """Chooses k distinct items, keeping their order in the population.
121
+
122
+ Args:
123
+ stream (str): one of STREAMS
124
+ population (list): items to choose from
125
+ k (int): how many to choose
126
+
127
+ Returns:
128
+ list: the chosen items
129
+ """
130
+ idx = sorted(rng(stream).choice(len(population), size=k, replace=False))
131
+ return [population[i] for i in idx]
132
+
133
+
134
+ def reset():
135
+ """Forgets the seed and every stream; the next draw sets a fresh seed."""
136
+ _state.update(seed=None, source=None, rngs={})
@@ -15,6 +15,7 @@ import yaml
15
15
  import numpy as np
16
16
  import pandas as pd
17
17
 
18
+ from ..core import seeding
18
19
  from ..analysis.plot import trace
19
20
  from ..core import projectfilesystem as pfs
20
21
  from ..core.molecule import MoleculeDict
@@ -1156,8 +1157,9 @@ class CureController:
1156
1157
  ''' roll the dice '''
1157
1158
  bdf['lucky']=[True for _ in range(bdf.shape[0])]
1158
1159
  if apply_probabilities:
1160
+ dice=seeding.rng('bond-search')
1159
1161
  for i,r in bdf.iterrows():
1160
- x=np.random.random()
1162
+ x=dice.random()
1161
1163
  if x>r.prob:
1162
1164
  bdf.loc[i,'lucky']=False
1163
1165
 
@@ -11,6 +11,7 @@ from itertools import product
11
11
  import numpy as np
12
12
  import pandas as pd
13
13
 
14
+ from ..core import seeding
14
15
  from ..external import software as sw
15
16
  from ..external.command import opts, run
16
17
  logger=logging.getLogger(__name__)
@@ -36,13 +37,16 @@ def insert_molecules(composition,boxSize,outName,inputs_dir='.',**kwargs):
36
37
  scale=kwargs.get('scale',0.4) # our default vdw radius scaling
37
38
  for name,num in composition.items(): # composition determines order
38
39
  ci=os.path.join(inputs_dir,f'{name}.gro')
40
+ # an explicit seed: GROMACS' default (0) draws one and does not report it
41
+ seed=seeding.gmx_seed('insert-molecules')
42
+ logger.info(f'insert-molecules: {num} {name}, seed {seed}')
39
43
  if os.path.isfile(f'{outName}.gro'):
40
44
  logger.debug(f'gmx insert-molecules inserts into existing {outName}.gro')
41
45
  ''' final gro file exists; we must insert into it '''
42
- out,err=run(f'{sw.gmx} {sw.gmx_options} insert-molecules -f {outName}.gro -ci {ci} -nmol {num} -o {outName} -box {box} -scale {scale}')
46
+ out,err=run(f'{sw.gmx} {sw.gmx_options} insert-molecules -f {outName}.gro -ci {ci} -nmol {num} -o {outName} -box {box} -scale {scale} -seed {seed}')
43
47
  else:
44
48
  ''' no final gro file yet; make it '''
45
- out,err=run(f'{sw.gmx} {sw.gmx_options} insert-molecules -ci {ci} -nmol {num} -o {outName} -box {box} -scale {scale}')
49
+ out,err=run(f'{sw.gmx} {sw.gmx_options} insert-molecules -ci {ci} -nmol {num} -o {outName} -box {box} -scale {scale} -seed {seed}')
46
50
  out+=err
47
51
  # logger.debug(f'Output of "{sw.gmx} insert-molecules"')
48
52
  # for ln in out.split('\n'):
@@ -192,6 +196,70 @@ def report_grompp_warnings(out, err, mdp=''):
192
196
  return found
193
197
 
194
198
 
199
+ def _mdp_value(d, key, default=None):
200
+ """Looks a key up in a parsed mdp, accepting '-' and '_' as GROMACS does."""
201
+ for k in (key, key.replace('-', '_'), key.replace('_', '-')):
202
+ if k in d:
203
+ return d[k]
204
+ return default
205
+
206
+
207
+ def seeded_mdp(mdp_filename, seeded_filename):
208
+ """Gives a velocity-generating mdp an explicit, logged ``gen-seed``.
209
+
210
+ A stage with ``gen-vel = yes`` and ``gen-seed = -1`` (or none) gets the next
211
+ seed from the build's ``gen-seed`` stream, written into a copy; the original
212
+ is not touched, because the cure reuses one mdp for many stages and a seed
213
+ written into it would give them all the same velocities. An mdp that sets
214
+ its own ``gen-seed``, or does not generate velocities, is used as it is.
215
+
216
+ Args:
217
+ mdp_filename (str): the stage's mdp file
218
+ seeded_filename (str): where to write the seeded copy
219
+
220
+ Returns:
221
+ str: the mdp file grompp should read
222
+ """
223
+ d = mdp_to_dict(mdp_filename)
224
+ if str(_mdp_value(d, 'gen-vel', 'no')).lower() != 'yes':
225
+ return mdp_filename
226
+ if str(_mdp_value(d, 'gen-seed', '-1')).strip() != '-1':
227
+ return mdp_filename
228
+ seed = seeding.gmx_seed('gen-seed')
229
+ logger.debug(f'{mdp_filename}: gen-seed {seed}')
230
+ d = {k: v for k, v in d.items() if k.replace('_', '-') != 'gen-seed'}
231
+ d['gen-seed'] = seed
232
+ with open(seeded_filename, 'w') as f:
233
+ for k, v in d.items():
234
+ f.write(f'{k} = {v}\n')
235
+ return seeded_filename
236
+
237
+
238
+ def report_lincs_warnings(logfile):
239
+ """Warns when an mdrun log holds LINCS warnings; returns how many it holds.
240
+
241
+ A run that warns thousands of times can still finish and look successful, and
242
+ that degraded case is the one that quietly corrupts a density. A fatal
243
+ ``Constraint error in algorithm Lincs`` already fails the run, but its earlier
244
+ warnings are counted here too, so the log says the constraints were failing
245
+ before the crash.
246
+
247
+ Args:
248
+ logfile (str): mdrun log file (``<deffnm>.log``); a missing file counts zero
249
+
250
+ Returns:
251
+ int: number of LINCS warnings in the log
252
+ """
253
+ if not os.path.exists(logfile):
254
+ return 0
255
+ with open(logfile, 'r', errors='replace') as f:
256
+ n = sum(1 for line in f if 'LINCS WARNING' in line)
257
+ if n:
258
+ logger.warning(f'{logfile}: {n} LINCS warning(s); the constraints did not hold '
259
+ f'everywhere -- check the timestep and the temperature')
260
+ return n
261
+
262
+
195
263
  def grompp_and_mdrun(gro='',top='',out='',mdp='',boxSize=[],single_molecule=False,**kwargs):
196
264
  """Launcher for grompp and mdrun.
197
265
 
@@ -222,7 +290,12 @@ def grompp_and_mdrun(gro='',top='',out='',mdp='',boxSize=[],single_molecule=Fals
222
290
  box_str = ' '.join(f'{x:.8f}' for x in boxSize)
223
291
  run(f'{sw.gmx} {sw.gmx_options} editconf -f {gro}.gro -o {gro} -box {box_str}', quiet=quiet)
224
292
  # nsteps=kwargs.get('nsteps',-2)
225
- _gout, _gerr = run(f'{sw.gmx} {sw.gmx_options} grompp -f {mdp}.mdp -c {gro}.gro -p {top}.top -o {out}.tpr -maxwarn {maxwarn}', quiet=quiet)
293
+ mdpfile = seeded_mdp(f'{mdp}.mdp', f'{out}-seeded.mdp')
294
+ try:
295
+ _gout, _gerr = run(f'{sw.gmx} {sw.gmx_options} grompp -f {mdpfile} -c {gro}.gro -p {top}.top -o {out}.tpr -maxwarn {maxwarn}', quiet=quiet)
296
+ finally:
297
+ if mdpfile != f'{mdp}.mdp' and os.path.exists(mdpfile):
298
+ os.remove(mdpfile)
226
299
  report_grompp_warnings(_gout, _gerr, mdp)
227
300
  mdrun_options = mdrun_options_for(mdrun_options, mdp_integrator(f'{mdp}.mdp'))
228
301
  mdrun_options = ensure_thread_mpi_ranks(
@@ -232,10 +305,11 @@ def grompp_and_mdrun(gro='',top='',out='',mdp='',boxSize=[],single_molecule=Fals
232
305
  if unusable:
233
306
  logger.debug(f'mdrun_options specifies gpu_id={mdrun_options["gpu_id"]} but ' + '; '.join(unusable) + '; ignoring gpu_id')
234
307
  mdrun_options = {k: v for k, v in mdrun_options.items() if k != 'gpu_id'}
235
- if single_molecule:
236
- run(f'{sw.mdrun_single_molecule} ' + opts(deffnm=out, **mdrun_options), quiet=quiet, ignore_codes=ignore_codes)
237
- else:
238
- run(f'{sw.mdrun} ' + opts(deffnm=out, **mdrun_options), quiet=quiet, ignore_codes=ignore_codes)
308
+ mdrun = sw.mdrun_single_molecule if single_molecule else sw.mdrun
309
+ try:
310
+ run(f'{mdrun} ' + opts(deffnm=out, **mdrun_options), quiet=quiet, ignore_codes=ignore_codes)
311
+ finally:
312
+ report_lincs_warnings(f'{out}.log')
239
313
  if os.path.exists(f'{out}.gro'):
240
314
  pass
241
315
  # logger.info(f'grompp_and_mdrun completed. Check {gro}.gro.')
@@ -370,14 +444,16 @@ def mdp_to_dict(mdp_filename):
370
444
  lines=f.read().split('\n')
371
445
  all_dict={}
372
446
  for l in lines:
373
- if len(l)>0:
374
- if '=' in l:
375
- k,v=l.split('=')
376
- k=k.strip()
377
- v=v.strip()
378
- all_dict[k]=v
379
- else:
380
- logger.debug(f'line {l} in {mdp_filename} skipped')
447
+ # ';' starts a comment, whole-line or inline, as it does for grompp. An inline
448
+ # comment used to stay in the value ('0.002 ; 2 fs'), so float(mdp_get(...,'dt'))
449
+ # failed, and a comment holding two '=' raised in the unpack (htpolynet-sweep,
450
+ # 2026-12-02)
451
+ s=l.split(';',1)[0].strip()
452
+ if '=' in s:
453
+ k,v=s.split('=',1)
454
+ all_dict[k.strip()]=v.strip()
455
+ elif s:
456
+ logger.debug(f'line {l} in {mdp_filename} skipped')
381
457
  return all_dict
382
458
 
383
459
  def mdp_get(mdp_filename,key):
@@ -108,4 +108,6 @@ def _build_run_cmd(config_file, run_args):
108
108
  parts.append('--param-only')
109
109
  if run_args.get('no_banner'):
110
110
  parts.append('--no-banner')
111
+ if run_args.get('seed') is not None:
112
+ parts += ['--seed', str(run_args['seed'])]
111
113
  return ' '.join(parts)
@@ -118,14 +118,20 @@ The first run of a new chemistry pays several minutes per species; later runs
118
118
  reuse it. Editing a monomer's structure **without renaming it** silently
119
119
  reuses the old parameterization — `--force-parameterization` rebuilds.
120
120
 
121
- ## Builds are not reproducible run to run
122
-
123
- There is no seed control. Conformer selection, the per-bond probability test,
124
- and Gromacs velocity generation are all unseeded, so two runs of one config
125
- diverge. Convenient in one direction — independent replicas of a
126
- quenched-disorder ensemble come free, and each `htpolynet run` in the same
127
- base directory makes its own project directory — but an exact rebuild is not
128
- available. Record the commit (`htpolynet info`) when the result matters.
121
+ ## A seed rebuilds the starting box, not the cure
122
+
123
+ Every build has one seed: `seed:` in the config, `--seed N` on `htpolynet
124
+ run`, or, with neither, one drawn and logged. It is written to `seed.txt` in
125
+ the project directory and in `systems/final-results`. It drives the conformer
126
+ choice, the `insert-molecules` packing, the bond-search dice and `gen-seed`.
127
+
128
+ The same seed gives the same starting box, bit for bit, on any machine. The
129
+ cure still diverges, because GROMACS is not bitwise reproducible across thread
130
+ counts or GPUs, so an exact rebuild of a network is not available: keep its
131
+ `final.gro`, `final.top` and `final.grx`. Replicates need different seeds, or
132
+ none; never put one seed in a config that several replicates share. To tell a
133
+ bad packing from a bad cure in an outlier build, rerun it with its recorded
134
+ seed. Record the commit (`htpolynet info`) too when the result matters.
129
135
 
130
136
  ## Reading the results
131
137
 
@@ -52,6 +52,20 @@ attributes:
52
52
  Worker processes for the parallelized bond search. Defaults to the
53
53
  machine's CPU count.
54
54
 
55
+ - name: seed
56
+ type: int
57
+ text: >
58
+ Seed for every random draw in the build: which conformers go into the
59
+ box, the initial packing (``gmx insert-molecules -seed``), the bond
60
+ search's acceptance dice, and ``gen-seed`` in each stage that generates
61
+ velocities. Omit it and one is drawn; either way it is logged and
62
+ written to ``seed.txt`` in the project directory and in
63
+ ``systems/final-results``. The same seed rebuilds the same starting
64
+ box on any machine. It does not replay the cure: MD is not bitwise
65
+ reproducible across thread counts or GPUs, so the cure diverges after
66
+ its first MD stage. Give replicates different seeds, or none. The
67
+ ``--seed`` option of ``htpolynet run`` overrides this.
68
+
55
69
  - name: gromacs
56
70
  type: dict
57
71
  text: >
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: htpolynet
3
- Version: 2.18.1
3
+ Version: 2.19.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/
@@ -1,26 +1,27 @@
1
1
  htpolynet/__init__.py,sha256=_ApfhZLLP4Hd3b5ZCHAw6FHEj2VpQhu3RrZrZPiTef4,80
2
- htpolynet/cli.py,sha256=qProWJ0hGgs4lBa1h4etiLCRp3paYPCN-g3XGi_IO-c,20038
2
+ htpolynet/cli.py,sha256=iV0hUvGRY3WAAvsMzaKt2Ib84-290pmEeDQr4ceNcL4,20318
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=lKduIPEVcl8gvZNn9nxdIdpywGTneBPEfhZsnePPk5U,47168
6
+ htpolynet/analysis/plot.py,sha256=z3P1_a0uKAXrUfH4mLuwoODRTQZQlkBlA_DWQ7DY81g,47477
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
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=RG7B3ecHP8LQfwVTqP0dsDf8rLR5vKL8WfW2OWPPp3E,5730
12
+ htpolynet/core/configuration.py,sha256=H_belRLV729e6uMDjEddXr0YHL93D6wYoMS9HRArgFo,5854
13
13
  htpolynet/core/coordinates.py,sha256=CGTHkdfw2ikc2ANacA5akRhZ9tOyM2IbELwQ2FVcKRw,23878
14
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
- htpolynet/core/runtime.py,sha256=Z8JUkvAzdD3Cg-5_AeM9hn0TOJjquhFKrsukpogf1eo,77463
18
+ htpolynet/core/runtime.py,sha256=90OQuOkp2_DXPMZf3tdOu1-xfpCheN6kVhaxFzvKrPk,78935
19
+ htpolynet/core/seeding.py,sha256=RWkTTZNbBJk5Ort1kToANNnG8DVqvrfvrRRl15Wwcoo,4467
19
20
  htpolynet/core/topocoord.py,sha256=jUgFg9TuUdSm14wo_464xX6dC4okJMrj1FbIzmaoA0Q,110520
20
21
  htpolynet/core/topology.py,sha256=bkV6yT69LJ89-aAc9-T56J4xZu6wF-8_sGGHj9ZlXpU,67879
21
22
  htpolynet/cure/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
22
23
  htpolynet/cure/chain.py,sha256=-d5BFE5xUKjFdNkxLfSnCnZIRSJCtr7xuxYzNHBeSgU,5344
23
- htpolynet/cure/curecontroller.py,sha256=Fi-nPuL4bjLfJepEeSXeOkQVCIrykMjjA8y4ikF3YmI,60752
24
+ htpolynet/cure/curecontroller.py,sha256=_zNkn-ISPKBWf_SiASuJ3Cu1a0lvqrqlAtierrzZMmY,60822
24
25
  htpolynet/cure/expandreactions.py,sha256=eN35-SQrzjoo8ftZVLJkiAKxpA_FigERTwZ8jtoxDng,20682
25
26
  htpolynet/cure/reaction.py,sha256=_kRJ1JzT_fjLIAF6j9lH_Sft41KD1kVQuWPmXdHia-M,13446
26
27
  htpolynet/cure/ringcontroller.py,sha256=gRdGIvYp46WMIyFfyS7YHkqL9ufUFpoJtm1eMAOTD-4,39356
@@ -28,8 +29,8 @@ htpolynet/cure/triplesearch.py,sha256=5XDjwJs4NZNenSwHBRCLE3s-bOlAM6Ba4RJhM74YFB
28
29
  htpolynet/external/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
29
30
  htpolynet/external/ambertools.py,sha256=NkZ0fP6iqwMnMk2jMD3-EaiGCmutHb1MVFOTFJiQ7WI,6286
30
31
  htpolynet/external/command.py,sha256=KYmWV8P4nuw_ciE16WazviorxjGj5un_z7dL62n0TG0,2480
31
- htpolynet/external/gromacs.py,sha256=0gxm3zcxICyRHvn1ZNt1r3aE2SobpYsl2H_0M0-0P6E,18427
32
- htpolynet/external/slurm.py,sha256=FvnKyNqFXgDe5bdTDB4Kcn9KU4mxq9Gcw675SzU-4w0,4082
32
+ htpolynet/external/gromacs.py,sha256=BfwFHWtfHGxamZYYVFZ6qNe0Kr2UedRKcLIKTVVsvIw,21570
33
+ htpolynet/external/slurm.py,sha256=w_u6f7iIAropzjS7lcKFUGVltAJBb6fvXc11FXMP6Zs,4174
33
34
  htpolynet/external/smiles_input.py,sha256=994kwl_Sjh2P_pepndv8QFRwzA5zSMVfD94OKRo8V1Q,22327
34
35
  htpolynet/external/software.py,sha256=Uzd1vkNnLm8C6By9ryFlbAnVPII30oFHLUOxzxdJJmw,10054
35
36
  htpolynet/geometry/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -50,7 +51,7 @@ htpolynet/repair/cyanate_cap.py,sha256=d-OqnoRwOMwijYuMLFhGoFkEa2qFyzCdGnICDK69V
50
51
  htpolynet/repair/topology_surgery.py,sha256=uuS49WTF8se_aNrxWBfyWf203ocv3k9j2ZluM7u15So,13250
51
52
  htpolynet/resources/README.md,sha256=epKLyqtcxtQOSzTYvaGlwhz970UA4vAU7r-iSBbbpmA,1432
52
53
  htpolynet/resources/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
53
- htpolynet/resources/claude/SKILL.md,sha256=nhs28iP0eVCqurXAOMFHLK6C0VAZPTZzAezzvNWj0yM,8629
54
+ htpolynet/resources/claude/SKILL.md,sha256=P1OJn95O0dRDRIcS-unJ8Ps64Wvw1bQcHnIklHINutw,9031
54
55
  htpolynet/resources/example_depot/0-liquid-styrene.yaml,sha256=Y3PJzm9WFwP3DYIQTP1RuV0_-6mZC8xrx0Wbj2gY1s4,2543
55
56
  htpolynet/resources/example_depot/1-polystyrene.yaml,sha256=_t6ZF9XbZDyH_Jn1lZq7DTNauS5-wo019CmA8oG8TMI,3807
56
57
  htpolynet/resources/example_depot/2-bisgma-styrene-thermoset.yaml,sha256=A9-7POzguVYLIuoOrrVxgyJUhD7ji1eWrIfL4ZkqeKA,6266
@@ -95,7 +96,7 @@ htpolynet/resources/molecules/sample-inputs/STY.mol2,sha256=r1NqpovL6L7E96Kkyc6U
95
96
  htpolynet/resources/tcl/readbonds.tcl,sha256=l_bh7eMjbxVi44UMPMi32bFntZltij92KmKfXC1qDz4,972
96
97
  htpolynet/resources/tcl/readgrx.tcl,sha256=A1KvyIpFC_lwfze3XOqTCPqLIkq7HwmqJ96lZH42W0U,1731
97
98
  htpolynet/resources/tcl/render.tcl,sha256=KUszYxzWtfuL7OXdtdk8n6eAQbz8DJfKJrGbb0pOdrI,2379
98
- htpolynet/schema/base.yaml,sha256=WT-YG6iM9U6MuSKsuPLwwym-vM6ltL7J4H5Ka6IKLn8,48082
99
+ htpolynet/schema/base.yaml,sha256=FuzqIZK_ffnhEB3KIASAJHckipTYyYlw3ik8G4Db1XY,48847
99
100
  htpolynet/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
100
101
  htpolynet/utils/banner.py,sha256=hdw6xoHNAo9p6X33LmhW5qyb67qAaQ3hmLnct3ZuDy0,906
101
102
  htpolynet/utils/checkpoint.py,sha256=QTZIJ8K777T6o-mNpjPdelTqrpT0amLlQcgpHBiq5V0,2924
@@ -106,8 +107,8 @@ htpolynet/utils/logsetup.py,sha256=o0mlVXNzqcfua2SAlJPkGSh4lM_bmI10gWwpb9gqYu8,1
106
107
  htpolynet/utils/profiling.py,sha256=su7qpGEz6FXVU4KT2HQDWG82bc1sgsfpDQBbAfPpsHc,7331
107
108
  htpolynet/utils/stringthings.py,sha256=Mr6o55EM8o4YAaVYpjIJj2IxDToNdbPzb-lpQ3w3jFk,1176
108
109
  htpolynet/utils/vmd_viz.py,sha256=Crk3Ln88PKiJ9X7DMMkFEVh2Ru6a1y0RUgj3w6EIgFc,10867
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,,
110
+ htpolynet-2.19.0.dist-info/METADATA,sha256=d9YagfHSSoWFypQ-88JxftnCQJk0eTCxknb7I1N_SQI,6754
111
+ htpolynet-2.19.0.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
112
+ htpolynet-2.19.0.dist-info/entry_points.txt,sha256=G5tx55llJf-IV9dIe7J8myGdyrhCVggCAhKrVNGP_s0,48
113
+ htpolynet-2.19.0.dist-info/licenses/LICENSE,sha256=piPSGqJdmTGyzF9HOnjlO2KvgOKT8NHwhCuGYM778tY,1071
114
+ htpolynet-2.19.0.dist-info/RECORD,,