Skip to content

Commit

Permalink
Merge pull request #515 from zincware/fix_single_snapshot
Browse files Browse the repository at this point in the history
fixed single snapshot feature for lammps files
  • Loading branch information
SamTov authored Apr 21, 2022
2 parents 67b5059 + 189abcd commit 0d4837c
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions mdsuite/file_io/lammps_trajectory_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,15 +234,16 @@ def _get_sample_rate(self, file, n_particles: int) -> typing.Union[int, None]:
file, self.n_header_lines, start_at=0
)
time_step_0 = int(first_header[1]) # Time in first configuration
second_header = mdsuite.file_io.tabular_text_files.read_n_lines(
file, self.n_header_lines, start_at=self.n_header_lines + n_particles
)
# catch single snapshot trajectory (second_header == [])
if not second_header:
try:
second_header = mdsuite.file_io.tabular_text_files.read_n_lines(
file, self.n_header_lines, start_at=self.n_header_lines + n_particles
)
except StopIteration:
return None

time__step_1 = int(second_header[1]) # Time in second configuration
return time__step_1 - time_step_0
time_step_1 = int(second_header[1]) # Time in second configuration
return time_step_1 - time_step_0


def extract_properties_from_header(
Expand Down

0 comments on commit 0d4837c

Please sign in to comment.