Skip to content

Commit

Permalink
remove bond force stuff from FF class
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisjonesBSU committed Feb 28, 2025
2 parents 9fc36b0 + 7f8f65c commit 21a1176
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion flowermd/library/polymers.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ def _build(self, length):
# Build up ellipsoid bead
bead = mb.Compound(name="ellipsoid")
head = mb.Compound(
pos=(0, 0, self.lpar), name="_H", mass=self.bead_mass / 2
pos=(0, 0, self.lpar), name="_H", mass=self.bead_mass / 2
)
center = mb.Compound(pos=(0, 0, 0), name="_C", mass=self.bead_mass / 2)
bead.add([center, head])
Expand Down
11 changes: 8 additions & 3 deletions flowermd/utils/constraints.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,20 @@ def set_bond_constraints(snapshot, bond_type, constrain_value, tolerance=1e-5):
constraint_values = []
constraint_groups = []
bond_type_id = snapshot.bonds.types.index(bond_type)
bond_indices = np.where(snapshot.bonds.typeid == np.array(bond_type_id))[0].astype(int)
bond_indices = np.where(snapshot.bonds.typeid == np.array(bond_type_id))[
0
].astype(int)
for idx in bond_indices:
group = snapshot.bonds.group[idx]
bond_len = np.linalg.norm(snapshot.particles.position[group[1]] - snapshot.particles.position[group[0]])
bond_len = np.linalg.norm(
snapshot.particles.position[group[1]]
- snapshot.particles.position[group[0]]
)
if not np.isclose(constrain_value, bond_len, atol=tolerance):
raise ValueError("Values found not within the given tolerance")
constraint_values.append(constrain_value)
constraint_groups.append(group)

snapshot.constraints.N = len(constraint_values)
snapshot.constraints.value = constraint_values
snapshot.constraints.group = constraint_groups
Expand Down

0 comments on commit 21a1176

Please sign in to comment.