HTPolyNet 2.3.0__py3-none-any.whl → 2.3.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.
@@ -248,7 +248,7 @@ def analyze(args):
248
248
  software.sw_setup()
249
249
  logger.debug(f'ogromacs {ogromacs}')
250
250
  for d in args.proj:
251
- pfs.pfs_setup(root=os.getcwd(),topdirs=pfs.Dirs.analyze_topdirs,verbose=True,projdir=d,reProject=False,userlibrary=args.lib)
251
+ pfs.pfs_setup(root=os.getcwd(),topdirs=pfs.Dirs.analyze_topdirs,verbose=True,projdir=d,reProject=False,userlibrary=pfs.resolve_user_library(args.lib))
252
252
  pfs.go_to(pfs.Dirs.analyze)
253
253
  for stage in cfg.stagelist:
254
254
  stage.do(**ogromacs)
@@ -436,7 +436,7 @@ def postsim(args):
436
436
  software.sw_setup()
437
437
  logger.debug(f'ogromacs {ogromacs}')
438
438
  for d in args.proj:
439
- pfs.pfs_setup(root=os.getcwd(),topdirs=pfs.Dirs.postsim_topdirs,verbose=True,projdir=d,reProject=False,userlibrary=args.lib)
439
+ pfs.pfs_setup(root=os.getcwd(),topdirs=pfs.Dirs.postsim_topdirs,verbose=True,projdir=d,reProject=False,userlibrary=pfs.resolve_user_library(args.lib))
440
440
  pfs.go_to(pfs.Dirs.postsim)
441
441
  for stage in cfg.stagelist:
442
442
  stage.do(mdp_pfx='local',**ogromacs)
htpolynet/cli.py CHANGED
@@ -235,7 +235,7 @@ def _add_gen_slurm_args(p):
235
235
  def _add_analysis_args(p):
236
236
  """Adds the common arguments shared by the postsim and analyze subcommands."""
237
237
  p.add_argument('-proj',type=str,default='',nargs='+',help='name of project directory')
238
- p.add_argument('-lib',type=str,default='lib',help='local user library of molecular structures and parameterizations')
238
+ p.add_argument('-lib',type=str,default=None,help='local user library of molecular structures and parameterizations (default: ./lib if it exists, otherwise none)')
239
239
  p.add_argument('-ocfg',type=str,default='',help='original htpolynet config file used to generate project(s)')
240
240
  p.add_argument('-cfg',type=str,default='',help='config file specifying the operations to perform')
241
241
  p.add_argument('--no-banner',default=False,action='store_true',help='suppress the startup banner')
@@ -208,7 +208,9 @@ class UserLibrary:
208
208
  pathname (str): path to the user library directory, defaults to '.'
209
209
  """
210
210
  self.root = Path(os.path.abspath(pathname))
211
- assert self.root.exists() and self.root.is_dir(), f'{pathname} is not a directory'
211
+ assert self.root.exists() and self.root.is_dir(), (
212
+ f'user library {pathname!r} (resolved to {self.root}) is not a directory; '
213
+ f'pass -lib <path> to point at an existing library, or create it')
212
214
 
213
215
  def exists(self, filename):
214
216
  """Checks if filename exists in the user library.
@@ -448,6 +450,28 @@ def pfs_setup(root='.', topdirs=['molecules', 'systems', 'plots'], projdir='next
448
450
  userlibrary=userlibrary, mock=mock)
449
451
 
450
452
 
453
+ def resolve_user_library(pathname, default='lib'):
454
+ """Returns the user-library path a subcommand should use, or None for none.
455
+
456
+ An explicitly supplied path is returned unchanged, so that a typo fails
457
+ loudly in UserLibrary rather than silently degrading to no library. When
458
+ nothing was supplied, the conventional ``lib/`` is used only if it is
459
+ actually there: a subcommand that merely reads finished results has no
460
+ reason to require a molecule library, and demanding one turns the default
461
+ value of a flag the user never typed into a hard error.
462
+
463
+ Args:
464
+ pathname (str or None): the value of the ``-lib`` flag, or None if unset
465
+ default (str): the conventional library directory, defaults to 'lib'
466
+
467
+ Returns:
468
+ str or None: path to use as the user library, or None for no user library
469
+ """
470
+ if pathname is not None:
471
+ return pathname
472
+ return default if os.path.isdir(default) else None
473
+
474
+
451
475
  def checkout(filename, altpath=[]):
