Skip to content

Commit 0ce1e41

Browse files
committed
Fixed a typo in neighbors
1 parent 0ec5efd commit 0ce1e41

2 files changed

Lines changed: 14 additions & 2 deletions

File tree

README.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ If using conda, make sure to be on up-to-date versions of `ipywidgets` and
2929
3030
conda install -c conda-forge notebook ipywidgets
3131
32+
Visualization currently support Chrome and Firefox.
33+
3234
###################
3335
Getting Started
3436
###################

exatomic/algorithms/neighbors.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,12 @@ def nearest_molecules(universe, n, sources, restrictions=None, how='atom',
4848
unis (dict): Dictionary of number of neighbors keys, universe values
4949
"""
5050
source_atoms, other_atoms, source_molecules, other_molecules, n = _slice_atoms_molecules(universe, sources, restrictions, n)
51+
print(source_atoms.shape)
52+
print(other_atoms.shape)
53+
print(source_molecules.shape)
54+
print(other_molecules.shape)
5155
ordered_molecules, ordered_twos = _compute_neighbors_by_atom(universe, source_atoms, other_atoms, source_molecules)
56+
print(ordered_molecules.shape)
5257
unis = {}
5358
if free_boundary == True:
5459
for nn in n:
@@ -73,20 +78,25 @@ def _slice_atoms_molecules(universe, sources, restrictions, n):
7378
n = [n]
7479
labels = universe.atom.get_atom_labels()
7580
universe.atom['label'] = labels
76-
symbols = universe.atom['symbol']
77-
classification = universe.molecule['classification']
81+
labels = labels.unique()
82+
symbols = universe.atom['symbol'].unique()
83+
classification = universe.molecule['classification'].unique()
7884
if all(source in labels for source in sources):
85+
print("all labels")
7986
source_atoms = universe.atom[universe.atom['label'].isin(sources)]
8087
mdx = source_atoms['molecule'].astype(np.int64)
8188
source_molecules = universe.molecule[universe.molecule.index.isin(mdx)]
8289
elif all(source in symbols for source in sources):
90+
print("all symbols")
8391
source_atoms = universe.atom[universe.atom['symbol'].isin(sources)]
8492
mdx = source_atoms['molecule'].astype(np.int64)
8593
source_molecules = universe.molecule[universe.molecule.index.isin(mdx)]
8694
elif all(source in classification for source in sources):
95+
print("all mols")
8796
source_molecules = universe.molecule[universe.molecule['classification'].isin(sources)]
8897
source_atoms = universe.atom[universe.atom['molecule'].isin(source_molecules.index)]
8998
else:
99+
print("all other")
90100
classif = [source for source in sources if source in classification]
91101
syms = [source for source in sources if source in symbols]
92102
lbls = [source for source in sources if source in labels]

0 commit comments

Comments
 (0)