xyzO, xyzH1, xyzH2, viscinaldir, shift, vshift, xbox, ybox, zbox, structure = vs.loadit(filename, nx, ny, nz, viscinaldir, nycel) NR = len(xyzO) # Get the nearest neighbor index and nearest-neighbor shift array nni,xyzshift = vs.getnni(xyzO,shift) # Check for any initial defects based on the original viscinal xyzO, xyzH1, and xyzH2 arrays nnitol, nnltoi, Ddefect, Adefect = vs.checkfordefects(nni,xyzO,xyzH1,xyzH2,xyzshift) # Get residues at the surface & bulk surfacelist, dum = np.where(nni==-1) alllist = range(NR) bulklist = np.squeeze(np.argwhere(~np.in1d(alllist,surfacelist))) # Get slabs of bulk and surface residues slab_surface = vs.slab(surfacefilename,structure,xyzO, xyzH1, xyzH2) slab_surface.cullout(bulklist) slab_surface.saveit() slab_bulk = vs.slab(bulkfilename,structure,xyzO, xyzH1, xyzH2) slab_bulk.cullout(surfacelist) slab_bulk.saveit() ''' # Reconstruct & rotate a viscinal slab with defects fixed xyzO_fixed, xyzH1_fixed, xyzH2_fixed = vs.reconstructit(xyzO, xyzH1, xyzH2, nni, nnitol_fixed, xyzshift) xyzO_rot, xyzH1_rot, xyzH2_rot, xboxp, yboxp, zboxp = vs.rotateit(xyzO_fixed, xyzH1_fixed, xyzH2_fixed, viscinaldir, shift, vshift, xbox, ybox, zbox) # Save the good vicinal slab slab_v = vs.slab(outfilename,structure,xyzO_rot, xyzH1_rot, xyzH2_rot)
import vstuff as vs reload(vs) import numpy as np xcel = 4.4907312 ycel = 7.7781746 zcel = 3.6666666 # vmd: set cell [pbc set {44.907312 45.9843789846 43.9999992} -all]; pbc box ... tilt angle is 9.826 deg filename = 'spc_10_6_12.pdb' xbox = xcel * 10 ybox = ycel * 6 zbox = zcel * 12 namestem = filename.find('.pdb') # Specify which is the exposed surface, and load the slab xyzO, xyzH1, xyzH2, shift, structure = vs.loaditnew(filename, xbox, ybox, zbox, 'y') # Shift in x #xyzO[:,0]+=xbox #xyzH1[:,0]+=xbox #xyzH2[:,0]+=xbox # Save it slab = vs.slab(filename, structure, xyzO, xyzH1, xyzH2, xbox, ybox, zbox) slab.filename = filename[0:namestem] + '_shifted0x.pdb' slab.saveit()
#filename = 'spc_4_4_2.pdb'; nx = 4; ny = 4; nz = 2 #filename = 'spc_10_6_12.pdb'; nx = 10; ny = 6; nz = 12 #filename = 'spc_10_6_14.pdb'; nx = 10; ny = 6; nz = 14 # Naming the output file dum = filename.find('.pdb') outfilename = filename[0:dum]+'_v.pdb' badfilename = filename[0:dum]+'_v_orig.pdb' testfilename = filename[0:dum]+'_shift.pdb' # Specify which viscinal surface to generate, and load the slab viscinaldir = 'y'; nycel=1 xyzO, xyzH1, xyzH2, viscinaldir, shift, vshift, xbox, ybox, zbox, structure = vs.loadit(filename, nx, ny, nz, viscinaldir, nycel) # Save the original slab slab = vs.slab(testfilename,structure,xyzO, xyzH1, xyzH2) slab.saveit() # Get the nearest neighbor index and nearest-neighbor shift array nni,xyzshift = vs.getnni(xyzO,shift) # Check for any initial defects based on the original viscinal xyzO, xyzH1, and xyzH2 arrays nnitol, nnltoi, Ddefect, Adefect = vs.checkfordefects(nni,xyzO,xyzH1,xyzH2,xyzshift) # Make new nnitol and,nnltoi arrays that correct for defects nnitol_fixed, nnltoi_fixed = vs.fixit(nni, nnitol, nnltoi, 3000) # Reconstruct & rotate a viscinal slab with defects fixed xyzO_fixed, xyzH1_fixed, xyzH2_fixed = vs.reconstructit(xyzO, xyzH1, xyzH2, nni, nnitol_fixed, xyzshift) xyzO_rot, xyzH1_rot, xyzH2_rot, xboxp, yboxp, zboxp = vs.rotateit(xyzO_fixed, xyzH1_fixed, xyzH2_fixed, viscinaldir, shift, vshift, xbox, ybox, zbox)
#filename = 'spc_10_6_14.pdb'; nx = 10; ny = 6; nz = 14 # Naming the output file dum = filename.find('.pdb') outfilename = filename[0:dum] + '_v.pdb' badfilename = filename[0:dum] + '_v_orig.pdb' testfilename = filename[0:dum] + '_shift.pdb' # Specify which viscinal surface to generate, and load the slab viscinaldir = 'y' nycel = 1 xyzO, xyzH1, xyzH2, viscinaldir, shift, vshift, xbox, ybox, zbox, structure = vs.loadit( filename, nx, ny, nz, viscinaldir, nycel) # Save the original slab slab = vs.slab(testfilename, structure, xyzO, xyzH1, xyzH2) slab.saveit() # Get the nearest neighbor index and nearest-neighbor shift array nni, xyzshift = vs.getnni(xyzO, shift) # Check for any initial defects based on the original viscinal xyzO, xyzH1, and xyzH2 arrays nnitol, nnltoi, Ddefect, Adefect = vs.checkfordefects(nni, xyzO, xyzH1, xyzH2, xyzshift) # Make new nnitol and,nnltoi arrays that correct for defects nnitol_fixed, nnltoi_fixed = vs.fixit(nni, nnitol, nnltoi, 3000) # Reconstruct & rotate a viscinal slab with defects fixed xyzO_fixed, xyzH1_fixed, xyzH2_fixed = vs.reconstructit( xyzO, xyzH1, xyzH2, nni, nnitol_fixed, xyzshift)
# Get the nearest neighbor index and nearest-neighbor shift array nni,xyzshift = vs.getnni(xyzO,shift) # Check for any initial defects based on the original viscinal xyzO, xyzH1, and xyzH2 arrays nnitol, nnltoi, Ddefect, Adefect = vs.checkfordefects(nni,xyzO,xyzH1,xyzH2,xyzshift) # Make new nnitol and,nnltoi arrays that correct for defects nnitol_fixed, nnltoi_fixed = vs.fixit(nni, nnitol, nnltoi, 3000) # Reconstruct & rotate a viscinal slab with defects fixed xyzO_fixed, xyzH1_fixed, xyzH2_fixed = vs.reconstructit(xyzO, xyzH1, xyzH2, nni, nnitol_fixed, xyzshift) xyzO_rot, xyzH1_rot, xyzH2_rot, xboxp, yboxp, zboxp = vs.rotateit(xyzO_fixed, xyzH1_fixed, xyzH2_fixed, viscinaldir, shift, vshift, xbox, ybox, zbox) # Save it slab1 = vs.slab(outfilename,structure,xyzO_rot, xyzH1_rot, xyzH2_rot) slab1.saveit() # Rotate a viscinal slab that has the original defects xyzO_rot_orig, xyzH1_rot_orig, xyzH2_rot_orig, xboxp, yboxp, zboxp = vs.rotateit(xyzO, xyzH1, xyzH2, viscinaldir, shift, vshift, xbox, ybox, zbox) # Save it vs.saveit(badfilename,structure,xyzO_rot_orig, xyzH1_rot_orig, xyzH2_rot_orig) slab2 = vs.slab(badfilename,structure,xyzO_rot_orig, xyzH1_rot_orig, xyzH2_rot_orig) slab2.saveit() #tic = time.time() #toc = time.time() #print (toc-tic)/60, "minutes" #execfile("plotit.py")
import vstuff as vs; reload(vs) # Get the spc slab (makes new xyzO, xyzH1, xyzH2, and shift-related arrays) #filename = 'spc_4_4_6.pdb'; nx = 4; ny = 4; nz = 6 #filename = 'spc_4_4_2.pdb'; nx = 4; ny = 4; nz = 2 filename = 'spc_10_6_12.pdb'; nx = 10; ny = 6; nz = 12 #filename = 'spc_10_6_14.pdb'; nx = 10; ny = 6; nz = 14 # Naming the output file dum = filename.find('.pdb') outfilename = filename[0:dum]+'_vx_orig.pdb' # Specify which viscinal surface to generate, and load the slab viscinaldir = 'yx'; nycel=1 xyzO, xyzH1, xyzH2, viscinaldir, shift, vshift, xbox, ybox, zbox, structure = \ vs.loadit(filename, nx, ny, nz, viscinaldir, nycel) slab = vs.slab(filename,structure,xyzO, xyzH1, xyzH2, xbox, ybox, zbox) # Reconstruct & rotate it, then save it slab.rotateit(viscinaldir,vshift) slab.saveit(outfilename) print slab.xbox, slab.ybox, slab.zbox
#outfilename = 'spc_10_6_12_v_06131.pdb' #xbox=44.90725; ybox=45.9565; zbox=44.6822104389 #filename = 'spc_10_6_12_vx_orig.pdb' #outfilename = 'spc_10_6_12_vx06271.pdb' #xbox=45.57594; ybox=45.98438; zbox=43.99999 filename = 'spc_20_6_12_vx_orig.pdb' outfilename = 'spc_20_6_12_vx07081.pdb' xbox=90.1507996879; ybox=46.4950169842; zbox=43.99999 # Specify which is the exposed surface, and load the slab vicinaldir = 'y'; nycel=0 xyzO, xyzH1, xyzH2, shift, structure = \ vs.loaditnew(filename, xbox, ybox, zbox, vicinaldir) slab = vs.slab(filename, structure, xyzO, xyzH1, xyzH2, xbox, ybox, zbox) # Report dipole print slab.getdipole() # Get nearest neighbor and defect information nni,xyzshift = vs.getnni(xyzO,shift) nnitol, nnltoi = vs.getnnitoletc(nni,xyzO,xyzH1,xyzH2,xyzshift) # Check for any initial defects based on the original vicinal xyzO, xyzH1, # and xyzH2 arrays nnitol, nnltoi, Ddefect, Adefect = \ vs.checkfordefects(nni,xyzO,xyzH1,xyzH2,xyzshift) # Make new nnitol and,nnltoi arrays that correct for defects