Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
rotagaporp-c
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ivan Kondov
rotagaporp-c
Commits
ab7fb70c
Commit
ab7fb70c
authored
6 years ago
by
Ivan Kondov
Browse files
Options
Downloads
Patches
Plain Diff
introduce a step (stride) to reduce trajectory output and optimizations
parent
26943420
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
classical/propagators.py
+12
-11
12 additions, 11 deletions
classical/propagators.py
classical/trajectory.py
+2
-2
2 additions, 2 deletions
classical/trajectory.py
with
14 additions
and
13 deletions
classical/propagators.py
+
12
−
11
View file @
ab7fb70c
...
...
@@ -56,24 +56,25 @@ class Propagator:
"""
perform a time step - stub method
"""
return
(
coordinate
,
momentum
)
def
get_trajectory
(
self
):
def
get_trajectory
(
self
,
step
=
1
):
"""
return a trajectory - a time series of coordinate and momentum
"""
time
=
np
.
array
(
self
.
time
,
dtype
=
'
float
'
)
coordinate
=
np
.
array
(
self
.
sq
,
dtype
=
'
float
'
)
momentum
=
np
.
array
(
self
.
sp
,
dtype
=
'
float
'
)
time
=
np
.
array
(
self
.
time
,
dtype
=
'
float
'
)
[::
step
]
coordinate
=
np
.
array
(
self
.
sq
,
dtype
=
'
float
'
)
[::
step
]
momentum
=
np
.
array
(
self
.
sp
,
dtype
=
'
float
'
)
[::
step
]
return
time
,
coordinate
,
momentum
def
get_trajectory_3d
(
self
):
def
get_trajectory_3d
(
self
,
step
=
1
):
"""
return a trajectory of coordinates grouped in 3-tuples
"""
ti
=
np
.
array
(
self
.
time
,
dtype
=
'
float
'
)
qt
=
np
.
array
([
list
(
zip
(
t
[
0
::
3
],
t
[
1
::
3
],
t
[
2
::
3
]))
for
t
in
self
.
sq
],
dtype
=
float
)
pt
=
np
.
array
([
list
(
zip
(
t
[
0
::
3
],
t
[
1
::
3
],
t
[
2
::
3
]))
for
t
in
self
.
sp
],
dtype
=
float
)
ti
,
qt
,
pt
=
self
.
get_trajectory
(
step
)
qt
.
shape
=
(
len
(
qt
),
-
1
,
3
)
pt
.
shape
=
(
len
(
pt
),
-
1
,
3
)
return
ti
,
qt
,
pt
def
analyse
(
self
):
def
analyse
(
self
,
step
=
1
):
"""
analyse the trajectory
"""
energy
=
[
self
.
syst
.
energy
(
q
,
p
)
for
q
,
p
in
zip
(
self
.
sq
,
self
.
sp
)]
self
.
en
=
np
.
array
(
energy
,
dtype
=
float
)
from
itertools
import
islice
qptup
=
islice
(
zip
(
self
.
sq
,
self
.
sp
),
0
,
None
,
step
)
self
.
en
=
np
.
array
([
self
.
syst
.
energy
(
*
t
)
for
t
in
qptup
],
dtype
=
float
)
self
.
er
=
(
self
.
en
-
self
.
en0
)
/
self
.
en0
def
plot
(
self
):
...
...
This diff is collapsed.
Click to expand it.
classical/trajectory.py
+
2
−
2
View file @
ab7fb70c
...
...
@@ -2,14 +2,14 @@ from ase import Atoms
from
ase.io
import
write
from
units
import
LJUnitsElement
def
write_ase_trajectory
(
propagator
,
atoms
,
filename
=
'
trajectory.traj
'
):
def
write_ase_trajectory
(
propagator
,
atoms
,
filename
=
'
trajectory.traj
'
,
step
=
1
):
"""
currently restricted to a single element, no export of time axis
"""
symbols
=
atoms
.
get_chemical_symbols
()
assert
len
(
set
(
symbols
))
==
1
ljunits
=
LJUnitsElement
(
symbols
[
0
])
pbc
=
atoms
.
get_pbc
()
cell
=
atoms
.
get_cell
()
traj_3d
=
propagator
.
get_trajectory_3d
()
traj_3d
=
propagator
.
get_trajectory_3d
(
step
)
qs
=
traj_3d
[
1
]
*
ljunits
.
sigmaA
ps
=
traj_3d
[
2
]
*
ljunits
.
momentumA
traj
=
[
Atoms
(
symbols
,
cell
=
cell
,
pbc
=
pbc
,
positions
=
q
,
momenta
=
p
)
...
...
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