From ac86cd4988531289ac399dedc3bc552f673e3af0 Mon Sep 17 00:00:00 2001 From: Sarath Menon Date: Mon, 26 Jun 2023 16:41:33 +0200 Subject: [PATCH] bug fixes in graph --- pyscal_rdf/graph.py | 5 ++++- pyscal_rdf/structure.py | 24 ++++++++++++------------ 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/pyscal_rdf/graph.py b/pyscal_rdf/graph.py index 6e4e1d2..77124ae 100644 --- a/pyscal_rdf/graph.py +++ b/pyscal_rdf/graph.py @@ -11,6 +11,7 @@ import numpy as np import inspect from ase.io import write +import copy from pyscal_rdf.visualize import visualize_graph from pyscal_rdf.network import OntologyNetwork @@ -230,7 +231,9 @@ def add_structure_to_graph(self, structure, names=True, name_index=None, format= if name_index is None: name_index = self.n_samples + 1 self.create_graph(names=names, name_index=name_index) - + structure.sample = self.sample + structure._atom_ids = copy.copy(self._atom_ids) + structure.graph = self def create_graph(self, names=False, name_index="1"): """ diff --git a/pyscal_rdf/structure.py b/pyscal_rdf/structure.py index 645a8e0..691de6b 100644 --- a/pyscal_rdf/structure.py +++ b/pyscal_rdf/structure.py @@ -62,9 +62,9 @@ def create_element(self, element, repetitions=(1,1,1), element = element)) if add_to_graph: self.add_structure_to_graph(sys, names=names) - sys.sample = self.sample - sys._atom_ids = copy.copy(self._atom_ids) - sys.graph = self + #sys.sample = self.sample + #sys._atom_ids = copy.copy(self._atom_ids) + #sys.graph = self return sys def create_structure(self, structure, @@ -116,9 +116,9 @@ def create_structure(self, structure, )) if add_to_graph: self.add_structure_to_graph(sys, names = names) - sys.sample = self.sample - sys._atom_ids = copy.copy(self._atom_ids) - sys.graph = self + #sys.sample = self.sample + #sys._atom_ids = copy.copy(self._atom_ids) + #sys.graph = self return sys def read_structure(self, filename, format="lammps-dump", @@ -149,9 +149,9 @@ def read_structure(self, filename, format="lammps-dump", sys = System(filename, format=format) if add_to_graph: self.add_structure_to_graph(sys, names=names) - sys.sample = self.sample - sys._atom_ids = copy.copy(self._atom_ids) - sys.graph = self + #sys.sample = self.sample + #sys._atom_ids = copy.copy(self._atom_ids) + #sys.graph = self return sys def create_grain_boundary(self, axis, @@ -223,9 +223,9 @@ def create_grain_boundary(self, axis, #mapping of the system can be done self.add_structure_to_graph(sys, names=names) - sys.sample = self.sample - sys._atom_ids = copy.copy(self._atom_ids) - sys.graph = self + #sys.sample = self.sample + #sys._atom_ids = copy.copy(self._atom_ids) + #sys.graph = self gb_dict = {"GBPlane": " ".join(np.array(gb_plane).astype(str)), "RotationAxis": axis, "MisorientationAngle": gb.theta,