root / ase / test / maxwellboltzmann.py @ 4
Historique | Voir | Annoter | Télécharger (395 octet)
| 1 |
from ase.md.velocitydistribution import MaxwellBoltzmannDistribution |
|---|---|
| 2 |
from ase.lattice.cubic import FaceCenteredCubic |
| 3 |
|
| 4 |
atoms = FaceCenteredCubic(size=(50,50,50), symbol="Cu", pbc=False) |
| 5 |
print "Number of atoms:", len(atoms) |
| 6 |
MaxwellBoltzmannDistribution(atoms, 0.1)
|
| 7 |
temp = atoms.get_kinetic_energy() / (1.5 * len(atoms)) |
| 8 |
|
| 9 |
print "Temperature", temp, " (should be 0.1)" |
| 10 |
assert abs(temp - 0.1) < 1e-3 |