Skip to content

Commit

Permalink
Use default_factory in abstract_site position field (#482)
Browse files Browse the repository at this point in the history
  • Loading branch information
umesh-timalsina authored Oct 27, 2020
1 parent 595a6f1 commit 78a3114
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions gmso/abc/abstract_site.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,23 @@
FIELDS_IN_DOCSTRING = 'alias_to_fields'


def default_position():
return u.unyt_array([np.nan] * 3, u.nm)


class Site(GMSOBase):
__base_doc__: ClassVar[str] = """An interaction site object in the topology hierarchy.
Site is the object that represents any general interaction site in a molecular simulation.
Sites have been designed to be as general as possible, making no assumptions about representing atoms or beads, or
having mass or charge. That is, a Site can represent an atom in an atomistic system,
a bead in a coarse-grained system, and much more.
a bead in a coarse-grained system, and much more.
Notes
-----
The label attribute for a site takes its meaning when used with some sort of container (like topology)
such that a label for a site can then be used to group sites together. The rules for defining a site label
and their meaning the responsibility of the container where the sites will reside.
and their meaning the responsibility of the container where the sites will reside.
"""

name_: str = Field(
Expand All @@ -43,7 +47,7 @@ class Site(GMSOBase):
)

position_: PositionType = Field(
u.unyt_array([np.nan]*3, u.nm),
default_factory=default_position,
description='The 3D Cartesian coordinates of the position of the site'
)

Expand Down

0 comments on commit 78a3114

Please sign in to comment.