452
476
  """Copies a file to cwd; searches user library, then user cache, then system library.
453
477
 
htpolynet/core/runtime.py CHANGED
@@ -619,18 +619,27 @@ class Runtime:
619
619
  of the stage is what someone scanning the tail of a log actually hits,
620
620
  and it arrives while the expensive part of the build is still ahead of
621
621
  them rather than behind.
622
+
623
+ Both messages have to say that the cached parameters are being *used*,
624
+ not merely that they could not be checked. A reader who upgrades with
625
+ an existing library, asks for one charge method, and gets another one's
626
+ numbers will otherwise conclude the cache guard does not work -- the
627
+ correct behavior here is indistinguishable from the bug it replaced
628
+ unless the message says which is happening.
622
629
  """
623
630
  if not self.unverified_parameterizations:
624
631
  return
625
632
  names = sorted(set(self.unverified_parameterizations))
626
633
  ess = '' if len(names) == 1 else 's'
627
634
  requested = paramcache.build_key(self.cfg.ambertools)
628
- my_logger(f'{len(names)} parameterization{ess} of unverified provenance', logger.warning)
629
- logger.warning(f'Reused from the library, but the library entry records nothing about how it')
630
- logger.warning(f'was built, so this run could not confirm it was parameterized with the')
631
- logger.warning(f'requested {requested["charge_method"]!r} charge method:')
635
+ my_logger(f'{len(names)} parameterization{ess} reused without provenance', logger.warning)
636
+ logger.warning('These were taken from the library, which records nothing about how they were')
637
+ logger.warning('built. This build therefore carries whatever charges those entries hold, and')
638
+ logger.warning(f'they may not be {requested["charge_method"]!r}:')
632
639
  my_logger(names, logger.warning)
633
- logger.warning('Rebuild them from the current directives with --force-parameterization.')
640
+ logger.warning('This is expected for entries written before htpolynet 2.3, and is not a')
641
+ logger.warning('failure. Rebuild them with --force-parameterization if this build\'s charges')
642
+ logger.warning('need to be certain.')
634
643
 
635
644
  @staticmethod
636
645
  def _checkin_parameterization(mname, overwrite):
@@ -687,9 +696,11 @@ class Runtime:
687
696
  pfs.checkout(keyfile)
688
697
  stored = paramcache.read_key(M.name)
689
698
  if stored is None:
690
- logger.warning(f'Cached parameterization for {M.name} carries no record of how it was built, '
691
- f'so it cannot be checked against the requested {requested["charge_method"]!r} '
692
- f'charge method; use --force-parameterization to rebuild it')
699
+ logger.warning(f'Reusing cached parameterization for {M.name}, which carries no record of '
700
+ f'how it was built: this build takes whatever charges that entry holds, and '
701
+ f'they may not be {requested["charge_method"]!r}. Expected for an entry '
702
+ f'written before htpolynet 2.3; rebuild it with --force-parameterization '
703
+ f'if this build\'s charges need to be certain.')
693
704
  self.unverified_parameterizations.append(M.name)
694
705
  return []
695
706
  diffs = paramcache.describe_mismatch(stored, requested)
@@ -90,8 +90,15 @@ def _mdrun_cmd(base):
90
90
 
91
91
  def _get_git_commit():
92
92
  """Records the short git commit hash of the htpolynet source tree and
93
- whether there are uncommitted changes. Falls back to 'unknown' if the
94
- working directory is not inside a git repo or git is not available.
93
+ whether there are uncommitted changes.
94
+
95
+ An installed copy -- pip, conda, or the published container -- has no
96
+ ``.git`` beside it, so the git lookup fails and there is nothing to
97
+ report. Reporting 'unknown' there leaves a build with no way to answer
98
+ "what code produced this" from inside itself, which is exactly the
99
+ question the parameterization records exist to answer for molecules.
100
+ Fall back to the installed distribution version, which for a released
101
+ install maps to a tag and is the honest answer.
95
102
  """
