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
8320fc41
Commit
8320fc41
authored
Nov 29, 2016
by
eric pellegrini
Browse files
bug fix when transmutating atoms from an atom selection different to 'all'
parent
7c0d220c
Changes
2
Hide whitespace changes
Inline
Side-by-side
MDANSE/Framework/Configurators/AtomSelectionConfigurator.py
View file @
8320fc41
...
...
@@ -105,14 +105,17 @@ class AtomSelectionConfigurator(IConfigurator):
parser
=
AtomSelectionParser
(
trajConfig
[
"instance"
])
indexes
.
update
(
parser
.
parse
(
v
))
indexes
=
sorted
(
list
(
indexes
))
self
[
"flatten_indexes"
]
=
sorted
(
list
(
indexes
))
trajConfig
=
self
.
_configurable
[
self
.
_dependencies
[
'trajectory'
]]
atoms
=
sorted
(
trajConfig
[
"universe"
].
atomList
(),
key
=
operator
.
attrgetter
(
'index'
))
selectedAtoms
=
[
atoms
[
idx
]
for
idx
in
indexes
]
self
[
"selection_length"
]
=
len
(
indexes
)
self
[
"selection_length"
]
=
len
(
self
[
"flatten_indexes"
])
self
[
'indexes'
]
=
[[
idx
]
for
idx
in
self
[
"flatten_indexes"
]]
self
[
'elements'
]
=
[[
at
.
symbol
]
for
at
in
selectedAtoms
]
self
[
'indexes'
]
=
[[
idx
]
for
idx
in
indexes
]
self
[
'names'
]
=
[
at
.
symbol
for
at
in
selectedAtoms
]
self
[
'unique_names'
]
=
sorted
(
set
(
self
[
'names'
]))
self
[
'masses'
]
=
[[
ELEMENTS
[
n
,
'atomic_weight'
]]
for
n
in
self
[
'names'
]]
...
...
MDANSE/Framework/Configurators/AtomTransmutationConfigurator.py
View file @
8320fc41
...
...
@@ -112,12 +112,18 @@ class AtomTransmutationConfigurator(IConfigurator):
raise
ConfiguratorError
(
"the element %r is not registered in the database"
%
element
,
self
)
atomSelConfigurator
=
self
.
_configurable
[
self
.
_dependencies
[
'atom_selection'
]]
for
idx
in
selection
:
atomSelConfigurator
[
"names"
][
idx
]
=
element
atomSelConfigurator
[
"elements"
][
idx
]
=
[
element
]
try
:
idxInSelection
=
atomSelConfigurator
[
"flatten_indexes"
].
index
(
idx
)
except
ValueError
:
pass
else
:
atomSelConfigurator
[
"names"
][
idxInSelection
]
=
element
atomSelConfigurator
[
"elements"
][
idxInSelection
]
=
[
element
]
atomSelConfigurator
[
'unique_names'
]
=
sorted
(
set
(
atomSelConfigurator
[
'names'
]))
atomSelConfigurator
[
'masses'
]
=
[[
ELEMENTS
[
n
,
'atomic_weight'
]]
for
n
in
atomSelConfigurator
[
'names'
]]
def
get_information
(
self
):
'''
...
...
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