1313
1414
1515class Path :
16+ """Creates a path from a given set of coordinates and a bond graph.
17+ This class is designed to be use in mbuild.polymer.Polymer.build_from_path().
18+ This also serves as the base class from which other paths inherit from.
19+
20+ Parameters
21+ ----------
22+ N : int, optional
23+ The number of sites belonging to the path.
24+ coordinates : array-like, optional
25+ Creates a path from a pre-defined set of coordinates
26+ bond_graph : networkx.Graph, optional
27+ The graph defining the edges between coordinates
28+ """
1629 def __init__ (self , N = None , coordinates = None , bond_graph = None ):
1730 self .bond_graph = bond_graph
1831 # Only N is defined, make empty coordinates array with size N
@@ -67,10 +80,10 @@ def add_edge(self, u, v):
6780 length = float (bond_length ),
6881 bond_type = (u_name , v_name ),
6982 )
70-
83+
7184 def get_bonded_sites (self ):
7285 """Get all bonded pairs and their bond-vector orientations."""
73- pass
86+ raise NotImplementedError ( "This feature of mBuild 2.0 has not been implemented yet." )
7487
7588 def get_coordinates (self ):
7689 if isinstance (self .coordinates , list ):
@@ -99,6 +112,7 @@ def apply_mapping(self):
99112 """Mapping other compounds onto a Path's coordinates
100113
101114 mapping = {"A": "c1ccccc1C=C", "B": "C=CC=C"}
115+ mapping = {"A": mb.Compound, "B": mb.Compound}
102116
103117 for bond in bond graph edges:
104118 site u: add compound
@@ -108,7 +122,7 @@ def apply_mapping(self):
108122 set orientation and separation for site v tail port
109123
110124 """
111- pass
125+ raise NotImplementedError ( "This feature of mBuild 2.0 has not been implemented yet." )
112126
113127 def _path_history (self ):
114128 """Maybe this is a method that can be used optionally.
@@ -117,7 +131,7 @@ def _path_history(self):
117131 computation time and resources.
118132 Might be useful for more complicated random walks/branching algorithms
119133 """
120- pass
134+ raise NotImplementedError ( "This feature of mBuild 2.0 has not been implemented yet." )
121135
122136
123137class HardSphereRandomWalk (Path ):
@@ -159,6 +173,23 @@ def __init__(
159173 max_angle : float, required
160174 Maximum angle (radians) used when randomly selecting angle
161175 for the next step.
176+ bead_name : str, default = "_A"
177+ The name assigned to each site in this random walk.
178+ volume_constraint : mbuild.utils.volumes.Constraint, optional
179+ Used to reject moves which are outside of the volume constraint
180+ start_from_path : mbuild.path.Path, optional
181+ An instance of a previous Path to start the random walk from.
182+ This path's sites are used in checking for overlapping sites.
183+ start_from_path_index : int, optional
184+ An index of `start_from_path` used as the starting point for this random walk.
185+ attach_paths : bool, default = False
186+ If True, adds an edge between the starting point of the last path and the first
187+ point of this path.
188+ initial_point : array-like, optional
189+ Used as the coordinate for the first site in this random walk path.
190+ include_compound : mb.Compound, optional
191+ An mBuild compound that is considered in this random walk.
192+ This random walk with reject new points that overlap with the Compound's coordinates.
162193 seed : int, default = 42
163194 Random seed
164195 trial_batch_size : int, default = 5
@@ -167,15 +198,7 @@ def __init__(
167198 random walks.
168199 max_attempts : int, default = 1e5
169200 The maximum number of trial moves to attempt before quiting.
170- start_from_path : mbuild.path.Path, optional
171- An instance of a previous Path to start the random walk from.
172- start_from_path_index : int, optional
173- The index of `start_from_path` to use as the initial point
174201 for the random walk.
175- attach_paths : bool, default = False
176- If True, an edge will be created in the bond graph between
177- the last point of `start_from_path` and the first point of
178- this random walk.
179202 tolerance : float, default = 1e-4
180203 Tolerance used for rounding and checking for overlaps.
181204
@@ -776,12 +799,28 @@ def generate(self):
776799
777800
778801class ZigZag (Path ):
802+ """Generates a path following a zig-zag pattern in a given plane.
803+
804+ Parameters
805+ ----------
806+ spacing : float, default = 1.0
807+ The distance between consecutive sites along the path.
808+ angle_deg : float, default = 120.
809+ The rotation applied between segments
810+ sites_per_segment : int, default = 4
811+ The number of sites before rotating and beginning next segment.
812+ plane : str, default = "xy"
813+ The plane that the sites in the path occupy
814+ bond_graph : networkx.Graph
815+ Defines connectivity between sites
816+
817+ """
779818 def __init__ (
780819 self ,
781820 N ,
782821 spacing = 1.0 ,
783822 angle_deg = 120.0 ,
784- sites_per_segment = 1 ,
823+ sites_per_segment = 4 ,
785824 plane = "xy" ,
786825 bond_graph = None ,
787826 ):
0 commit comments