예제 #1
0
# 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)

    try:
        thermo
    except NameError:
        thermo = 'no'
    if type(thermo) == int and (k + 1) % thermo == 0:
        md.thermo(k, thermo, vels, vTot, nondim, elem)
예제 #2
0
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)

    try:
        thermo
    except NameError:
        thermo = 'no'
    if type(thermo) == int and (k + 1) % thermo == 0:
        md.thermo(k, thermo, vels, vTot)