96
103
  global git_commit
97
104
  src = os.path.dirname(__file__)
@@ -108,6 +115,15 @@ def _get_git_commit():
108
115
  )
109
116
  if dirty.returncode == 0 and dirty.stdout.strip():
110
117
  git_commit += ' (uncommitted changes present)'
118
+ return
119
+ except Exception:
120
+ pass
121
+ try:
122
+ from importlib.metadata import version, PackageNotFoundError
123
+ try:
124
+ git_commit = f'not a git checkout (installed version {version("htpolynet")})'
125
+ except PackageNotFoundError:
126
+ pass
111
127
  except Exception:
112
128
  pass
113
129
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: htpolynet
3
- Version: 2.3.0
3
+ Version: 2.3.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/
@@ -1,9 +1,9 @@
1
1
  htpolynet/__init__.py,sha256=_ApfhZLLP4Hd3b5ZCHAw6FHEj2VpQhu3RrZrZPiTef4,80
2
- htpolynet/cli.py,sha256=s0ZjMStMnE7UHliBp7m1MDGFZB0zM7B6bwwoqCcUo4M,15141
2
+ htpolynet/cli.py,sha256=4QjaltjS1LLBciGc5uiENFbKC4_ReIHVHMq6PVe-7ZQ,15186
3
3
  htpolynet/analysis/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
- htpolynet/analysis/analyze.py,sha256=dJMEWDJ1RpRut8nJhPQD7dmW25qiZ1asjnPEEfykAWU,9106
4
+ htpolynet/analysis/analyze.py,sha256=vM-FpM7rC6hiXw7VjrKFmpTjrfRzSbWHG9McsaZrhMs,9132
5
5
  htpolynet/analysis/plot.py,sha256=ncLduM4cK7ncQjksE2qL0Z086gqQOCpMs66rlI7AbOk,33020
6
- htpolynet/analysis/postsim.py,sha256=Mf4fEh6G8bm0gbiV2wewxO5htOTExl21zczQBKpavSo,16847
6
+ htpolynet/analysis/postsim.py,sha256=7HvW6yPHfSddl63QUp8PbyzToMSm13Pw16cqCY8OnWw,16873
7
7
  htpolynet/analysis/utils.py,sha256=jmQMfw8EDzRSEvqBHUQV2g15-MmZbreJYiJ7gan_z-c,17246
8
8
  htpolynet/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
9
  htpolynet/core/bondtemplate.py,sha256=Sz_K7ZhyHzj_dCBjDASlhzm3cXgIwAvHIgIanvuld5s,8512
@@ -11,8 +11,8 @@ htpolynet/core/configuration.py,sha256=CsfCE6_SwwFgN6BdY-4cWrQKAIcVNE1mxp2_qyQaJ
11
11
  htpolynet/core/coordinates.py,sha256=CGTHkdfw2ikc2ANacA5akRhZ9tOyM2IbELwQ2FVcKRw,23878
12
12
  htpolynet/core/molecule.py,sha256=xUA52zkRMyAFCE8LbXvXghweDCPkrgD4rx1mcimddn0,52751
13
13
  htpolynet/core/paramcache.py,sha256=3MTG96F4vtT5w-pn1RWNmXic0QKB7WVcwCrD-BSY3B0,4508
