当前位置: 首页>>代码示例>>Python>>正文


Python Model.write_our_xyz方法代码示例

本文整理汇总了Python中model.Model.write_our_xyz方法的典型用法代码示例。如果您正苦于以下问题:Python Model.write_our_xyz方法的具体用法?Python Model.write_our_xyz怎么用?Python Model.write_our_xyz使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在model.Model的用法示例。


在下文中一共展示了Model.write_our_xyz方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: main

# 需要导入模块: from model import Model [as 别名]
# 或者: from model.Model import write_our_xyz [as 别名]
def main():
    modelfile = sys.argv[1]
    m = Model(modelfile)

    # Below is the identity rotation array.
    #rot_arr = [1,0,0,0,1,0,0,0,1]

    # Below is the correct rotation matrix for JWH t3 icofrac to get it into the orientation in his PRL paper.
    #rot_arr = [-0.031777, 0.998843, 0.036102, 0.986602, 0.025563, 0.161133, 0.160023, 0.040739, -0.986272]

    # Below is a (the?) rotation matrix for JWH t1 icofrac.
    #rot_arr = [ 0.954646, -0.233932, 0.184194, 0.280650, 0.913581, -0.294287, -0.099433, 0.332633, 0.937800 ]

    # Below is a (the?) rotation matrix of Pei's t1 that gives some planes. Oriented for a specific plane ~.
    #rot_arr = [ -0.977103, -0.123352, -0.173361, -0.130450, 0.990997, 0.030118, 0.168085, 0.052043, -0.984398 ]

    # Below is a (the?) rotation matrix of Pei's t2 that gives some planes. Oriented for a specific plane ~.
    rot_arr = [ 0.985478, -0.010230, -0.169493, 0.009247, 0.999936, -0.006586, 0.169549, 0.004923, 0.985509]

    # Below is a (the?) rotation matrix of Pei's t3 that gives some planes. Oriented for a specific plane ~.
    #rot_arr = [0.981624,-0.002765,-0.190808, -0.003436,0.999477,-0.032163, 0.190797,0.032228,0.981100]

    npra = np.asarray(rot_arr)
    rot(m,npra)

    # Write cif file to screen
    #m.write_cif()
    m.write_our_xyz()
开发者ID:jjmaldonis,项目名称:OdieCode,代码行数:30,代码来源:2d_rot.py

示例2: glm

# 需要导入模块: from model import Model [as 别名]
# 或者: from model.Model import write_our_xyz [as 别名]
def glm(modelfile,mult):
    model = Model(modelfile)

    outfile = modelfile+'.bigger'

    model = Model(modelfile)
    atoms = model.atoms[:]
    natoms = model.natoms
    for atom in atoms:
        for i in range(0,mult):
            for j in range(0,mult):
                for k in range(0,mult):
                    if(i == j == k == 0): continue
                    natoms += 1
                    x = atom.coord[0] + i*model.lx
                    y = atom.coord[1] + j*model.ly
                    z = atom.coord[2] + k*model.lz
                    model.add_atom(Atom(natoms,atom.z,x,y,z))

    # Shift right 1/2 world and left mult/2 worlds
    # which is equivalent to left (mult-1)/2 worlds
    for i,atom in enumerate(model.atoms):
        model.atoms[i].set_coord(model.atoms[i].coord[0] - (mult-1)/2.0*model.lx, model.atoms[i].coord[1] - (mult-1)/2.0*model.ly, model.atoms[i].coord[2] - (mult-1)/2.0*model.lz)

    model.lx *= mult
    model.ly *= mult
    model.lz *= mult

    model.write_our_xyz(outfile)
开发者ID:jjmaldonis,项目名称:OdieCode,代码行数:31,代码来源:generate_bigger_model.py

示例3: main

# 需要导入模块: from model import Model [as 别名]
# 或者: from model.Model import write_our_xyz [as 别名]
def main():
    modelfile = sys.argv[1]
    m = Model(modelfile)

    # Below is a (the?) rotation matrix of Pei's t1 that gives some planes. Oriented for a specific plane ~.
    rot_arr = [ -0.977103, -0.123352, -0.173361, -0.130450, 0.990997, 0.030118, 0.168085, 0.052043, -0.984398 ]
    rot(m,rot_arr)

    # Angles in radians
    # Note that these are semi difficult to figure out from the vesta rotation matrix,
    # partly because there are negative angles, so you may need to do 2pi - angle you found.
    #t1 = np.pi*2 - 0.0371505
    #t2 = 0.162790
    #t3 = 0
    #rot_arr = calc_rot_array(m,t1,t2,t3)
    #rot(m,rot_arr)

    # Write cif file to screen
    #m.write_cif()
    m.write_our_xyz()
