示例#1
0
def initSimulation(cmd):
    sim = SimFlat(cmd.nSteps, cmd.printRate, cmd.dt)

    latticeConstant = cmd.lat

    if cmd.lat < 0.0:
        latticeConstant = sim.pot.lat


    box_size = np.zeros(3)
    box_size[0] = cmd.nx*latticeConstant
    box_size[1] = cmd.ny*latticeConstant
    box_size[2] = cmd.nz*latticeConstant

    sim.domain = domain.Domain(cmd.xproc, cmd.yproc, cmd.zproc, box_size)

    sim.boxes = linkcell.initLinkCells(sim, sim.domain)

    sim.atoms = initatoms.initAtoms(sim.boxes.nTotalBoxes * sim.boxes.MAXATOMS)

    sim.atoms.setBounds(cmd.nx, cmd.ny, cmd.nz, latticeConstant)

    initatoms.createFccLattice(cmd.nx, cmd.ny, cmd.nz, latticeConstant, sim.atoms, sim.boxes, sim.domain)

    initatoms.setTemperature(sim, cmd.temp)

    sim.atomHalo = halo.Halo(sim.boxes, sim.domain)

    redistributeAtoms(sim, sim.atoms)



    return sim
示例#2
0
import numpy as np

sim = simflat.SimFlat(10, 10, 0.1)

lat = 3.615
nx = 4
ny = 4
nz = 4

box_size = np.zeros(3)
box_size[0] = nx * lat
box_size[1] = ny * lat
box_size[2] = nz * lat

boxes = linkcell.initLinkCells(sim, box_size)
sim.atoms = initatoms.atoms(boxes.nTotalBoxes * boxes.MAXATOMS)
sim.atoms.setBounds(nx, ny, nz, lat)
sim.boxes = boxes

initatoms.createFccLattice(nx, ny, nz, lat, sim.atoms, sim.boxes)


def test_tuple(boxes):
    """
        Test the conversion from 3-D indices to a linear index and back
    """
    ix = 0
    iy = 0
    iz = 0
    for ix in range(-1, boxes.gridSize[0] + 1):