HTPolyNet 2.10.0__py3-none-any.whl → 2.10.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.
htpolynet/core/runtime.py CHANGED
@@ -195,6 +195,28 @@ class Runtime:
195
195
  if k not in current:
196
196
  current[k]=v
197
197
 
198
+ def _report_parameterization_summary(self):
199
+ """Logs how many molecule templates were reused and how many were parameterized.
200
+
201
+ Counted after every derived template (symmetry, C=C chain, and
202
+ second-shell) exists, so the numbers cover everything this run needs;
203
+ a job that must not parameterize anything, e.g. one reading a
204
+ pre-filled read-only cache, can check for "0 freshly parameterized".
205
+ """
206
+ n_cached=sum(1 for M in self.molecules.values() if M.origin=='previously parameterized')
207
+ n_new=sum(1 for M in self.molecules.values() if (M.origin or '').startswith('newly parameterized'))
208
+ if not (n_cached or n_new): return
209
+ where=[]
210
+ if pfs._PFS_ and pfs._PFS_.userlibrary:
211
+ where.append(f'{pfs._PFS_.userlibrary.root}')
212
+ if pfs._USER_CACHE_ is not None:
213
+ where.append(f'{pfs._USER_CACHE_.root}')
214
+ logger.info(f'Parameterization summary: {n_cached} of {n_cached+n_new} molecule templates reused from the library '
215
+ f'({" or ".join(where) or "unknown location"}), {n_new} freshly parameterized.')
216
+ if n_cached:
217
+ logger.info(' to force re-parameterization on the next run, use '
218
+ '`htpolynet run --force-parameterization --force-checkin ...`')
219
+
198
220
  def _read_frcmods(self):
199
221
  """Reads the user frcmod file each constituent names, if any.
200
222
 
@@ -357,18 +379,6 @@ class Runtime:
357
379
  logger.debug(f'Generating: {list(self.molecules.keys())}')
358
380
  for mname,M in self.molecules.items():
359
381
  self._generate_molecule(M,force_parameterization=force_parameterization,force_checkin=force_checkin)
360
- n_cached=sum(1 for M in self.molecules.values() if M.origin=='previously parameterized')
361
- n_new=sum(1 for M in self.molecules.values() if M.origin=='newly parameterized')
362
- if n_cached or n_new:
363
- logger.info(
364
- f'Parameterization summary: {n_cached} reused from cache '
365
- f'(~/.htpolynet/molecules/parameterized/), {n_new} freshly parameterized.'
366
- )
367
- if n_cached:
368
- logger.info(
369
- ' to force re-parameterization on the next run, use '
370
- '`htpolynet run --force-parameterization --force-checkin ...`'
371
- )
372
382
  new_reactions,new_molecules=bondchain_expand_reactions(self.molecules)
373
383
  if len(new_molecules)>0:
374
384
  ess='' if len(new_molecules)==1 else 's'
@@ -392,6 +402,7 @@ class Runtime:
392
402
  self.molecules[mname]=M
393
403
  logger.debug(f'Generated {mname}')
394
404
 
405
+ self._report_parameterization_summary()
395
406
  self._check_frcmod_type_conflicts()
396
407
 
397
408
  for M in self.molecules:
@@ -890,7 +890,13 @@ class CureController:
890
890
  # monomer was mid-chain.
891
891
  if fmax<3:
892
892
  if mask is not None:
893
- logger.info('No residue carries three or more cure-reactive sites, so crosslink percolation is not assessed. That is correct for a linear polymer; a system that crosslinks through a multi-residue molecule -- a dimethacrylate, a multi-arm prepolymer -- is outside what this residue-level check can see.')
893
+ logger.info('Crosslink percolation was not assessed: no residue carries three or more '
894
+ 'cure-reactive sites. For a chain polymer that is the answer -- a fully reacted '
895
+ 'difunctional unit is a chain interior, not a junction. But a system that '
896
+ 'crosslinks through a multi-residue molecule, such as a dimethacrylate built from '
897
+ 'a bisphenol and two methacrylates, does percolate through junctions this '
898
+ 'residue-level count cannot see, and there this line means "cannot assess", not '
899
+ '"does not percolate".')
894
900
  return
895
901
  names=adf.loc[adf['resNum']==func.idxmax(),'resName']
896
902
  resname=names.iloc[0] if len(names) else f'residue {func.idxmax()}'
@@ -60,6 +60,56 @@ def insert_molecules(composition,boxSize,outName,inputs_dir='.',**kwargs):
60
60
  logger.debug(l)
61
61
  raise Exception('need bigger box')
62
62
 
63
+ _DYNAMICAL_INTEGRATORS_ = ('md', 'md-vv', 'md-vv-avek', 'sd', 'bd')
64
+ """GROMACS integrators that do dynamics; the rest (steep, cg, l-bfgs, nm, tpi, ...) do not."""
65
+
66
+ _DYNAMICS_ONLY_GPU_TASKS_ = ('pme', 'update', 'bonded')
67
+ """mdrun tasks not forced onto a GPU without a dynamical integrator.
68
+
69
+ GROMACS refuses ``-pme gpu`` and ``-update gpu`` with a minimizer. Whether it
70
+ accepts ``-bonded gpu`` there has not been checked, and a minimization is
71
+ cheap enough that running its bonded work on the CPU costs nothing that matters.
72
+ """
73
+
74
+
75
+ def mdp_integrator(mdp_filename):
76
+ """Returns the integrator an mdp file selects, lower-cased; 'md' if it does not say.
77
+
78
+ Args:
79
+ mdp_filename (str): mdp file name
80
+
81
+ Returns:
82
+ str: integrator name
83
+ """
84
+ value = mdp_to_dict(mdp_filename).get('integrator', 'md')
85
+ return value.split(';')[0].strip().lower() or 'md'
86
+
87
+
88
+ def mdrun_options_for(mdrun_options, integrator):
89
+ """Returns the mdrun options to use with a given integrator.
90
+
91
+ One ``gromacs.mdrun_options`` serves every stage of a build, minimizations
92
+ included. GROMACS stops with a fatal error when ``-pme gpu`` or
93
+ ``-update gpu`` is given with a minimizer, so for a minimizer these, and
94
+ ``-bonded gpu``, become ``auto``. Dynamics gets the options unchanged.
95
+
96
+ Args:
97
+ mdrun_options (dict): options from the configuration
98
+ integrator (str): the mdp's integrator
99
+
100
+ Returns:
101
+ dict: options to pass to mdrun
102
+ """
103
+ if integrator in _DYNAMICAL_INTEGRATORS_:
104
+ return mdrun_options
105
+ adjusted = dict(mdrun_options)
106
+ for task in _DYNAMICS_ONLY_GPU_TASKS_:
107
+ if str(adjusted.get(task, '')).lower() == 'gpu':
108
+ adjusted[task] = 'auto'
109
+ logger.debug(f'integrator {integrator} cannot run {task} on the GPU; passing -{task} auto for this run')
110
+ return adjusted
111
+
112
+
63
113
  def grompp_and_mdrun(gro='',top='',out='',mdp='',boxSize=[],single_molecule=False,**kwargs):
64
114
  """Launcher for grompp and mdrun.
