def compare_trajectory(self, i_traj, calc, tables, i_par): """ Calculate the energies for the frames in the trajectory and plot them. """ frames = [] energies = [] trajectory = PickleTrajectory(self.trajectories[i_traj]) for i, image in enumerate(trajectory): e_tb = None try: atoms = Atoms(image) c = copy(calc) c.tables = tables atoms.set_calculator(c) e_tb = atoms.get_potential_energy() except Exception as ex: print(ex, file=self.txt) if e_tb != None: energies.append(e_tb) frames.append(i) delta_E = self.norm_to_isolated_atoms(trajectory[0]) for i in range(len(energies)): energies[i] += delta_E self.plot(frames, energies, i_traj, tables, i_par)
def compare_trajectory(self, i_traj, calc, tables, i_par): """ Calculate the energies for the frames in the trajectory and plot them. """ frames = [] energies = [] trajectory = PickleTrajectory(self.trajectories[i_traj]) for i, image in enumerate(trajectory): e_tb = None try: atoms = Atoms(image) c = copy(calc) c.tables = tables atoms.set_calculator(c) e_tb = atoms.get_potential_energy() except Exception, ex: print>>self.txt, ex if e_tb != None: energies.append(e_tb) frames.append(i)
def compare_trajectory(self, i_traj, calc, tables, i_par): """ Calculate the energies for the frames in the trajectory and plot them. """ frames = [] energies = [] trajectory = PickleTrajectory(self.trajectories[i_traj]) for i, image in enumerate(trajectory): e_tb = None try: atoms = Atoms(image) c = copy(calc) c.tables = tables atoms.set_calculator(c) e_tb = atoms.get_potential_energy() except Exception, ex: print >> self.txt, ex if e_tb != None: energies.append(e_tb) frames.append(i)
def get_isolated_energies(self, trajs, par): """ Return the energies of an isolated atoms. """ elements = [] energies = {} for t in trajs: traj = PickleTrajectory(t) for atom in traj[0]: if not atom.symbol in elements: elements.append(atom.symbol) el1, el2 = par.split("_")[0:2] for el in elements: ss = "%s%s" % (el, el) if el1 == el2 and el1 == el: tables = {ss:par, 'rest':'default'} calc = Hotbit(SCC=True, tables=tables) else: calc = Hotbit(SCC=True) atoms = Atoms(ss, ((0,0,0),(200,0,0))) atoms.center(vacuum=100) atoms.set_calculator(calc) energies[el] = atoms.get_potential_energy() / 2 return energies