Skip to content

Commit

Permalink
In process
Browse files Browse the repository at this point in the history
  • Loading branch information
dprada committed Feb 24, 2024
1 parent 546e081 commit 6688510
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 16 deletions.
4 changes: 2 additions & 2 deletions molsysmt/form/molsysmt_Structures/append_structures.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from molsysmt._private.exceptions import NotImplementedMethodError
from molsysmt._private.digestion import digest

@digest(form='molsysmt.Structures')
def append_structures(item, id=None, time=None, coordinates=None, velocities=None,
@digest(form='molsysmt.Structures', to_form='molsysmt.Structures')
def append_structures(to_item, item=None, id=None, time=None, coordinates=None, velocities=None,
box=None, temperature=None, potential_energy=None, kinetic_energy=None, skip_digestion=False):

item.append(id=id, time=time, coordinates=coordinates,
Expand Down
15 changes: 1 addition & 14 deletions molsysmt/native/structures.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def _append_coordinates(self, coordinates, atom_indices='all', structure_indices
raise ValueError(
"The coordinates to be appended in the system "
"need to have the same number of atoms.")
self.coordinates = _concatenate_arrays(self.coordinates, coordinates)

if is_all(structure_indices):
if is_all(atom_indices):
self.coordinates = np.concatenate([self.coordinates, coordinates])
Expand Down Expand Up @@ -166,7 +166,6 @@ def _append_velocities(self, velocities, atom_indices='all', structure_indices='
raise ValueError(
"The velocities to be appended in the system "
"need to have the same number of atoms.")
self.velocities = _concatenate_arrays(self.velocities, velocities)
if is_all(structure_indices):
if is_all(atom_indices):
self.velocities = np.concatenate([self.velocities, velocities])
Expand Down Expand Up @@ -426,7 +425,6 @@ def append_structures(self, item, atom_indices='all', structure_indices='all', s
skip_digestion=True
)


@digest(form='molsysmt.Structures')
def add(self, item, atom_indices='all', structure_indices='all', skip_digestion=False):

Expand Down Expand Up @@ -625,14 +623,3 @@ def copy(self):
""" Returns a copy of the structures."""
return deepcopy(self)


@staticmethod
def _concatenate_arrays(array_1, array_2):
""" Concatenates two arrays provided that they are not null."""
if array_2 is not None:
if array_1 is None:
raise ValueError(
f"The trajectory has no array to append the new frame.")
else:
return np.concatenate([array_1, array_2])

0 comments on commit 6688510

Please sign in to comment.