def plot_to_file(self, outfile=''): import matplotlib matplotlib.use('pdf') import matplotlib.pyplot as plt fig = plt.figure() ax1 = fig.add_subplot(2, 1, 1) ax2 = fig.add_subplot(2, 1, 2) self.plot_rdf(ax1) self.getStructureFactor() self.plot_sq(ax2) if outfile == '': outfile = os.path.splitext(sys.argv[0])[0] + '.pdf' sys.stdout.write("Writing %s... " % os.path.basename(outfile)) sys.stdout.flush() plt.savefig(outfile) sys.stdout.write("done!\n") if __name__ == '__main__': print " --> Reading trajectory" traj = read_trajectory(unwrap_pbcs=False) #for at in range(0,65): at = [10] pl = PairDistributionFunctionPlot(traj, n_bins='auto', atoms=at) pl.plot_to_file('%s_%s_%d.pdf' % (os.getcwd().split('/').pop(), 'rdf', at[0]))
def plot_to_file(self, outfile = ''): import matplotlib matplotlib.use('pdf') import matplotlib.pyplot as plt fig = plt.figure() ax1 = fig.add_subplot(2,1,1) ax2 = fig.add_subplot(2,1,2) self.plot_rdf(ax1) self.getStructureFactor() self.plot_sq(ax2) if outfile == '': outfile = os.path.splitext(sys.argv[0])[0] + '.pdf' sys.stdout.write("Writing %s... " % os.path.basename(outfile)) sys.stdout.flush() plt.savefig(outfile) sys.stdout.write("done!\n") if __name__ == '__main__': print " --> Reading trajectory" traj = read_trajectory(unwrap_pbcs = False) #for at in range(0,65): at = [10] pl = PairDistributionFunctionPlot(traj, n_bins = 'auto', atoms = at) pl.plot_to_file('%s_%s_%d.pdf' % (os.getcwd().split('/').pop(), 'rdf', at[0] ))
#print "y",y.shape print self.y.shape y = self.y[:mp] return float(y[y < treshold].shape[0]) / y.shape[0] #print y[not y>treshold].shape if __name__ == "__main__": from oppvasp import read_trajectory from oppvasp.vasp.parsers import PoscarParser #atom = 42 atom = 0 traj = read_trajectory( './', unwrap_pbcs = False ) poscar = '/Users/danmichael/Documents/Studier/Master/notur/hipersol/templates/si64/POSCAR' pl = DistanceFromLatticeSites(trajectory = traj, lattice = PoscarParser(poscar).get_structure(), atom = atom, nn = 1, step = 50 ) first = True def on_enter_site(obj): global first if first: sys.stdout.write('\033[31;1mEntered lattice site at %.2f\033[0m\n' % obj['x']) first = False pl.entered_site.subscribe(on_enter_site) pl.plot_to_file('%s_%s.pdf' % (os.getcwd().split('/').pop(), 'dist_from_lattice' ), verbose = False) #dp.analyse()
def plot_to_file(self,outfile): import matplotlib matplotlib.use('pdf') from oppvasp.plotutils import prepare_canvas prepare_canvas('8 cm') import matplotlib.pyplot as plt fig = plt.figure() ax = fig.add_subplot(1,1,1) fig.subplots_adjust(left=0.17, bottom=0.20, right=0.80, top=0.95) self.plot(ax) plt.savefig(outfile) if __name__ == '__main__': from oppvasp import read_trajectory traj = read_trajectory(unwrap_pbcs = True) atom = 0 pl = DisplacementPlot(traj, atom = atom) pl.plot_to_file('%s_%s.pdf' % (os.getcwd().split('/').pop(), 'displacement' )) ##!/usr/bin/env python ## -*- coding: utf-8; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- ## vim:fenc=utf-8:et:sw=4:ts=4:sts=4:tw=0 #import os, sys #import numpy as np #from optparse import OptionParser #from oppvasp import read_trajectory #from oppvasp.plotutils import DisplacementPlot
def plot_to_file(self, outfile): import matplotlib matplotlib.use('pdf') from oppvasp.plotutils import prepare_canvas prepare_canvas('8 cm') import matplotlib.pyplot as plt fig = plt.figure() ax = fig.add_subplot(1, 1, 1) fig.subplots_adjust(left=0.17, bottom=0.20, right=0.80, top=0.95) self.plot(ax) plt.savefig(outfile) if __name__ == '__main__': from oppvasp import read_trajectory traj = read_trajectory(unwrap_pbcs=True) atom = 0 pl = DisplacementPlot(traj, atom=atom) pl.plot_to_file('%s_%s.pdf' % (os.getcwd().split('/').pop(), 'displacement')) ##!/usr/bin/env python ## -*- coding: utf-8; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- ## vim:fenc=utf-8:et:sw=4:ts=4:sts=4:tw=0 #import os, sys #import numpy as np #from optparse import OptionParser #from oppvasp import read_trajectory #from oppvasp.plotutils import DisplacementPlot