HTPolyNet 2.2.0__py3-none-any.whl → 2.3.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.
- htpolynet/cli.py +1 -1
- htpolynet/core/molecule.py +7 -0
- htpolynet/core/paramcache.py +132 -0
- htpolynet/core/projectfilesystem.py +1 -1
- htpolynet/core/runtime.py +107 -7
- htpolynet/external/ambertools.py +23 -4
- {htpolynet-2.2.0.dist-info → htpolynet-2.3.0.dist-info}/METADATA +2 -1
- {htpolynet-2.2.0.dist-info → htpolynet-2.3.0.dist-info}/RECORD +11 -10
- {htpolynet-2.2.0.dist-info → htpolynet-2.3.0.dist-info}/WHEEL +0 -0
- {htpolynet-2.2.0.dist-info → htpolynet-2.3.0.dist-info}/entry_points.txt +0 -0
- {htpolynet-2.2.0.dist-info → htpolynet-2.3.0.dist-info}/licenses/LICENSE +0 -0
htpolynet/cli.py
CHANGED
|
@@ -127,7 +127,7 @@ def _add_run_options(p, loglevel='debug'):
|
|
|
127
127
|
p.add_argument('-restart',default=False,action='store_true',help='restart in latest proj dir (EXPERIMENTAL: broken at the cure stage; see usage docs)')
|
|
128
128
|
p.add_argument('--no-banner',default=False,action='store_true',help='suppress the startup banner')
|
|
129
129
|
p.add_argument('--force-parameterization',default=False,action='store_true',help='force GAFF parameterization of any input mol2 structures')
|
|
130
|
-
p.add_argument('--force-checkin',default=False,action='store_true',help='
|
|
130
|
+
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')
|
|
131
131
|
p.add_argument('--param-only',default=False,action='store_true',help='stop after parameterizing molecules without building the full system')
|
|
132
132
|
p.add_argument('--loglevel',type=str,default=loglevel,help='log level for the diagnostic file (debug|info)')
|
|
133
133
|
|
htpolynet/core/molecule.py
CHANGED
|
@@ -12,6 +12,7 @@ from itertools import product
|
|
|
12
12
|
import numpy as np
|
|
13
13
|
import pandas as pd
|
|
14
14
|
|
|
15
|
+
from ..core import paramcache
|
|
15
16
|
from ..core import projectfilesystem as pfs
|
|
16
17
|
from ..core.bondtemplate import BondTemplate, BondTemplateList, ReactionBond, ReactionBondList
|
|
17
18
|
from ..core.topocoord import TopoCoord
|
|
@@ -424,6 +425,12 @@ class Molecule:
|
|
|
424
425
|
shutil.copy(f'{self.parentname}.top', f'{self.name}.top')
|
|
425
426
|
shutil.copy(f'{self.parentname}.grx', f'{self.name}.grx')
|
|
426
427
|
shutil.copy(f'{self.parentname}.tpx', f'{self.name}.tpx')
|
|
428
|
+
# The isomer carries the parent's parameters, so it carries the
|
|
429
|
+
# parent's provenance too; without this it would look like a
|
|
430
|
+
# library entry of unknown origin on every subsequent run.
|
|
431
|
+
parent_key = paramcache.key_filename(self.parentname)
|
|
432
|
+
if os.path.exists(parent_key):
|
|
433
|
+
shutil.copy(parent_key, paramcache.key_filename(self.name))
|
|
427
434
|
|
|
428
435
|
if do_minimization:
|
|
429
436
|
self.minimize(outname)
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"""Provenance records for cached GAFF parameterizations.
|
|
2
|
+
|
|
3
|
+
A parameterization checked into the user library is identified by molecule
|
|
4
|
+
name alone, but the numbers it contains depend on more than the name: the
|
|
5
|
+
antechamber charge method, the net charge passed as ``-nc``, and the atom-type
|
|
6
|
+
set. Without a record of those, a configuration asking for
|
|
7
|
+
``charge_method: bcc`` silently reuses a ``gas`` parameterization checked in
|
|
8
|
+
months earlier under the same residue name, and the only trace is a log line
|
|
9
|
+
saying the cache was used. The resulting system carries one charge method on
|
|
10
|
+
some residues and another on the rest, and nothing in the output says so.
|
|
11
|
+
|
|
12
|
+
This module writes a small JSON sidecar next to a parameterization recording
|
|
13
|
+
what produced it, and compares that record against what the current run asks
|
|
14
|
+
for. A mismatch is a cache miss. An *absent* record -- any library built
|
|
15
|
+
before sidecars existed -- is a cache hit with a warning, so that existing
|
|
16
|
+
libraries keep working rather than silently re-parameterizing wholesale.
|
|
17
|
+
|
|
18
|
+
Author: Cameron F. Abrams <cfa22@drexel.edu>
|
|
19
|
+
"""
|
|
20
|
+
import json
|
|
21
|
+
import logging
|
|
22
|
+
import os
|
|
23
|
+
|
|
24
|
+
logger = logging.getLogger(__name__)
|
|
25
|
+
|
|
26
|
+
CACHE_KEY_EXT = 'parm'
|
|
27
|
+
"""Filename extension of the sidecar record, alongside gro/top/itp/tpx/grx."""
|
|
28
|
+
|
|
29
|
+
_KEY_FIELDS = (
|
|
30
|
+
('charge_method', 'charge method'),
|
|
31
|
+
('net_charge', 'net charge'),
|
|
32
|
+
('atom_type', 'atom-type set'),
|
|
33
|
+
)
|
|
34
|
+
"""Fields that determine the parameters, with human-readable labels."""
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def build_key(ambertools=None):
|
|
38
|
+
"""Returns the provenance record describing a parameterization run under
|
|
39
|
+
the given AmberTools directives.
|
|
40
|
+
|
|
41
|
+
Defaults come from :data:`htpolynet.external.ambertools.AMBERTOOLS_DEFAULTS`
|
|
42
|
+
so that the record cannot drift from what GAFFParameterize actually does.
|
|
43
|
+
|
|
44
|
+
Args:
|
|
45
|
+
ambertools (dict, optional): ambertools configuration directives
|
|
46
|
+
|
|
47
|
+
Returns:
|
|
48
|
+
dict: provenance record
|
|
49
|
+
"""
|
|
50
|
+
from ..external.ambertools import AMBERTOOLS_DEFAULTS
|
|
51
|
+
ambertools = ambertools or {}
|
|
52
|
+
return {field: ambertools.get(field, AMBERTOOLS_DEFAULTS[field])
|
|
53
|
+
for field, _ in _KEY_FIELDS}
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def key_filename(prefix):
|
|
57
|
+
"""Returns the sidecar filename for the given file basename.
|
|
58
|
+
|
|
59
|
+
Args:
|
|
60
|
+
prefix (str): file basename
|
|
61
|
+
|
|
62
|
+
Returns:
|
|
63
|
+
str: sidecar filename
|
|
64
|
+
"""
|
|
65
|
+
return f'{prefix}.{CACHE_KEY_EXT}'
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def write_key(prefix, key):
|
|
69
|
+
"""Writes a provenance record beside the parameterization it describes.
|
|
70
|
+
|
|
71
|
+
Args:
|
|
72
|
+
prefix (str): file basename
|
|
73
|
+
key (dict): provenance record
|
|
74
|
+
"""
|
|
75
|
+
with open(key_filename(prefix), 'w') as f:
|
|
76
|
+
json.dump(key, f, indent=2, sort_keys=True)
|
|
77
|
+
f.write('\n')
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
def read_key(prefix):
|
|
81
|
+
"""Reads the provenance record for the given file basename.
|
|
82
|
+
|
|
83
|
+
A record that is missing, unreadable, or malformed is reported as absent
|
|
84
|
+
rather than raising, since an unusable record must not be able to abort a
|
|
85
|
+
build that would otherwise have proceeded.
|
|
86
|
+
|
|
87
|
+
Args:
|
|
88
|
+
prefix (str): file basename
|
|
89
|
+
|
|
90
|
+
Returns:
|
|
91
|
+
dict or None: provenance record, or None if absent or unusable
|
|
92
|
+
"""
|
|
93
|
+
fn = key_filename(prefix)
|
|
94
|
+
if not os.path.exists(fn):
|
|
95
|
+
return None
|
|
96
|
+
try:
|
|
97
|
+
with open(fn) as f:
|
|
98
|
+
key = json.load(f)
|
|
99
|
+
except (OSError, ValueError) as m:
|
|
100
|
+
logger.warning(f'Could not read parameterization record {fn} ({m}); treating it as absent')
|
|
101
|
+
return None
|
|
102
|
+
if not isinstance(key, dict):
|
|
103
|
+
logger.warning(f'Parameterization record {fn} is not a JSON object; treating it as absent')
|
|
104
|
+
return None
|
|
105
|
+
return key
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
def describe_mismatch(stored, requested):
|
|
109
|
+
"""Returns human-readable descriptions of every field on which a stored
|
|
110
|
+
record disagrees with what the current run requests.
|
|
111
|
+
|
|
112
|
+
A field absent from the stored record is skipped rather than counted as a
|
|
113
|
+
mismatch, so that adding a field here does not invalidate every record
|
|
114
|
+
written by an earlier version.
|
|
115
|
+
|
|
116
|
+
Args:
|
|
117
|
+
stored (dict or None): record read from the cache
|
|
118
|
+
requested (dict): record describing what this run asks for
|
|
119
|
+
|
|
120
|
+
Returns:
|
|
121
|
+
list: descriptions of the differing fields; empty if the record agrees
|
|
122
|
+
or is absent
|
|
123
|
+
"""
|
|
124
|
+
if not stored:
|
|
125
|
+
return []
|
|
126
|
+
diffs = []
|
|
127
|
+
for field, label in _KEY_FIELDS:
|
|
128
|
+
if field not in stored:
|
|
129
|
+
continue
|
|
130
|
+
if stored[field] != requested.get(field):
|
|
131
|
+
diffs.append(f'{label} {stored[field]!r} cached, {requested.get(field)!r} requested')
|
|
132
|
+
return diffs
|
|
@@ -487,7 +487,7 @@ def fetch_molecule_files(mname):
|
|
|
487
487
|
"""
|
|
488
488
|
ret_exts = []
|
|
489
489
|
dirname = 'molecules/parameterized'
|
|
490
|
-
for e in ['mol2', 'pdb', 'gro', 'top', 'tpx', 'itp', 'grx']:
|
|
490
|
+
for e in ['mol2', 'pdb', 'gro', 'top', 'tpx', 'itp', 'grx', 'parm']:
|
|
491
491
|
prob_filename = os.path.join(dirname, f'{mname}.{e}')
|
|
492
492
|
if exists(prob_filename):
|
|
493
493
|
ret_exts.append(e)
|
htpolynet/core/runtime.py
CHANGED
|
@@ -13,6 +13,7 @@ from copy import deepcopy
|
|
|
13
13
|
import numpy as np
|
|
14
14
|
|
|
15
15
|
from ..analysis.plot import trace
|
|
16
|
+
from ..core import paramcache
|
|
16
17
|
from ..core import projectfilesystem as pfs
|
|
17
18
|
from ..core.configuration import Configuration
|
|
18
19
|
from ..core.molecule import Molecule, MoleculeDict
|
|
@@ -148,6 +149,9 @@ class Runtime:
|
|
|
148
149
|
if restart:
|
|
149
150
|
logger.info(f'Restarting in {pfs.proj()}')
|
|
150
151
|
self.molecules:MoleculeDict={}
|
|
152
|
+
# molecules reused from a library entry that carries no provenance
|
|
153
|
+
# record, collected for a stage-end summary; see generate_molecules
|
|
154
|
+
self.unverified_parameterizations=[]
|
|
151
155
|
self.reactions:ReactionList=[]
|
|
152
156
|
self.molecule_report={}
|
|
153
157
|
self.maxconv=0.0
|
|
@@ -279,6 +283,7 @@ class Runtime:
|
|
|
279
283
|
"""
|
|
280
284
|
for mname,M in self.molecules.items():
|
|
281
285
|
M.origin='unparameterized'
|
|
286
|
+
self.unverified_parameterizations=[]
|
|
282
287
|
pfs.go_to(pfs.Dirs.molecules_parameterized)
|
|
283
288
|
my_logger(f'Templates in {pfs.cwd()}',logger.info)
|
|
284
289
|
ess='' if len(self.molecules)==1 else 's'
|
|
@@ -322,6 +327,8 @@ class Runtime:
|
|
|
322
327
|
logger.info(f'Resolving type discrepancies for directive {resolve_directive}')
|
|
323
328
|
self._type_consistency_check(typename=resolve_directive['typename'],funcidx=resolve_directive.get('funcidx',4),selection_rule=resolve_directive['rule'])
|
|
324
329
|
|
|
330
|
+
self._report_unverified_parameterizations()
|
|
331
|
+
|
|
325
332
|
ess='' if len(self.molecules)==1 else 's'
|
|
326
333
|
logger.info(f'Generated {len(self.molecules)} molecule template{ess}')
|
|
327
334
|
if self.cfg.initial_composition:
|
|
@@ -601,6 +608,96 @@ class Runtime:
|
|
|
601
608
|
except Exception as e:
|
|
602
609
|
logger.warning(f'Could not write profile.json: {e}')
|
|
603
610
|
|
|
611
|
+
def _report_unverified_parameterizations(self):
|
|
612
|
+
"""Summarizes, at the end of the parameterization stage, every molecule
|
|
613
|
+
reused from a library entry whose provenance could not be checked.
|
|
614
|
+
|
|
615
|
+
The per-molecule warning is right for grepping but wrong as the only
|
|
616
|
+
surface: it sits in a log that runs to thousands of lines, alongside
|
|
617
|
+
the ordinary "Using cached parameterization" line that this whole
|
|
618
|
+
mechanism exists because people read straight past. A block at the end
|
|
619
|
+
of the stage is what someone scanning the tail of a log actually hits,
|
|
620
|
+
and it arrives while the expensive part of the build is still ahead of
|
|
621
|
+
them rather than behind.
|
|
622
|
+
"""
|
|
623
|
+
if not self.unverified_parameterizations:
|
|
624
|
+
return
|
|
625
|
+
names = sorted(set(self.unverified_parameterizations))
|
|
626
|
+
ess = '' if len(names) == 1 else 's'
|
|
627
|
+
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:')
|
|
632
|
+
my_logger(names, logger.warning)
|
|
633
|
+
logger.warning('Rebuild them from the current directives with --force-parameterization.')
|
|
634
|
+
|
|
635
|
+
@staticmethod
|
|
636
|
+
def _checkin_parameterization(mname, overwrite):
|
|
637
|
+
"""Checks a molecule's parameterization files into the user library.
|
|
638
|
+
|
|
639
|
+
The provenance record is checked in only when the data files beside it
|
|
640
|
+
are. pfs.checkin() will not replace a file that already exists unless
|
|
641
|
+
told to, and a library entry can be partially populated, so a record
|
|
642
|
+
checked in unconditionally could attach itself to files it does not
|
|
643
|
+
describe -- leaving the library asserting that a gas parameterization
|
|
644
|
+
was built with bcc, which is worse than the missing record it replaced.
|
|
645
|
+
|
|
646
|
+
Args:
|
|
647
|
+
mname (str): molecule name
|
|
648
|
+
overwrite (bool): replace files already in the library
|
|
649
|
+
"""
|
|
650
|
+
entry = f'{pfs.Dirs.molecules_parameterized}/{mname}'
|
|
651
|
+
wrote_data = overwrite or not pfs.exists(f'{entry}.gro')
|
|
652
|
+
for ex in ['mol2', 'top', 'tpx', 'itp', 'gro', 'grx']:
|
|
653
|
+
pfs.checkin(f'{entry}.{ex}', overwrite=overwrite)
|
|
654
|
+
if wrote_data:
|
|
655
|
+
pfs.checkin(f'{entry}.{paramcache.CACHE_KEY_EXT}', overwrite=True)
|
|
656
|
+
|
|
657
|
+
def _cached_parameterization_mismatch(self, M):
|
|
658
|
+
"""Returns descriptions of every way a cached parameterization of M
|
|
659
|
+
disagrees with what this run asks AmberTools for.
|
|
660
|
+
|
|
661
|
+
The cache is keyed on molecule name alone, so without this check a
|
|
662
|
+
configuration requesting one charge method silently reuses a
|
|
663
|
+
parameterization built with another, producing a system with mixed
|
|
664
|
+
charge methods and no indication of it anywhere in the output.
|
|
665
|
+
|
|
666
|
+
A library entry written before provenance records existed carries no
|
|
667
|
+
record to check. That is reported and treated as a match, so that an
|
|
668
|
+
existing library keeps working; --force-parameterization remains the
|
|
669
|
+
way to be certain of what a build used.
|
|
670
|
+
|
|
671
|
+
Args:
|
|
672
|
+
M (Molecule): the molecule whose cached parameterization is in question
|
|
673
|
+
|
|
674
|
+
Returns:
|
|
675
|
+
list: descriptions of the differing directives; empty if the cached
|
|
676
|
+
parameterization agrees with this run or carries no record
|
|
677
|
+
"""
|
|
678
|
+
requested = paramcache.build_key(self.cfg.ambertools)
|
|
679
|
+
# Discard any record left in the project directory by an earlier run so
|
|
680
|
+
# that what we check is the record belonging to the library entry that
|
|
681
|
+
# previously_parameterized() just found.
|
|
682
|
+
local = paramcache.key_filename(M.name)
|
|
683
|
+
if os.path.exists(local):
|
|
684
|
+
os.remove(local)
|
|
685
|
+
keyfile = os.path.join(pfs.Dirs.molecules_parameterized, local)
|
|
686
|
+
if pfs.exists(keyfile):
|
|
687
|
+
pfs.checkout(keyfile)
|
|
688
|
+
stored = paramcache.read_key(M.name)
|
|
689
|
+
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')
|
|
693
|
+
self.unverified_parameterizations.append(M.name)
|
|
694
|
+
return []
|
|
695
|
+
diffs = paramcache.describe_mismatch(stored, requested)
|
|
696
|
+
if diffs:
|
|
697
|
+
logger.info(f'Cached parameterization for {M.name} was built differently than this run requests '
|
|
698
|
+
f'({"; ".join(diffs)}); re-parameterizing')
|
|
699
|
+
return diffs
|
|
700
|
+
|
|
604
701
|
def _generate_molecule(self,M:Molecule,**kwargs):
|
|
605
702
|
"""Generates and parameterizes a single molecule based on the partially complete instance in parameter M.
|
|
606
703
|
|
|
@@ -609,18 +706,23 @@ class Runtime:
|
|
|
609
706
|
"""
|
|
610
707
|
if M.origin!='unparameterized' and M.origin!='symmetry_product': return
|
|
611
708
|
mname=M.name
|
|
612
|
-
checkin=pfs.checkin
|
|
613
709
|
force_parameterization=kwargs.get('force_parameterization',False)
|
|
614
710
|
force_checkin=kwargs.get('force_checkin',False)
|
|
711
|
+
# A cached parameterization is keyed on molecule name, which says nothing
|
|
712
|
+
# about the charge method, net charge or atom types that produced its
|
|
713
|
+
# numbers. Reject one that answers a different question than this run is
|
|
714
|
+
# asking; see _cached_parameterization_mismatch.
|
|
715
|
+
use_cache = (not force_parameterization) and M.previously_parameterized()
|
|
716
|
+
if use_cache and self._cached_parameterization_mismatch(M):
|
|
717
|
+
use_cache = False
|
|
615
718
|
# Either perform a fresh parameterization or fetch parameterization files
|
|
616
|
-
if
|
|
719
|
+
if not use_cache:
|
|
617
720
|
logger.debug(f'Parameterization of {mname} requested -- can we generate {mname}?')
|
|
618
721
|
generatable=(not M.generator) or (all([m in self.molecules for m in M.generator.reactants.values()]))
|
|
619
722
|
if generatable:
|
|
620
723
|
logger.debug(f'Generating {mname}')
|
|
621
724
|
M.generate(available_molecules=self.molecules,gaff=self.cfg.gaff,ambertools=self.cfg.ambertools)
|
|
622
|
-
|
|
623
|
-
checkin(f'{pfs.Dirs.molecules_parameterized}/{mname}.{ex}',overwrite=force_checkin)
|
|
725
|
+
self._checkin_parameterization(mname, force_checkin)
|
|
624
726
|
M.origin='newly parameterized'
|
|
625
727
|
else:
|
|
626
728
|
logger.debug(f'Error: could not generate {mname}')
|
|
@@ -690,9 +792,7 @@ class Runtime:
|
|
|
690
792
|
M.set_sequence_from_moldict(self.molecules)
|
|
691
793
|
M.generate(available_molecules=self.molecules,
|
|
692
794
|
gaff=self.cfg.gaff, ambertools=self.cfg.ambertools)
|
|
693
|
-
|
|
694
|
-
checkin(f'{pfs.Dirs.molecules_parameterized}/{mname}.{ex}',
|
|
695
|
-
overwrite=True)
|
|
795
|
+
self._checkin_parameterization(mname, True)
|
|
696
796
|
M.origin='newly parameterized (stale cache refreshed)'
|
|
697
797
|
else:
|
|
698
798
|
M.origin='previously parameterized'
|
htpolynet/external/ambertools.py
CHANGED
|
@@ -9,11 +9,24 @@ import shutil
|
|
|
9
9
|
|
|
10
10
|
import parmed
|
|
11
11
|
|
|
12
|
+
from ..core import paramcache
|
|
12
13
|
from ..core.coordinates import Coordinates
|
|
13
14
|
from ..external.command import run
|
|
14
15
|
|
|
15
16
|
logger = logging.getLogger(__name__)
|
|
16
17
|
|
|
18
|
+
AMBERTOOLS_DEFAULTS = {
|
|
19
|
+
'charge_method': 'bcc',
|
|
20
|
+
'net_charge': 0,
|
|
21
|
+
'atom_type': 'gaff',
|
|
22
|
+
}
|
|
23
|
+
"""Directives that determine the parameters GAFFParameterize produces.
|
|
24
|
+
|
|
25
|
+
These are the single source of truth for both the antechamber/parmchk2/tleap
|
|
26
|
+
invocations below and the provenance record written beside their output; see
|
|
27
|
+
:mod:`htpolynet.core.paramcache`.
|
|
28
|
+
"""
|
|
29
|
+
|
|
17
30
|
|
|
18
31
|
def GAFFParameterize(inputPrefix, outputPrefix, input_structure_format='mol2', ambertools=None):
|
|
19
32
|
"""Manages execution of antechamber, parmchk2, and tleap to generate GAFF parameters,
|
|
@@ -29,7 +42,9 @@ def GAFFParameterize(inputPrefix, outputPrefix, input_structure_format='mol2', a
|
|
|
29
42
|
parmed.exceptions.GromacsError: if parmed fails to convert tleap output
|
|
30
43
|
"""
|
|
31
44
|
ambertools = ambertools or {}
|
|
32
|
-
chargemethod = ambertools.get('charge_method', '
|
|
45
|
+
chargemethod = ambertools.get('charge_method', AMBERTOOLS_DEFAULTS['charge_method'])
|
|
46
|
+
netcharge = ambertools.get('net_charge', AMBERTOOLS_DEFAULTS['net_charge'])
|
|
47
|
+
atomtype = ambertools.get('atom_type', AMBERTOOLS_DEFAULTS['atom_type'])
|
|
33
48
|
logger.info(f'AmberTools> generating GAFF parameters from {inputPrefix}.{input_structure_format}')
|
|
34
49
|
|
|
35
50
|
structin = f'{inputPrefix}.{input_structure_format}'
|
|
@@ -47,9 +62,9 @@ def GAFFParameterize(inputPrefix, outputPrefix, input_structure_format='mol2', a
|
|
|
47
62
|
shutil.copy(structin, new_structin)
|
|
48
63
|
|
|
49
64
|
run(f'antechamber -j 4 -fi {input_structure_format} -fo mol2 -c {chargemethod}'
|
|
50
|
-
f' -at
|
|
65
|
+
f' -at {atomtype} -i {new_structin} -o {mol2out} -pf Y -nc {netcharge} -eq 1 -pl 10', quiet=False)
|
|
51
66
|
logger.debug(f'AmberTools> Antechamber generated {mol2out}')
|
|
52
|
-
run(f'parmchk2 -i {mol2out} -o {frcmodout} -f mol2 -s
|
|
67
|
+
run(f'parmchk2 -i {mol2out} -o {frcmodout} -f mol2 -s {atomtype}', quiet=False)
|
|
53
68
|
|
|
54
69
|
# Antechamber ignores SUBSTRUCTURE records, so patch the antechamber output
|
|
55
70
|
# mol2 with the original resName/resNum before passing it to tleap.
|
|
@@ -70,7 +85,7 @@ def GAFFParameterize(inputPrefix, outputPrefix, input_structure_format='mol2', a
|
|
|
70
85
|
|
|
71
86
|
with open(f'{inputPrefix}-tleap.in', 'w') as f:
|
|
72
87
|
f.write('\n'.join([
|
|
73
|
-
'source leaprc.
|
|
88
|
+
f'source leaprc.{atomtype}',
|
|
74
89
|
# Load parmchk2's patches BEFORE checking the molecule, otherwise
|
|
75
90
|
# `check` reports any GAFF-coverage gaps (e.g. h5-ce-n2 on cyanate-
|
|
76
91
|
# ester dimers) as `Error!`, the run-wrapper's override needle
|
|
@@ -100,3 +115,7 @@ def GAFFParameterize(inputPrefix, outputPrefix, input_structure_format='mol2', a
|
|
|
100
115
|
logger.error('Unspecified parmed error')
|
|
101
116
|
raise parmed.exceptions.GromacsError(m) from m
|
|
102
117
|
|
|
118
|
+
# Record what produced these parameters, so that a later run reusing them
|
|
119
|
+
# from the library can tell whether they answer the question it is asking.
|
|
120
|
+
paramcache.write_key(outputPrefix, paramcache.build_key(ambertools))
|
|
121
|
+
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: htpolynet
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.3.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/
|
|
@@ -42,6 +42,7 @@ Description-Content-Type: text/markdown
|
|
|
42
42
|
[](https://github.com/cameronabrams/htpolynet/blob/main/LICENSE)
|
|
43
43
|
[](https://htpolynet.readthedocs.io/en/latest/)
|
|
44
44
|
[](https://pepy.tech/projects/htpolynet)
|
|
45
|
+
[](https://doi.org/10.5281/zenodo.22070252)
|
|
45
46
|
|
|
46
47
|
htpolynet is a Python utility for generating atomistic models of cross-linked polymer networks together with appropriate topology and parameter files required for molecular dynamics simulations using Gromacs. It is intended as a fully automated system builder requiring as inputs only the molecular structures of any monomer species, a description of the polymerization chemistry, and a handful of options describing desired system size and composition. htpolynet uses the Generalized Amber Force Field for atom-typing and parameter generation.
|
|
47
48
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
htpolynet/__init__.py,sha256=_ApfhZLLP4Hd3b5ZCHAw6FHEj2VpQhu3RrZrZPiTef4,80
|
|
2
|
-
htpolynet/cli.py,sha256=
|
|
2
|
+
htpolynet/cli.py,sha256=s0ZjMStMnE7UHliBp7m1MDGFZB0zM7B6bwwoqCcUo4M,15141
|
|
3
3
|
htpolynet/analysis/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
4
|
htpolynet/analysis/analyze.py,sha256=dJMEWDJ1RpRut8nJhPQD7dmW25qiZ1asjnPEEfykAWU,9106
|
|
5
5
|
htpolynet/analysis/plot.py,sha256=ncLduM4cK7ncQjksE2qL0Z086gqQOCpMs66rlI7AbOk,33020
|
|
@@ -9,9 +9,10 @@ htpolynet/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
|
9
9
|
htpolynet/core/bondtemplate.py,sha256=Sz_K7ZhyHzj_dCBjDASlhzm3cXgIwAvHIgIanvuld5s,8512
|
|
10
10
|
htpolynet/core/configuration.py,sha256=CsfCE6_SwwFgN6BdY-4cWrQKAIcVNE1mxp2_qyQaJ9Y,3052
|
|
11
11
|
htpolynet/core/coordinates.py,sha256=CGTHkdfw2ikc2ANacA5akRhZ9tOyM2IbELwQ2FVcKRw,23878
|
|
12
|
-
htpolynet/core/molecule.py,sha256=
|
|
13
|
-
htpolynet/core/
|
|
14
|
-
htpolynet/core/
|
|
12
|
+
htpolynet/core/molecule.py,sha256=xUA52zkRMyAFCE8LbXvXghweDCPkrgD4rx1mcimddn0,52751
|
|
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
|
|
15
16
|
htpolynet/core/topocoord.py,sha256=jtQcwzvzPVNjU9VxBF9iXw8g3KiY55_jGDlwAZDOSjs,101564
|
|
16
17
|
htpolynet/core/topology.py,sha256=XcFL96x2E4MsMrUr9upjE211-VcPVwLVoPL9vrV4DOw,56954
|
|
17
18
|
htpolynet/cure/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -20,7 +21,7 @@ htpolynet/cure/curecontroller.py,sha256=a97x1GaJ7Q2ayDEN48K4QHS9EOCPEljraUN_joR9
|
|
|
20
21
|
htpolynet/cure/expandreactions.py,sha256=_NNsAuOCdgHMBLyEwl6S7VAZyDT5ei-m4OBBXjDE3YQ,13774
|
|
21
22
|
htpolynet/cure/reaction.py,sha256=S-w60HocYknKnGbq1_uwLpKTL5Fte_o7zxwk3FbyQ1I,10557
|
|
22
23
|
htpolynet/external/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
23
|
-
htpolynet/external/ambertools.py,sha256=
|
|
24
|
+
htpolynet/external/ambertools.py,sha256=W3Ut9z7XovJcrxfgkL8eyP-Q0tKmyK1awfAcEafNxB0,5307
|
|
24
25
|
htpolynet/external/command.py,sha256=KYmWV8P4nuw_ciE16WazviorxjGj5un_z7dL62n0TG0,2480
|
|
25
26
|
htpolynet/external/gromacs.py,sha256=KEtHA4TuHaSA_nFXoz2NyrX3JUr9a733-KkOv5BE4Lc,12848
|
|
26
27
|
htpolynet/external/slurm.py,sha256=FvnKyNqFXgDe5bdTDB4Kcn9KU4mxq9Gcw675SzU-4w0,4082
|
|
@@ -94,8 +95,8 @@ htpolynet/utils/logsetup.py,sha256=o0mlVXNzqcfua2SAlJPkGSh4lM_bmI10gWwpb9gqYu8,1
|
|
|
94
95
|
htpolynet/utils/profiling.py,sha256=su7qpGEz6FXVU4KT2HQDWG82bc1sgsfpDQBbAfPpsHc,7331
|
|
95
96
|
htpolynet/utils/stringthings.py,sha256=Mr6o55EM8o4YAaVYpjIJj2IxDToNdbPzb-lpQ3w3jFk,1176
|
|
96
97
|
htpolynet/utils/vmd_viz.py,sha256=Crk3Ln88PKiJ9X7DMMkFEVh2Ru6a1y0RUgj3w6EIgFc,10867
|
|
97
|
-
htpolynet-2.
|
|
98
|
-
htpolynet-2.
|
|
99
|
-
htpolynet-2.
|
|
100
|
-
htpolynet-2.
|
|
101
|
-
htpolynet-2.
|
|
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,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|