Esempio n. 1
0
def maketraj(atoms, t, nstep):
    e = [atoms.get_potential_energy()]
    dyn = VelocityVerlet(atoms, 5*units.fs)
    for i in range(nstep):
        dyn.run(10)
        e.append(atoms.get_potential_energy())
        if t is not None:
            t.write()
    return e
Esempio n. 2
0
def maketraj(atoms, t, nstep):
    e = [atoms.get_potential_energy()]
    dyn = VelocityVerlet(atoms, 5 * units.fs)
    for i in range(nstep):
        dyn.run(10)
        e.append(atoms.get_potential_energy())
        if t is not None:
            t.write()
    return e
Esempio n. 3
0
def Compare(name, atoms, observer, ref, interval=4):
    dyn = VelocityVerlet(atoms, 5*units.fs)
    dyn.attach(observer, interval=interval)
    r = []
    for i in range(50):
        dyn.run(5)
        epot = atoms.get_potential_energy() / len(atoms)
        ekin = atoms.get_kinetic_energy() / len(atoms)
        r.append([epot, ekin, epot+ekin])
    r = array(r)
    diff = r - ref
    maxdiff = diff.max()
    print "Maximal difference is", maxdiff
    ReportTest(name, maxdiff, 0.0, 1e-6)
Esempio n. 4
0
def twoAtomForce():
    print "\nRunning LJ twoAtomForce"
    elements = [29]
    epsilon = [0.15]
    sigma = [2.7]

    atoms = Atoms(positions=[(0.0, 0.0, 0.0), (0.0, 0.0, 2.0)], symbols="Cu2")

    atoms.set_calculator(LennardJones(elements, epsilon, sigma, -1.0, False))

    result = atoms.get_potential_energy()

    r = atoms.get_positions()
    r.flat[:] += 0.06 * np.sin(np.arange(3 * len(atoms)))
    atoms.set_positions(r)
    resA, resB = atoms.get_forces()
    storedForces = [-1.15732425, 13.10743025, -258.04517252]

    for a in range(1, 3):
        ReportTest(("  Simple force test dimension %d" % a),
                   resA[a],
                   storedForces[a],
                   1e-8,
                   silent=Silent)

    print "  Running Verlet dynamics (%s)" % ("Cu", )
    dyn = VelocityVerlet(atoms, 2 * units.fs)
    dyn.run(100)

    etot1 = (atoms.get_potential_energy() + atoms.get_kinetic_energy())
    dyn.run(1000)
    etot2 = (atoms.get_potential_energy() + atoms.get_kinetic_energy())
    ReportTest(("  Energy conservation (%s)" % ("Cu", )),
               etot1,
               etot2,
               1.0,
               silent=Silent)

    epot = atoms.get_potential_energies()
    stress = atoms.get_stresses()

    e = []
    s = []
    j = 0
    for i in range(0, len(atoms), 100):
        e.append(epot[i])
        s.append(stress[i, j])
        j = (j + 1) % 6
    print "  e" + "Cu" + " =", repr(e)
    print "  s" + "Cu" + " =", repr(s)
Esempio n. 5
0
def twoAtomForce():
  print "\nRunning LJ twoAtomForce"
  elements = [29]
  epsilon  = [0.15]
  sigma    = [2.7]

  atoms=Atoms(positions=[(0.0, 0.0, 0.0),(0.0, 0.0, 2.0)],
              symbols="Cu2")

  atoms.set_calculator(LennardJones(elements, epsilon, sigma, -1.0, False))


  result = atoms.get_potential_energy()

  r = atoms.get_positions()
  r.flat[:] += 0.06 * np.sin(np.arange(3*len(atoms)))
  atoms.set_positions(r)
  resA, resB = atoms.get_forces() ;
  storedForces = [ -1.15732425,   13.10743025, -258.04517252 ]

  for a in range(1,3):
    ReportTest(("  Simple force test dimension %d" % a), resA[a],
               storedForces[a], 1e-8, silent=Silent)


  print "  Running Verlet dynamics (%s)" % ("Cu",)
  dyn = VelocityVerlet(atoms, 2*units.fs)
  dyn.run(100)

  etot1 = (atoms.get_potential_energy() + atoms.get_kinetic_energy())
  dyn.run(1000)
  etot2 = (atoms.get_potential_energy() + atoms.get_kinetic_energy())
  ReportTest(("  Energy conservation (%s)" % ("Cu",)), etot1, etot2, 1.0, silent=Silent)

  epot = atoms.get_potential_energies()
  stress = atoms.get_stresses()

  e = []
  s = []
  j = 0
  for i in range(0, len(atoms), 100):
      e.append(epot[i])
      s.append(stress[i,j])
      j = (j + 1) % 6
  print "  e"+"Cu"+" =", repr(e)
  print "  s"+"Cu"+" =", repr(s)
