Skip to content

Commit

Permalink
bug fixes in graph
Browse files Browse the repository at this point in the history
  • Loading branch information
srmnitc committed Jun 26, 2023
1 parent 5b8da11 commit ac86cd4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
5 changes: 4 additions & 1 deletion pyscal_rdf/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"):
"""
Expand Down
24 changes: 12 additions & 12 deletions pyscal_rdf/structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit ac86cd4

Please sign in to comment.