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

Neighbour analysis for the entire trajectory #251

Merged
merged 38 commits into from
Jul 19, 2021
Merged
Changes from 1 commit
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
f7648be
:zap: Neighbour analysis for the entire trajectory
sudarsan-surendralal Jun 27, 2021
f8f2a95
pep8
sudarsan-surendralal Jun 27, 2021
bb8b781
:bug: Set the correct quantity
sudarsan-surendralal Jun 27, 2021
84c82ac
Reduce lines
sudarsan-surendralal Jun 27, 2021
2308729
Make the attributes available as properties
sudarsan-surendralal Jun 27, 2021
b6456c1
Move the functions to a new class `NeighborTraj`
sudarsan-surendralal Jun 27, 2021
aa5f24f
Implement functions
sudarsan-surendralal Jun 27, 2021
02611d1
Important fixes
sudarsan-surendralal Jun 28, 2021
6bc829b
Fix and data type conversion!
sudarsan-surendralal Jun 28, 2021
4e1cb35
Introducing tests
sudarsan-surendralal Jun 28, 2021
cf219f8
Improving docstrings
sudarsan-surendralal Jun 28, 2021
3341f0d
pep8
sudarsan-surendralal Jun 28, 2021
cc0ec61
More functions in the job class!
sudarsan-surendralal Jun 28, 2021
80cb83e
Updating tests
sudarsan-surendralal Jun 28, 2021
9614ef8
Add option to store and retrieve from HDF5 files
sudarsan-surendralal Jun 30, 2021
7462d71
Merge remote-tracking branch 'origin/master' into neighbors_traj
sudarsan-surendralal Jul 2, 2021
f349cf7
Derive class from DataContainer
sudarsan-surendralal Jul 2, 2021
13c5978
Use HasStructure for _get_neighbors instead of re-creating structures…
pmrv Jul 6, 2021
2e12c1e
Update pyiron_atomistics/atomistics/structure/neighbors.py
sudarsan-surendralal Jul 6, 2021
5f407a2
Merge remote-tracking branch 'origin/master' into neighbors_traj
sudarsan-surendralal Jul 7, 2021
3d9792e
Set table name and rely on base class for writing to hdf
sudarsan-surendralal Jul 7, 2021
e5cfc43
Define index variable
pmrv Jul 8, 2021
b278379
Fix typo
pmrv Jul 8, 2021
d9cc947
Merge remote-tracking branch 'origin/nj_has' into neighbors_traj
sudarsan-surendralal Jul 9, 2021
9acaa44
Implement `__getitem__` to clice trajectories
sudarsan-surendralal Jul 14, 2021
7c00690
Disable loading checks!
sudarsan-surendralal Jul 14, 2021
02413e0
cleanup!
sudarsan-surendralal Jul 15, 2021
ecad9c0
Update pyiron_atomistics/atomistics/structure/neighbors.py
sudarsan-surendralal Jul 16, 2021
4aa7856
Update pyiron_atomistics/atomistics/structure/neighbors.py
sudarsan-surendralal Jul 16, 2021
7f23b96
minor changes
sudarsan-surendralal Jul 16, 2021
ed5e4f5
Merge branch 'neighbors_traj' of https://github.com/pyiron/pyiron_ato…
sudarsan-surendralal Jul 16, 2021
c6b9fed
:bug: Fix constructor
sudarsan-surendralal Jul 19, 2021
ae725e5
Restoring some checks
sudarsan-surendralal Jul 19, 2021
1b74ecc
Refactoring class name and attributes (Marvin's suggestion)
sudarsan-surendralal Jul 19, 2021
62e39a4
Remove unused import
sudarsan-surendralal Jul 19, 2021
6d51b09
Merge remote-tracking branch 'origin/master' into neighbors_traj
sudarsan-surendralal Jul 19, 2021
853b376
Merge remote-tracking branch 'origin/master' into neighbors_traj
sudarsan-surendralal Jul 19, 2021
2d507db
Merging new neighbor function changes
sudarsan-surendralal Jul 19, 2021
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
29 changes: 29 additions & 0 deletions pyiron_atomistics/atomistics/job/atomistic.py
Original file line number Diff line number Diff line change
Expand Up @@ -728,6 +728,9 @@ def __init__(self, positions, structure, center_of_mass=False, cells=None, indic
self._structure = structure
self._cells = cells
self._indices = indices
self._neighbor_indices = None
self._neighbor_distances = None
self._neighbor_vectors = None

def __getitem__(self, item):
new_structure = self._structure.copy()
Expand All @@ -744,6 +747,10 @@ def __getitem__(self, item):
def __len__(self):
return len(self._positions)

def get_neighbors_traj(self, start=0, stop=-1, stride=1):
self._neighbor_indices, self._neighbor_distances, self._neighbor_vectors = \
get_neighbors_traj(self._structure, positions=self._positions[start:stop:stride])


class GenericInput(GenericParameters):
def __init__(self, input_file_name=None, table_name="generic"):
Expand Down Expand Up @@ -889,3 +896,25 @@ def __dir__(self):
return hdf5_path.list_nodes()
else:
return []

def get_neighbors_traj(struct, positions, cells=None, num_neighbors=20):
[n_steps, n_atoms, _] = positions.shape
indices, distances = [np.zeros((n_steps, n_atoms, num_neighbors)) for _ in range(2)]
vecs = np.zeros((n_steps, n_atoms, num_neighbors, 3))
struct = struct.copy()
if cells is not None:
samwaseda marked this conversation as resolved.
Show resolved Hide resolved
for t, pos in enumerate(positions):
struct.positions = pos
struct.cell = cells[t]
neigh = struct.get_neighbors(num_neighbors=num_neighbors)
indices[t, :, :] = neigh.indices
distances[t, :, :] = neigh.indices
vecs[t, :, :, :] = neigh.vecs
else:
for t, pos in enumerate(positions):
struct.positions = pos
neigh = struct.get_neighbors(num_neighbors=num_neighbors)
indices[t, :, :] = neigh.indices
distances[t, :, :] = neigh.indices
vecs[t, :, :, :] = neigh.vecs
return indices, distances, vecs