65
115
 
@@ -75,7 +125,7 @@ def grompp_and_mdrun(gro='',top='',out='',mdp='',boxSize=[],single_molecule=Fals
75
125
  quiet=kwargs.get('quiet',True)
76
126
  ignore_codes=kwargs.get('ignore_codes',[-11])
77
127
  maxwarn=kwargs.get('maxwarn',4)
78
- mdrun_options=kwargs.get('mdrun_options',{})
128
+ mdrun_options=dict(kwargs.get('mdrun_options',{}))
79
129
  for option in ['rdd','dds','dlb','npme','nt','ntpmi','ntomp','ntomp_pme','nb','tunepme','pme','pmefft','bonded','update']:
80
130
  if option in kwargs and not option in mdrun_options:
81
131
  mdrun_options[option]=kwargs[option]
@@ -91,6 +141,7 @@ def grompp_and_mdrun(gro='',top='',out='',mdp='',boxSize=[],single_molecule=Fals
91
141
  run(f'{sw.gmx} {sw.gmx_options} editconf -f {gro}.gro -o {gro} -box {box_str}', quiet=quiet)
92
142
  # nsteps=kwargs.get('nsteps',-2)
93
143
  run(f'{sw.gmx} {sw.gmx_options} grompp -f {mdp}.mdp -c {gro}.gro -p {top}.top -o {out}.tpr -maxwarn {maxwarn}', quiet=quiet)
144
+ mdrun_options = mdrun_options_for(mdrun_options, mdp_integrator(f'{mdp}.mdp'))
94
145
  if 'gpu_id' in mdrun_options:
95
146
  unusable = sw.gpu_unusable_reasons()
96
147
  if unusable:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: htpolynet
3
- Version: 2.10.0
3
+ Version: 2.10.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/
@@ -12,18 +12,18 @@ htpolynet/core/coordinates.py,sha256=CGTHkdfw2ikc2ANacA5akRhZ9tOyM2IbELwQ2FVcKRw
12
12
  htpolynet/core/molecule.py,sha256=MXTdgKXFc7JnCvFhorCaTBQNXrdhKhC9gALtBge4Ff0,52787
13
13
  htpolynet/core/paramcache.py,sha256=A99VVqf1SdcdzoW5tEkRnN_GEPMjnw-1yy0J-S6FzJI,5660
14
14
  htpolynet/core/projectfilesystem.py,sha256=2U_EToZxN7yUGWu9BIRABVsYdp1AKkOuManwuFBz89k,20983
15
- htpolynet/core/runtime.py,sha256=DOYay4BcLab2p-Eeti45kWMozEol-8fYsYB5mZQixCY,61529
15
+ htpolynet/core/runtime.py,sha256=FQUHlU0SUPxAqcUnMZHhpLgNu8fa5zRmPy8kv5pv72w,62251
16
16
  htpolynet/core/topocoord.py,sha256=GfxOf04jAMYB6_vgj87kG9lXR0LVXwDHWetG5sv5AIA,109249
17
17
  htpolynet/core/topology.py,sha256=fRp3a-ILNsrjCyIuJrs7p1NYnH4Y6waKLm_CEQK7IUw,60531
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=ulj9wpXRIEH6AAUSS23ssCMYvPKiOOL748fKK0jVjJI,58056
20
+ htpolynet/cure/curecontroller.py,sha256=NObB2l32W2eAf59j_LSHjj_UNEvUQ-dqvs8MWFQ8_pU,58433
21
21
  htpolynet/cure/expandreactions.py,sha256=LDVefyrCZI2QSqrTsrVIPYP6g_w-LiUsYZkN3lUAM74,19977
22
22
  htpolynet/cure/reaction.py,sha256=S-w60HocYknKnGbq1_uwLpKTL5Fte_o7zxwk3FbyQ1I,10557
23
23
  htpolynet/external/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
24
24
  htpolynet/external/ambertools.py,sha256=NkZ0fP6iqwMnMk2jMD3-EaiGCmutHb1MVFOTFJiQ7WI,6286
25
25
  htpolynet/external/command.py,sha256=KYmWV8P4nuw_ciE16WazviorxjGj5un_z7dL62n0TG0,2480
26
- htpolynet/external/gromacs.py,sha256=KEtHA4TuHaSA_nFXoz2NyrX3JUr9a733-KkOv5BE4Lc,12848
26
+ htpolynet/external/gromacs.py,sha256=vyK-FfodCSgrjELMBWOG7K8pldG2EqoSLJBa_hzC4lk,14795
27
27
  htpolynet/external/slurm.py,sha256=FvnKyNqFXgDe5bdTDB4Kcn9KU4mxq9Gcw675SzU-4w0,4082
28
28
  htpolynet/external/smiles_input.py,sha256=vt-CdEHSqpJ5EA57NqQSCywjpHnTE5wCk2im2oxhM3U,9830
29
29
  htpolynet/external/software.py,sha256=Uzd1vkNnLm8C6By9ryFlbAnVPII30oFHLUOxzxdJJmw,10054
@@ -98,8 +98,8 @@ htpolynet/utils/logsetup.py,sha256=o0mlVXNzqcfua2SAlJPkGSh4lM_bmI10gWwpb9gqYu8,1
98
98
  htpolynet/utils/profiling.py,sha256=su7qpGEz6FXVU4KT2HQDWG82bc1sgsfpDQBbAfPpsHc,7331
99
99
  htpolynet/utils/stringthings.py,sha256=Mr6o55EM8o4YAaVYpjIJj2IxDToNdbPzb-lpQ3w3jFk,1176
100
100
  htpolynet/utils/vmd_viz.py,sha256=Crk3Ln88PKiJ9X7DMMkFEVh2Ru6a1y0RUgj3w6EIgFc,10867
101
- htpolynet-2.10.0.dist-info/METADATA,sha256=tnzImfyZ92r2NecCZeltVxO4wkElSF5ZCgrnQkNauMM,6589
102
- htpolynet-2.10.0.dist-info/WHEEL,sha256=zOwg4jB6zX2kU910N-cMawjivD6tO8NEWvE12je1bVk,87
103
- htpolynet-2.10.0.dist-info/entry_points.txt,sha256=G5tx55llJf-IV9dIe7J8myGdyrhCVggCAhKrVNGP_s0,48
104
- htpolynet-2.10.0.dist-info/licenses/LICENSE,sha256=piPSGqJdmTGyzF9HOnjlO2KvgOKT8NHwhCuGYM778tY,1071
105
- htpolynet-2.10.0.dist-info/RECORD,,
101
+ htpolynet-2.10.1.dist-info/METADATA,sha256=t_ogJTLM8JzzOFhYqZpwQqLaRMFwKQhrvIHxXBZEhuk,6589
102
+ htpolynet-2.10.1.dist-info/WHEEL,sha256=zOwg4jB6zX2kU910N-cMawjivD6tO8NEWvE12je1bVk,87
103
+ htpolynet-2.10.1.dist-info/entry_points.txt,sha256=G5tx55llJf-IV9dIe7J8myGdyrhCVggCAhKrVNGP_s0,48
104
+ htpolynet-2.10.1.dist-info/licenses/LICENSE,sha256=piPSGqJdmTGyzF9HOnjlO2KvgOKT8NHwhCuGYM778tY,1071
105
+ htpolynet-2.10.1.dist-info/RECORD,,