Adjusted functions to work with new pbc_poits
This commit is contained in:
parent
0bd82ee281
commit
a38e601fcb
@ -4,7 +4,7 @@ from .coordinates import rotate_axis, polar_coordinates, spherical_coordinates
|
|||||||
from .atoms import next_neighbors
|
from .atoms import next_neighbors
|
||||||
from .autosave import autosave_data
|
from .autosave import autosave_data
|
||||||
from .utils import runningmean
|
from .utils import runningmean
|
||||||
from .pbc import pbc_diff, pbc_points, make_PBC
|
from .pbc import pbc_diff, pbc_points
|
||||||
from .logging import logger
|
from .logging import logger
|
||||||
from scipy import spatial
|
from scipy import spatial
|
||||||
|
|
||||||
@ -144,7 +144,7 @@ def rdf(atoms_a, atoms_b=None, bins=None, box=None, kind=None, chunksize=50000,
|
|||||||
def pbc_tree_rdf(atoms_a, atoms_b=None, bins=None, box=None, exclude=0, returnx=False, **kwargs):
|
def pbc_tree_rdf(atoms_a, atoms_b=None, bins=None, box=None, exclude=0, returnx=False, **kwargs):
|
||||||
if box is None:
|
if box is None:
|
||||||
box = atoms_a.box.diagonal()
|
box = atoms_a.box.diagonal()
|
||||||
all_coords = pbc_points(pbc_diff(atoms_b,box=box), box, thickness=np.amax(bins)+0.1, center=0)
|
all_coords = pbc_points(atoms_b, box, thickness=np.amax(bins)+0.1)
|
||||||
to_tree = spatial.cKDTree(all_coords)
|
to_tree = spatial.cKDTree(all_coords)
|
||||||
dist = to_tree.query(pbc_diff(atoms_a,box=box),k=len(atoms_b), distance_upper_bound=np.amax(bins)+0.1)[0].flatten()
|
dist = to_tree.query(pbc_diff(atoms_a,box=box),k=len(atoms_b), distance_upper_bound=np.amax(bins)+0.1)[0].flatten()
|
||||||
dist = dist[dist < np.inf]
|
dist = dist[dist < np.inf]
|
||||||
@ -159,8 +159,8 @@ def pbc_tree_rdf(atoms_a, atoms_b=None, bins=None, box=None, exclude=0, returnx=
|
|||||||
|
|
||||||
def pbc_spm_rdf(atoms_a, atoms_b=None, bins=None, box=None, exclude=0, returnx=False, **kwargs):
|
def pbc_spm_rdf(atoms_a, atoms_b=None, bins=None, box=None, exclude=0, returnx=False, **kwargs):
|
||||||
if box is None:
|
if box is None:
|
||||||
box = atoms_a.box.diagonal()
|
box = atoms_a.box
|
||||||
all_coords = pbc_points(pbc_diff(atoms_b,box=box), box, thickness=np.amax(bins)+0.1, center=0)
|
all_coords = pbc_points(atoms_b, box, thickness=np.amax(bins)+0.1)
|
||||||
to_tree = spatial.cKDTree(all_coords)
|
to_tree = spatial.cKDTree(all_coords)
|
||||||
if all_coords.nbytes/1024**3 * len(atoms_a) < 2:
|
if all_coords.nbytes/1024**3 * len(atoms_a) < 2:
|
||||||
from_tree = spatial.cKDTree(pbc_diff(atoms_a,box=box))
|
from_tree = spatial.cKDTree(pbc_diff(atoms_a,box=box))
|
||||||
@ -361,7 +361,7 @@ def next_neighbor_distribution(atoms, reference=None, number_of_neighbors=4, bin
|
|||||||
|
|
||||||
def hbonds(D, H, A, box, DA_lim=0.35, HA_lim=0.35, min_cos=np.cos(30*np.pi/180), full_output=False):
|
def hbonds(D, H, A, box, DA_lim=0.35, HA_lim=0.35, min_cos=np.cos(30*np.pi/180), full_output=False):
|
||||||
def dist_DltA(D, H, A, box, max_dist=0.35):
|
def dist_DltA(D, H, A, box, max_dist=0.35):
|
||||||
ppoints, pind = make_PBC(D, box, thickness=max_dist+0.1, index=True)
|
ppoints, pind = pbc_points(D, box, thickness=max_dist+0.1, index=True)
|
||||||
Dtree = cKDTree(ppoints)
|
Dtree = cKDTree(ppoints)
|
||||||
Atree = cKDTree(A)
|
Atree = cKDTree(A)
|
||||||
pairs = Dtree.sparse_distance_matrix(Atree, max_dist, output_type='ndarray')
|
pairs = Dtree.sparse_distance_matrix(Atree, max_dist, output_type='ndarray')
|
||||||
@ -371,7 +371,7 @@ def hbonds(D, H, A, box, DA_lim=0.35, HA_lim=0.35, min_cos=np.cos(30*np.pi/180),
|
|||||||
return pairs
|
return pairs
|
||||||
|
|
||||||
def dist_AltD(D, H, A, box, max_dist=0.35):
|
def dist_AltD(D, H, A, box, max_dist=0.35):
|
||||||
ppoints, pind = make_PBC(A, box, thickness=max_dist+0.1, index=True)
|
ppoints, pind = pbc_points(A, box, thickness=max_dist+0.1, index=True)
|
||||||
Atree = cKDTree(ppoints)
|
Atree = cKDTree(ppoints)
|
||||||
Dtree = cKDTree(D)
|
Dtree = cKDTree(D)
|
||||||
pairs = Atree.sparse_distance_matrix(Dtree, max_dist, output_type='ndarray')
|
pairs = Atree.sparse_distance_matrix(Dtree, max_dist, output_type='ndarray')
|
||||||
|
Loading…
Reference in New Issue
Block a user