From 28c52db812a948de7db24c7490e2f150d6236a8b Mon Sep 17 00:00:00 2001 From: Sam Dareska <37879103+samwaseda@users.noreply.github.com> Date: Wed, 24 May 2023 10:54:28 +0200 Subject: [PATCH 1/6] Add `parent` to `get_chemical_symbols` --- structuretoolkit/common/helper.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/structuretoolkit/common/helper.py b/structuretoolkit/common/helper.py index 835ceae0a..aee2978dc 100644 --- a/structuretoolkit/common/helper.py +++ b/structuretoolkit/common/helper.py @@ -4,7 +4,7 @@ def get_atomic_numbers(structure): - return [atomic_numbers[el] for el in structure.get_chemical_symbols()] + return [atomic_numbers[el] for el in structure.get_chemical_symbols(parent=True)] def get_extended_positions( From 59b0fe026e913517097c0013b7620ceb79663019 Mon Sep 17 00:00:00 2001 From: Sam Dareska <37879103+samwaseda@users.noreply.github.com> Date: Thu, 25 May 2023 16:46:33 +0200 Subject: [PATCH 2/6] use ASE-native get_atomic_numbers --- structuretoolkit/common/helper.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/structuretoolkit/common/helper.py b/structuretoolkit/common/helper.py index aee2978dc..1062b81be 100644 --- a/structuretoolkit/common/helper.py +++ b/structuretoolkit/common/helper.py @@ -4,7 +4,7 @@ def get_atomic_numbers(structure): - return [atomic_numbers[el] for el in structure.get_chemical_symbols(parent=True)] + return structure.get_atomic_numbers() def get_extended_positions( From faf48d98b69c47fbcf4244015364567cd101ac70 Mon Sep 17 00:00:00 2001 From: Sam Dareska <37879103+samwaseda@users.noreply.github.com> Date: Thu, 25 May 2023 16:57:06 +0200 Subject: [PATCH 3/6] remove get_atomic_numbers --- structuretoolkit/common/helper.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/structuretoolkit/common/helper.py b/structuretoolkit/common/helper.py index 1062b81be..2c901a591 100644 --- a/structuretoolkit/common/helper.py +++ b/structuretoolkit/common/helper.py @@ -3,10 +3,6 @@ from scipy.sparse import coo_matrix -def get_atomic_numbers(structure): - return structure.get_atomic_numbers() - - def get_extended_positions( structure, width, return_indices=False, norm_order=2, positions=None ): From bb9c71a6a6faf91ec55ee26821f6e98b88e8c283 Mon Sep 17 00:00:00 2001 From: samwaseda Date: Thu, 25 May 2023 15:00:28 +0000 Subject: [PATCH 4/6] replace get_atomic_numbers by structure.get_atomic_numbers --- structuretoolkit/visualize.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/structuretoolkit/visualize.py b/structuretoolkit/visualize.py index 6b7ed9b79..b8d69fc57 100644 --- a/structuretoolkit/visualize.py +++ b/structuretoolkit/visualize.py @@ -7,8 +7,6 @@ import numpy as np from scipy.interpolate import interp1d -from structuretoolkit.common.helper import get_atomic_numbers - __author__ = "Joerg Neugebauer, Sudarsan Surendralal" __copyright__ = ( "Copyright 2021, Max-Planck-Institut für Eisenforschung GmbH - " @@ -184,7 +182,7 @@ def _plot3d_plotly( if select_atoms is None: select_atoms = np.arange(len(structure)) elements = structure.get_chemical_symbols() - atomic_numbers = get_atomic_numbers(structure=structure) + atomic_numbers = structure.get_atomic_numbers() if scalar_field is None: scalar_field = elements fig = px.scatter_3d( @@ -302,7 +300,7 @@ def _plot3d( vector_field = structure.get_initial_magnetic_moments() elements = structure.get_chemical_symbols() - atomic_numbers = get_atomic_numbers(structure=structure) + atomic_numbers = structure.get_atomic_numbers() positions = structure.positions # If `select_atoms` was given, visualize only a subset of the `parent_basis` From 111c1d3d2ce7bfe665e4af0ea2f2b950a23a720b Mon Sep 17 00:00:00 2001 From: samwaseda Date: Thu, 25 May 2023 15:01:25 +0000 Subject: [PATCH 5/6] remove from __init__.py --- structuretoolkit/common/__init__.py | 1 - 1 file changed, 1 deletion(-) diff --git a/structuretoolkit/common/__init__.py b/structuretoolkit/common/__init__.py index 41bad76b0..b762bac1c 100644 --- a/structuretoolkit/common/__init__.py +++ b/structuretoolkit/common/__init__.py @@ -2,7 +2,6 @@ from structuretoolkit.common.helper import ( apply_strain, center_coordinates_in_unit_cell, - get_atomic_numbers, get_extended_positions, get_vertical_length, get_wrapped_coordinates, From 51d9d6df2d652114c55f9706a075281bbe6d6da8 Mon Sep 17 00:00:00 2001 From: Jan Janssen Date: Thu, 25 May 2023 09:06:46 -0600 Subject: [PATCH 6/6] Update __init__.py --- structuretoolkit/__init__.py | 1 - 1 file changed, 1 deletion(-) diff --git a/structuretoolkit/__init__.py b/structuretoolkit/__init__.py index 3a79c0486..cf64fdab7 100644 --- a/structuretoolkit/__init__.py +++ b/structuretoolkit/__init__.py @@ -44,7 +44,6 @@ ase_to_pymatgen, ase_to_pyscal, center_coordinates_in_unit_cell, - get_atomic_numbers, get_extended_positions, get_vertical_length, get_wrapped_coordinates,