numpy.savetxt('RHS.txt', F) setup_time = toc - TIC print 'List time : %fs' % list_time print 'Data transfer time : %fs' % transfer_time print 'RHS generation time: %fs' % rhs_time print '------------------------------' print 'Total setup time : %fs\n' % setup_time tic = time.time() ### Solve print 'Solve' phi = numpy.zeros(param.Neq) phi = gmres_solver(surf_array, field_array, phi, F, param, ind0, timing, kernel) toc = time.time() solve_time = toc - tic print 'Solve time : %fs' % solve_time numpy.savetxt('phi.txt', phi) #phi = loadtxt('phi.txt') # Put result phi in corresponding surfaces fill_phi(phi, surf_array) ### Calculate solvation energy print '\nCalculate Esolv' tic = time.time() E_solv = calculateEsolv(surf_array, field_array, param, kernel) toc = time.time() print 'Time Esolv: %fs' % (toc - tic)
numpy.savetxt('RHS.txt',F) setup_time = toc-TIC print 'List time : %fs'%list_time print 'Data transfer time : %fs'%transfer_time print 'RHS generation time: %fs'%rhs_time print '------------------------------' print 'Total setup time : %fs\n'%setup_time tic = time.time() ### Solve print 'Solve' phi = numpy.zeros(param.Neq) phi = gmres_solver(surf_array, field_array, phi, F, param, ind0, timing, kernel) toc = time.time() solve_time = toc-tic print 'Solve time : %fs'%solve_time numpy.savetxt('phi.txt',phi) #phi = loadtxt('phi.txt') # Put result phi in corresponding surfaces fill_phi(phi, surf_array) ### Calculate solvation energy print '\nCalculate Esolv' tic = time.time() E_solv = calculateEsolv(surf_array, field_array, param, kernel) toc = time.time() print 'Time Esolv: %fs'%(toc-tic)
if type(MM[0, 0]) != numpy.complex128: savetxt('RHS_matrix.txt', FF) print '\nSolve system' tec = time.time() phi = zeros(len(F)) if type(MM[0, 0]) == numpy.complex128: phi = gmres(MM, FF, tol=param.tol, restart=param.restart, maxiter=param.max_iter)[0] else: phi = gmres_solver(MM, phi, FF, param.restart, param.tol, param.max_iter) converged = -1 toc = time.time() if type(MM[0, 0]) != numpy.complex128: savetxt('phi_matrix.txt', phi) print '\nEnergy calculation' fill_phi(phi, surf_array) Esolv, field_Esolv = solvationEnergy(surf_array, field_array, param) Ecoul, field_Ecoul = coulombicEnergy(field_array, param) Esurf, surf_Esurf = surfaceEnergy(surf_array, param)
MM = Ainv*M FF = Ainv*F #MM = M #FF = F if type(MM[0,0]) != numpy.complex128: savetxt('RHS_matrix.txt',FF) print '\nSolve system' tec = time.time() phi = zeros(len(F)) if type(MM[0,0]) == numpy.complex128: phi = gmres(MM, FF, tol=param.tol, restart=param.restart, maxiter=param.max_iter)[0] else: phi = gmres_solver(MM, phi, FF, param.restart, param.tol, param.max_iter) converged = -1 toc = time.time() if type(MM[0,0]) != numpy.complex128: savetxt('phi_matrix.txt',phi) print '\nEnergy calculation' fill_phi(phi, surf_array) Esolv, field_Esolv = solvationEnergy(surf_array, field_array, param) Ecoul, field_Ecoul = coulombicEnergy(field_array, param)
print '\n\nGenerate preconditioner' Ainv = generatePreconditioner(surf_array) print 'preconditioner generated' MM = Ainv*M FF = Ainv*F #MM = M #FF = F savetxt('RHS_matrix.txt',FF) print '\nCalculation for both spheres' tec = time.time() phi = zeros(len(F)) phi = gmres_solver(MM, phi, FF, param.restart, param.tol, param.max_iter) # Potential both spheres converged = -1 toc = time.time() savetxt('phi_matrix.txt',phi) print '\nEnergy calculation' fill_phi(phi, surf_array) Esolv, field_Esolv = solvationEnergy(surf_array, field_array, param) Ecoul, field_Ecoul = coulombicEnergy(field_array, param) Esurf, surf_Esurf = surfaceEnergy(surf_array, param) toc = time.time()