Skip to content

Commit

Permalink
update env file, use snap mol cluster func from cmeutils instead of i…
Browse files Browse the repository at this point in the history
…nternal one
  • Loading branch information
chrisjonesBSU committed Jun 19, 2024
1 parent d5d5bff commit 5ee91d6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 26 deletions.
11 changes: 5 additions & 6 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,18 @@ name: grits
channels:
- conda-forge
dependencies:
- cmeutils >= 1.2.0
- cmeutils >=1.2.0
- ele
- freud = 2.13.2
- gsd >= 3.0
- freud >=3.0
- gsd >=3.0
- jupyterlab
- mbuild
- mbuild >=0.17.1
- ele
- freud
- numpy
- openbabel
- pip
- pre-commit
- py3Dmol
- pytest
- pytest-cov
- python = 3.10
- python >=3.10
5 changes: 2 additions & 3 deletions grits/coarsegrain.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import freud
import gsd.hoomd
import numpy as np
from cmeutils.gsd_utils import identify_snapshot_connections
from cmeutils.gsd_utils import get_molecule_cluster, identify_snapshot_connections
from ele import element_from_symbol
from mbuild import Compound, clone
from mbuild.utils.io import run_from_ipython
Expand All @@ -24,7 +24,6 @@
get_quaternion,
has_common_member,
has_number,
snap_molecules,
)

__all__ = ["CG_Compound", "CG_System", "Bead"]
Expand Down Expand Up @@ -574,7 +573,7 @@ def _get_compounds(
conversion_dict[i].symbol for i in snap.particles.types
]
# Break apart the snapshot into separate molecules
molecules = snap_molecules(snap)
molecules = get_molecule_cluster(snap=snap)
mol_inds = []
for i in range(max(molecules) + 1):
mol_inds.append(np.where(molecules == i)[0])
Expand Down
17 changes: 0 additions & 17 deletions grits/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,23 +82,6 @@ def comp_from_snapshot(snapshot, indices, length_scale=1.0, mass_scale=1.0):
return comp


def snap_molecules(snap):
"""Get the molecule indices based on bonding in a gsd.hoomd.Frame."""
system = freud.AABBQuery.from_system(snap)
n_query_points = n_points = snap.particles.N
query_point_indices = snap.bonds.group[:, 0]
point_indices = snap.bonds.group[:, 1]
distances = system.box.compute_distances(
system.points[query_point_indices], system.points[point_indices]
)
nlist = freud.NeighborList.from_arrays(
n_query_points, n_points, query_point_indices, point_indices, distances
)
cluster = freud.cluster.Cluster()
cluster.compute(system=system, neighbors=nlist)
return cluster.cluster_idx


def align(compound, particle, towards_compound, around=None):
"""Spin a compound such that particle points at towards_compound.
Expand Down

0 comments on commit 5ee91d6

Please sign in to comment.