开发者ID:jjmaldonis,项目名称:OdieCode,代码行数:22,代码来源:3d_rot.py

示例4: main

# 需要导入模块: from model import Model [as 别名]
# 或者: from model.Model import write_our_xyz [as 别名]
def main():
    modelfile = sys.argv[1]
    outfilebase = sys.argv[2]
    m = Model(modelfile)

    # Below is the identity rotation array.
    #rot_arr = [1,0,0,0,1,0,0,0,1]

    # Below is the correct rotation matrix for JWH t3 icofrac to get it into the orientation in his PRL paper.
    #rot_arr = [-0.031777, 0.998843, 0.036102, 0.986602, 0.025563, 0.161133, 0.160023, 0.040739, -0.986272]

    # Below is a (the?) rotation matrix for JWH t1 icofrac.
    #rot_arr = [ 0.954646, -0.233932, 0.184194, 0.280650, 0.913581, -0.294287, -0.099433, 0.332633, 0.937800 ]

    # Below is a (the?) rotation matrix of Pei's t1 that gives some planes. Oriented for a specific plane ~.
    #rot_arr = [ -0.977103, -0.123352, -0.173361, -0.130450, 0.990997, 0.030118, 0.168085, 0.052043, -0.984398 ]

    # Below is a (the?) rotation matrix of Pei's t2 that gives some planes. Oriented for a specific plane ~.
    #rot_arr = [ 0.985478, -0.010230, -0.169493, 0.009247, 0.999936, -0.006586, 0.169549, 0.004923, 0.985509]

    # Below is a (the?) rotation matrix of Pei's t3 that gives some planes. Oriented for a specific plane ~.
    #rot_arr = [0.981624,-0.002765,-0.190808, -0.003436,0.999477,-0.032163, 0.190797,0.032228,0.981100]

    # Below is a rotation matrix of Pei's Zr50 t3 that gives some planes. Oriented for a specific plane ~.
    #rot_arr = [0.983910,-0.035278,-0.175147,0.048246,0.996356,0.070340,0.172028,-0.077659,0.982026]

    # Below is a rotation matrix of Pei's Zr50 t3, cluster 0 from 'Crystal-like' with an alternate plane pattern.
    #rot_arr = [-0.078966,-0.539181,0.838479,-0.486443,0.755011,0.439695,-0.870137,-0.373151,-0.321901]
    #rot_arr = [-0.550168, -0.592703, -0.588233, -0.675963, 0.729699, -0.103023, 0.490295, 0.340944, -0.802102] # a second attempt
    #rot_arr = [ -0.102056, 0.795154, -0.597758, 0.867018, 0.365702, 0.338439, 0.487712, -0.483728, -0.726735] # eh
    #rot_arr = [ -0.485998, 0.815787, 0.313525, -0.151211, -0.431820, 0.889195, 0.860779, 0.384739, 0.333220]
    #rot_arr = [ -0.508856, -0.631880, -0.584631, -0.710228, 0.691926, -0.129672, 0.486458, 0.349237, -0.800870]

    # Below is a rotation matrix of Pei's Zr50 t3, all clusters, with one promising spot. Mostly noise probably.
    #rot_arr = [0.563829, 0.290821, -0.772995, -0.641563, -0.435169, -0.631684, -0.520090, 0.852086, -0.058781]
    #rot_arr = [-0.832982, -0.489634, -0.257683, -0.212007, -0.147731, 0.966038, -0.511072, 0.859322, 0.019252]
    #rot_arr = [ 0.494247,  0.236924,  -0.836413, 0.704623,  0.454325,  0.545064, 0.509142,  -0.858752,  0.057607]

    #rot_arr = [0.235445, 0.089792, 0.967731, -0.967993, 0.110713, 0.225236, -0.086917, -0.989788, 0.112985]
    #rot_arr = [0.216234, -0.047608, 0.975180,-0.955161, 0.196601, 0.221394,-0.202262, -0.979327, -0.002961]
    # BELOW: t3 - 0 rot
    rot_arr = [ 0.984104, 0.007169, -0.177450, 0.008311, 0.996231, 0.086340, 0.177400, -0.086442, 0.980335] # Pei t3 0 rot
    #rot_arr = [ 0.983102, -0.003388, -0.183028, 0.003365, 0.999994, -0.000437, 0.183028, -0.000187, 0.983108]
    
    # Pei's t2
    #rot_arr = [ 0.985568, 0.001345, -0.169276, 0.000677, 0.999929, 0.011883, 0.169280, -0.011826, 0.985497] # 0rot
    #rot_arr = [ -0.406881, -0.461953, -0.788065, -0.548766, 0.813295, -0.193412, 0.730277, 0.353768, -0.584418] #1rot
    #rot_arr =[ -0.466130, 0.820964, 0.329760, -0.171769, -0.449615, 0.876551, 0.867881, 0.351944, 0.350596] # 2rot
    #rot_arr = [ -0.303913, -0.572611, -0.761415, -0.608626, 0.731562, -0.307232, 0.732947, 0.370045, -0.570838] # 3rot
    #rot_arr = [ -0.653632, -0.441386, -0.614771, -0.749000, 0.260854, 0.609061, -0.108465,0.858565, -0.501100] # 4rot

    # Pei's t1
    #rot_arr =  [0.985435, 0.000143, -0.170053, 0.003167, 0.999811, 0.019194, 0.170023, -0.019453, 0.985248] #0rot
    #rot_arr = [ -0.181186, -0.653769, -0.734682, -0.632103, 0.649717, -0.422273, 0.753404, 0.387885, -0.530968] #1rot
    #rot_arr = [ -0.408942, 0.873456, 0.264275, -0.252622, -0.386635, 0.886959, 0.876897, 0.295953, 0.378765] #2rot
    #rot_arr = [ -0.243749, -0.741828, -0.624722, -0.637231, 0.608094, -0.473453, 0.731111, 0.282689, -0.620938] #3rot

    # JWH's t1
    #rot_arr = [ 0.915013, -0.004459, -0.403401, -0.010527, 0.999335, -0.034924, 0.403288, 0.036202, 0.914357]
    # JWH's t2
    #rot_arr = [ 0.983576, 0.009003, -0.180268, 0.010862, 0.993992, 0.108912, 0.180165, -0.109081, 0.977569]
    #JWH's t3
    #rot_arr = [ 0.985667, 0.014122, 0.168112, -0.020755, 0.999071, 0.037763, -0.167422, -0.040711, 0.985044]
    #JWH's t3 all.xtal cluster
    #rot_arr = [ 0.985237, 0.004144, 0.171146, -0.008192, 0.999703, 0.022952, -0.171000, -0.024015, 0.984978] 

    # 10k Zr50 model, rotated to see cluster in bottom right corner.
    #rot_arr = [ 0.985669, -0.008419, -0.168483, -0.000875, 0.998485, -0.055012, 0.168691, 0.054371, 0.984168]

    #rot_arr = [1,0,0,0,1,0,0,0,1]

    #kx = 0.3046888
    #ky = -0.0234376
    #kz = 0.2578136
    #kmag = sqrt(kx**2+ky**2+kz**2)
    #print(kx,ky,kz,kmag)
    #rot_arr = calc_rot_array(acos(kx/kmag),acos(ky/kmag),acos(kz/kmag))
    #print(rot_arr)

    npra = np.asarray(rot_arr)
    rot(m,npra)

    # Write cif file to screen
    m.write_cif(outfilebase+'.cif')
    m.write_our_xyz(outfilebase+'.xyz')
