Ejemplo n.º 1
0
"""

from numpy import *
from asap3 import Atoms, EMT, units
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].set_momentum(array([0, -11.3, 0]))
print "Kinetic energies of all atoms:"
p = atoms.get_momenta()
kinenergies = 0.5 * (p * p).sum(1) / atoms.get_masses()
print kinenergies

# 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)
print ""
print "Energy per atom:"
print "  %15s %15s %15s" % ("Pot. energy", "Kin. energy", "Total energy")

for i in range(25):
    dyn.run(10)
    epot = atoms.get_potential_energy()/len(atoms)
Ejemplo n.º 2
0
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]

output = file("Langevin.dat", "w")

for temp, frict in ((0.01, 0.001),):
    dyn = Langevin(atoms, timestep, temp, frict)
Ejemplo n.º 3
0
"""

from numpy import *
from asap3 import Atoms, EMT, units
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].set_momentum(array([0, -11.3, 0]))
print "Kinetic energies of all atoms:"
p = atoms.get_momenta()
kinenergies = 0.5 * (p * p).sum(1) / atoms.get_masses()
print kinenergies

# 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)
print ""
print "Energy per atom:"
print "  %15s %15s %15s" % ("Pot. energy", "Kin. energy", "Total energy")

for i in range(25):
    dyn.run(10)
    epot = atoms.get_potential_energy() / len(atoms)