Esempio n. 6
0
def dotest(atoms, nsteps, ampl, name):
    print "Potential energy", atoms.get_potential_energy() / len(atoms)
    r = atoms.get_positions()
    r.flat[:] += ampl * sin(arange(3*len(atoms)))
    atoms.set_positions(r)
    print "Potential energy", atoms.get_potential_energy() / len(atoms)

    print "Running Verlet dynamics (%s)" % (name,)
    dyn = VelocityVerlet(atoms, 2*femtosecond)
    etot1 = (atoms.get_potential_energy() + atoms.get_kinetic_energy())
    dyn.run(nsteps)
    etot2 = (atoms.get_potential_energy() + atoms.get_kinetic_energy())
    ReportTest(("Energy conservation (%s)" % (name,)), etot1, etot2, 1.0)
    print etot1, etot2

    epot = atoms.get_potential_energies()
    stress = atoms.get_stresses()
    if firsttime:
        print "Reporting energies and stresses"
        e = []
        s = []
        j = 0
        for i in range(0, len(atoms), 100):
            e.append(epot[i])
            s.append(stress[i,j])
            j = (j + 1) % 6
        print >> out, "e"+name+" =", repr(e)
        print >> out, "s"+name+" =", repr(s)
    else:
        print "Testing energies and stresses"
        j = 0
        eres=getattr(potResults, "e"+name)
        sres=getattr(potResults, "s"+name)
        for i in range(len(atoms)/100):
            ReportTest(("%s energy %d" % (name, i*100)),
                       epot[i*100], eres[i], 1e-8, silent=True)
            ReportTest(("%s stress %d" % (name, i*100)),
                       stress[i*100, j], sres[i], 1e-8, silent=True)
            j = (j + 1) % 6
