コード例 #1
0
# Carbon - Hydrogen Bond Length
BL_CH = 160e-12  # m

r_min, r_max = -BL_CH * 2, BL_CH * 2

# Tetrahedral angle (109.4 deg) - 90 deg
tet_theta = -asin(1 / 3)

# Charge Districution for C atom
C_chargeArray = [4 * e] + [-e] * 4

C_chargePosArray = np.array(
    sp2cart([0] + [r_C] * 4, [0, pi / 2] + [tet_theta] * 3,
            [0, 0, -pi / 3, pi / 3, pi])).transpose()

C_ChargeDist = ChargeDistribution(C_chargeArray, C_chargePosArray)

# Array of positions of H atoms
H_PosArray = np.array(
    sp2cart([BL_CH] * 4, [pi / 2] + [tet_theta] * 3,
            [0, -pi / 3, pi / 3, pi])).transpose()

# Array of positions of electron of H atom
# assuming them to be farther away from the C atom
H_e_PosArray = np.array(
    sp2cart([BL_CH + r_H] * 4, [pi / 2] + [tet_theta] * 3,
            [0, -pi / 3, pi / 3, pi])).transpose()

# H atom Dipoles
H1 = Dipole.fromChargeDistro(
    ChargeDistribution([e, -e], [H_PosArray[0], H_e_PosArray[0]]))
コード例 #2
0
a = 38e-12  # m

n_frames = 50
frequency = 10  # Hz
r_min, r_max = a * 10, a * 15

chargeArray = [4 * e] + [-e] * 4

tet_theta = -asin(1 / 3)

chargePosArray = np.array(
    sp2cart([0] + [a] * 4, [0, pi / 2] + [tet_theta] * 3,
            [0, 0, -pi / 3, pi / 3, pi])).transpose()

myChargeDist = ChargeDistribution(chargeArray, chargePosArray)

n_points = 20

r_array = np.linspace(r_min, r_max, n_points)
theta_array = np.linspace(tet_theta, pi / 2, n_points)
phi_array = np.linspace(-pi / 3, pi / 3, n_frames)

V_Tensor = np.zeros((n_frames, n_points, n_points))

print('Started calculating V_Tensor')

for i in range(n_frames):

    phi = phi_array[i]
r_min, r_max = -2*a, 2*a

chargeArray = [e]*6 + [-6*e]

chargePosArray = [ 
        [ a, 0, 0],
        [ 0, a, 0],
        [ 0, 0, a],
        [-a, 0, 0],
        [ 0,-a, 0],
        [ 0, 0,-a],
        [ 0, 0, 0]
    ]

myChargeDist = ChargeDistribution(chargeArray, chargePosArray)

n_points = 20

x_array = np.linspace(r_min, r_max, n_points)
y_array = np.linspace(r_min, r_max, n_points)
z_array = np.linspace(r_min, r_max, n_points)

V_Tensor = np.zeros((n_points, n_points, n_points))

print('Started calculating V_Tensor')

for i in range(n_points) :

    x = x_array[i]
コード例 #4
0
BL_CH = 160e-12  # m

# H atom PE
PE_H = 2 * -2.179871971e-18  #j

# Tetrahedral angle (109.4 deg) - 90 deg
tet_theta = -asin(1 / 3)

# Charge Districution for C atom
C_chargeArray = [4 * e] + [-e] * 4

C_chargePosArray = np.array(
    sp2cart([0] + [r_C] * 4, [0, pi / 2] + [tet_theta] * 3,
            [0, 0, -pi / 3, pi / 3, pi])).transpose()

C_ChargeDist = ChargeDistribution(C_chargeArray, C_chargePosArray)

# Array of positions of H atoms
H_PosArray = np.array(
    sp2cart([BL_CH] * 4, [pi / 2] + [tet_theta] * 3,
            [0, -pi / 3, pi / 3, pi])).transpose()

# Array of positions of electron of H atom
# assuming them to be farther away from the C atom
H_e_PosArray = np.array(
    sp2cart([BL_CH + r_H] * 4, [pi / 2] + [tet_theta] * 3,
            [0, -pi / 3, pi / 3, pi])).transpose()

# H atom Dipoles
H1 = Dipole.fromChargeDistro(
    ChargeDistribution([e, -e], [H_PosArray[0], H_e_PosArray[0]]))
コード例 #5
0
from electric_multipoles import ChargeDistribution, e
import numpy as np

a_array = [1e-10, 5e-10, 24e-10]  # m

r_o = np.array([0, 0, 0]) * 1e-10

chargeArray = [e] * 6 + [-6 * e]

for a in a_array:

    chargePosArray = [[a, 0, 0], [0, a, 0], [0, 0, a], [-a, 0, 0], [0, -a, 0],
                      [0, 0, -a], [0, 0, 0]]

    myChargeDist = ChargeDistribution(chargeArray, chargePosArray)

    print('\na = ', a, ' m')

    print('P_e : ')
    print(myChargeDist.P_e(r_o))

    print('q_e : ')
    print(myChargeDist.q_e(r_o))