#!/Users/yuzhang/anaconda/bin/python
# Filename:
# Date: 01-20-2015 Created
# Description: This is a file to compute the number density near the gold disk

import calc_common as calc_comm
import numpy as np
import mdtraj as md
import matplotlib.pyplot as plt
import pdb

########## main ##########
traj_name, traj0, topology = calc_comm.load_traj()
para = calc_comm.load_para()
res_targ, res_name = calc_comm.select_groups(traj0)
direction = calc_comm.direction
bin_size = calc_comm.bin_size
bound = calc_comm.load_bound(traj0, direction)
distances = np.arange(bound[0], bound[1], bin_size)
nd = np.zeros((len(distances), len(res_targ)))
chunk_size = 10
cyl = [4, 4, 1.5]
for chunk_index, traj in enumerate(
        md.iterload(traj_name, chunk=chunk_size, top='topol.pdb')):
    #if chunk_index == 1:
    #    break
    for i, frame in enumerate(traj):
        #xyz_com = calc_comm.calc_xyz_com(res_targ, frame, topology, para)
        xyz_com = calc_comm.calc_xyz_cyl(res_targ, frame, topology, para, cyl)
        for res_type, xyz in enumerate(xyz_com):
            temp, _ = np.histogram(xyz[:, direction],
예제 #2
0
#!/Users/yuzhang/anaconda/bin/python
# Filename: calc_rdf.py
# Description: This is a python script to calculate the cylindrical distribution between different spicies
# Date: 01-28-2016: Created

import pdb
import mdtraj as md
import numpy as np
import matplotlib.pyplot as plt
import calc_common as comm

############ main ##########
traj_name, traj0, topology = comm.load_traj()
para = comm.load_para()
direction = comm.direction   ## the direction where the slit are selected
bin_size = 0.01
bound = comm.load_bound(traj0, direction)
dim_flat = []
for i in range(3):
    if i != direction:
        dim_flat.append(i)
#d_plane = [4.66581 for row in range(3)]
d_plane = [traj0.unitcell_lengths[0, i] for i in dim_flat]
#dimensions = [int(i/bin_size)+1 for i in d_plane]
cutoff = 3.0
distances = np.arange(0, cutoff+bin_size, bin_size)

# Antoher way is to use the previous function select groups, and automatically make pairs based on the selected groups.
# This redueces the lines of the code and make the codes more consistent, but it has less freedom to tune.
# Current version is based on the following code.
res_targ, res_name = comm.select_groups(traj0)
예제 #3
0
#!/Users/yuzhang/anaconda/bin/python
# Filename: calc_cylindrical_distribution.py
# Description: This is a python script to calculate the cylindrical distribution between different spicies
# Date: 01-25-2016: Created

import pdb
import mdtraj as md
import numpy as np
import matplotlib.pyplot as plt
import calc_common as calc_comm

############ main ##########
traj_name, traj0, topology = calc_comm.load_traj()
nonbond = calc_comm.load_nonbond()
para = calc_comm.load_para(nonbond)
direction = 2
bound = calc_comm.load_bound(traj0, direction)
bin_size = 0.01
dim_flat = []
for i in range(3):
    if i != direction:
        dim_flat.append(i)
d_plane = [traj0.unitcell_lengths[0, i] for i in dim_flat]
dimensions = [int(i/bin_size)+1 for i in d_plane]
cutoff = 3.0
distances = np.arange(0, cutoff+bin_size, bin_size)

# The following way creates a new function called radial_pairs in the calc_common.py file
#pair_targ = calc_comm.radial_pairs(traj0)

# Antoher way is to use the previous function select groups, and automatically make pairs based on the selected groups.