Пример #1
0
def Task4b_iv_avg():
    print("TASK : Task4b_iv_avg")
    maxTime = 0.7
    t, N, T = SetTime(maxTime, increments)
    vac = []
    sampling = 5
    for i in range(0, sampling):
        particles = MDGenerators.PopulateCreateCrystalStructure(
            4, "Ar", 1.7, N, constants.mass, 190)
        MDFunctions.MoveToCentreOfBox(particles)
        MDSolver.solveFaster(MDSolver.velocityVerletFast2, particles, maxTime,
                             N)
        vag, diffu_coeff = MDFunctions.ComputeVelocityAutoCorrelation(
            t, particles)
        vac.append(vag)

    avgVag = vac[0]
    for i in range(0, sampling):
        avgVag += vac[i]

    avgVag[0] /= sampling
    chartName = f"Avg Vel AUtocorrelation {sampling}"
    MDPlot.plot([avgVag], t, N, chartName, ["vac"], "time (s)", "4biv_avg")
    MDFileWriter.WriteXYZFile(particles, "4b_ii", N)
    MDFileWriter.WriteLastFrame(particles, "4b_iiii_lastFrame", N)
Пример #2
0
def Task4b_ii():
    print("TASK : Task4b_ii")
    maxTime = 0.7
    t, N, T = SetTime(maxTime, increments)

    #particles = MDGenerators.PopulateCreateCrystalStructure(4, "Ar", 1.7,  N, constants.mass, 190)
    #MDFunctions.MoveToCentreOfBox(particles)
    #MDSolver.solveFaster(MDSolver.velocityVerletFast2, particles, maxTime, N)

    particles = MDFileWriter.ReadEverything("4b_ii_everything", N)
    MDPlot.plotVelocityAutoCorrelation(particles, t, N, "4b) ii", True,
                                       "4b_ii")
    MDFileWriter.WriteXYZFile(particles, "4b_ii", N)
    MDFileWriter.WriteLastFrame(particles, "4b_ii_lastFrame", N)
Пример #3
0
def Task4c_ii():
    print("TASK : Task4c_ii")
    maxTime = 0.7
    t, N, T = SetTime(maxTime, increments)

    particles = MDGenerators.PopulateCreateCrystalStructure(
        6, "Ar", 1.7, N, constants.mass, 190)
    MDFunctions.MoveToCentreOfBox(particles)
    MDSolver.solveFaster(MDSolver.velocityVerletFast2, particles, maxTime, N)

    MDPlot.plotMeanSquaredDisplacement(particles, t, N, constants.eps,
                                       "4c) i - Mean squared displacement",
                                       True, "4c_ii")
    MDFileWriter.WriteXYZFile(particles, "4c_ii", N)
    MDFileWriter.WriteLastFrame(particles, "4c_ii_lastFrame", N)
Пример #4
0
def Task4b_v():
    print("TASK : Task4b_v")
    maxTime = 0.7
    t, N, T = SetTime(maxTime, increments)

    particles = MDGenerators.PopulateCreateCrystalStructure(
        4, "Ar", 1.7, N, constants.mass, 190)
    MDFunctions.MoveToCentreOfBox(particles)
    MDSolver.solveFaster(MDSolver.velocityVerletFast2, particles, maxTime, N)

    MDPlot.plotVelocityAutoCorrelation(particles, t, N,
                                       "4b) ii - Vel.Corr / Diff.coeff ",
                                       "4b_v")
    MDFileWriter.WriteXYZFile(particles, "4b_v", N)
    MDFileWriter.WriteLastFrame(particles, "4b_v_lastFrame", N)
Пример #5
0
def Task4b_iii():
    print("TASK : Task4b_iii")
    beginTime = 0.7
    maxTime = 1.5
    t, N, T = SetTime(maxTime, increments, beginTime)

    particles = MDFileWriter.ReadInitialConditions("4b_ii_lastFrame", N,
                                                   constants.mass)
    #MDFunctions.MoveToCentreOfBox(particles)
    MDSolver.solveFaster(MDSolver.velocityVerletFast2, particles, maxTime, N)
    MDPlot.plotVelocityAutoCorrelation(
        particles, t, N, "4b) iii - Velocity autocorrelation plot", "4b_iii")
    MDFileWriter.WriteXYZFile(particles, "4b_iii", N)

    MDFileWriter.WriteLastFrame(particles, "4b_iii_lastFrame", N)