def testSplineCoeff(): import parse_potential as pp prefix = '/home/cask0/home/tsanyal/c25ld/data/cg_ff/methane/methane_wca_SPLD' logfile, histfile, sumfile = pp.parseFileNames(prefix) paramstring = pp.parseParamString(sumfile) h = pp.parseHist(histfile)['LD'] rho_t = h[0]; rho_m = h[1] d = alg.makeSysData(isPolymer = False, hasLJ = True) Sys = alg.makeSys(LDCut = 6.5, SysData = d, Prefix = 'testsys', paramstring = paramstring, fftype = 'wca') (nknot, spdist, spc0, spc1, spc2, spc3) = alg.getLDSpline(Sys = Sys) rho = rho_t dfdrho = np.zeros(len(rho)) frho = np.zeros(len(rho)) for n in range(len(rho)): x = (rho[n] - min(rho)) * spdist[1] i = max(min(int(x), nknot-2), 0) t = max(min(x - float(i), 1.0), 0.0) frho[n] = spc0[i] + t * (spc1[i] + t*(spc2[i]+t*spc3[i])) dfdrho[n] = spdist[1] * (spc1[i] + t * (2.*spc2[i]+t*3.*spc3[i])) fig = plt.figure ax1 = plt.subplot(211) ; ax2 = plt.subplot(212) ax1.plot(rho, frho, linewidth = 3, label = r'$f(\rho)$'); ax1.legend() ax2.plot(rho, dfdrho, linewidth = 3, label = r'$\frac{df}{d\rho}$'); ax2.legend()
N_water = int(sys.argv[5]) LammpsTraj = sys.argv[6] Prefix = sys.argv[7] LDCut = float(sys.argv[8]) if len(sys.argv) > 9: checkpt = sys.argv[9] else: checkpt = 'start' #MD iteration settings if isPolymer: NStep = NStep_polymer else: NStep = NStep_methane #system parameters SysData = alg.makeSysData(isPolymer = isPolymer, hasLJ = hasLJ, N_mon = N_mon, N_water = N_water) TempSet = 298.0 Delta = 1.2 #AA traj parameters Trj, BoxL, mappedatoms = parseTraj(LammpsTraj) #create the system object Sys = alg.makeSys(LDCut = LDCut, SysData = SysData, fftype = fftype, BoxL = BoxL, Prefix = Prefix, paramstring = None, Delta = 1.2) #initialize and energy minimize sim.system.init.positions.CubicLattice(Sys, Random = 0.1) sim.system.init.velocities.Canonical(Sys, Temp = TempSet) Int = Sys.Int Int.Method = Int.Methods.VVQuench Int.Run(NStep['Min'])