def main(): print('{:-^60}'.format('Running molecule_dirichlet test')) try: test_outputs = pickleload() except FileNotFoundError: test_outputs = {} problem_folder = 'input_files' # molecule_dirichlet param = 'sphere_fine.param' test_name = 'molecule_dirichlet' if test_name not in test_outputs.keys(): N, iterations, Esolv, Esurf, Ecoul, Time = run_convergence( mesh, test_name, problem_folder, param) test_outputs[test_name] = [N, iterations, Esolv, Esurf, Ecoul, Time] picklesave(test_outputs) # molecule_single_center param = 'sphere_fine.param' test_name = 'molecule_single_center' if test_name not in test_outputs.keys(): N, iterations, Esolv, Esurf, Ecoul, Time = run_convergence( mesh, test_name, problem_folder, param) test_outputs[test_name] = [N, iterations, Esolv, Esurf, Ecoul, Time] picklesave(test_outputs) # dirichlet_surface param = 'sphere_fine.param' test_name = 'dirichlet_surface' if test_name not in test_outputs.keys(): N, iterations, Esolv, Esurf, Ecoul, Time = run_convergence( mesh, test_name, problem_folder, param) test_outputs[test_name] = [N, iterations, Esolv, Esurf, Ecoul, Time] picklesave(test_outputs) Esolv, Esurf, Ecoul = test_outputs['molecule_dirichlet'][2:5] Esolv_mol, Esurf_mol, Ecoul_mol = test_outputs['molecule_single_center'][2: 5] Esolv_surf, Esurf_surf, Ecoul_surf = test_outputs['dirichlet_surface'][2:5] Time = test_outputs['molecule_dirichlet'][-1] Time_mol = test_outputs['molecule_single_center'][-1] Time_surf = test_outputs['dirichlet_surface'][-1] N, iterations = test_outputs['molecule_dirichlet'][:2] Einter = (Esolv + Esurf + Ecoul - Esolv_surf - Esurf_mol - Ecoul_mol - Esolv_mol - Esurf_surf - Ecoul_surf) total_time = Time + Time_mol + Time_surf analytical = an_solution.molecule_constant_potential(1., 1., 5., 4., 12., 0.125, 4., 80.) error = abs(Einter - analytical) / abs(analytical) report_results(error, N, iterations, Einter, analytical, total_time, test_name='molecule dirichlet')
def main(): print('{:-^60}'.format('Running two_molecules test')) try: test_outputs = pickleload() except FileNotFoundError: test_outputs = {} problem_folder = 'input_files' # twosphere print('Runs for two molecules') param = 'sphere_fine.param' test_name = 'twosphere' if test_name not in test_outputs.keys(): N, iterations, Esolv, Esurf, Ecoul, Time = run_convergence( mesh, test_name, problem_folder, param, delete_output=False) test_outputs[test_name] = [N, iterations, Esolv, Esurf, Ecoul, Time] picklesave(test_outputs) # molecule_single_center print('Runs for isolated molecule') param = 'sphere_fine.param' test_name = 'molecule_single_center' if test_name not in test_outputs.keys(): N, iterations, Esolv, Esurf, Ecoul, Time = run_convergence( mesh, test_name, problem_folder, param, delete_output=False) test_outputs[test_name] = [N, iterations, Esolv, Esurf, Ecoul, Time] picklesave(test_outputs) # load results for analysis Esolv, Esurf, Ecoul = test_outputs['twosphere'][2:5] Esolv_single, Esurf_single, Ecoul_single = test_outputs[ 'molecule_single_center'][2:5] Time = test_outputs['twosphere'][-1] Time_single = test_outputs['molecule_single_center'][-1] N, iterations = test_outputs['twosphere'][:2] total_time = Time Esolv_single *= 2 # Same molecule twice Einter = Esolv + Esurf + Ecoul - Esurf_single - Ecoul_single - Esolv_single total_time = Time + Time_single analytical, EE1, EE2 = an_solution.two_sphere(5., 12., 0.125, 4., 80., 1.) analytical *= 2 error = abs(Einter - analytical) / abs(analytical) report_results(error, N, iterations, Einter, analytical, total_time, test_name='two molecules')
def main(): print('{:-^60}'.format('Running twosphere_neumann test')) try: test_outputs = pickleload() except FileNotFoundError: test_outputs = {} problem_folder = 'input_files' # twosphere_neumann print('Runs for two spherical surfaces with set dphidn') param = 'sphere_fine.param' test_name = 'twosphere_neumann' if test_name not in test_outputs.keys(): N, iterations, Esolv, Esurf, Ecoul, Time = run_convergence( mesh, test_name, problem_folder, param) test_outputs[test_name] = [N, iterations, Esolv, Esurf, Ecoul, Time] picklesave(test_outputs) # neumann_surface print('Runs for isolated surface') param = 'sphere_fine.param' test_name = 'neumann_surface' if test_name not in test_outputs.keys(): N, iterations, Esolv, Esurf, Ecoul, Time = run_convergence( mesh, test_name, problem_folder, param) test_outputs[test_name] = [N, iterations, Esolv, Esurf, Ecoul, Time] picklesave(test_outputs) Esolv, Esurf, Ecoul = test_outputs['twosphere_neumann'][2:5] Esolv_surf, Esurf_surf, Ecoul_surf = test_outputs['neumann_surface'][2:5] Time = test_outputs['twosphere_neumann'][-1] Time_surf = test_outputs['neumann_surface'][-1] N, iterations = test_outputs['twosphere_neumann'][:2] Einter = Esurf - 2 * Esurf_surf # Isolated sphere has to be done twice total_time = Time + Time_surf analytical = an_solution.constant_charge_twosphere_dissimilar( 80 * 1., 80 * 1., 4., 4., 12., 0.125, 80.) error = abs(Einter - analytical) / abs(analytical) report_results(error, N, iterations, Einter, analytical, total_time, test_name='twosphere neumann')
def main(): print('{:-^60}'.format('Running sphere_molecule_single test')) try: test_outputs = pickleload() except FileNotFoundError: test_outputs = {} problem_folder = 'input_files' # molecule_single param = 'sphere_fine.param' test_name = 'molecule_single' if test_name not in test_outputs.keys(): N, iterations, Esolv, Esurf, Ecoul, Time = run_convergence( mesh, test_name, problem_folder, param) test_outputs[test_name] = [N, iterations, Esolv, Esurf, Ecoul, Time] picklesave(test_outputs) # load results for analysis Esolv, Esurf, Ecoul = test_outputs['molecule_single'][2:5] Time = test_outputs['molecule_single'][-1] N, iterations = test_outputs['molecule_single'][:2] total_time = Time analytical = an_solution.an_P( numpy.array([1.]), numpy.array([[1., 1., 1.41421356]]), 4., 80., 5., 0.125, 5., 20) error = abs(Esolv - analytical) / abs(analytical) report_results(error, N, iterations, Esolv, analytical, total_time, energy_type='Total', test_name='sphere molecule single')
def main(): print('{:-^60}'.format('Running sphere_neumann test')) try: test_outputs = pickleload() except FileNotFoundError: test_outputs = {} problem_folder = 'input_files' # neumann_surface param = 'sphere_fine.param' test_name = 'neumann_surface' if test_name not in test_outputs.keys(): N, iterations, Esolv, Esurf, Ecoul, Time = run_convergence( mesh, test_name, problem_folder, param) test_outputs[test_name] = [N, iterations, Esolv, Esurf, Ecoul, Time] picklesave(test_outputs) # load results for analysis Esolv, Esurf, Ecoul = test_outputs['neumann_surface'][2:5] Time = test_outputs['neumann_surface'][-1] N, iterations = test_outputs['neumann_surface'][:2] Etotal = Esolv + Esurf + Ecoul total_time = Time analytical = an_solution.constant_charge_single_energy(-80 * 1, 4, 0.125, 80) error = abs(Etotal - analytical) / abs(analytical) report_results(error, N, iterations, Etotal, analytical, total_time, energy_type='Total', test_name='sphere neumann')
def main(): print('{:-^60}'.format('Running sphere_neumann test')) try: test_outputs = pickleload() except FileNotFoundError: test_outputs = {} problem_folder = 'input_files' # neumann_surface param = 'sphere_fine.param' test_name = 'neumann_surface' if test_name not in test_outputs.keys(): N, iterations, Esolv, Esurf, Ecoul, Time = run_convergence( mesh, test_name, problem_folder, param) test_outputs[test_name] = [N, iterations, Esolv, Esurf, Ecoul, Time] picklesave(test_outputs) # load results for analysis Esolv, Esurf, Ecoul = test_outputs['neumann_surface'][2:5] Time = test_outputs['neumann_surface'][-1] N, iterations = test_outputs['neumann_surface'][:2] Etotal = Esolv + Esurf + Ecoul total_time = Time analytical = an_solution.constant_charge_single_energy( -80 * 1, 4, 0.125, 80) error = abs(Etotal - analytical) / abs(analytical) report_results(error, N, iterations, Etotal, analytical, total_time, energy_type='Total', test_name='sphere neumann')
def main(): print('{:-^60}'.format('Running molecule_dirichlet test')) try: test_outputs = pickleload() except FileNotFoundError: test_outputs = {} problem_folder = 'input_files' # molecule_dirichlet param = 'sphere_fine.param' test_name = 'molecule_dirichlet' if test_name not in test_outputs.keys(): N, iterations, Esolv, Esurf, Ecoul, Time = run_convergence( mesh, test_name, problem_folder, param) test_outputs[test_name] = [N, iterations, Esolv, Esurf, Ecoul, Time] picklesave(test_outputs) # molecule_single_center param = 'sphere_fine.param' test_name = 'molecule_single_center' if test_name not in test_outputs.keys(): N, iterations, Esolv, Esurf, Ecoul, Time = run_convergence( mesh, test_name, problem_folder, param) test_outputs[test_name] = [N, iterations, Esolv, Esurf, Ecoul, Time] picklesave(test_outputs) # dirichlet_surface param = 'sphere_fine.param' test_name = 'dirichlet_surface' if test_name not in test_outputs.keys(): N, iterations, Esolv, Esurf, Ecoul, Time = run_convergence( mesh, test_name, problem_folder, param) test_outputs[test_name] = [N, iterations, Esolv, Esurf, Ecoul, Time] picklesave(test_outputs) Esolv, Esurf, Ecoul = test_outputs['molecule_dirichlet'][2:5] Esolv_mol, Esurf_mol, Ecoul_mol = test_outputs['molecule_single_center'][ 2:5] Esolv_surf, Esurf_surf, Ecoul_surf = test_outputs['dirichlet_surface'][2:5] Time = test_outputs['molecule_dirichlet'][-1] Time_mol = test_outputs['molecule_single_center'][-1] Time_surf = test_outputs['dirichlet_surface'][-1] N, iterations = test_outputs['molecule_dirichlet'][:2] Einter = (Esolv + Esurf + Ecoul - Esolv_surf - Esurf_mol - Ecoul_mol - Esolv_mol - Esurf_surf - Ecoul_surf) total_time = Time + Time_mol + Time_surf analytical = an_solution.molecule_constant_potential( 1., 1., 5., 4., 12., 0.125, 4., 80.) error = abs(Einter - analytical) / abs(analytical) report_results(error, N, iterations, Einter, analytical, total_time, test_name='molecule dirichlet')
def main(): print('{:-^60}'.format('Running molecule_neumann test')) try: test_outputs = pickleload() except FileNotFoundError: test_outputs = {} problem_folder = 'input_files' # molecule_neumann print('Runs for molecule + set phi/dphi surface') param = 'sphere_fine.param' test_name = 'molecule_neumann' if test_name not in test_outputs.keys(): N, iterations, Esolv, Esurf, Ecoul, Time = run_convergence( mesh, test_name, problem_folder, param) test_outputs[test_name] = [N, iterations, Esolv, Esurf, Ecoul, Time] picklesave(test_outputs) # molecule_single_center print('Runs for isolated molecule') param = 'sphere_fine.param' test_name = 'molecule_single_center' if test_name not in test_outputs.keys(): N, iterations, Esolv, Esurf, Ecoul, Time = run_convergence( mesh, test_name, problem_folder, param) test_outputs[test_name] = [N, iterations, Esolv, Esurf, Ecoul, Time] picklesave(test_outputs) # neumann_surface print('Runs for isolated surface') param = 'sphere_fine.param' test_name = 'neumann_surface' if test_name not in test_outputs.keys(): N, iterations, Esolv, Esurf, Ecoul, Time = run_convergence( mesh, test_name, problem_folder, param) test_outputs[test_name] = [N, iterations, Esolv, Esurf, Ecoul, Time] picklesave(test_outputs) # Load results for analysis Esolv, Esurf, Ecoul = test_outputs['molecule_neumann'][2:5] Esolv_mol, Esurf_mol, Ecoul_mol = test_outputs['molecule_single_center'][ 2:5] Esolv_surf, Esurf_surf, Ecoul_surf = test_outputs['neumann_surface'][2:5] Time = test_outputs['molecule_neumann'][-1] Time_mol = test_outputs['molecule_single_center'][-1] Time_surf = test_outputs['neumann_surface'][-1] N, iterations = test_outputs['molecule_neumann'][:2] Einter = (Esolv + Esurf + Ecoul - Esolv_surf - Esurf_mol - Ecoul_mol - Esolv_mol - Esurf_surf - Ecoul_surf) total_time = Time + Time_mol + Time_surf analytical = an_solution.molecule_constant_charge(1., -80 * 1., 5., 4., 12., 0.125, 4., 80.) error = abs(Einter - analytical) / abs(analytical) report_results(error, N, iterations, Einter, analytical, total_time, test_name='molecule neumann')
def main(): print('{:-^60}'.format('Running molecule_neumann test')) try: test_outputs = pickleload() except FileNotFoundError: test_outputs = {} problem_folder = 'input_files' # molecule_neumann print('Runs for molecule + set phi/dphi surface') param = 'sphere_fine.param' test_name = 'molecule_neumann' if test_name not in test_outputs.keys(): N, iterations, Esolv, Esurf, Ecoul, Time = run_convergence( mesh, test_name, problem_folder, param) test_outputs[test_name] = [N, iterations, Esolv, Esurf, Ecoul, Time] picklesave(test_outputs) # molecule_single_center print('Runs for isolated molecule') param = 'sphere_fine.param' test_name = 'molecule_single_center' if test_name not in test_outputs.keys(): N, iterations, Esolv, Esurf, Ecoul, Time = run_convergence( mesh, test_name, problem_folder, param) test_outputs[test_name] = [N, iterations, Esolv, Esurf, Ecoul, Time] picklesave(test_outputs) # neumann_surface print('Runs for isolated surface') param = 'sphere_fine.param' test_name = 'neumann_surface' if test_name not in test_outputs.keys(): N, iterations, Esolv, Esurf, Ecoul, Time = run_convergence( mesh, test_name, problem_folder, param) test_outputs[test_name] = [N, iterations, Esolv, Esurf, Ecoul, Time] picklesave(test_outputs) # Load results for analysis Esolv, Esurf, Ecoul = test_outputs['molecule_neumann'][2:5] Esolv_mol, Esurf_mol, Ecoul_mol = test_outputs['molecule_single_center'][2: 5] Esolv_surf, Esurf_surf, Ecoul_surf = test_outputs['neumann_surface'][2:5] Time = test_outputs['molecule_neumann'][-1] Time_mol = test_outputs['molecule_single_center'][-1] Time_surf = test_outputs['neumann_surface'][-1] N, iterations = test_outputs['molecule_neumann'][:2] Einter = (Esolv + Esurf + Ecoul - Esolv_surf - Esurf_mol - Ecoul_mol - Esolv_mol - Esurf_surf - Ecoul_surf) total_time = Time + Time_mol + Time_surf analytical = an_solution.molecule_constant_charge(1., -80 * 1., 5., 4., 12., 0.125, 4., 80.) error = abs(Einter - analytical) / abs(analytical) report_results(error, N, iterations, Einter, analytical, total_time, test_name='molecule neumann')