Add serialization for Topology - #567
Conversation
Codecov Report
@@ Coverage Diff @@
## master #567 +/- ##
==========================================
+ Coverage 90.29% 90.49% +0.19%
==========================================
Files 54 56 +2
Lines 4205 4408 +203
==========================================
+ Hits 3797 3989 +192
- Misses 408 419 +11
Continue to review full report at Codecov.
|
|
This pull request introduces 1 alert when merging f26edf9 into 538049e - view on LGTM.com new alerts:
|
|
This PR also brings in the concept of Registries to save/load files. Only the |
|
The following gist contains simple test cases. |
|
Just tried this out but one thing i noticed is that the potential types are not being brought over in the json files. Is that expected? an example: from mbuild.lib.molecules import Ethane
from gmso.external import from_parmed
import foyer
oplsaa = foyer.forcefields.load_OPLSAA()
eth_typed = oplsaa.apply(Ethane())
topology_typed = from_parmed(topology_typed, refer_types=True)
topology_typed.save("eth.json", overwrite=True, indent=4) |
|
Yeah this is expected. You have to explicitly specify |
|
Very true! I forgot about that flag! Working well for me! |
After PR mosdef-hub#567, which brought in the addition of concept of Registries to save/load files; Only the json methods are currently using the registries but can be extended to other formats as well. This PR introduces the overhaul to the `xyz` file format, one of the simpler cases. So far, this seems to have worked quite well.
justinGilmer
left a comment
There was a problem hiding this comment.
New changes look good. When all checks pass LGTM!
daico007
left a comment
There was a problem hiding this comment.
Tested it out locally, LGTM!
After PR mosdef-hub#567, which brought in the addition of concept of Registries to save/load files; Only the json methods are currently using the registries but can be extended to other formats as well. This PR introduces the overhaul to the `xyz` file format, one of the simpler cases. So far, this seems to have worked quite well.
* Convert xyz file I/O to use the load/save methods After PR #567, which brought in the addition of concept of Registries to save/load files; Only the json methods are currently using the registries but can be extended to other formats as well. This PR introduces the overhaul to the `xyz` file format, one of the simpler cases. So far, this seems to have worked quite well. * Overhaul write_gro and read_gro to use the new registry system. * Update top, gsd, mcf, lammps tests and writer/readers * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Use deepcopy of the topology when modifying the position for gro files * Support stacking loads_as, saves_as decorators for multiple file extensions * Use cheaper deepcopy alternative, simplify decorator for multiple file extensions Co-authored-by: Co Quach <43968221+daico007@users.noreply.github.com> Co-authored-by: Umesh Timalsina <umesh.timalsina@vanderbilt.edu> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This PR attempts to implement a full serialization for topology. Two methods are available: