# Interoperability Layer between GMSO and OpenFF-System
In this note we propose an interoperability module between [gmso](https://github.com/mosdef-hub/gmso) and the [openff-system](https://github.com/openff/openff-system) objects. The deliverables are the following:
1. A conversion between a typed `gmso` `Topology` and an `OpenFF` `System` object and vice versa.
2. Develop a plugin architecture that discovers this layer for both `GMSO` and `OpenFF-System`.
## openff.System object details:
Inorder to create an openff.System Objects we need the following (see [the following link](https://github.com/openforcefield/openff-system/blob/2bbb2c76ea809bd7839932b735d2a0852bc68ec6/openff/system/components/system.py#L20-L23)):
1. Potential Handlers: Potential handlers for a System object is a dictionary of all the Forcefield Paramters for the System Object.
2. Topology: An `openff.topology.topology.Topology` object.
3. Box: A numpy(unit-tagged) array of `Box` parameters.
4. Positions: A numpy array(unit-tagged) of 3D-Cartesian coordinates of the System Particles.
## Goal of Writing this Mapping
The goal of writing this mapping are three folds:
1. Develop understanding of OpenFF software stack.
2. Seek a one--to--one mapping between objects in `gmso` and the `openFF` software stack, enhancing the datastructures if needeed, to develop the specification that we initially agreed to.
3. Bring `gmso`esque features to `OpenFF` and vice versa.
## First Pass: Conversion From GMSO Topology to OpenFF System Object
As a first pass, we plan to facilitate the conversion between a `gmso` `Topology` to an `OpenFF` `System` Object using a plugin architecure for `gmso.exteral`. The high level API will be as shown below:
```python
def to_openff_system(topology: gmso.Topology, **kwargs) -> openff.System:
...
```
### Potential Handlers:
From a typed gmso `Topology` we can create the following Potential Handlers:
* `GMSOAtomHandler` -> Mapping between Potential Objects associated with an Atom in `gmso` to `openFF` Potential Object.
* `GMSOBondHandler` -> Similar to `GMSOAtomHandler` for `Bonds` in a `gmso` `Topology`.
* `GMSOAngleHandler` -> Similar to `GMSOAtomHandler` for angles in a `gmso` `Topology`. etc...
### Topology
Flatten gmso.topology to 1 level, this is a single molecule to pass to openff.System
* Conformers not really possible at this time.
### Box
Should Be Trivial
### Positions
Enhance `gmso.Topology`'s `position` property to get positions based on index of Atom in desired units.
## Gist from smirnoff
https://gist.github.com/mattwthompson/bd45643321519ae1b25d312aaac17dc7
Interoperability energies
https://github.com/openforcefield/openff-system/blob/master/openff/system/tests/integration_tests/test_interoperability_pathways.py