Пример #1
0
def run_comd():
    cmd = parseCommandLine()
    # init subsystems
    sim = simflat.initSimulation(cmd)

    sim.ePot = sim.pot.computeForce(sim.atoms, sim)
    sim.eKinetic = initatoms.kineticEnergy(sim)

    initValidate(sim)

    timestepTime = 0.0
    timestepTimeOneIteration = 0.0

    iStep = 0
    for jStep in range(0, sim.nSteps, sim.printRate):
        printInfo(sim, iStep, timestepTimeOneIteration)

        start = time.clock()
        timestep(sim, sim.printRate, sim.dt)
        end = time.clock()

        timestepTimeOneIteration = end - start
        if jStep >= sim.nSkip * sim.printRate:
            timestepTime += timestepTimeOneIteration

        iStep += sim.printRate

    printInfo(sim, iStep, timestepTimeOneIteration)

    printPerformanceResult(sim, timestepTime)
Пример #2
0
def timestep(sim, nSteps, dt):
    for ii in range(nSteps):
        advanceVelocity(sim.atoms, 0.5*dt)
        advancePosition(sim, sim.atoms, dt)
        # redistributeAtoms
        sim.ePot = sim.pot.computeForce(sim.atoms)
        advanceVelocity(sim.atoms, 0.5*dt)
    #print('ke,pe = ',initatoms.kineticEnergy(sim)/sim.atoms.nAtoms,sim.ePot/sim.atoms.nAtoms)
    sim.eKinetic = initatoms.kineticEnergy(sim)
Пример #3
0
def initValidate(sim):
    ke = initatoms.kineticEnergy(sim)
    pe = sim.ePot

    print("Initial PE (cohesive energy) : ",pe/sim.atoms.nAtoms)
    print("Initial energy : ",(ke+pe)/sim.atoms.nAtoms," atom count : ",sim.atoms.nAtoms)