14
- htpolynet/core/projectfilesystem.py,sha256=GlFv0ToHkKRqRfSfXMT4D_jgnBR08uPG2YkfsndmAII,19891
15
- htpolynet/core/runtime.py,sha256=Cw8J5q-SBgEsZT1KHnN5fGXcfgRuvkUqjbt15D8XQKU,52524
14
+ htpolynet/core/projectfilesystem.py,sha256=2U_EToZxN7yUGWu9BIRABVsYdp1AKkOuManwuFBz89k,20983
15
+ htpolynet/core/runtime.py,sha256=BmWDttIKtRJnqYiYgrv7bJcivLaBtsgXK8q1jdYVKGw,53299
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
@@ -26,7 +26,7 @@ htpolynet/external/command.py,sha256=KYmWV8P4nuw_ciE16WazviorxjGj5un_z7dL62n0TG0
26
26
  htpolynet/external/gromacs.py,sha256=KEtHA4TuHaSA_nFXoz2NyrX3JUr9a733-KkOv5BE4Lc,12848
27
27
  htpolynet/external/slurm.py,sha256=FvnKyNqFXgDe5bdTDB4Kcn9KU4mxq9Gcw675SzU-4w0,4082
28
28
  htpolynet/external/smiles_input.py,sha256=vt-CdEHSqpJ5EA57NqQSCywjpHnTE5wCk2im2oxhM3U,9830
29
- htpolynet/external/software.py,sha256=eqRemJKJOV_iFM0TMOFuCOmpE7MOSJ4JJ4LUo2YFVCQ,8891
29
+ htpolynet/external/software.py,sha256=vVgm7hvF9PyjWZ8-gUTDMl4XdnC3IIK7QEWQGr0-B7g,9569
30
30
  htpolynet/geometry/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
31
31
  htpolynet/geometry/bondlist.py,sha256=ps6AreIHLz-55zZieJiBg9rbd9zZctw8gPrmQYK0MbI,6144
32
32
  htpolynet/geometry/lattice.py,sha256=YgrX52xHjiK9DP-T_xFiqiCYLHukU5tKCxutl-rC5c0,896
@@ -95,8 +95,8 @@ htpolynet/utils/logsetup.py,sha256=o0mlVXNzqcfua2SAlJPkGSh4lM_bmI10gWwpb9gqYu8,1
95
95
  htpolynet/utils/profiling.py,sha256=su7qpGEz6FXVU4KT2HQDWG82bc1sgsfpDQBbAfPpsHc,7331
96
96
  htpolynet/utils/stringthings.py,sha256=Mr6o55EM8o4YAaVYpjIJj2IxDToNdbPzb-lpQ3w3jFk,1176
97
97
  htpolynet/utils/vmd_viz.py,sha256=Crk3Ln88PKiJ9X7DMMkFEVh2Ru6a1y0RUgj3w6EIgFc,10867
98
- htpolynet-2.3.0.dist-info/METADATA,sha256=PZfpIk9xUlKslt52ROVDAimtFf53TKLsrLqIbRLtzb0,6036
99
- htpolynet-2.3.0.dist-info/WHEEL,sha256=zOwg4jB6zX2kU910N-cMawjivD6tO8NEWvE12je1bVk,87
100
- htpolynet-2.3.0.dist-info/entry_points.txt,sha256=G5tx55llJf-IV9dIe7J8myGdyrhCVggCAhKrVNGP_s0,48
101
- htpolynet-2.3.0.dist-info/licenses/LICENSE,sha256=piPSGqJdmTGyzF9HOnjlO2KvgOKT8NHwhCuGYM778tY,1071
102
- htpolynet-2.3.0.dist-info/RECORD,,
98
+ htpolynet-2.3.1.dist-info/METADATA,sha256=tXtk99WECunWtlinNhiRCqy6z8XiB6bzZMcDrEdB1Ms,6036
99
+ htpolynet-2.3.1.dist-info/WHEEL,sha256=zOwg4jB6zX2kU910N-cMawjivD6tO8NEWvE12je1bVk,87
100
+ htpolynet-2.3.1.dist-info/entry_points.txt,sha256=G5tx55llJf-IV9dIe7J8myGdyrhCVggCAhKrVNGP_s0,48
101
+ htpolynet-2.3.1.dist-info/licenses/LICENSE,sha256=piPSGqJdmTGyzF9HOnjlO2KvgOKT8NHwhCuGYM778tY,1071
102
+ htpolynet-2.3.1.dist-info/RECORD,,