Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
parser-asap
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
nomad-lab
parser-asap
Commits
c8881c4a
Commit
c8881c4a
authored
8 years ago
by
Mikkel Strange
Browse files
Options
Downloads
Patches
Plain Diff
test examples for asap
parent
43404684
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
test/examples/md.py
+44
-0
44 additions, 0 deletions
test/examples/md.py
test/examples/moldyn2.traj
+0
-0
0 additions, 0 deletions
test/examples/moldyn2.traj
with
44 additions
and
0 deletions
test/examples/md.py
0 → 100644
+
44
−
0
View file @
c8881c4a
from
__future__
import
print_function
from
ase.lattice.cubic
import
FaceCenteredCubic
from
ase.md.langevin
import
Langevin
from
ase.io.trajectory
import
Trajectory
from
ase
import
units
#from asap3 import EMT # Way too slow with ase.EMT !
from
ase.calculators.emt
import
EMT
size
=
2
T
=
1500
# Kelvin
# Set up a crystal
atoms
=
FaceCenteredCubic
(
directions
=
[[
1
,
0
,
0
],
[
0
,
1
,
0
],
[
0
,
0
,
1
]],
symbol
=
"
Cu
"
,
size
=
(
size
,
size
,
size
),
pbc
=
False
)
# Describe the interatomic interactions with the Effective Medium Theory
atoms
.
set_calculator
(
EMT
())
# We want to run MD with constant energy using the Langevin algorithm
# with a time step of 5 fs, the temperature T and the friction
# coefficient to 0.02 atomic units.
dyn
=
Langevin
(
atoms
,
5
*
units
.
fs
,
T
*
units
.
kB
,
0.002
)
def
printenergy
(
a
=
atoms
):
# store a reference to atoms in the definition.
"""
Function to print the potential, kinetic and total energy.
"""
epot
=
a
.
get_potential_energy
()
/
len
(
a
)
ekin
=
a
.
get_kinetic_energy
()
/
len
(
a
)
print
(
'
Energy per atom: Epot = %.3feV Ekin = %.3feV (T=%3.0fK)
'
'
Etot = %.3feV
'
%
(
epot
,
ekin
,
ekin
/
(
1.5
*
units
.
kB
),
epot
+
ekin
))
dyn
.
attach
(
printenergy
,
interval
=
50
)
# We also want to save the positions of all atoms after every 100th time step.
traj
=
Trajectory
(
'
moldyn2.traj
'
,
'
w
'
,
atoms
)
dyn
.
attach
(
traj
.
write
,
interval
=
50
)
# Now run the dynamics
printenergy
()
dyn
.
run
(
5000
)
This diff is collapsed.
Click to expand it.
test/examples/moldyn2.traj
0 → 100644
+
0
−
0
View file @
c8881c4a
File added
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment