From 4cd90c1bed3bd83b88d2b9bb43e1223c7f0139c4 Mon Sep 17 00:00:00 2001 From: patrickreiser Date: Thu, 31 Aug 2023 11:17:45 +0200 Subject: [PATCH] update force.py --- kgcnn/data/force.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/kgcnn/data/force.py b/kgcnn/data/force.py index 819fc010..70d7a8cf 100644 --- a/kgcnn/data/force.py +++ b/kgcnn/data/force.py @@ -69,7 +69,7 @@ def file_path_force_xyz(self): self._verify_data_directory() if self.file_name_force_xyz is None: return os.path.join(self.data_directory, os.path.splitext(self.file_name)[0] + "_force.xyz") - elif isinstance(self.file_name_force_xyz, (str, os.path.Path)): + elif isinstance(self.file_name_force_xyz, (str, os.PathLike)): return os.path.join(self.data_directory, self.file_name_xyz) elif isinstance(self.file_name_force_xyz, (list, tuple)): return [os.path.join(self.data_directory, x) for x in self.file_name_force_xyz] @@ -99,7 +99,7 @@ def prepare_data(self, overwrite: bool = False, file_column_name: str = None, fi if not isinstance(file_path_forces, (list, tuple)): file_path_forces = [file_path_forces] if not isinstance(file_column_name_force, (list, tuple)): - file_column_name_forces = [file_column_name_force] + file_column_name_force = [file_column_name_force] for f, c in zip(file_path_forces, file_column_name_force): if not os.path.exists(f): xyz_list = self.collect_files_in_file_directory( @@ -162,5 +162,7 @@ def read_in_memory(self, if not isinstance(file_path_forces, (list, tuple)): file_path_forces = [file_path_forces] for i, x in enumerate(file_path_forces): - self.read_in_memory_xyz(x, atomic_coordinates="force_" % i, atomic_number=None, atomic_symbol=None) + self.read_in_memory_xyz(x, atomic_coordinates=str(os.path.basename(x)), + # We do not want to change atomic information but only read xyz. + atomic_number=None, atomic_symbol=None) return self