Skip to content
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
303 commits
Select commit Hold shift + click to select a range
08c5b8a
fix problem reloading objects with no deps
dwhswenson Feb 14, 2018
9cc896c
Reloading networks works
dwhswenson Feb 14, 2018
aa122b8
starting toward pseudo-tables in new storage
dwhswenson Feb 14, 2018
73ccdb4
Merge remote-tracking branch 'upstream/master' into storage
dwhswenson Feb 15, 2018
0c47ed8
Pseudo-tables (for volumes, ensembles, etc)
dwhswenson Feb 15, 2018
66acbb4
Fixes to get Details stored
dwhswenson Feb 15, 2018
56625bd
can reload move changes & details
dwhswenson Feb 15, 2018
52a4ab4
runs toy MSTIS correctly!
dwhswenson Feb 16, 2018
1b576dd
refactoring for readability
dwhswenson Feb 16, 2018
4cfa935
refactoring storage loading
dwhswenson Feb 16, 2018
1c6e505
pylint cleanup
dwhswenson Feb 16, 2018
e2a3f2e
Clear out unused code
dwhswenson Feb 16, 2018
381fab7
tests & docstrings in sql_backend
dwhswenson Feb 17, 2018
36c3f54
more testing; more cleanup
dwhswenson Feb 17, 2018
aa8b1ee
Tests for get_all_uuids and some other UUID funcs
dwhswenson Feb 19, 2018
e8a8944
Tests & docs for replace_uuid
dwhswenson Feb 19, 2018
5bc05dd
tests for search_caches
dwhswenson Feb 19, 2018
79790b6
docs & tests for from_dict_with_uuids
dwhswenson Feb 19, 2018
e1b099f
tests & docs for _uuids_from_table_row
dwhswenson Feb 20, 2018
1ee80fb
steps toward performance improvements (find UUIDs)
dwhswenson Feb 20, 2018
6c9753a
Merge remote-tracking branch 'upstream/master' into storage
dwhswenson Feb 27, 2018
0d5133f
Updates as I start to refactor new storage
dwhswenson Mar 16, 2018
f72826c
Start on reorg of lazy object creation
dwhswenson Mar 28, 2018
b6a780f
Merge remote-tracking branch 'upstream/master' into storage
dwhswenson May 5, 2018
85b7b48
Updates on storage progress
dwhswenson May 5, 2018
cd21864
saving performance improvements
dwhswenson May 11, 2018
67eb67a
experimental package, exptl.storage subpackage
dwhswenson May 31, 2018
c2bd886
SerializationScheme for (some) simulation objs
dwhswenson May 31, 2018
8264105
Merge remote-tracking branch 'upstream/master' into storage
dwhswenson May 31, 2018
3e9a9a8
SerializationSchema can serialize snapshots
dwhswenson May 31, 2018
fc83ca0
snapshots reload with SerializationSchema
dwhswenson May 31, 2018
29fd056
Monkey patch CallableCV.from_dict
dwhswenson Jun 1, 2018
ab00c7e
Fix deserialization of uuid_list (e.g, trajs)
dwhswenson Jun 1, 2018
0ab74e0
switch to uses lists in get_all_uuids
dwhswenson Jun 13, 2018
dda720c
Add dependencies for schema objs with JSON entries
dwhswenson Jun 16, 2018
3ed834e
Merge remote-tracking branch 'upstream/master' into storage
dwhswenson Jun 21, 2018
70f1098
minor text update
dwhswenson Jun 21, 2018
eef5f52
Updates for first parallel RETIS
dwhswenson Jul 21, 2018
00a2cfb
Merge remote-tracking branch 'upstream/master' into storage
dwhswenson Jul 24, 2018
2218af3
Fix case where find_uuids is None
dwhswenson Jul 24, 2018
797e638
Merge remote-tracking branch 'upstream/master' into storage
dwhswenson Sep 17, 2018
d97ee22
Merge remote-tracking branch 'upstream/master' into storage
dwhswenson Oct 8, 2018
801fe70
Merge remote-tracking branch 'upstream/master' into storage
dwhswenson Dec 26, 2018
ba834b6
Updates to get this run MSTIS working again
dwhswenson Dec 30, 2018
7889b31
class_lookup performance improvements
dwhswenson Dec 31, 2018
7a7198e
comment out things that aren't being used
dwhswenson Jan 1, 2019
36f0115
performance improvements
dwhswenson Jan 2, 2019
b3c23a0
more tests for serialization_helpers
dwhswenson Jan 3, 2019
03e092e
Steps toward Python 3 support in new storage
dwhswenson Jan 31, 2019
85d1114
py3 fixes in tests
dwhswenson Jan 31, 2019
574e118
Merge remote-tracking branch 'upstream/master' into storage
dwhswenson Jan 31, 2019
5f39c7a
fix collections.abc warnings; prepare for new json
dwhswenson Feb 1, 2019
0e1e2cf
Add custom JSON codecs (for numpy, etc)
dwhswenson Feb 1, 2019
f3bd2b6
Integrate custom JSON. All notebooks run now!
dwhswenson Feb 1, 2019
44937ae
MAJOR performance improvements in get_all_uuids
dwhswenson Feb 1, 2019
9630030
Update to stash between save steps. This is FAST!
dwhswenson Feb 1, 2019
99734c6
Additional test for custom_json
dwhswenson Feb 8, 2019
4433529
Move mocks into test_utils.py
dwhswenson Feb 9, 2019
0f3736c
Change "Default" Ser/Deser to "Schema"
dwhswenson Feb 12, 2019
f5af6d9
Replace old Serialization obj with ProxyObjFactory
dwhswenson Feb 12, 2019
4d7e571
Simplify SerializationSchema.__get_item__
dwhswenson Feb 19, 2019
77f88de
Merge remote-tracking branch 'upstream/master' into storage
dwhswenson Apr 1, 2019
350235d
more improvements (& docs) on JSON extensions
dwhswenson Apr 6, 2019
cff23f6
Merge branch 'master' of github.com:openpathsampling/openpathsampling…
dwhswenson Apr 7, 2019
4f901f2
Start to test_class_info; restructure mocks
dwhswenson Apr 23, 2019
112175a
update to use wrapper for custom json codecs
dwhswenson May 1, 2019
6bae127
Merge remote-tracking branch 'upstream/master' into storage
dwhswenson May 1, 2019
405620f
test for add_codec in the custom JSON stuff
dwhswenson May 2, 2019
0da8607
Tests for serialization_schema w/out specials
dwhswenson May 3, 2019
e3edeea
Tests for SerializationSchema with specials
dwhswenson May 3, 2019
c6a535d
use ClassLookup for OPSSpecialLookup
dwhswenson May 3, 2019
b5b239b
listify tests
dwhswenson May 8, 2019
aeeb017
Tests for mock backend; clean comments in ser
dwhswenson May 10, 2019
8747c77
Start to tests for proxy objects
dwhswenson May 14, 2019
a035c3d
more test setup for proxies
dwhswenson May 14, 2019
534367e
tests for proxy factory
dwhswenson May 15, 2019
97fd51a
Test for get_all_uuids_loading
dwhswenson May 16, 2019
4a99bb6
start on tests for storage tables
dwhswenson May 16, 2019
5d6eb96
basic tests for PseudoTable
dwhswenson May 17, 2019
0aabd08
Merge remote-tracking branch 'upstream/master' into storage
dwhswenson Jul 4, 2019
d32e4d4
finish tests for pseudotable
dwhswenson Jul 4, 2019
734ca70
test serialization of proxy
dwhswenson Jul 7, 2019
676d29a
Merge remote-tracking branch 'upstream/master' into storage
dwhswenson Jul 11, 2019
0783929
tool for serializing dict with tuple keys
dwhswenson Aug 10, 2019
c5ff104
monkey-patch helpers; better backend loading
dwhswenson Aug 11, 2019
2e59c3a
Merge remote-tracking branch 'upstream/master' into storage
dwhswenson Aug 11, 2019
d855347
storage uses PseudoTables (instead of dicts)
dwhswenson Aug 11, 2019
897ce8a
see everything in pseudotables; reload tables
dwhswenson Aug 11, 2019
197fc1b
More steps toward loading (need to fix proxies)
dwhswenson Aug 11, 2019
88fd724
More fixes for loading/analysis
dwhswenson Aug 12, 2019
6488145
Minor updates preparing for storable functions
dwhswenson Sep 17, 2019
0a9e7ea
add storage.filter_existing_uuids
dwhswenson Sep 18, 2019
902dcff
Add callable codec and tests
dwhswenson Sep 19, 2019
11f6c2c
Add tests for most of snapshots.py
dwhswenson Jan 22, 2020
92cab3e
Add tests for dict serialization helpers
dwhswenson Jan 22, 2020
f94f84e
Tests for a few more functions in sql_backend
dwhswenson Jan 22, 2020
bc7d238
Merge remote-tracking branch 'upstream/master' into storage
dwhswenson Jan 22, 2020
9f8a876
delete unused files
dwhswenson Feb 3, 2020
69782cb
sql backend for storable functions
dwhswenson Mar 13, 2020
f80eb26
Merge remote-tracking branch 'upstream/master' into storage
dwhswenson Mar 13, 2020
2c98789
Merge branch 'storage' into storable_functions
dwhswenson Apr 1, 2020
e578985
Merge remote-tracking branch 'upstream/master' into storable_functions
dwhswenson Apr 1, 2020
38cdcdd
External engine communicating exit
oliverdutton Apr 30, 2020
a65682f
Merge remote-tracking branch 'upstream/master' into storage
dwhswenson May 14, 2020
b1110c3
Basic storable funcs
dwhswenson May 19, 2020
855f0fb
In code keep_half string used as option, but says 50% in docs, they'r…
oliverdutton May 24, 2020
2914fac
Added snapshot_timestep to options dict (proper integration of readin…
oliverdutton May 24, 2020
c2d47f0
Added Bolhuis example to PES presets for my own uses, probs shouldn't…
oliverdutton May 24, 2020
f0ced85
Steps toward "gather" for StorableFunctionResults
dwhswenson Jun 9, 2020
baec27f
can reload storable funcs from storage
dwhswenson Jun 9, 2020
ecd144c
Add preload cache; support for parallel CV gather
dwhswenson Jun 10, 2020
deac34f
storable funcs now seem to work!
dwhswenson Jun 17, 2020
28e5064
start to StorableFunctionConfig
dwhswenson Jun 19, 2020
0c1cf23
I think this is working StorableFuncConfig
dwhswenson Jun 20, 2020
d583e79
Tests for StorageFunctionHandler
dwhswenson Jun 24, 2020
59942a0
Add CVs, including MDTrajFunctionCV
dwhswenson Jun 25, 2020
36654d5
Add SimStore support to ExternalMDSnapshot
dwhswenson Jun 25, 2020
0afac9e
fixes to get Gromacs traj running with SimStore
dwhswenson Jun 26, 2020
26ea346
Fixes to test errors introduced in CallableCodec
dwhswenson Jul 14, 2020
21f4cc0
Remove unused class_idx
dwhswenson Jul 14, 2020
bf70519
Mostly working memory backend for network xfer
dwhswenson Jul 17, 2020
68c2d9e
use tobytes() and pep8
sroet Jul 20, 2020
289219d
Update of PR for reactive flux method
singraber Jul 20, 2020
9f816e0
Merge remote-tracking branch 'upstream/master' into storage
dwhswenson Jul 28, 2020
78dd77f
Merge remote-tracking branch 'upstream/master' into storable_functions
dwhswenson Jul 28, 2020
dabccfc
Merge branch 'storage' into storable_functions
dwhswenson Jul 28, 2020
c420649
Add MDTraj JSON codecs (and tests)
dwhswenson Jul 30, 2020
8ad72d2
Improvements to gmx engine tools
dwhswenson Jul 21, 2020
0761836
Modifications to external/gmx for parallelization
dwhswenson Jul 23, 2020
6f78c45
Add internalized snapshots (& some docstrings)
dwhswenson Aug 3, 2020
b66f5de
Add _InternalizedEngineProxy and tests
dwhswenson Aug 6, 2020
40ca424
add pytest.ini
dwhswenson Sep 17, 2020
9eeeb25
Merge branch 'clean-devtools' into storage
dwhswenson Sep 17, 2020
102c79b
Merge branch 'devtools_cleanup' into storage
dwhswenson Sep 17, 2020
0b9ee90
CI section for tests on experimental packages
dwhswenson Sep 17, 2020
4b15df4
don't run experimental tests in minimal
dwhswenson Sep 17, 2020
0e02c21
use blocksize in storage table iterator
dwhswenson Sep 17, 2020
c9497c6
Merge remote-tracking branch 'upstream/master' into storage
dwhswenson Sep 23, 2020
1613b34
SQL backend fixes that Sander found
dwhswenson Sep 23, 2020
47e0cfe
Update openpathsampling/experimental/storage/serialization_helpers.py
dwhswenson Sep 23, 2020
0af4f7d
allow negative indices in tables
dwhswenson Sep 23, 2020
66a38be
Merge branch 'storage' into storable_functions
dwhswenson Sep 23, 2020
22b63d0
Changes to make storage objects storable
dwhswenson Jul 22, 2020
2c68356
use mixed cache for existing sim objs
dwhswenson Sep 24, 2020
bc371b1
cache clearing when iterating StorageTable
dwhswenson Sep 24, 2020
efbf0cb
draft StorageTable.cache_all()
dwhswenson Sep 24, 2020
47d92f8
Merge branch 'storage' into storable_functions
dwhswenson Sep 24, 2020
3e4ce61
fix problem with identifier for sqlite :memory:
dwhswenson Sep 24, 2020
b77319c
Fix a potential bug in saving storage identifiers
dwhswenson Sep 24, 2020
65f71e1
fix obvious mistake
dwhswenson Sep 24, 2020
592429e
Remove cache from StorageTable.__init__ (unused)
dwhswenson Sep 24, 2020
c3fbbe0
Update openpathsampling/experimental/storage/storage.py
dwhswenson Sep 24, 2020
1295837
Rename and reduce system
dwhswenson Sep 25, 2020
3e371b5
Finish renaming and cleaning __init__.py
dwhswenson Sep 25, 2020
55dd27c
Merge branch 'storage' of github.com:dwhswenson/openpathsampling into…
dwhswenson Sep 25, 2020
ec5213d
correct test with && in bash
dwhswenson Sep 25, 2020
fbe2b05
add simstore __init__
dwhswenson Sep 25, 2020
5269918
Merge branch 'storage' into storable_functions
dwhswenson Sep 25, 2020
dc455c7
fix (most) test issues after renaming
dwhswenson Sep 25, 2020
1513273
StorageTable no longer takes a cache
dwhswenson Sep 25, 2020
ed47cc3
Bump version to 1.4.0.dev0
dwhswenson Sep 26, 2020
05646a1
Merge pull request #931 from dwhswenson/bump-1.4.0.dev0
dwhswenson Sep 26, 2020
956fa9c
Add CLI docs to core
dwhswenson Sep 26, 2020
bd79890
Merge remote-tracking branch 'upstream/master' into gmx_updates
dwhswenson Sep 27, 2020
899029b
fix for py27
dwhswenson Sep 27, 2020
b2fdfad
missed one
dwhswenson Sep 27, 2020
5570cd3
Merge pull request #932 from dwhswenson/cli_docs
dwhswenson Sep 27, 2020
55e2888
add some tests
dwhswenson Sep 29, 2020
e6c9943
more testing for gmx updates
dwhswenson Oct 1, 2020
f2a4e46
fix TestGroFileEngine for CI
dwhswenson Oct 1, 2020
29da5dc
add dict serialization cycle test for GroFileEng
dwhswenson Oct 1, 2020
e220a9a
clearer error message
dwhswenson Oct 13, 2020
a2706cc
build index on uuid table on creation
dwhswenson Oct 13, 2020
bc97663
start to using nbsphinx for notebooks
dwhswenson Oct 14, 2020
0cb85b2
Update openpathsampling/engines/external_engine.py
dwhswenson Oct 14, 2020
42d186f
Merge pull request #935 from dwhswenson/storage-error-message
dwhswenson Oct 14, 2020
b5b6f0a
Merge pull request #933 from dwhswenson/gmx_updates
dwhswenson Oct 14, 2020
ace9d7e
Merge pull request #928 from dwhswenson/storage
dwhswenson Oct 15, 2020
f0c5e51
some nbsphinx integration; improve docs/examples
dwhswenson Oct 16, 2020
fcc39dc
pretty much ready to re-run the AD TPS now
dwhswenson Oct 16, 2020
db3f5c3
solve another depr warning
sroet Oct 17, 2020
fcff10b
allow python27
sroet Oct 17, 2020
7c7cf7c
Merge pull request #936 from sroet/fix_py_39_depr
dwhswenson Oct 17, 2020
76b2f88
Update and re-run AD TPS example (flex-length)
dwhswenson Oct 17, 2020
03408fc
move discussion of visit all ensemble to topics
dwhswenson Oct 17, 2020
3fc22d3
Apply suggestions from code review
dwhswenson Oct 20, 2020
6430927
Merge remote-tracking branch 'upstream/master' into storable_functions
dwhswenson Oct 20, 2020
723e8bf
fix existing storage loading
dwhswenson Oct 20, 2020
7f52f0c
OpenMM inst temp should work if positions not set
dwhswenson Oct 22, 2020
f62b4b4
remove commented code
dwhswenson Oct 22, 2020
d93df76
Merge remote-tracking branch 'origin/fix_openmm_inst_temp' into nbsphinx
dwhswenson Oct 22, 2020
25b3a41
Update fixed-len AD TPS example
dwhswenson Oct 23, 2020
7499787
Merge branch 'nbsphinx' of github.com:dwhswenson/openpathsampling int…
dwhswenson Oct 23, 2020
14a888e
Merge pull request #938 from dwhswenson/fix_openmm_inst_temp
dwhswenson Oct 23, 2020
67177a1
add SnapshotsTable class (and tests)
dwhswenson Oct 23, 2020
e32c198
integrate SnapshotsTable into storage
dwhswenson Oct 23, 2020
04a8a60
update filenames in example text
dwhswenson Oct 23, 2020
8bf22d9
Merge pull request #937 from dwhswenson/nbsphinx
dwhswenson Oct 24, 2020
7e3a5be
fix error in finding UUIDs in no-caching mode
dwhswenson Oct 24, 2020
08564c1
Merge remote-tracking branch 'upstream/master' into storable_functions
dwhswenson Oct 24, 2020
14d9913
add simstore support to interface sets
dwhswenson Oct 24, 2020
8dac4c5
fixes for correctly recreating names
dwhswenson Oct 24, 2020
b3de252
better treatment of problems with name params
dwhswenson Oct 24, 2020
2b46284
Minor improvements on CLI docs
dwhswenson Oct 26, 2020
c9f02c3
Merge pull request #939 from dwhswenson/cli_docs_fix
dwhswenson Oct 26, 2020
ea4d6bb
Initial support for tags in SimStore
dwhswenson Oct 29, 2020
86eafe2
Merge pull request #929 from dwhswenson/storable_functions
dwhswenson Oct 31, 2020
0877580
docstrings; fix up things for SimStore on CLI
dwhswenson Oct 31, 2020
fa40a71
Merge remote-tracking branch 'upstream/master' into simstore-tags
dwhswenson Oct 31, 2020
bd0cd64
Add type_ident and tests
dwhswenson Nov 1, 2020
fb65104
Merge pull request #940 from dwhswenson/simstore-tags
dwhswenson Nov 3, 2020
934c4bb
Fix bug in SimStore when appending to non-existent
dwhswenson Nov 7, 2020
aa1a7c5
Integrate type IDing with function result storage
dwhswenson Nov 9, 2020
dace6e8
Update openpathsampling/experimental/simstore/test_sql_backend.py
dwhswenson Nov 9, 2020
4a77d33
consistently use `from collections import abc`
dwhswenson Nov 9, 2020
fc27a9d
Merge pull request #941 from dwhswenson/fix-simstore-append
dwhswenson Nov 9, 2020
44c6b29
Fix SyntaxWarning (resolves #943).
bdice Nov 17, 2020
6ee9733
Merge pull request #944 from bdice/fix/syntaxwarning-literal
dwhswenson Nov 17, 2020
a883e19
fix for filname counter of gromacs engine
hejung Nov 17, 2020
67518ed
Merge pull request #946 from hejung/fix_gromacs_engine
dwhswenson Nov 18, 2020
bf38610
Finish type ident in storable funcs
dwhswenson Nov 28, 2020
f5dc3a5
Merge remote-tracking branch 'upstream/master' into simstore-typing
dwhswenson Nov 28, 2020
49ffebc
Merge pull request #947 from dwhswenson/simstore-typing
dwhswenson Dec 1, 2020
a67f164
Refactor for attribute handler factories
dwhswenson Dec 1, 2020
51cbccd
redo attribute handlers; integrate for ndarray
dwhswenson Dec 3, 2020
31892e9
complete transition to attribute handlers (numpy)
dwhswenson Dec 3, 2020
1a2ae80
support for simtk units (needs tests)
dwhswenson Dec 3, 2020
c4d0ade
most of the way to storing OpenMM snapshots
dwhswenson Dec 4, 2020
d4546e2
Add engine to StaticContainer/KineticContainer
dwhswenson Dec 4, 2020
b8fa05d
Seems like I can store/load OpenMM snapshots now!
dwhswenson Dec 5, 2020
1523850
move proxy and UUID stuff to their own files
dwhswenson Dec 12, 2020
7224f2e
Fix test for new file locs
dwhswenson Dec 12, 2020
4e29269
docstrings
dwhswenson Dec 12, 2020
c5b6f78
Misc fixes to get the new tutorial to work
dwhswenson Dec 12, 2020
1bf7a16
tests for attribute_handler.py
dwhswenson Dec 19, 2020
9e901bf
Additional test for scalarize_singletons
dwhswenson Dec 19, 2020
8f97732
tests for simstore/simtk-quantity serialization
dwhswenson Dec 20, 2020
62d09d6
integration tests for openmm snapshots
dwhswenson Dec 20, 2020
4267456
simplify constructor for OPS Storage
dwhswenson Dec 21, 2020
9495b54
Merge pull request #949 from dwhswenson/simstore-openmm
dwhswenson Dec 23, 2020
8a39b66
Merge remote-tracking branch 'upstream/master' into simstore-simplify
dwhswenson Dec 23, 2020
3c9ef75
Merge pull request #950 from dwhswenson/simstore-simplify
dwhswenson Dec 23, 2020
9671b53
Merge pull request #923 from sroet/fix_np_1_19_depr
dwhswenson Dec 23, 2020
c6095fd
Merge pull request #913 from oliverdutton/master
dwhswenson Dec 23, 2020
6b0ff89
Revert "Added Bolhuis example to PES presets for my own uses, probs s…
dwhswenson Dec 23, 2020
abfc895
Merge pull request #951 from dwhswenson/revert-c2d47f0
dwhswenson Dec 23, 2020
51f1011
Merge branch 'master' into reactive_flux_updated_pr
dwhswenson Dec 23, 2020
56f52ad
Merge pull request #924 from singraber/reactive_flux_updated_pr
dwhswenson Dec 23, 2020
756dc6f
Release 1.4.0
dwhswenson Dec 23, 2020
f7650b6
try fix in autorelease
dwhswenson Dec 23, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion openpathsampling/engines/features/kinetics.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@

dimensions = ['n_atoms', 'n_spatial']

_vel_unit = "simtk(unit.nanometer/unit.picosecond)"
_vel_str = "ndarray.float32({n_atoms},{n_spatial})"
schema_entries = [
('kinetics', [
('velocities', _vel_unit + "*" + _vel_str),
('engine', 'uuid'),
]),
('is_reversed', 'bool'),
]


def netcdfplus_init(store):
kinetic_store = KineticContainerStore()
Expand Down Expand Up @@ -50,7 +60,7 @@ def velocities(self):
@velocities.setter
def velocities(self, value):
if value is not None:
kc = KineticContainer(velocities=value)
kc = KineticContainer(velocities=value, engine=self.engine)
else:
kc = None

Expand Down
77 changes: 17 additions & 60 deletions openpathsampling/engines/features/shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def unmask_quantity(quantity):
return quantity
return np.array(quantity.value_in_unit(q_unit)) * q_unit


# =============================================================================
# SIMULATION CONFIGURATION
# =============================================================================
Expand All @@ -36,53 +37,24 @@ class StaticContainer(StorableObject):
Simulation configuration. Only Coordinates, the associated boxvectors
and the potential_energy

Attributes
Parameters
----------
coordinates : simtk.unit.Quantity wrapping Nx3 np array of dimension length
atomic coordinates
box_vectors : periodic box vectors
the periodic box vectors

engine : :class:`.DynamicsEngine`
the engine that creating this data
"""

# Class variables to store the global storage and the system context
# describing the system to be saved as configuration_indices

def __init__(self, coordinates, box_vectors):
"""
Create a simulation configuration from either an OpenMM context or
individually-specified components.

Parameters
----------
coordinates
box_vectors
"""

def __init__(self, coordinates, box_vectors, engine=None):
super(StaticContainer, self).__init__()

self.coordinates = copy.deepcopy(coordinates)
self.box_vectors = copy.deepcopy(box_vectors)

# if self.coordinates is not None:
# # Check for nans in coordinates, and raise an exception if
# # something is wrong.
# if type(self.coordinates) is unit.Quantity:
# coords = self.coordinates._value
# else:
# coords = self.coordinates
#
# if np.any(np.isnan(coords)):
# bad_atoms = [i for i in range(len(coords))
# if np.any(np.isnan(coords[i]))]
# raise ValueError("Coordinates went 'nan' for atoms: " +
# str(bad_atoms))

return

# =========================================================================
# Comparison functions
# =========================================================================
self.engine = engine

@property
def n_atoms(self):
Expand All @@ -91,10 +63,6 @@ def n_atoms(self):
"""
return self.coordinates.shape[0]

# =========================================================================
# Utility functions
# =========================================================================

def copy(self):
"""
Returns a deep copy of the instance itself using a subset of coordinates.
Expand All @@ -108,10 +76,11 @@ def copy(self):
"""

return StaticContainer(coordinates=self.coordinates,
box_vectors=self.box_vectors
)
box_vectors=self.box_vectors,
engine=self.engine)

def to_dict(self):
# note: to_dict not used here in SimStore, so no need to change
return {
'coordinates': self.coordinates,
'box_vectors': self.box_vectors
Expand Down Expand Up @@ -149,7 +118,8 @@ def _load(self, idx):
if not np.count_nonzero(box_vectors):
box_vectors = None

configuration = StaticContainer(coordinates=coordinates, box_vectors=box_vectors)
configuration = StaticContainer(coordinates=coordinates,
box_vectors=box_vectors)

return configuration

Expand Down Expand Up @@ -214,26 +184,14 @@ class KineticContainer(StorableObject):
----------
velocities : simtk.unit.Quantity wrapping Nx3 np array of dimension length
atomic velocities

engine : :class:`.DynamicsEngine`
the engine that creating this data
"""

def __init__(self, velocities):
"""
Create a simulation momentum from either an OpenMM context or
individually-specified components.

Parameters
----------
velocities
"""

def __init__(self, velocities, engine=None):
super(KineticContainer, self).__init__()

self.velocities = copy.deepcopy(velocities)

# =========================================================================
# Utility functions
# =========================================================================
self.engine = engine

def copy(self):
"""
Expand All @@ -245,9 +203,8 @@ def copy(self):
Momentum()
the shallow copy
"""

this = KineticContainer(velocities=self.velocities)

this = KineticContainer(velocities=self.velocities,
engine=self.engine)
return this

def to_dict(self):
Expand Down
27 changes: 21 additions & 6 deletions openpathsampling/engines/features/statics.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,21 @@

dimensions = ['n_atoms', 'n_spatial']

schema_entries = [(
'statics', [('coordinates', 'ndarray.float32({n_atoms},{n_spatial})'),
('box_vectors', 'ndarray.float32({n_spatial},{n_spatial})')]
)]
_length_unit = "simtk(unit.nanometer)"
_array32 = "ndarray.float32"
schema_entries = [
('statics', [
('coordinates',
'{length_unit}*{array32}({{n_atoms}},{{n_spatial}})'.format(
length_unit=_length_unit, array32=_array32
)),
('box_vectors',
'{length_unit}*{array32}({{n_spatial}},{{n_spatial}})'.format(
length_unit=_length_unit, array32=_array32
)),
('engine', 'uuid'),
]),
]


def netcdfplus_init(store):
Expand Down Expand Up @@ -52,7 +63,9 @@ def coordinates(snapshot):
@coordinates.setter
def coordinates(self, value):
if value is not None:
sc = StaticContainer(coordinates=value, box_vectors=self.box_vectors)
sc = StaticContainer(coordinates=value,
box_vectors=self.box_vectors,
engine=self.engine)
else:
sc = None

Expand All @@ -77,7 +90,9 @@ def box_vectors(snapshot):
@box_vectors.setter
def box_vectors(self, value):
if value is not None:
sc = StaticContainer(box_vectors=value, coordinates=self.coordinates)
sc = StaticContainer(box_vectors=value,
coordinates=self.coordinates,
engine=self.engine)
else:
sc = None

Expand Down
9 changes: 7 additions & 2 deletions openpathsampling/engines/openmm/snapshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,15 @@ def construct(
if statics is None:
statics = Snapshot.StaticContainer(
coordinates=coordinates,
box_vectors=box_vectors)
box_vectors=box_vectors,
engine=engine
)

if kinetics is None:
kinetics = Snapshot.KineticContainer(velocities=velocities)
kinetics = Snapshot.KineticContainer(
velocities=velocities,
engine=engine
)

return Snapshot(
engine=engine,
Expand Down
6 changes: 4 additions & 2 deletions openpathsampling/engines/openmm/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,11 @@ def trajectory_from_mdtraj(mdtrajectory, simple_topology=False,

statics = Snapshot.StaticContainer(
coordinates=coord,
box_vectors=box_v
box_vectors=box_v,
engine=engine
)
kinetics = Snapshot.KineticContainer(velocities=vel)
kinetics = Snapshot.KineticContainer(velocities=vel,
engine=engine)

snap = Snapshot(
statics=statics,
Expand Down
144 changes: 144 additions & 0 deletions openpathsampling/experimental/simstore/attribute_handlers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
from .my_types import parse_ndarray_type
import numpy as np


class AttributeHandler(object):
"""Abstract object to handler a given attribute type.

Each attribute in a schema entry will generate an instance of this for
the appropriate type. Different subclasses handle different types that
are supported by SimStore.

Note that you'll usually use this with the :method:`.from_type_string`
constructor, which returns None if the type string doesn't match what
this class handles.
"""
def __init__(self, type_info):
self.type_info = type_info

@staticmethod
def is_my_type(type_str):
"""Returns type info (possibly tuple) if true, None if false"""
raise NotImplementedError()

@classmethod
def from_type_string(cls, type_str):
"""Generate attribute handler based on a given type string.

Parameters
----------
type_str: str
the specific type string in a format understood by SimStore

Returns
-------
:class:`.AttributeHandler` or None:
an attribute handler for the given type string, or None if this
class doesn't know how to handle that type
"""
type_info = cls.is_my_type(type_str)
if type_info:
return cls(type_info)

def serialize(self, obj):
"""Serialize the object.

Default serialization just returns the object.

Parameters
----------
obj : Any
object to be serialized

Returns
-------
Any:
version ready to be written to disk; typically str or bytes but
standard types are also allowed (bool, float, int, etc.)
"""
return obj

def deserialize(self, data, caches=None):
"""Deserialize the serialized form.

Parameters
----------
data: Any
bytes to deserialize (usually as str or bytes)
caches: Dict
mapping of identifiers to known objects that might be components
of this object; mainly used when deserializing UUID objects.
"""
return data


class StandardHandler(AttributeHandler):
"""Attribute handler for common standard types
"""
standard_types = ['str', 'int', 'float', 'function']
def __init__(self, type_info):
super().__init__(type_info)
self.backend_type = type_info
self.type_size = None

@classmethod
def is_my_type(cls, type_str):
if type_str in cls.standard_types:
return type_str


# TODO: these have not yet been implemented, but this is how it should all
# work -- everything should be managed through attribute handlers, instead
# of separate functions for serialize/deserialize
class UUIDHandler(StandardHandler):
standard_types = ['uuid', 'lazy']
def serialize(self, obj):
pass

def deserialize(self, data, caches=None):
pass


class ListUUIDHandler(StandardHandler):
standard_types = ['list_uuid']
def serialize(self, obj):
pass

def deserialize(self, data, caches=None):
pass


class JSONObjHandler(StandardHandler):
standard_types = ['json_obj']
def serialize(self, obj):
pass

def deserialize(self, data, caches=None):
pass


class NDArrayHandler(AttributeHandler):
"""Attribute handler for NumPy ndarrays.

Parameters
----------
type_info: Tuple
dtype and shape of the array
"""
def __init__(self, type_info):
super().__init__(type_info)
self.dtype, self.shape = type_info
self.backend_type = 'ndarray'
self.type_size = None # TODO: change this based on dtype/shape

@classmethod
def is_my_type(cls, type_str):
return parse_ndarray_type(type_str)

def serialize(self, obj):
return obj.astype(dtype=self.dtype, copy=False).tostring()

def deserialize(self, data, caches=None):
return np.fromstring(data, dtype=self.dtype).reshape(self.shape)

DEFAULT_HANDLERS = [NDArrayHandler, StandardHandler]
Loading