def Potential(Psi, Ecut): Ecut = Ecut / har2wave V = CH5pot.mycalcpot(Psi.coords, N_0) V_orig = np.array(V) cuts = len(Ecut) for i in range(cuts): ind = np.argwhere(V_orig < Ecut[i]) Psi.V[i, :] = np.array(V) Psi.V[i, ind] = Ecut[i] Psi.Diff[i, :] = V_orig - Psi.V[i, :] return Psi
def get_pot(coords): V = CH5pot.mycalcpot(coords, len(coords)) return V
def V(whereUat): #-----------our potential function v = np.zeros(len(whereUat)) emin = -40.65276470207075 v = CH5pot.mycalcpot(whereUat, len(whereUat)) v = np.array(v) return v # must return a 1D numpy array
if timestep % 500 == 0: print vref, ", ", timestep, ", ", len(whereUat) # Descendant Weighting # if timestep % 500 == 50 and timestep > 4000: for i in whereUfrom: ancestorPile.append(ancestors[i]) timestep += 1 ancestorPile = np.array(ancestorPile) b = 0 convert = 0.52917725 v = np.zeros(len(ancestorPile)) v = CH5pot.mycalcpot(ancestorPile, len(ancestorPile)) # for item in ancestors: #-----------for jmol xyz file # if mox == 1: # fileXYZ.write("6\n") # fileXYZ.write("CH5+ coordinates %f" % v[b]) # fileXYZ.write("%i\n" % b) # fileXYZ.write("C %f %f %f\n" % (item[0,0]*convert, item[0,1]*convert, item[0,2]*convert)) # fileXYZ.write("H %f %f %f\n" % (item[1,0]*convert, item[1,1]*convert, item[1,2]*convert)) # fileXYZ.write("H %f %f %f\n" % (item[2,0]*convert, item[2,1]*convert, item[2,2]*convert)) # fileXYZ.write("H %f %f %f\n" % (item[3,0]*convert, item[3,1]*convert, item[3,2]*convert)) # fileXYZ.write("H %f %f %f\n" % (item[4,0]*convert, item[4,1]*convert, item[4,2]*convert)) # fileXYZ.write("H %f %f %f\n\n" % (item[5,0]*convert, item[5,1]*convert, item[5,2]*convert)) # b+=1 # else: # print "6\n"
def Potential(Psi): V = CH5pot.mycalcpot(Psi.coords, N_0) Psi.V = np.array(V) return Psi
convref = conavg(conpotentials, trueweights, n0) energies.append(convref) conpvalues = pcalc(conpotentials, convref, dtau) trueweights = trueweights * conpvalues conwalkers, trueweights = conFate(conwalkers, trueweights) # Descendant Weighting # # if timestep%500 == 50 and timestep > 4000: # for i in whereUfrom: # ancestorPile.append(ancestors[i]) timestep += 1 convert = 0.52917725 v = np.zeros(len(conwalkers)) v = CH5pot.mycalcpot(conwalkers, len(conwalkers)) b = 0 for item in conwalkers: # for jmol xyz file if mox == 1: fileXYZ.write("6\n") fileXYZ.write("weight/potential/Bvalue %f %f %f" % (trueweights[b], v[b], Bvalues[b])) fileXYZ.write("%i\n" % b) fileXYZ.write( "C %f %f %f\n" % (item[0, 0] * convert, item[0, 1] * convert, item[0, 2] * convert)) fileXYZ.write( "H %f %f %f\n" % (item[1, 0] * convert, item[1, 1] * convert, item[1, 2] * convert)) fileXYZ.write( "H %f %f %f\n" %
def Potential(grid): V = CH5pot.mycalcpot(grid, len(grid[:, 0, 0])) V_final = np.diag(np.array(V)) return V_final
struct2 = np.array([[-0.000298856, -0.000017412, -0.000141136], [1.022099482, 0.000046092, -0.361081497], [0.000552766, 0.471961633, 1.102712489], [-0.000044126, -0.471802245, 1.102854612], [-0.606229037, -0.878215253, -0.263411220], [-0.606365863, 0.878027160, -0.263097351]])*ang2bohr struct3 = np.array([[-0.000110479, 0.000019746, 0.204885798], [0.000032256, 0.000040871, -0.957945282], [0.950920625, -0.000050787, 0.731398902], [-0.950992179, -0.000020046, 0.731563788], [0.000089457, -1.002878334, -0.339811499], [0.000060320, 1.002888551, -0.339901698]])*ang2bohr min_en = CH5pot.mycalcpot(np.array([coords_initial_min]*3), 3)*har2wave a = CH5pot.mycalcpot(np.array([struct1]*3), 3)*har2wave cs_en = CH5pot.mycalcpot(np.array([coords_initial_cs]*3), 3)*har2wave b = CH5pot.mycalcpot(np.array([struct2]*3), 3)*har2wave c2v_en = CH5pot.mycalcpot(np.array([coords_initial_c2v]*3), 3)*har2wave c = CH5pot.mycalcpot(np.array([struct3]*3), 3)*har2wave def grid(a, b, N, CH, coords_initial): spacing = np.linspace(a, b, num=N) if CH == 1: new_coords = CoordinateSet(coords_initial, system=CartesianCoordinates3D) new_coords = new_coords.convert(ZMatrixCoordinates, ordering=([[0, 0, 0, 0], [1, 0, 0, 0], [2, 0, 1, 0], [3, 0, 1, 2], [4, 0, 1, 2], [5, 0, 1, 2]])) new_coords = new_coords.convert(CartesianCoordinates3D).coords print(new_coords[1, 0]/ang2bohr)
[-5.4640011799588715E-017, -0.8923685824271653, 2.083855680290835], [-1.145620108130841, -1.659539840225091, -0.4971351597887673], [-1.145620108130841, 1.659539840225091, -0.4971351597887673]]) F = np.zeros((18, 18)) Ffirst = np.zeros(18) row = 0 col = 0 track = 0 for z in xrange(0, N): for y in xrange(0, 3): shift = np.zeros((6, 3)) shift[z][y] = delta shiftarr = [beg + shift, beg - shift] Vfirst = CH5pot.mycalcpot(shiftarr, len(shiftarr)) Ffirst[track] = (1 / (2 * delta)) * (Vfirst[0] - Vfirst[1]) track += 1 for i in xrange(0, N): for j in xrange(0, 3): shift1 = np.zeros((6, 3)) shift1[i][j] = delta for k in xrange(0, N): for m in xrange(0, 3): shift2 = np.zeros((6, 3)) shift2[k][m] = delta shiftarray = [
def pot(Psi): V = np.array(CH5pot.mycalcpot(Psi.coords, len(Psi.coords))) Psi.V = V return Psi