diff --git a/snow/descriptors/lae.py b/snow/descriptors/lae.py index 90a5196..b77e4d8 100644 --- a/snow/descriptors/lae.py +++ b/snow/descriptors/lae.py @@ -1,6 +1,6 @@ import numpy as np import os -from snow.lodispp.utils import nearest_neighbours +from snow.descriptors.utils import nearest_neighbours from snow.descriptors.coordination import agcn_calculator diff --git a/snow/descriptors/shape_descriptors.py b/snow/descriptors/shape_descriptors.py index 5c951da..e4c4277 100644 --- a/snow/descriptors/shape_descriptors.py +++ b/snow/descriptors/shape_descriptors.py @@ -46,7 +46,7 @@ def geometric_com(index_frame: int, coords: np.ndarray): gcom = np.mean(coords, axis=0) return gcom -def compute_gyration_tensor(positions, masses=None, COM=True): +def gyr_tensor(positions, masses=None, COM=True): """ Computes the gyration tensor for a given set of coordinates. \n This can be done in the center of mass reference system or in the raw provided coordinates. @@ -86,7 +86,7 @@ def compute_gyration_tensor(positions, masses=None, COM=True): return np.array([[Sxx, Sxy, Sxz], [Sxy, Syy, Syz], [Sxz, Syz, Szz]]) -def compute_gyration_desc_from_tensor(gyration_tensor): +def gyr_desc_from_tensor(gyration_tensor): """ Computes general shape descriptors (gyration radius, asphericity, acylindricity, relative shape anisotropy) from the gyration tensor @@ -122,7 +122,7 @@ def compute_gyration_desc_from_tensor(gyration_tensor): return rg, b, c, k -def compute_gyration_descriptors(positions, masses=None, COM=True): +def gyr_desc(index_frame: int, positions, masses=None, COM=True): """ Computes general shape descriptors obtained from the gyration tensor \n (gyration radius, asphericity, acylindricity, relative shape anisotropy) directly from the provided atomic positions. \n @@ -132,6 +132,8 @@ def compute_gyration_descriptors(positions, masses=None, COM=True): Parameters ---------- + index_frame (int): + Index of the frame in the trajectory (for reference only - not used now). positions : ndarray (n,3) Array of the coordinates of the atoms forming the system. masses : ndarray @@ -150,11 +152,11 @@ def compute_gyration_descriptors(positions, masses=None, COM=True): relative shape anisotropy """ - return compute_gyration_desc_from_tensor(compute_gyration_tensor(positions, masses, COM)) + return gyr_desc_from_tensor(gyr_tensor(positions, masses, COM)) -def compute_inertia_tensor(positions, masses=None, COM=True): +def inertia_tensor(positions, masses=None, COM=True): """ Computes the inertia tensor for a given set of coordinates. \n @@ -194,7 +196,7 @@ def compute_inertia_tensor(positions, masses=None, COM=True): return np.array([[Ixx, Ixy, Ixz], [Ixy, Iyy, Iyz], [Ixz, Iyz, Izz]]) -def compute_aspect_ratio_from_tensor(inertia_tensor): +def aspect_ratio_from_tensor(inertia_tensor): """ Computes the aspect ratio, a shape descriptor obtained from the inertia tensor. @@ -211,13 +213,15 @@ def compute_aspect_ratio_from_tensor(inertia_tensor): -def compute_aspect_ratio(positions, masses=None, COM=True): +def aspect_ratio(index_frame: int, positions, masses=None, COM=True): """ Computes the aspect ratio, a shape descriptor derived from the inertia tensor, for a given set of coordinates. \n This can be done in the center of mass reference system or in the raw provided coordinates Parameters ---------- + index_frame (int): + Index of the frame in the trajectory (for reference only - not used now). positions : ndarray Nx3 Array of the coordinates of the atoms in the system. masses : ndarray @@ -232,15 +236,17 @@ def compute_aspect_ratio(positions, masses=None, COM=True): aspect ratio """ - return compute_aspect_ratio_from_tensor(compute_inertia_tensor(positions, masses, COM)) + return aspect_ratio_from_tensor(inertia_tensor(positions, masses, COM)) -def compute_gyr_rad(positions, masses=None): +def gyr_rad(index_frame: int, positions, masses=None): """ Computes the gyration radius, which corresponds to the average weighted by the masses of\n atoms in the system. Parameters ---------- + index_frame (int): + Index of the frame in the trajectory (for reference only - not used now). positions : ndarray Nx3 Array of the coordinates of the atoms in the system. masses : ndarray @@ -257,4 +263,4 @@ def compute_gyr_rad(positions, masses=None): centered = positions - np.average(positions, axis=0, weights=masses) - return np.sqrt( np.average( np.sum(centered**2, axis=1), weights=masses ) ) \ No newline at end of file + return np.sqrt( np.average( np.sum(centered**2, axis=1), weights=masses ) )