cube1 = Cube(0,0,0,30,mesh_size) x_extent = cube1.x_extent z_extent = cube1.z_extent start = time.time() timeList,dList = [],numpy.concatenate((numpy.linspace(0,10,101),range(11,101))) Uside2sideArray = numpy.zeros((len(dList), 5)) outFile1 = open(join(root, 'interactionPotential_{0}(finalWith-Z&HP-{1}nm).dat'.format(name, mesh_size)), 'w') outFile1.write("Separation Potential\n") print "Cube ..." for n,d in tqdm(enumerate(dList)): d_vector = numpy.array([0,0,z_extent + d]) cube2 = cube1.shift(d_vector) U,Vdw = interactionPotential(cube1, cube2,conc,A) hp1 = hydrophobic_potential(d, 0.5) hp2 = hydrophobic_potential(d, 1) hp3 = hydrophobic_potential(d, 2) Uside2sideArray[n] = [U, Vdw, hp1, hp2, hp3] outFile1.write("%f %.18e %.18e %.18e %.18e %.18e\n" %(d, U, Vdw, hp1, hp2, hp3)) end = time.time() print "Total number of runs = ", len(dList) print "Time for full run = {0} minutes".format((end-start) / 60.) print "Time for each run = {0} minutes".format((end-start)/(60. * len(dList))) outFile1.close() #fig, (ax1, ax2) = plt.subplots(2, figsize=(5,7)) #ax1.plot(dList, Uside2sideArray[:,0], color='steelblue')
start = time.time() timeList, dList = [], numpy.concatenate((numpy.linspace(1, 10, 91), range(11, 101))) Uside2sideArray = numpy.zeros((len(dList), 2)) outFile1 = open( join(root, 'interactionPotential_s2s_{0}({1}nm).dat'.format(name, mesh_size)), 'w') outFile1.write("Separation Potential\n") for n, d in tqdm(enumerate(dList)): d_vector = numpy.array([0, 0, d]) new_bp = bp.shift(d_vector) U, Vdw = interactionPotential(new_bp, sheet, conc, A) Uside2sideArray[n] = [U, Vdw] outFile1.write("%f %.18e %.18e\n" % (d, U, Vdw)) end = time.time() print "Total number of runs = ", 2 * len(dList) print "Time for full run = {0} minutes".format((end - start) / 60.) print "Time for each run = {0} minutes".format( (end - start) / (60. * len(dList))) outFile1.close() fig, (ax1, ax2) = plt.subplots(2, figsize=(5, 7)) ax1.plot(dList, Uside2sideArray[:, 0], color='steelblue') ax1.set_yscale('log') ax1.set_ylabel('Coulomb potential')
start = time.time() timeList, dList = [], numpy.concatenate((numpy.linspace(0, 10, 101), range(11, 101))) Uside2sideArray = numpy.zeros((len(dList), 2)) outFile1 = open( join( root, 'interactionPotential_{0}(finalzeta-{1}nm).dat'.format( name, mesh_size)), 'w') outFile1.write("Separation Potential\n") print "Sphere ..." for n, d in tqdm(enumerate(dList)): d_vector = numpy.array([0, 0, z_extent + d]) sphere2 = sphere1.shift(d_vector) U, Vdw = interactionPotential(sphere1, sphere2, conc, A) Uside2sideArray[n] = [U, Vdw] outFile1.write("%f %.18e %.18e\n" % (d, U, Vdw)) end = time.time() print "Total number of runs = ", len(dList) print "Time for full run = {0} minutes".format((end - start) / 60.) print "Time for each run = {0} minutes".format( (end - start) / (60. * len(dList))) outFile1.close() fig, (ax1, ax2) = plt.subplots(2, figsize=(5, 7)) ax1.plot(dList, Uside2sideArray[:, 0], color='steelblue') ax1.set_yscale('log') ax1.set_ylabel('Coulomb potential')
outFile1 = open( join( root, 'interactionPotential_s2s_{0}(final-{1}nm).dat'.format( name, mesh_size)), 'w') outFile2 = open( join( root, 'interactionPotential_t2t_{0}(final-{1}nm).dat'.format( name, mesh_size)), 'w') outFile1.write("Separation Potential\n") outFile2.write("Separation Potential\n") print "Side by side" for n, d in tqdm(enumerate(dList)): d_vector = numpy.array([x_extent + d, 0, 0]) rod2 = rod1.shift(d_vector) U, Vdw = interactionPotential(rod1, rod2, conc, A) Uside2sideArray[n] = [U, Vdw] outFile1.write("%f %.18e %.18e\n" % (d, U, Vdw)) print "Tip to tip" for n, d in tqdm(enumerate(dList)): d_vector = numpy.array([0, 0, z_extent + d]) rod2 = rod1.shift(d_vector) U, Vdw = interactionPotential(rod1, rod2, conc, A) Utip2tipArray[n] = [U, Vdw] outFile2.write("%f %.18e %.18e\n" % (d, U, Vdw)) end = time.time() print "Total number of runs = ", 2 * len(dList) print "Time for full run = {0} minutes".format((end - start) / 60.) print "Time for each run = {0} minutes".format(
outFile1 = open( join( root, 'interactionPotential_s2s_{0}(final-{1}nm).dat'.format( name, mesh_size)), 'w') outFile2 = open( join( root, 'interactionPotential_t2t_{0}(final-{1}nm).dat'.format( name, mesh_size)), 'w') outFile1.write("Separation Potential\n") outFile2.write("Separation Potential\n") print "Side by side" for n, d in tqdm(enumerate(dList)): d_vector = numpy.array([x_extent + d, 0, 0]) bp2 = bp1.shift(d_vector) U, Vdw = interactionPotential(bp1, bp2, conc, A) Uside2sideArray[n] = [U, Vdw] outFile1.write("%f %.18e %.18e\n" % (d, U, Vdw)) print "Tip to tip" for n, d in tqdm(enumerate(dList)): d_vector = numpy.array([0, 0, z_extent + d]) bp2 = bp1.shift(d_vector) U, Vdw = interactionPotential(bp1, bp2, conc, A) Utip2tipArray[n] = [U, Vdw] outFile2.write("%f %.18e %.18e\n" % (d, U, Vdw)) end = time.time() print "Total number of runs = ", 2 * len(dList) print "Time for full run = {0} minutes".format((end - start) / 60.) print "Time for each run = {0} minutes".format(