def calc_test_images(job, test_images, amp_pes, title, suptitle, ncore, Lgraph, val_id=None, nmol=1, Ltwinx=None): try: calc = Amp.load(amp_pes) except FileNotFoundError: try: calc = Amp.load("amp-untrained-parameters.amp") except FileNotFoundError: print( "Error: amp-pes.amp file does not exist, input amp-pot file by -p" ) sys.exit(1) escale = 1 # my_chem.ev2kj y = [] y_bar = [] #return # this runs for mol in test_images: y.append(mol.get_potential_energy() / nmol) mol.set_calculator(calc) y_bar.append(mol.get_potential_energy() / nmol) with open("amp_test.txt", 'w') as f: f.write("\ttrue\t\thypothesis\n") for y1, ybar1 in zip(y, y_bar): f.write(f"{y1:15.5f} {ybar1:15.5f}\n") if Lgraph: modulename = 'myplot2D' ### FOR MLET if modulename not in sys.modules: import myplot2D err, res_max = myplot2D.draw_dots_two(y, y_bar, title, suptitle, Ltwinx=Ltwinx) else: h_conv = np.array(y_bar) * escale y_conv = np.array(y) * escale diff = np.subtract(h_conv, y_conv) err = np.sqrt((diff**2).mean()) res_max = abs(max(diff, key=abs)) #err = rmse(y, y_bar)*escale return err, res_max
def amp_pyplot(fdata, ftitle, HL, E_conv,f_conv,f_coeff, ntrain, ntest, Lgraph): title, subtitle = get_title(ftitle, HL, E_conv,f_conv,f_coeff, ntrain, ntest) ### file parsing Ys = f_parsing(fdata) ### 2 columns y = Ys[0][:] y_bar = Ys[1][:] if not ntest: ntest = len(y) if Lgraph: modulename='myplot2D' if modulename not in sys.modules: import myplot2D err, res_max = myplot2D.draw_dots_two(y, y_bar, title, subtitle, Ltwinx=True) return 0