Skip to content

Commit d4a8d31

Browse files
Merge pull request #79 from chrisjonesBSU/freud3.0
Update to freud 3.0, use `get_molecule_cluster` from cmeutils
2 parents d5d5bff + f40c005 commit d4a8d31

File tree

3 files changed

+7
-26
lines changed

3 files changed

+7
-26
lines changed

environment.yml

+5-6
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,18 @@ name: grits
22
channels:
33
- conda-forge
44
dependencies:
5-
- cmeutils >= 1.2.0
5+
- cmeutils >=1.3.0
66
- ele
7-
- freud = 2.13.2
8-
- gsd >= 3.0
7+
- freud >=3.0
8+
- gsd >=3.0
99
- jupyterlab
10-
- mbuild
10+
- mbuild >=0.17.1
1111
- ele
12-
- freud
1312
- numpy
1413
- openbabel
1514
- pip
1615
- pre-commit
1716
- py3Dmol
1817
- pytest
1918
- pytest-cov
20-
- python = 3.10
19+
- python >=3.10

grits/coarsegrain.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import freud
1111
import gsd.hoomd
1212
import numpy as np
13-
from cmeutils.gsd_utils import identify_snapshot_connections
13+
from cmeutils.gsd_utils import get_molecule_cluster, identify_snapshot_connections
1414
from ele import element_from_symbol
1515
from mbuild import Compound, clone
1616
from mbuild.utils.io import run_from_ipython
@@ -24,7 +24,6 @@
2424
get_quaternion,
2525
has_common_member,
2626
has_number,
27-
snap_molecules,
2827
)
2928

3029
__all__ = ["CG_Compound", "CG_System", "Bead"]
@@ -574,7 +573,7 @@ def _get_compounds(
574573
conversion_dict[i].symbol for i in snap.particles.types
575574
]
576575
# Break apart the snapshot into separate molecules
577-
molecules = snap_molecules(snap)
576+
molecules = get_molecule_cluster(snap=snap)
578577
mol_inds = []
579578
for i in range(max(molecules) + 1):
580579
mol_inds.append(np.where(molecules == i)[0])

grits/utils.py

-17
Original file line numberDiff line numberDiff line change
@@ -82,23 +82,6 @@ def comp_from_snapshot(snapshot, indices, length_scale=1.0, mass_scale=1.0):
8282
return comp
8383

8484

85-
def snap_molecules(snap):
86-
"""Get the molecule indices based on bonding in a gsd.hoomd.Frame."""
87-
system = freud.AABBQuery.from_system(snap)
88-
n_query_points = n_points = snap.particles.N
89-
query_point_indices = snap.bonds.group[:, 0]
90-
point_indices = snap.bonds.group[:, 1]
91-
distances = system.box.compute_distances(
92-
system.points[query_point_indices], system.points[point_indices]
93-
)
94-
nlist = freud.NeighborList.from_arrays(
95-
n_query_points, n_points, query_point_indices, point_indices, distances
96-
)
97-
cluster = freud.cluster.Cluster()
98-
cluster.compute(system=system, neighbors=nlist)
99-
return cluster.cluster_idx
100-
101-
10285
def align(compound, particle, towards_compound, around=None):
10386
"""Spin a compound such that particle points at towards_compound.
10487

0 commit comments

Comments
 (0)