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
71c96de5
Commit
71c96de5
authored
6 years ago
by
Ivan Kondov
Browse files
Options
Downloads
Patches
Plain Diff
replaced subs() with xreplace() for more speed
parent
ab7fb70c
No related branches found
No related tags found
No related merge requests found
Pipeline
#158447
failed
6 years ago
Stage: build
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
classical/systems.py
+4
-4
4 additions, 4 deletions
classical/systems.py
with
4 additions
and
4 deletions
classical/systems.py
+
4
−
4
View file @
71c96de5
...
...
@@ -184,11 +184,11 @@ class ManyParticlePhysicalSystem:
def
get_potential_energy
(
self
,
qval
):
"""
evaluate the potential energy numerically
"""
return
float
(
self
.
potential_energy
.
subs
(
lis
t
(
zip
(
self
.
q
,
qval
))))
return
float
(
self
.
potential_energy
.
xreplace
(
dic
t
(
zip
(
self
.
q
,
qval
))))
def
get_kinetic_energy
(
self
,
pval
):
"""
evaluate the kinetic energy numerically
"""
return
float
(
self
.
kinetic_energy
.
subs
(
lis
t
(
zip
(
self
.
p
,
pval
))))
return
float
(
self
.
kinetic_energy
.
xreplace
(
dic
t
(
zip
(
self
.
p
,
pval
))))
def
get_total_energy
(
self
,
qval
,
pval
):
"""
evaluate the total energy numerically
"""
...
...
@@ -196,7 +196,7 @@ class ManyParticlePhysicalSystem:
def
get_forces_subs
(
self
,
q
):
"""
evaluate the forces numerically, subs version, very slow
"""
return
self
.
forces
.
subs
(
lis
t
(
zip
(
self
.
q
,
q
)))
return
self
.
forces
.
xreplace
(
dic
t
(
zip
(
self
.
q
,
q
)))
def
get_forces_nopbc
(
self
,
qval
):
return
np
.
array
(
self
.
get_forces_val
(
qval
),
dtype
=
float
)
...
...
@@ -223,7 +223,7 @@ class MPPS1D(ManyParticlePhysicalSystem):
def
find_mic
(
self
,
qval
):
"""
works for only two particles
"""
micval
=
qval
.
copy
()
r
=
float
(
self
.
ff
[
0
].
r_cart
.
subs
(
lis
t
(
zip
(
self
.
q
,
qval
))))
r
=
float
(
self
.
ff
[
0
].
r_cart
.
xreplace
(
dic
t
(
zip
(
self
.
q
,
qval
))))
r
-=
np
.
rint
(
r
*
self
.
inv_cell
)
*
self
.
cell
micval
[
1
]
=
qval
[
0
]
+
np
.
abs
(
r
)
return
micval
,
np
.
abs
(
r
)
...
...
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