steps, test_traj = trjbd.integrate_atoms( test_atoms, test_traj, n_test, save_interval, timestep=timestep, convert=True ) amp_test_traj = "amp_test.traj" steps, amp_test_traj = trjbd.integrate_atoms( amp_test_atoms, amp_test_traj, n_test, save_interval, timestep=timestep, convert=True, ) anl = Analyzer() r, rdf = anl.calculate_rdf(test_traj, r_max=6.0) r_amp, rdf_amp = anl.calculate_rdf(amp_test_traj, r_max=6.0) rdf_plot = system + "_" + "rdf.png" plter.plot_rdf(rdf_plot, legend, r, rdf, rdf_amp) steps, energy_exact, energy_amp = anl.calculate_pot_energy_diff( test_traj, amp_test_traj, save_interval=save_interval ) pot_plot = system + "_" + "pot.png" plter.plot_pot_energy_diff(pot_plot, legend, steps, energy_exact, energy_amp) steps, energy_exact, energy_amp = anl.calculate_energy_diff( test_traj, amp_test_traj, save_interval=save_interval ) energy_plot = system + "_" + "energy.png" plter.plot_energy_diff(energy_plot, legend, steps, energy_exact, energy_amp)
import matplotlib.pyplot as plt import seaborn as sns sys.path.insert(1, "../tools") from analysis import Analyzer from plotting import Plotter from training import Trainer if __name__ == "__main__": sns.set() plot_dir = "plots" plot_file = os.path.join(plot_dir, "rdf.png") if not os.path.exists(plot_dir): os.mkdir(plot_dir) anl = Analyzer() plter = Plotter() r_cut = 6.0 r, rdf = anl.calculate_rdf("trajs/training.traj", r_max=r_cut) rdf[np.nonzero(rdf)] /= max(rdf) cutoff = plter.polynomial(r, r_cut, gamma=5.0) plt.plot(r, rdf, label="Radial distribution function") plt.plot(r, cutoff, label="Polynomial cutoff, gamma=5.0") plt.legend() plt.title("Copper radial distribution function") plt.xlabel("Radial distance [Angstrom]") plt.ylabel("Radial distribution function (normalized to 1)") plt.savefig(plot_file)
trn.create_Gs(elements, num_radial_etas, num_angular_etas, num_zetas, angular_type) symm_funcs["Selected"] = trn.Gs G2 = make_symmetry_functions(elements=elements, type="G2", etas=[0.05, 0.23, 1.0, 5.0], centers=np.zeros(4)) G4 = make_symmetry_functions( elements=elements, type="G4", etas=0.005 * np.ones(1), zetas=[1.0, 4.0], gammas=[1.0, -1.0], ) symm_funcs["Default"] = G2 + G4 anl = Analyzer() plter = Plotter() r, rdf = anl.calculate_rdf(train_traj, r_max=cutoff.Rc) for label, symm_func in symm_funcs.items(): plter.plot_symmetry_functions( label + "_rad.png", label + "_ang.png", symm_func, rij=r, rdf=rdf, cutoff=cutoff, )