Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Scientific Software
MDANSE
Commits
51b9b2b1
Commit
51b9b2b1
authored
Jan 12, 2016
by
eric pellegrini
Browse files
Bug fix in Density analysis when computing mass density
parent
598d9b62
Changes
1
Hide whitespace changes
Inline
Side-by-side
MDANSE/Framework/Jobs/Density.py
View file @
51b9b2b1
...
...
@@ -32,7 +32,10 @@ Created on Apr 10, 2015
import
collections
from
MMTK
import
Units
from
MDANSE
import
ELEMENTS
from
MDANSE.Externals.magnitude.magnitude
import
mg
from
MDANSE.Framework.Jobs.IJob
import
IJob
,
JobError
from
MDANSE.MolecularDynamics.Trajectory
import
sorted_atoms
...
...
@@ -66,7 +69,7 @@ class Density(IJob):
# Will store the time.
self
.
_outputData
.
add
(
"times"
,
"line"
,
self
.
configuration
[
'frames'
][
'time'
],
units
=
'ps'
)
self
.
_outputData
.
add
(
"mass_density"
,
"line"
,
(
self
.
_nFrames
,),
units
=
'g/
n
m3'
)
self
.
_outputData
.
add
(
"mass_density"
,
"line"
,
(
self
.
_nFrames
,),
units
=
'g/
c
m3'
)
self
.
_outputData
.
add
(
"atomic_density"
,
"line"
,
(
self
.
_nFrames
,),
units
=
'1/nm3'
)
...
...
@@ -86,11 +89,11 @@ class Density(IJob):
self
.
configuration
[
'trajectory'
][
'instance'
].
universe
.
setFromTrajectory
(
self
.
configuration
[
'trajectory'
][
'instance'
],
frameIndex
)
cellVolume
=
self
.
configuration
[
'trajectory'
][
'instance'
].
universe
.
cellVolume
()
cellVolume
=
self
.
configuration
[
'trajectory'
][
'instance'
].
universe
.
cellVolume
()
*
mg
(
1.0
,
'nm3'
,
'cm3'
).
toval
()
atomicDensity
=
self
.
configuration
[
'trajectory'
][
'instance'
].
universe
.
numberOfAtoms
()
/
cellVolume
massDensity
=
sum
([
ELEMENTS
[
s
,
'atomic_weight'
]
for
s
in
self
.
_symbols
])
/
cellVolume
massDensity
=
sum
([
ELEMENTS
[
s
,
'atomic_weight'
]
for
s
in
self
.
_symbols
])
/
Units
.
Nav
/
cellVolume
return
index
,
(
atomicDensity
,
massDensity
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment