gmso
gmso copied to clipboard
Standardize file readers and writers
There should be a standard format for file readers and writers so that they can be consistent and extensible. Standardization could be enforced by defining an abstract class that each reader/writer inherits from (pydantic could help with this). But before we get started on this we should agree on what components need to be in the abstract class. @mosdef-hub/mosdef-contributors, what are everyone's thoughts on this?
Related to #51
Standardization sounds good. I'll edit this comment later and add as needed.
- Checking functional forms
- Unit conversions
- Require topology to use certain functions to write sections (bonds, angles, etc.)
- Perhaps have "standard" xyz and PDB writers, and then subclass? custom versions for simulations that have "specialized" or are "picky" with respect to the exact formatting.
Possible ideas:
- Precision of values in file format
Correct me if I misremember these: Warnings should be issued for when writing a file type that would incur some information loss. An example mentioned was "standard" .xyz files vs cassandra .xyz, or writing .gro files from fully-parametrized FFs.
So here are the components of a file reader/writer mentioned yesterday and in the comments above:
- blank functions for each cohesive piece of information
-
write_positions
-
write_bonds
-
write_angles
- etc.
-
- warnings clearly stating what information is lost during writing (Maybe also a warning saying what information can be saved to a format but is missing in the topology)
- A list/set of accepted potential forms
- A common function for comparing potential forms in the topology with accepted potential forms for the writer
- unit set for the writer
- an argument in the write function for precision
Also we would want to include intermediate abstract classes for writers with many styles (i.e. cassandra xyz vs standard xyz, or GOMC psf vs CHARMM psf, etc.)
I think this is enough to get started on a PR, but feel free to keep posting suggestions.