Skip to content

Commit

Permalink
Fix if "Atomsk" is in the LMP
Browse files Browse the repository at this point in the history
  • Loading branch information
cdavro committed Jun 12, 2024
1 parent 86ef617 commit bff197f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions arcann_training/labeling/extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# SPDX-License-Identifier: AGPL-3.0-only #
#----------------------------------------------------------------------------------------------------#
Created: 2022/01/01
Last modified: 2024/05/15
Last modified: 2024/06/12
"""

# Standard library modules
Expand Down Expand Up @@ -139,9 +139,9 @@ def main(
check_file_existence(training_path / "user_files" / f"{system_auto}.lmp", True, True, "Input data file (lmp) not present.")

lammps_data = textfile_to_string_list(training_path / "user_files" / f"{system_auto}.lmp")
indexes = [idx for idx, s in enumerate(lammps_data) if "Atoms" in s]
indexes = [idx for idx, s in enumerate(lammps_data) if "Atoms" in s and "tomsk" not in s]
if len(indexes) > 1:
for index in [idx for idx, s in enumerate(lammps_data) if "Atoms" in s]:
for index in [idx for idx, s in enumerate(lammps_data) if "Atoms" in s and "tomsk" not in s]:
atom_list = [line.strip().split() for line in lammps_data[index + 2 : index + 4]]
if len(atom_list[0]) == len(atom_list[1]) and lammps_data[index + 1] == " \n" and atom_list[0][0] == "1" and atom_list[1][0] == "2":
idx = index
Expand Down Expand Up @@ -301,9 +301,9 @@ def main(
check_file_existence(training_path / "user_files" / f"{system_auto}.lmp", True, True, "Input data file (lmp) not present.")

lammps_data = textfile_to_string_list(training_path / "user_files" / f"{system_auto}.lmp")
indexes = [idx for idx, s in enumerate(lammps_data) if "Atoms" in s]
indexes = [idx for idx, s in enumerate(lammps_data) if "Atoms" in s and "tomsk" not in s]
if len(indexes) > 1:
for index in [idx for idx, s in enumerate(lammps_data) if "Atoms" in s]:
for index in [idx for idx, s in enumerate(lammps_data) if "Atoms" in s and "tomsk" not in s]:
atom_list = [line.strip().split() for line in lammps_data[index + 2 : index + 4]]
if len(atom_list[0]) == len(atom_list[1]) and lammps_data[index + 1] == " \n" and atom_list[0][0] == "1" and atom_list[1][0] == "2":
idx = index
Expand Down

0 comments on commit bff197f

Please sign in to comment.