Example #1
0
## You shouldn't have to change anything below here to run a
## general simulation for an FCC solid (as of 2.22.2019)
###############################################################

## Initial conditions for simulation
steps = int(tTot / dt)  #number of steps to run simulation

# Call function to read initial positions
num, pos, types = md.readXYZ(infile, nondim)  #non dimensional lj units
del infile  #clean up variables

# Call function to initialize velocities (trivial here)
vels = md.vInit(pos, dist, val, nondim)  #get initial velocites

# Call function to initialize forces
fij, vij, vTot = md.fLJ(pos, num, nondim, elem)
###############################################################
md.tic()
print('\nRunning MD simulation!\n')
for k in range(steps):  #run the MD simulation
    if (k + 1) % 1000 == 0:
        print('\n\tNow on step:\t' + str(k + 1) + ' out of ' + str(steps))
    pos, vels, fij, vTot = md.vVerlet(num, pos, vels, fij, dt, nondim, elem)

    try:
        dump
    except NameError:
        dump = 'no'
    if type(dump) == int and (k + 1) % dump == 0:
        md.dump(k, dump, num, pos, types)
Example #2
0
## generic simulation for a FCC argon (as of 3.5.2019)
###############################################################

## Initial conditions for simulation
steps = int(tTot / dt)  #number of steps to run simulation
dt = md.ndTime(dt)  #nondimesnional timestep

# Call function to read initial positions
num, pos, types = md.readXYZ(infile)  #non dimensional lj units
del infile  #clean up variables

# Call function to initialize velocities (trivial here)
vels = md.vInit(pos, dist, val)  #get initial velocites

# Call function to initialize forces
fij, vij, vTot = md.fLJ(pos, num)

###############################################################
md.tic()
print('\nRunning MD simulation!\n')
for k in range(steps):  #run the MD simulation
    if (k + 1) % 500 == 0:
        print('\tNow on step:\t' + str(k + 1) + ' out of ' + str(steps))
    pos, vels, fij, vTot = md.vVerlet(num, pos, vels, fij, dt)

    try:
        dump
    except NameError:
        dump = 'no'
    if type(dump) == int and (k + 1) % dump == 0:
        md.dump(k, dump, num, pos, types)