Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to freud 3.0, use get_molecule_cluster from cmeutils #79

Merged
merged 2 commits into from
Jun 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.3.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
Loading