Skip to content

Rename function #22

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

Merged
merged 13 commits into from
Dec 7, 2021
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
2 changes: 1 addition & 1 deletion cmeutils/gsd_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def get_all_types(gsd_file=None, snap=None, gsd_frame=-1):
return snap.particles.types


def snap_molecule_cluster(gsd_file=None, snap=None, gsd_frame=-1):
def get_molecule_cluster(gsd_file=None, snap=None, gsd_frame=-1):
"""Find molecule index for each particle.

Compute clusters of bonded molecules and return an array of the molecule
Expand Down
12 changes: 6 additions & 6 deletions cmeutils/structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def gsd_rdf(
type_B = snap.particles.typeid == snap.particles.types.index(B_name)

if exclude_bonded:
molecules = gsd_utils.snap_molecule_cluster(snap=snap)
molecules = gsd_utils.get_molecule_cluster(snap=snap)
molecules_A = molecules[type_A]
molecules_B = molecules[type_B]

Expand Down Expand Up @@ -164,7 +164,7 @@ def get_centers(gsdfile, new_gsdfile):
"""
with gsd.hoomd.open(new_gsdfile, 'wb') as new_traj, gsd.hoomd.open(gsdfile, 'rb') as traj:
snap = traj[0]
cluster_idx = gsd_utils.snap_molecule_cluster(snap=snap)
cluster_idx = gsd_utils.get_molecule_cluster(snap=snap)
for snap in traj:
new_snap = gsd.hoomd.Snapshot()
new_snap.configuration.box = snap.configuration.box
Expand Down Expand Up @@ -285,20 +285,20 @@ def all_atom_rdf(gsdfile,
bins=100,
):
"""Compute intermolecular RDF from a GSD file.

This function calculates the radial distribution function given a GSD file
for all atoms. By default it will calculate the RDF
for the entire trajectory.
It is assumed that the bonding, number of particles, and simulation box do
not change during the simulation.

Parameters
----------
gsdfile : str
Filename of the GSD trajectory.
start : int, default 0
Starting frame index for accumulating the RDF. Negative numbers index
from the end.
from the end.
stop : int, default -1
Final frame index for accumulating the RDF. If None, the last frame
will be used.
Expand All @@ -308,7 +308,7 @@ def all_atom_rdf(gsdfile,
Minimum radius of RDF.
bins : int, default 100
Number of bins to use when calculating the RDF.

Returns
-------
freud.density.RDF
Expand Down
6 changes: 3 additions & 3 deletions cmeutils/tests/test_gsd.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from base_test import BaseTest
from cmeutils.gsd_utils import (
get_type_position, snap_molecule_cluster, get_all_types, _validate_inputs,
get_type_position, get_molecule_cluster, get_all_types, _validate_inputs,
snap_delete_types, xml_to_gsd
)

Expand Down Expand Up @@ -45,8 +45,8 @@ def test_get_all_types(self, gsdfile):
types = get_all_types(gsdfile)
assert types == ["A", "B"]

def test_snap_molecule_cluster(self, gsdfile_bond):
cluster = snap_molecule_cluster(gsd_file=gsdfile_bond)
def test_get_molecule_cluster(self, gsdfile_bond):
cluster = get_molecule_cluster(gsd_file=gsdfile_bond)
assert np.array_equal(cluster, [1, 0, 1, 0, 0])

def test_snap_delete_types(self, snap):
Expand Down