コード例 #1
0
ファイル: orderpar.py プロジェクト: ajjackson/chemlab
def radial_density(ion='Cl'):
    s = current_system()    
    
    select_crystal()
    center = cluster_center()

    mask = s.type_array == ion | s.type_array == 'Na'
    r_array = s.r_array.copy()
    
    ions_r = r_array[mask]
    ions_r -= center
    ions_r = minimum_image(ions_r, s.box_vectors.diagonal())
    
    # Density
    mx = s.box_vectors.max()
    
    # distance from center
    distances = np.sqrt((ions_r ** 2).sum(axis=1))
    
    bins = np.linspace(0, mx, 100)
    hist, bins_= np.histogram(distances, bins)

    # Normalize the histogram
    start_shells_r = bins_[:-1]
    end_shells_r = bins_[1:]
    
    start_shells_V = 4.0/3.0 * np.pi * start_shells_r**3
    end_shells_V = 4.0/3.0 * np.pi * end_shells_r**3
    
    V_shell = end_shells_V - start_shells_V
    
    return bins_[:-1], hist/V_shell
コード例 #2
0
ファイル: orderpar.py プロジェクト: ajjackson/chemlab
def center_on_crystal():
    select_crystal()
    center = cluster_center()
    current_system().r_array -= center
    current_system().r_array += 0.5 * current_system().box_vectors.diagonal()
    current_system().r_array[:] = minimum_image(current_system().r_array, current_system().box_vectors.diagonal())
    current_representation().update_positions(current_system().r_array)
コード例 #3
0
ファイル: orderpar.py プロジェクト: ajjackson/chemlab
def radial_density(ion='Cl'):
    s = current_system()

    select_crystal()
    center = cluster_center()

    mask = s.type_array == ion | s.type_array == 'Na'
    r_array = s.r_array.copy()

    ions_r = r_array[mask]
    ions_r -= center
    ions_r = minimum_image(ions_r, s.box_vectors.diagonal())

    # Density
    mx = s.box_vectors.max()

    # distance from center
    distances = np.sqrt((ions_r**2).sum(axis=1))

    bins = np.linspace(0, mx, 100)
    hist, bins_ = np.histogram(distances, bins)

    # Normalize the histogram
    start_shells_r = bins_[:-1]
    end_shells_r = bins_[1:]

    start_shells_V = 4.0 / 3.0 * np.pi * start_shells_r**3
    end_shells_V = 4.0 / 3.0 * np.pi * end_shells_r**3

    V_shell = end_shells_V - start_shells_V

    return bins_[:-1], hist / V_shell
コード例 #4
0
ファイル: orderpar.py プロジェクト: ajjackson/chemlab
def center_on_crystal():
    select_crystal()
    center = cluster_center()
    current_system().r_array -= center
    current_system().r_array += 0.5 * current_system().box_vectors.diagonal()
    current_system().r_array[:] = minimum_image(
        current_system().r_array,
        current_system().box_vectors.diagonal())
    current_representation().update_positions(current_system().r_array)
コード例 #5
0
ファイル: orderpar.py プロジェクト: ajjackson/chemlab
def periodic_add(a, b):
    return minimum_image(a + b,
                         current_system().box_vectors.diagonal())
コード例 #6
0
ファイル: orderpar.py プロジェクト: ajjackson/chemlab
def periodic_add(a, b):
    return minimum_image(a + b, current_system().box_vectors.diagonal())