print(' Chech the parameters nmeasure and nshift, and input files.') sys.exit() #...make output data files outfname = 'dat.msd-{0}'.format(id) outfile = open(outfname, 'w') p0 = np.zeros((nmeasure, 3)) pp = np.zeros(3) msd = np.zeros((len(infiles), nmeasure, 3)) npbc = np.zeros((3, ), dtype=int) hmat = np.zeros((3, 3)) for ifile in range(len(infiles)): file = infiles[ifile] system = NAPSystem() system.read_akr(file) hmat[0] = system.a1 * system.alc hmat[1] = system.a2 * system.alc hmat[2] = system.a3 * system.alc #...human-readable ID to computer-oriented ID i = id - 1 ai = system.atoms[i] pi = ai.pos if ifile == 0: pp = pi else: #...correct periodic motion dev = pi - pp if dev[0] > 0.5: npbc[0] += -1 elif dev[0] < -0.5:
infiles.append(file) infiles.sort() #...compute sampling time-window from nmeasure and nshift ntwindow= len(infiles) -(nmeasure-1)*nshift print ' ntwindow=',ntwindow if ntwindow <= 0: print ' [Error] ntwindow <= 0 !!!' print ' Chech the parameters nmeasure and nshift, and input files.' sys.exit() #...set global values infile= infiles[0] system=NAPSystem() system.read_akr(infile) natm= len(system.atoms) psid= np.zeros((natm,),dtype=np.int8) nas= 0 for ia in range(natm): if sid == 0: psid[ia] = 1 nas += 1 elif system.atoms[ia].sid == sid: psid[ia] = 1 nas += 1 print ' num of all atoms = ',natm print ' num of atoms to be considered = ',nas print ' accumurating data', actmp= np.zeros((nmeasure,ntwindow,3))
sys.exit() #...make output data files outfname='dat.msd-{0}'.format(id) outfile= open(outfname,'w') p0= np.zeros((nmeasure,3)) pp= np.zeros(3) msd= np.zeros((len(infiles),nmeasure,3)) npbc= np.zeros((3,),dtype=int) hmat= np.zeros((3,3)) for ifile in range(len(infiles)): file= infiles[ifile] system= NAPSystem() system.read_akr(file) hmat[0]= system.a1 *system.alc hmat[1]= system.a2 *system.alc hmat[2]= system.a3 *system.alc #...human-readable ID to computer-oriented ID i= id-1 ai= system.atoms[i] pi= ai.pos if ifile == 0: pp= pi else: #...correct periodic motion dev= pi -pp if dev[0] > 0.5: npbc[0] += -1 elif dev[0] < -0.5:
#!/bin/env python import sys,os from napsys import NAPSystem infname= sys.argv[1] print 'input file: ',infname aSys= NAPSystem() aSys.read_akr(infname) natm= len(aSys.atoms) outfname= infname+".voro" f= open(outfname,'w') alc= aSys.alc ax= aSys.a1[0] ay= aSys.a2[1] az= aSys.a3[2] for ia in range(natm): pos= aSys.atoms[ia].pos f.write(' {0:4d}'.format(ia+1)) f.write(' {0:10.3f}'.format(alc*ax*pos[0])) f.write(' {0:10.3f}'.format(alc*ay*pos[1])) f.write(' {0:10.3f}'.format(alc*az*pos[2])) f.write('\n') f.close() print 'Use voro++ as follows:' cmd= 'voro++ -p -c " %i %q %v %s %A"' \ +' 0.0 {0:5.1f}'.format(alc*ax) \ +' 0.0 {0:5.1f}'.format(alc*ay) \ +' 0.0 {0:5.1f}'.format(alc*az) \
#!/bin/env python from __future__ import print_function import sys, os from napsys import NAPSystem infname = sys.argv[1] print('input file: ', infname) aSys = NAPSystem() aSys.read_akr(infname) natm = len(aSys.atoms) outfname = infname + ".voro" f = open(outfname, 'w') alc = aSys.alc ax = aSys.a1[0] ay = aSys.a2[1] az = aSys.a3[2] for ia in range(natm): pos = aSys.atoms[ia].pos f.write(' {0:4d}'.format(ia + 1)) f.write(' {0:10.3f}'.format(alc * ax * pos[0])) f.write(' {0:10.3f}'.format(alc * ay * pos[1])) f.write(' {0:10.3f}'.format(alc * az * pos[2])) f.write('\n') f.close() print('Use voro++ as follows:') cmd= 'voro++ -p -c " %i %q %v %s %A"' \ +' 0.0 {0:5.1f}'.format(alc*ax) \