Skip to content

Commit

Permalink
Add Incomplete documentation for topology
Browse files Browse the repository at this point in the history
  • Loading branch information
umesh-timalsina committed Feb 27, 2020
1 parent a53cc9d commit 5ed28ab
Show file tree
Hide file tree
Showing 3 changed files with 96 additions and 13 deletions.
25 changes: 19 additions & 6 deletions docs/data_structures.rst
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
Data Structures in GMSO
---------------------------
Following data structures are available within GMSO, which are generally referred to `CoreMembers` and `CoreTypes`.
Following data structures are available within GMSO.

Core Members
=============
Core Classes
============

Topology
********
.. autoclass:: gmso.Topology
:members:

SubTopology
***********
.. autoclass:: gmso.SubTopology
:members:

Site
****
Expand All @@ -25,8 +35,9 @@ Dihedral
.. autoclass:: gmso.Dihedral
:members:

Potential Classes(CoreTypes)
============================

Potential Classes
=================
.. autoclass:: gmso.Potential
:members:

Expand Down Expand Up @@ -54,4 +65,6 @@ DihedralType
ForceField
==========
.. autoclass:: gmso.ForceField
:members:
:members:

:
1 change: 1 addition & 0 deletions gmso/core/subtopology.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

class SubTopology(object):
"""A sub-topology."""

def __init__(self, name="Sub-Topology", parent=None):
if name is not None:
self._name = str(name)
Expand Down
83 changes: 76 additions & 7 deletions gmso/core/topology.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,79 @@
class Topology(object):
"""A topology.
A topology represents a chemical structure wherein lie the collection
of sites(associated with an atom/residue) which
together form a chemical structure containing gmso.Bond, gmso.Angle
and gmso.Dihedral (along with the associated types). A topology
is the fundamental data-structure in GMSO, from which we can gather
various information about the chemical structure and apply a forcefield
before converting the structure into a format familiar to various simulation
engines.
Parameters
----------
name : str, optional
name : str, optional, default='Topology'
A name for the Topology.
box: gmso.Box, optional, default=None
A gmso.Box object bounding the topology
Attributes
----------
typed: bool
True if the topology is typed
combining_rule: str, ['lorentz', 'geometric']
The combining rule for the topology, can be either 'lorentz' or 'geometric'
n_sites: int
Number of sites in the topology
n_connections: int
Number of connections in the topology (Atoms, Bonds, Angles, Dihedrals)
n_bonds: int
Number of bonds in the topology
n_angles: int
Number of angles in the topology
n_dihedrals: int
Number of dihedrals in the topology
n_subtops: int
Number of subtopolgies in the topology
connections: tuple of gmso.Connection objects
A collection of bonds, angles and dihedrals in the topology
bonds: tuple of gmso.Bond objects
A collection of bonds in the topology
dihedrals: tuple of gmso.Dihedral objects
A collection of dihedrals in the topology
connection_types: tuple of gmso.Potential objects
A collection of AtomTypes, BondTypes, AngleTypes and DihedralTypes in the topology
atom_types: tuple of gmso.AtomType objects
A collection of AtomTypes in the topology
bond_types: tuple of gmso.BondType objects
A collection of BondTypes in the topology
angle_types: tuple of gmso.AngleType objects
A collection go AngleTypes in the topology
dihedral_types: tuple of gmso.DihedralType objects
A collection of DihedralTypes in the topology
See Also
--------
gmso.SubTopology:
A topology within a topology
"""
def __init__(self, name="Topology", box=None):
if name is not None:
Expand Down Expand Up @@ -181,14 +250,14 @@ def dihedral_type_expressions(self):
return list(set([atype.expression for atype in self.dihedral_types]))

def add_site(self, site, update_types=True):
"""Add the site to the topology
"""Add a site to the topology
Parameters
-----------
site: (gmso.core.Site), site to be added to this topology
update_types: (bool), default(true), If true, update atom types for the site
Returns
-------
None
site: gmso.core.Site
Site to be added to this topology
update_types: (bool), default=True
If true, update atom types for the site
"""
self._sites.add(site)
if update_types and site.atom_type:
Expand Down

0 comments on commit 5ed28ab

Please sign in to comment.