Exemple #1
0
top_file="W11_large.psf"
traj_file="DH5_423_0.dcd"

label="o2"

tfname=label+"_traj"
sfname=label+"_sf"

if not os.path.isfile(sfname+".npz"):					#check to see if SF needs to be calculated
	if not os.path.isfile(tfname+".npz"):  				#check to see if trajectory needs to be processed
		print "processing trajectory file "+traj_file
		lt.process(top_file,traj_file,tfname)   					#Process trajectory into numpy array.  Commented to run on windows
		print 'done'
	traj=np.load(tfname+".npz")							#load processed trajectory
	rad=dens.load_radii("radii.txt")					#load radii definitions from file
	dens.compute_sf(traj['coords'],traj['dims'],traj['typ'],sfname,rad)		#compute time-averaged 3d structure factor and save to sfname.npz

dpl=np.load(sfname+".npz")					#load 3d SF
grid=dpl['kgridplt']

p2d.mainlabel="W623"			#title for plots

dir=p2d.mainlabel+"_plots"+fd	#set up directories for saving plots
sfdir=dir+"structure_factor"+fd
sfsubdir=sfdir+"additional_plots"+fd
EWdir=dir+"Ewald_Corrected"+fd


p2d.path=EWdir
p2d.Plot_Ewald_Sphere_Correction(grid,1.54)		#compute Ewald-corrected SF cross sections in xy,xz,yz planes
        sfname = 'lattice_' + str(Nx) + "_" + str(Ny) + "_" + str(Nz)

        name = np.zeros(Nlat, dtype=object)
        mass = np.zeros(Nlat)
        typ = np.zeros(Nlat, dtype=object)

        typ[:] = args.lattice_label

        print("saving...")
        np.savez_compressed(sfname,
                            dims=dims,
                            coords=coords,
                            name=name,
                            typ=typ)
        rad = dens.load_radii("%s/radii.txt" %
                              location)  # load radii definitions from file
        print("computing SF...")

        dens.compute_sf(
            coords, dims, typ, sfname, rad, ucell, args.spatial_resolution
        )  # compute time-averaged 3d structure factor and save to sfname.npz

    elif args.random_counts > 0:  # create a random trajectory

        spcheck = 0  # check if simulating a single particle.

        Rboxsize = 100.0
        BUFFsize = 10000000
        sfname = 'RND'

        print("generating random trajectory...")