Пример #1
0
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)
chunk_size  = 100
cyld = np.zeros((len(distances), sum(range(len(res_targ)+1))))
r2d = []
for chunk_index, traj in enumerate(md.iterload(traj_name, chunk = chunk_size, top = 'topol.pdb')):
    for sub_ind, frame in enumerate(traj):
        xyz_com = comm.calc_xyz_com_con(res_targ, frame, topology, para, direction, bound)
        r2d = []
        count = []
        for res_type, xyz_res in enumerate(xyz_com):
            for ref_type, xyz_ref in enumerate(xyz_com[res_type:]):
                count.append(len(xyz_res))
                r2d.append([])
                for i in xyz_res:
                    for j in xyz_ref:
                        if sum((i-j)**2) != 0:
# Description: This is a python script to calculate the nonbond interaction between ions and the electrode surface within a cutoff distance
# Date: 02-24-2016 Created

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

bound_slit = [4, 8, 23, 27]
#bound_slit = [4, 5, 23, 24]

############ Main #############
traj_name, traj0, topology = comm.load_traj()
para = comm.load_para()
res_targ, res_name, wallindex, wallname = comm.select_groups(traj0)
direction = comm.direction
#bound = comm.load_bound(traj0, direction)
bin_size = comm.bin_size
cutoff = comm.args.cutoff

#res_targ = [i[:100] for i in res_targ]

distances = []
n_dist = []
ninslit = []
vdw_sum = []
es_sum = []
vdw_slit = []
es_slit = []