file_name = file_name_py.replace('.py', '') file_traj = file_name + '.traj' start_file = '../In2O3_110_clean.traj' mode = 'a' try: sys = Trajectory(file_traj, 'r')[-1] except (IOError, RuntimeError): print "Importing trajectory file from: %s" % start_file sys = read(start_file) sys.center(vacuum=5.0, axis=2) else: print "Importing trajectory file from: %s" % file_traj set_calc_In2O3(sys) print "Constraints:" print " c1: Fix bottom two layers." avg_z = np.mean([atom.z for atom in sys]) c1 = FixAtoms(mask=[atom.z < avg_z for atom in sys]) sys.set_constraint(c1) if testRun == True: run_testRun(sys) else: geo_traj = Trajectory(file_traj, mode, sys) dyn = LBFGS(sys, trajectory=geo_traj) dyn.run(fmax=0.05) energy = sys.get_potential_energy() print "Energy: %f" % energy print "Completed %s" % file_name_py
# In[10]: atom2 = read('c2h6.gen') ao2 = AtomOP(atom2) # pairs = [[1,2],[13,7],[5,26]] pairs = [[0, 1]] images2 = ao2.stretch(pairs, nbin=50, wtraj=True) ao2.close() view(images2) # In[14]: e_c2h4, e_c2h6 = [], [] for atoms in images: e_c2h4.append(atoms.get_potential_energy()) for atoms in images2: e_c2h6.append(atoms.get_potential_energy()) fig, ax = plt.subplots() plt.plot(e_c2h4[0:40] - min(e_c2h4), label=r'$C_{2}H_4$', color='blue', linewidth=2, linestyle='-.') plt.plot(e_c2h6[0:40] - min(e_c2h6), label=r'$C_{2}H_6$', color='r', linewidth=2, linestyle='-') plt.legend(loc='best', edgecolor='yellowgreen')