Esempio n. 7
0
"""

from numpy import *
from asap3 import Atoms, EMT, units, Trajectory
from ase.lattice.cubic import FaceCenteredCubic
from asap3.md.verlet import VelocityVerlet

# Create the atoms
atoms = FaceCenteredCubic(size=(3, 3, 3), symbol="Cu", pbc=False)

# Give the first atom a non-zero momentum
atoms[0].momentum = array([0, -11.3, 0])

# Associate the EMT potential with the atoms
atoms.set_calculator(EMT())

# Now do molecular dynamics, printing kinetic, potential and total
# energy every ten timesteps.
dyn = VelocityVerlet(atoms, 5.0 * units.fs)

# Make a trajectory writing output
trajectory = Trajectory("TrajectoryMD-output.traj", "w", atoms)

# Attach it to the dynamics, so it is informed every fifth time a
# timestep is made.
dyn.attach(trajectory, interval=5)

# Now do 1000 timesteps.
dyn.run(1000)
print "The output is in the ASE Trajectory file TrajectoryMD-output.traj"
Esempio n. 8
0
import sys

if len(sys.argv) == 2:
    arg = sys.argv[1]
else:
    arg = 'Wrong number of arguments.'
if arg == 'EMT':
    filename = 'small_EMT.dat'
elif arg == 'EMT2013':
    filename = 'small_EMT2013.dat'
else:
    print __doc__
    sys.exit(1)

T = 450
atoms = FaceCenteredCubic(size=(10, 10, 10), symbol='Cu', pbc=False)
if arg == 'EMT':
    atoms.set_calculator(EMT())
else:
    atoms.set_calculator(EMT2013(EMT2013_parameters))

print "Setting temperature:", T, "K"
MaxwellBoltzmannDistribution(atoms, 2 * T * units.kB)
Stationary(atoms)

dyn1 = Langevin(atoms, 2 * units.fs, temperature=T * units.kB, friction=0.05)
dyn1.run(200)

dyn = VelocityVerlet(atoms, 3 * units.fs, logfile=filename, loginterval=25)
dyn.run(10000000)  # 10^7 timesteps is 3 ns.
Esempio n. 9
0
    fixedatoms = np.less(z, 0.501*z.max())
    print len(init), sum(fixedatoms)
    MaxwellBoltzmannDistribution(init, 6000*units.kB)
    init.set_tags(fixedatoms)
else:
    init = None

print
print "Running simulation with Filter"
atoms1 = MakeParallelAtoms(init, cpulayout)
atoms1.arrays['r_init'] = atoms1.get_positions()
atoms1.set_calculator(EMT())
atoms1a = Filter(atoms1, mask=np.logical_not(atoms1.get_tags()))

dyn = VelocityVerlet(atoms1a, 3*units.fs)
dyn.run(100)

print
print "Running simulation with Asap's FixAtoms"
atoms2 = MakeParallelAtoms(init, cpulayout)
atoms2.arrays['r_init'] = atoms2.get_positions()
atoms2.set_calculator(EMT())
atoms2.set_constraint(FixAtoms(mask=atoms2.get_tags()))

dyn = VelocityVerlet(atoms2, 3*units.fs)
dyn.run(100)

print
print "Running Langevin simulation with Asap's FixAtoms"
atoms4 = MakeParallelAtoms(init, cpulayout)
atoms4.arrays['r_init'] = atoms4.get_positions()
Esempio n. 10
0
print "Making initial system"
iniatoms = FaceCenteredCubic(directions=[[1,0,0],[0,1,0],[0,0,1]],
                             size=(10,5,5), symbol="Cu", pbc=(1,1,0))
iniatoms.set_calculator(EMT())
inidyn = Langevin(iniatoms, 5*units.fs, 450*units.kB, 0.05)
inidyn.run(100)
print "Temperature is now", iniatoms.get_kinetic_energy() / (1.5*units.kB*len(iniatoms)), "K"

print "Making reference simulation"
refatoms = Atoms(iniatoms)
refatoms.set_calculator(EMT())
dyn = VelocityVerlet(refatoms, 5*units.fs)
ref = []
for i in range(50):
    dyn.run(5)
    epot = refatoms.get_potential_energy() / len(refatoms)
    ekin = refatoms.get_kinetic_energy() / len(refatoms)
    ref.append([epot, ekin, epot+ekin])

ref = array(ref)

print "Testing RestrictedCNA"
atoms = Atoms(iniatoms)
atoms.set_calculator(EMT())
cna = RestrictedCNA(atoms)
Compare("RestrictedCNA", atoms, cna.analyze, ref)

print "Testing RadialDistributionFunction"
atoms = Atoms(iniatoms)
atoms.set_calculator(EMT())
Esempio n. 11
0
 for natoms in sizes:
     print "Timing with %i atoms (%i threads)" % (natoms, nthreads)
     blocksize = int(np.ceil((natoms/4)**(1./3.)))
     atoms = FaceCenteredCubic(symbol='Cu', size=(blocksize,blocksize,blocksize), pbc=False)
     print "Creating block with %i atoms, cutting to %i atoms" % (len(atoms), natoms)
     atoms = atoms[:natoms]
     assert len(atoms) == natoms
     atoms.set_calculator(EMT())
     MaxwellBoltzmannDistribution(atoms, 2 * T * units.kB)
     dyn = VelocityVerlet(atoms, 5*units.fs)
     ptsteps = int(laststeps * (0.1 * targettime / lasttime) * lastsize / natoms)
     if ptsteps < 100:
         ptsteps = 100
     print "Running pre-timing (%i steps)..." % (ptsteps,)
     t1 = time.time()
     dyn.run(ptsteps - 50)
     MaxwellBoltzmannDistribution(atoms, (2 * T - atoms.get_temperature()) * units.kB)
     dyn.run(50)
     t1 = time.time() - t1
     steps = int(ptsteps * targettime / t1)
     if steps < 200:
         steps = 200 
     print "Temperature is %.1f K" % (atoms.get_temperature(),)
     print "Running main timing (%i steps)" % (steps,)
     MaxwellBoltzmannDistribution(atoms, T * units.kB)
     t1 = time.time()
     dyn.run(steps)
     t1 = time.time() - t1
     lasttime = t1
     print "... done in %.1f s  (T = %.1f K)." % (t1, atoms.get_temperature())
     t1 *= 1e6 / (natoms * steps)
Esempio n. 12
0
import numpy as np

init = FaceCenteredCubic(size=(10, 10, 10), symbol='Cu', pbc=False)
z = init.get_positions()[:, 2]
fixedatoms = np.less(z, 0.501 * z.max())
print len(init), sum(fixedatoms)
MaxwellBoltzmannDistribution(init, 2000 * units.kB)

print
print "Running simulation with Filter"
atoms1 = Atoms(init)
atoms1.set_calculator(EMT())
atoms1a = Filter(atoms1, mask=np.logical_not(fixedatoms))

dyn = VelocityVerlet(atoms1a, 0.5 * units.fs)
dyn.run(50)
r1 = atoms1.get_positions()

print
print "Running simulation with Asap's FixAtoms"
atoms2 = Atoms(init)
atoms2.set_calculator(EMT())
atoms2.set_constraint(FixAtoms(mask=fixedatoms))

dyn = VelocityVerlet(atoms2, 0.5 * units.fs)
dyn.run(50)
r2 = atoms2.get_positions()

print
print "Running simulation with ASE's FixAtoms"
atoms3 = Atoms(init)
Esempio n. 13
0
    del olde, oldf
else:
    print "WARNING: No self-check database found, creating it."
    cPickle.dump((e, f), open(selfcheckfilename, "w"))
del e,f,atoms

ReportTest.Summary(exit=1)

print "Preparing to run Verlet dynamics."
atoms = Atoms(initial)
atoms.set_calculator(EMT())
dynamics = VelocityVerlet(atoms, 5*units.fs)

print "Running Verlet dynamics."
startcpu, startwall = time.clock(), time.time()
dynamics.run(timesteps)

vcpu, vwall = time.clock() - startcpu, time.time() - startwall
vfraction = vcpu/vwall
sys.stderr.write("\n")
print "Verlet dynamics done."
del dynamics, atoms

print "Preparing to run Langevin dynamics."
atoms = Atoms(initial)
atoms.set_calculator(EMT())
dynamics = Langevin(atoms, 5*units.fs, 400*units.kB, 0.001)

print "Running Langevin dynamics."
startcpu, startwall = time.clock(), time.time()
dynamics.run(timesteps)
Esempio n. 14
0
def dynamicsTest(size, before, steps, v0, rCut, nonSense):
    print "\n\nStarting LJ dynamicsTest with "
    print "  cube of size                  %d" % size
    print "  time before measurement start %d*1*femtoseconds" % before
    print "  measuring time                %d*femtoseconds" % steps
    print "  add v0                        %d" % (v0 == 1)
    print "  rCut                          %d" % rCut
    print "  3 kinds of atoms              %s" % (nonSense == 1)

    start = time()

    nsteps = steps
    #Warning: numbers and constants are not supposed to make sense or to be correct!!
    #         they're only here to assure that the program handles the input correctly
    if nonSense:
        elements = [29, 79, 39]
        epsilon = [0.15, 0.00, 0.00, 0.10, 0.25, 0.00, 0.31, 0.60, 0.15]
        sigma = [2.7, 0.00, 0.00, 1.90, 2.7, 0.00, 2.20, 1.50, 2.7]
        atoms = L1_2([[1, 0, 0], [0, 1, 0], [0, 0, 1]],
                     size=(size, size, size),
                     element=("Cu", "Au"),
                     periodic=(1, 0, 1),
                     debug=0,
                     latticeconstant=3.95)
        atoms.set_calculator(LennardJones(elements, epsilon, sigma, rCut, v0))
    else:
        elements = [29]
        epsilon = [0.15]
        sigma = [2.7]
        atoms = FaceCenteredCubic(directions=[[1, 0, 0], [0, 1, 0], [0, 0, 1]],
                                  size=(size, size, size),
                                  symbol="Cu",
                                  pbc=(1, 0, 1),
                                  debug=0,
                                  latticeconstant=1.09 * sigma[0] * 1.41)
        atoms.set_calculator(LennardJones(elements, epsilon, sigma, rCut, v0))

    r = atoms.get_positions()
    r.flat[:] += 0.06 * np.sin(np.arange(3 * len(atoms)))
    atoms.set_positions(r)

    print "  Running Verlet dynamics (%s)" % ("Cu", )
    dyn = VelocityVerlet(atoms, 1 * units.fs)
    dyn.run(before)

    etot1 = (atoms.get_potential_energy() + atoms.get_kinetic_energy())
    for i in range(nsteps / 10):
        dyn.run(10)
        #print atoms.get_potential_energy()/len(atoms), atoms.get_kinetic_energy()/len(atoms), (atoms.get_potential_energy() + atoms.get_kinetic_energy())/len(atoms)
    etot2 = (atoms.get_potential_energy() + atoms.get_kinetic_energy())
    ReportTest(("  Energy conservation (%s)" % ("Cu", )),
               etot1,
               etot2,
               2,
               silent=Silent)
    print "Before: ", etot1, " now: ", etot2, " diff= ", (etot1 - etot2)
    epot = atoms.get_potential_energies()
    stress = atoms.get_stresses()
    print "  Reporting energies and stresses"

    e = []
    s = []
    j = 0
    for i in range(0, len(atoms), 100):
        e.append(epot[i])
        s.append(stress[i, j])
        j = (j + 1) % 6
    print "  e" + "Cu" + " =", repr(e)
    print "  s" + "Cu" + " =", repr(s)
    end = time()
    print "  ++++ Test runtime of the LJ dynamicsTest was %d seconds ++++\n\n" % (
        end - start)
    if 1:
        sumstress = np.zeros(6, np.float)
        for s in stress:
            sumstress += s
        totalstress = atoms.get_stress()
        for i in range(6):
            ReportTest("Sum of stresses (%d)" % (i, ),
                       sumstress[i] / len(atoms), totalstress[i],
                       abs(0.01 * totalstress[i]))
Esempio n. 15
0
import numpy as np

init = FaceCenteredCubic(size=(10,10,10), symbol='Cu', pbc=False)
z = init.get_positions()[:,2]
fixedatoms = np.less(z, 0.501*z.max())
print len(init), sum(fixedatoms)
MaxwellBoltzmannDistribution(init, 2000*units.kB)

print
print "Running simulation with Filter"
atoms1 = Atoms(init)
atoms1.set_calculator(EMT())
atoms1a = Filter(atoms1, mask=np.logical_not(fixedatoms))

dyn = VelocityVerlet(atoms1a, 0.5*units.fs)
dyn.run(50)
r1 = atoms1.get_positions()

print
print "Running simulation with Asap's FixAtoms"
atoms2 = Atoms(init)
atoms2.set_calculator(EMT())
atoms2.set_constraint(FixAtoms(mask=fixedatoms))

dyn = VelocityVerlet(atoms2, 0.5*units.fs)
dyn.run(50)
r2 = atoms2.get_positions()

print
print "Running simulation with ASE's FixAtoms"
atoms3 = Atoms(init)
Esempio n. 16
0
    del olde, oldf
else:
    print "WARNING: No self-check database found, creating it."
    cPickle.dump((e, f), open(selfcheckfilename, "w"))
del e,f,atoms

ReportTest.Summary(exit=1)

print "Preparing to run Verlet dynamics."
atoms = Atoms(initial)
atoms.set_calculator(EMT())
dynamics = VelocityVerlet(atoms, 5*units.fs)

print "Running Verlet dynamics."
startcpu, startwall = time.clock(), time.time()
dynamics.run(timesteps)

vcpu, vwall = time.clock() - startcpu, time.time() - startwall
vfraction = vcpu/vwall
sys.stderr.write("\n")
print "Verlet dynamics done."
del dynamics, atoms

print "Preparing to run Langevin dynamics."
atoms = Atoms(initial)
atoms.set_calculator(EMT())
dynamics = Langevin(atoms, 5*units.fs, 400*units.kB, 0.001)

print "Running Langevin dynamics."
startcpu, startwall = time.clock(), time.time()
dynamics.run(timesteps)
    ekin = atoms.get_kinetic_energy() / nTotalAtoms
    etotallist = [epot+ekin]
    ekinlist = [ekin]

    #report()

    if ismaster:
        print "\nE_pot = %-12.5f  E_kin = %-12.5f  E_tot = %-12.5f" % (epot, ekin,
                                                                     epot+ekin)
    ReportTest("Initial potential energy", epot,-3.4669, 1e-4)
    ReportTest("Initial kinetic energy", ekin, 0.0, 1e-9)

    dyn.attach(MDLogger(dyn, atoms, "-", peratom=True), interval=10)

    for i in range(40):
        dyn.run(10)
        epot = atoms.get_potential_energy() / nTotalAtoms
        ekin = atoms.get_kinetic_energy() / nTotalAtoms
        etotallist.append(epot+ekin)
        ekinlist.append(ekin)

    if ismaster:
        print "Average total energy:", sum(etotallist)/len(etotallist)
        print "Average kinetic energy:", sum(ekinlist)/len(ekinlist)

    ReportTest("Agv. total energy", sum(etotallist)/len(etotallist), -3.4669,
               0.0001)
    ReportTest("Agv. kinetic energy", sum(ekinlist)/len(ekinlist), 0.02165,
               0.002)
    ReportTest.Summary(0)
Esempio n. 18
0
else:
    atoms = None

if isparallel:
    atoms = MakeParallelAtoms(atoms, cpulayout)
atoms.set_calculator(asap3.EMT())
natoms = atoms.get_number_of_atoms()
    
ReportTest("Number of atoms", natoms, 800, 0)

# Make a small perturbation of the momenta
atoms.set_momenta(1e-6 * random.random([len(atoms), 3]))
print "Initializing ..."
predyn = VelocityVerlet(atoms, 0.5)
try:
    predyn.run(2500)
except:
    print atoms.arrays['positions']
    print atoms.arrays['momenta']
    print atoms.arrays['momenta'].shape
    print atoms.get_masses()
    print atoms.get_masses().shape
    
    raise

initr = atoms.get_positions()
initp = atoms.get_momenta()


def targetfunc(params, x):
    return params[0] * exp(-params[1] * x) + params[2]
Esempio n. 19
0
if len(sys.argv) == 2:
    arg = sys.argv[1]
else:
    arg = 'Wrong number of arguments.'
if arg == 'EMT':
    filename = 'small_EMT.dat'
elif arg == 'EMT2013':
    filename = 'small_EMT2013.dat'
else:
    print __doc__
    sys.exit(1)

    
T = 450
atoms = FaceCenteredCubic(size=(10,10,10), symbol='Cu', pbc=False)
if arg == 'EMT':
    atoms.set_calculator(EMT())
else:
    atoms.set_calculator(EMT2013(EMT2013_parameters))
    
print "Setting temperature:", T, "K"
MaxwellBoltzmannDistribution(atoms, 2*T*units.kB)
Stationary(atoms)

dyn1 = Langevin(atoms, 2*units.fs, temperature=T*units.kB, friction=0.05)
dyn1.run(200)

dyn = VelocityVerlet(atoms, 3*units.fs, logfile=filename, loginterval=25)
dyn.run(10000000) # 10^7 timesteps is 3 ns.

Esempio n. 20
0
def dynamicsTest(size, before, steps, v0, rCut, nonSense):
    print "\n\nStarting LJ dynamicsTest with "
    print "  cube of size                  %d"%size
    print "  time before measurement start %d*1*femtoseconds"%before
    print "  measuring time                %d*femtoseconds"%steps
    print "  add v0                        %d"%(v0==1)
    print "  rCut                          %d"%rCut
    print "  3 kinds of atoms              %s"%(nonSense==1)

    start = time();

    nsteps = steps;
    #Warning: numbers and constants are not supposed to make sense or to be correct!!
    #         they're only here to assure that the program handles the input correctly
    if nonSense:
      elements = [29, 79, 39]
      epsilon  = [0.15, 0.00, 0.00,
                  0.10, 0.25, 0.00,
                  0.31, 0.60, 0.15]
      sigma    = [2.7 , 0.00, 0.00,
                  1.90, 2.7 , 0.00,
                  2.20, 1.50, 2.7 ]
      atoms = L1_2([[1,0,0],[0,1,0],[0,0,1]], size=(size,size,size),
                              element=("Cu", "Au"), periodic=(1,0,1), debug=0,
                              latticeconstant=3.95)
      atoms.set_calculator(LennardJones(elements, epsilon, sigma, rCut, v0))
    else:
      elements = [29]
      epsilon  = [0.15]
      sigma    = [2.7]
      atoms = FaceCenteredCubic(directions=[[1,0,0],[0,1,0],[0,0,1]],
                                size=(size,size,size),
                                symbol="Cu", pbc=(1,0,1), debug=0,
                                latticeconstant=1.09*sigma[0]*1.41)
      atoms.set_calculator(LennardJones(elements, epsilon, sigma, rCut, v0))

    r = atoms.get_positions()
    r.flat[:] += 0.06 * np.sin(np.arange(3*len(atoms)))
    atoms.set_positions(r)

    print "  Running Verlet dynamics (%s)" % ("Cu",)
    dyn = VelocityVerlet(atoms, 1*units.fs)
    dyn.run(before)
    
    etot1 = (atoms.get_potential_energy() + atoms.get_kinetic_energy())
    for i in range(nsteps/10):
        dyn.run(10)
        #print atoms.get_potential_energy()/len(atoms), atoms.get_kinetic_energy()/len(atoms), (atoms.get_potential_energy() + atoms.get_kinetic_energy())/len(atoms)
    etot2 = (atoms.get_potential_energy() + atoms.get_kinetic_energy())
    ReportTest(("  Energy conservation (%s)" % ("Cu",)), etot1, etot2, 2, silent=Silent)
    print "Before: ", etot1, " now: ", etot2, " diff= ", (etot1-etot2)
    epot = atoms.get_potential_energies()
    stress = atoms.get_stresses()
    print "  Reporting energies and stresses"
    
    e = []
    s = []
    j = 0
    for i in range(0, len(atoms), 100):
        e.append(epot[i])
        s.append(stress[i,j])
        j = (j + 1) % 6
    print "  e"+"Cu"+" =", repr(e)
    print "  s"+"Cu"+" =", repr(s)
    end = time();
    print "  ++++ Test runtime of the LJ dynamicsTest was %d seconds ++++\n\n" %(end-start)
    if 1:
        sumstress = np.zeros(6, np.float)
        for s in stress:
            sumstress += s
        totalstress = atoms.get_stress()
        for i in range(6):
            ReportTest("Sum of stresses (%d)" % (i,), sumstress[i]/len(atoms),
                       totalstress[i], abs(0.01*totalstress[i]))