开发者ID:adehgha,项目名称:model_analysis,代码行数:87,代码来源:rotate_2d.py

示例5: main

# 需要导入模块: from model import Model [as 别名]
# 或者: from model.Model import write_our_xyz [as 别名]
def main():
    # sys.argv[1] should be the modelfile in the xyz format
    # sys.argv[2] should be the cutoff desired
    modelfile = sys.argv[1]
    cutoff = float(sys.argv[2])
    ag = AtomGraph(modelfile,cutoff)
    model = Model(modelfile)
    model.generate_neighbors(cutoff)
    #submodelfile = sys.argv[3]

    #mixedmodel = Model('Mixed atoms',model.lx,model.ly,model.lz, [atom for atom in ag.model.atoms if atom.vp.type == 'Mixed'])
    #icolikemodel = Model('Ico-like atoms',model.lx,model.ly,model.lz, [atom for atom in ag.model.atoms if(atom.vp.type == 'Icosahedra-like' or atom.vp.type == 'Full-icosahedra')])
    #fullicomodel = Model('Full-icosahedra atoms',model.lx,model.ly,model.lz, [atom for atom in ag.model.atoms if atom.vp.type == 'Full-icosahedra'])
    #xtalmodel = Model('Xtal-like atoms',model.lx,model.ly,model.lz, [atom for atom in ag.model.atoms if atom.vp.type == 'Crystal-like'])
    #undefmodel = Model('Undef atoms',model.lx,model.ly,model.lz, [atom for atom in ag.model.atoms if atom.vp.type == 'Undef'])
    ##mixedmodel.write_cif('mixed.cif')
    ##mixedmodel.write_our_xyz('mixed.xyz')
    ##icolikemodel.write_cif('icolike.cif')
    ##icolikemodel.write_our_xyz('icolike.xyz')
    ##fullicomodel.write_cif('fullico.cif')
    ##fullicomodel.write_our_xyz('fullico.xyz')
    ##xtalmodel.write_cif('xtal.cif')
    ##xtalmodel.write_our_xyz('xtal.xyz')
    ##undefmodel.write_cif('undef.cif')
    ##undefmodel.write_our_xyz('undef.xyz')
    #icomixedmodel = Model('ico+mix atoms',model.lx,model.ly,model.lz, mixedmodel.atoms + icolikemodel.atoms)
    ##mixedmodel.write_cif('icomixed.cif')
    ##mixedmodel.write_our_xyz('icomixed.xyz')
    #vpcoloredmodel = Model('vp colored atoms',model.lx,model.ly,model.lz, ag.model.atoms)
    #for atom in vpcoloredmodel.atoms:
    #    if(atom.vp.type == 'Full-icosahedra'):
    #        atom.z = 1
    #    elif(atom.vp.type == 'Icosahedra-like'):
    #        atom.z = 2
    #    elif(atom.vp.type == 'Mixed'):
    #        atom.z = 3
    #    elif(atom.vp.type == 'Crystal-like'):
    #        atom.z = 4
    #    elif(atom.vp.type == 'Undef'):
    #        atom.z = 5
    ##vpcoloredmodel.write_cif('vpcolored.cif')
    ##vpcoloredmodel.write_our_xyz('vpcolored.xyz')
    #subvpcoloredmodel = Model(submodelfile)
    #for atom in subvpcoloredmodel.atoms:
    #    atom.z = vpcoloredmodel.atoms[ag.model.atoms.index(atom)].z
    #subvpcoloredmodel.write_cif('subvpcolored.cif')
    #subvpcoloredmodel.write_our_xyz('subvpcolored.xyz')
    #return

    golden = False

    #cluster_prefix = 'ico.t3.'
    #cluster_types = 'Icosahedra-like', 'Full-icosahedra' # Need this for final/further analysis

    #cluster_prefix = 'fi.t3.'
    #cluster_types = ['Full-icosahedra'] # Need this for final/further analysis

    cluster_prefix = 'xtal.t3.'
    cluster_types = 'Crystal-like' # Need this for final/further analysis

    #cluster_prefix = 'mix.t3'
    #cluster_types = ['Mixed'] # Need this for final/further analysis

    #cluster_prefix = 'undef.t3'
    #cluster_types = ['Undef'] # Need this for final/further analysis

    # Decide what time of clustering you want to do
    #clusters = ag.get_clusters_with_n_numneighs(cutoff,5,cluster_types) #Vertex
    #clusters = ag.get_vertex_sharing_clusters(cutoff,cluster_types) #Vertex
    #clusters = ag.get_edge_sharing_clusters(cutoff,cluster_types) #Edge
    #clusters = ag.get_face_sharing_clusters(cutoff,cluster_types) #Face
    #clusters = ag.get_interpenetrating_atoms(cutoff,cluster_types) #Interpenetrating
    #clusters = ag.get_interpenetrating_clusters_with_neighs(cutoff,cluster_types) #Interpenetrating+neighs
    #clusters = ag.get_connected_clusters_with_neighs(cutoff, cluster_types) #Connected (vertex) + neighs
    v,e,f,i = ag.vefi_sharing(cluster_types)
    print("V: {0}  E: {1}  F: {2}  I: {3}".format(int(v),int(e),int(f),int(i)))
    return

    orig_clusters = clusters[:]
    # Print orig clusters
    j = 0
    for i,cluster in enumerate(clusters):
        print("Orig cluster {0} contains {1} atoms.".format(i,len(cluster)))
        if(golden):
            for atom in cluster:
                if(atom.vp.type in cluster_types):
                    atom.z = 0
        # Save cluster files
        cluster_model = Model("Orig cluster {0} contains {1} atoms.".format(i,len(cluster)),model.lx, model.ly, model.lz, cluster)
        cluster_model.write_cif('{1}cluster{0}.cif'.format(i,cluster_prefix))
        cluster_model.write_our_xyz('{1}cluster{0}.xyz'.format(i,cluster_prefix))

    allclusters = []
    for cluster in clusters:
        for atom in cluster:
            if(atom not in allclusters):
                allclusters.append(atom)
                #if(atom.vp.type in cluster_types): print('  {0}\t{1}'.format(atom,atom.vp.type))
    allclusters = Model("All clusters.",model.lx, model.ly, model.lz, allclusters)
    allclusters.write_cif('{0}allclusters.cif'.format(cluster_prefix))
#.........这里部分代码省略.........
开发者ID:adehgha,项目名称:model_analysis,代码行数:103,代码来源:cluster_analysis.py


注:本文中的model.Model.write_our_xyz方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。