Skip to content

Commit

Permalink
Merge branch 'main' into default_mass_charge
Browse files Browse the repository at this point in the history
  • Loading branch information
daico007 committed Aug 8, 2022
2 parents 7cef3dd + 0970f90 commit 947f87c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion mbuild/bond_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def compose(self, graph):
adj = self._adj
for node, neighbors in graph._adj.items():
if self.has_node(node):
(adj[node].add(neighbor) for neighbor in neighbors)
[adj[node].add(neighbor) for neighbor in neighbors]
else:
# Add new node even if it has no bond/neighbor
adj[node] = neighbors
Expand Down
13 changes: 13 additions & 0 deletions mbuild/tests/test_coordinate_transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,3 +448,16 @@ def test_z_axis_transform(self, h2o):
for i in range(4):
z_axis_transform(h2o)
assert np.allclose(h2o.xyz, init_xyz, atol=1e-4)

def test_bondgraph(self, ch3):
ch3_2 = mb.clone(ch3)
mb.force_overlap(ch3_2, ch3_2["up"], ch3["up"])
ch3.add(ch3_2)
bgraph = ch3.bond_graph
for edge0, edge1 in bgraph.edges():
assert bgraph.has_edge(edge0, edge1)
assert bgraph.has_edge(edge1, edge0)
neighbors = {"C": 4, "H": 1}
for node in bgraph.nodes():
x = map(lambda node: node.name, bgraph._adj[node])
assert neighbors[node.name] == len(list(x))

0 comments on commit 947f87c

Please sign in to comment.