Example #1
0
def makeNnzDist():
    import parseXYZ

    matD = getAtomMatrix("/Volumes/s/matrices/matrixmarket/diamond-2r_P2_A.mm")
    matW = getAtomMatrix("/Volumes/s/matrices/matrixmarket/nanowire25-2r_P2_A.mm")
    nnzD = matD.nnz
    nnzW = matW.nnz
    distD = np.array([0.0] * nnzD)
    distW = np.array([0.0] * nnzW)
    xyzD = parseXYZ.getXYZ("diamond-2r_P2.xyz")
    xyzW = parseXYZ.getXYZ("nanowire25-2r_P2.xyz")

    for i in range(matW.nnz):
        if i < matD.nnz:
            atom1 = matD.row[i]
            atom2 = matD.col[i]
            distD[i] = parseXYZ.getdistance(
                xyzD[1][atom1], xyzD[2][atom1], xyzD[3][atom1], xyzD[1][atom2], xyzD[2][atom2], xyzD[3][atom2]
            )
        atom1 = matW.row[i]
        atom2 = matW.col[i]
        distW[i] = parseXYZ.getdistance(
            xyzW[1][atom1], xyzW[2][atom1], xyzW[3][atom1], xyzW[1][atom2], xyzW[2][atom2], xyzW[3][atom2]
        )
    print "done"
    plt.figure()
    plt.hist(distD, bins=1000, cumulative=False, normed=True, histtype=u"step", color="red", edgecolor="red", alpha=0.7)
    plt.hist(
        distW, bins=1000, cumulative=False, normed=True, histtype=u"step", color="green", edgecolor="green", alpha=0.7
    )
    plt.show()
    return
Example #2
0
def makeNnzHist(mat, xyz):
    import parseXYZ

    nnz = mat.nnz
    dist = np.array([0.0] * nnz)

    for i in range(nnz):
        atom1 = mat.row[i]
        atom2 = mat.col[i]
        dist[i] = parseXYZ.getdistance(
            xyz[1][atom1], xyz[2][atom1], xyz[3][atom1], xyz[1][atom2], xyz[2][atom2], xyz[3][atom2]
        )
    plt.figure()
    plt.hist(dist, bins=1000, cumulative=False, normed=True, histtype=u"step", color="red", edgecolor="red", alpha=0.7)
    return
Example #3
0
def getDistMat(xyz, thresh):
    import parseXYZ

    natoms = len(xyz[1])
    mat = np.zeros((natoms, natoms), dtype=np.int)
    centerlist = []
    for i in range(natoms - 1):
        for j in range(i + 1, natoms):
            tmp = parseXYZ.getdistance(xyz[1][i], xyz[2][i], xyz[3][i], xyz[1][j], xyz[2][j], xyz[3][j])
            if tmp < thresh:
                mat[i][j] = tmp
                if abs(i - j) < 152 and abs(i - j) > 148:
                    centerlist.append(i)
                    centerlist.append(j)
    print "jmol command:", str(["C" + str(centerlist[i] + 1) for i in range(len(centerlist))]).replace("[", "").replace(
        "]", ""
    ).replace("'", "")
    return spa.coo_matrix(mat)