18.11.2012 Views

ASE Manual Release 3.6.1.2825 CAMd - CampOS Wiki

ASE Manual Release 3.6.1.2825 CAMd - CampOS Wiki

ASE Manual Release 3.6.1.2825 CAMd - CampOS Wiki

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

ag moldyn3.traj<br />

<strong>ASE</strong> <strong>Manual</strong>, <strong>Release</strong> 3.6.1.2828<br />

Try plotting the kinetic energy. You will not see a well-defined melting point due to finite size effects (including<br />

surface melting), but you will probably see an almost flat region where the inside of the system melts. The<br />

outermost layers melt at a lower temperature.<br />

Note: The Langevin dynamics will by default keep the position and momentum of the center of mass unperturbed.<br />

This is another improvement over just setting momenta corresponding to a temperature, as we did before.<br />

Isolated particle MD<br />

When simulating isolated particles with MD, it is sometimes preferable to set random momenta corresponding to<br />

a spefic temperature and let the system evolve freely. With a relatively high temperature, the is however a risk that<br />

the collection of atoms will drift out of the simulation box because the randomized momenta gave the center of<br />

mass a small but non-zero velocity too.<br />

Let us see what happens when we propagate a nanoparticle for a long time:<br />

"Demonstrates molecular dynamics for isolated particles."<br />

from ase.calculators.emt import EMT<br />

from ase.cluster.cubic import FaceCenteredCubic<br />

from ase.optimize import QuasiNewton<br />

from ase.md.velocitydistribution import MaxwellBoltzmannDistribution, \<br />

Stationary, ZeroRotation<br />

from ase.md.verlet import VelocityVerlet<br />

from ase import units<br />

# Use Asap for a huge performance increase if it is installed<br />

useAsap = True<br />

if useAsap:<br />

from asap3 import EMT<br />

size = 4<br />

else:<br />

size = 2<br />

# Set up a nanoparticle<br />

atoms = FaceCenteredCubic(’Cu’, surfaces=[[1,0,0],[1,1,0],[1,1,1]],<br />

layers=(size,size,size), vacuum=4)<br />

# Describe the interatomic interactions with the Effective Medium Theory<br />

atoms.set_calculator(EMT())<br />

# Do a quick relaxation of the cluster<br />

qn = QuasiNewton(atoms)<br />

qn.run(0.001, 10)<br />

# Set the momenta corresponding to T=1200K<br />

MaxwellBoltzmannDistribution(atoms, 1200*units.kB)<br />

Stationary(atoms) # zero linear momentum<br />

ZeroRotation(atoms) # zero angular momentum<br />

# We want to run MD using the VelocityVerlet algorithm.<br />

dyn = VelocityVerlet(atoms, 5*units.fs, trajectory=’moldyn4.traj’) # save trajectory.<br />

#Function to print the potential, kinetic and total energy.<br />

def printenergy(a=atoms): #store a reference to atoms in the definition.<br />

epot = a.get_potential_energy() / len(a)<br />

ekin = a.get_kinetic_energy() / len(a)<br />

6.2. <strong>ASE</strong> 41

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!