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
a2805403
Commit
a2805403
authored
Nov 11, 2015
by
eric pellegrini
Browse files
Bug fix when displaying X-H hydrogens
Added a selector for selector hydrogen linked to sulphur atoms
parent
7ce0f863
Changes
5
Hide whitespace changes
Inline
Side-by-side
MDANSE/Framework/Selectors/CarboHydrogen.py
View file @
a2805403
...
...
@@ -38,17 +38,29 @@ class CarboHydrogen(ISelector):
section
=
"hydrogens"
def
select
(
self
,
*
args
):
def
__init__
(
self
,
universe
):
ISelector
.
__init__
(
self
,
universe
)
sel
=
set
()
for
obj
in
self
.
_universe
.
objectList
():
carbons
=
[
at
for
at
in
obj
.
atomList
()
if
at
.
type
.
name
.
strip
().
lower
()
==
'carbon'
]
for
car
in
carbons
:
neighbours
=
car
.
bondedTo
()
hydrogens
=
[
neigh
for
neigh
in
neighbours
if
neigh
.
type
.
name
.
strip
().
lower
()
==
'hydrogen'
]
sel
.
update
(
hydrogens
)
return
sel
\ No newline at end of file
hydrogens
=
[
neigh
.
fullName
().
strip
().
lower
()
for
neigh
in
neighbours
if
neigh
.
type
.
name
.
strip
().
lower
()
==
'hydrogen'
]
self
.
_choices
.
extend
(
sorted
(
hydrogens
))
def
select
(
self
,
names
):
sel
=
set
()
if
'*'
in
names
:
names
=
self
.
_choices
[
1
:]
vals
=
set
([
v
.
lower
()
for
v
in
names
])
sel
.
update
([
at
for
at
in
self
.
_universe
.
atomList
()
if
at
.
fullName
().
strip
().
lower
()
in
vals
])
return
sel
\ No newline at end of file
MDANSE/Framework/Selectors/HeteroHydrogen.py
View file @
a2805403
...
...
@@ -38,17 +38,27 @@ class HeteroHydrogenBound(ISelector):
section
=
"hydrogens"
def
select
(
self
,
*
args
):
def
__init__
(
self
,
universe
):
ISelector
.
__init__
(
self
,
universe
)
sel
=
set
()
for
obj
in
self
.
_universe
.
objectList
():
heteroatoms
=
[
at
for
at
in
obj
.
atomList
()
if
at
.
type
.
name
.
strip
().
lower
()
not
in
[
'carbon'
,
'hydrogen'
]]
for
het
in
heteroatoms
:
neighbours
=
het
.
bondedTo
()
hydrogens
=
[
neigh
for
neigh
in
neighbours
if
neigh
.
type
.
name
.
strip
().
lower
()
==
'hydrogen'
]
sel
.
update
(
hydrogens
)
hydrogens
=
[
neigh
.
fullName
().
strip
().
lower
()
for
neigh
in
neighbours
if
neigh
.
type
.
name
.
strip
().
lower
()
==
'hydrogen'
]
self
.
_choices
.
extend
(
sorted
(
hydrogens
))
def
select
(
self
,
names
):
sel
=
set
()
if
'*'
in
names
:
names
=
self
.
_choices
[
1
:]
vals
=
set
([
v
.
lower
()
for
v
in
names
])
sel
.
update
([
at
for
at
in
self
.
_universe
.
atomList
()
if
at
.
fullName
().
strip
().
lower
()
in
vals
])
return
sel
MDANSE/Framework/Selectors/NitroHydrogen.py
View file @
a2805403
...
...
@@ -38,17 +38,28 @@ class NitroHydrogen(ISelector):
section
=
"hydrogens"
def
select
(
self
,
*
args
):
def
__init__
(
self
,
universe
):
ISelector
.
__init__
(
self
,
universe
)
sel
=
set
()
for
obj
in
self
.
_universe
.
objectList
():
nitrogens
=
[
at
for
at
in
obj
.
atomList
()
if
at
.
type
.
name
.
strip
().
lower
()
==
'nitrogen'
]
for
nit
in
nitrogens
:
neighbours
=
nit
.
bondedTo
()
hydrogens
=
[
neigh
for
neigh
in
neighbours
if
neigh
.
type
.
name
.
strip
().
lower
()
==
'hydrogen'
]
sel
.
update
(
hydrogens
)
for
nitro
in
nitrogens
:
neighbours
=
nitro
.
bondedTo
()
hydrogens
=
[
neigh
.
fullName
().
strip
().
lower
()
for
neigh
in
neighbours
if
neigh
.
type
.
name
.
strip
().
lower
()
==
'hydrogen'
]
self
.
_choices
.
extend
(
sorted
(
hydrogens
))
def
select
(
self
,
names
):
sel
=
set
()
if
'*'
in
names
:
names
=
self
.
_choices
[
1
:]
vals
=
set
([
v
.
lower
()
for
v
in
names
])
sel
.
update
([
at
for
at
in
self
.
_universe
.
atomList
()
if
at
.
fullName
().
strip
().
lower
()
in
vals
])
return
sel
MDANSE/Framework/Selectors/OxyHydrogen.py
View file @
a2805403
...
...
@@ -38,17 +38,28 @@ class OxyHydrogen(ISelector):
section
=
"hydrogens"
def
select
(
self
,
*
args
):
def
__init__
(
self
,
universe
):
ISelector
.
__init__
(
self
,
universe
)
sel
=
set
()
for
obj
in
self
.
_universe
.
objectList
():
oxygens
=
[
at
for
at
in
obj
.
atomList
()
if
at
.
type
.
name
.
strip
().
lower
()
==
'oxygen'
]
for
oxy
in
oxygens
:
neighbours
=
oxy
.
bondedTo
()
hydrogens
=
[
neigh
for
neigh
in
neighbours
if
neigh
.
type
.
name
.
strip
().
lower
()
==
'hydrogen'
]
sel
.
update
(
hydrogens
)
return
sel
\ No newline at end of file
hydrogens
=
[
neigh
.
fullName
().
strip
().
lower
()
for
neigh
in
neighbours
if
neigh
.
type
.
name
.
strip
().
lower
()
==
'hydrogen'
]
self
.
_choices
.
extend
(
sorted
(
hydrogens
))
def
select
(
self
,
names
):
sel
=
set
()
if
'*'
in
names
:
names
=
self
.
_choices
[
1
:]
vals
=
set
([
v
.
lower
()
for
v
in
names
])
sel
.
update
([
at
for
at
in
self
.
_universe
.
atomList
()
if
at
.
fullName
().
strip
().
lower
()
in
vals
])
return
sel
MDANSE/Framework/Selectors/SulphurHydrogen.py
0 → 100644
View file @
a2805403
#MDANSE : Molecular Dynamics Analysis for Neutron Scattering Experiments
#------------------------------------------------------------------------------------------
#Copyright (C)
#2015- Eric C. Pellegrini Institut Laue-Langevin
#BP 156
#6, rue Jules Horowitz
#38042 Grenoble Cedex 9
#France
#pellegrini[at]ill.fr
#goret[at]ill.fr
#aoun[at]ill.fr
#
#This library is free software; you can redistribute it and/or
#modify it under the terms of the GNU Lesser General Public
#License as published by the Free Software Foundation; either
#version 2.1 of the License, or (at your option) any later version.
#
#This library is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
#Lesser General Public License for more details.
#
#You should have received a copy of the GNU Lesser General Public
#License along with this library; if not, write to the Free Software
#Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
'''
Created on Mar 27, 2015
:author: Eric C. Pellegrini
'''
from
MDANSE.Framework.Selectors.ISelector
import
ISelector
class
OxyHydrogen
(
ISelector
):
type
=
"sulphur_hydrogen"
section
=
"hydrogens"
def
__init__
(
self
,
universe
):
ISelector
.
__init__
(
self
,
universe
)
for
obj
in
self
.
_universe
.
objectList
():
sulphurs
=
[
at
for
at
in
obj
.
atomList
()
if
at
.
type
.
name
.
strip
().
lower
()
in
[
'sulphur'
,
'sulfur'
]]
for
sul
in
sulphurs
:
neighbours
=
sul
.
bondedTo
()
hydrogens
=
[
neigh
.
fullName
().
strip
().
lower
()
for
neigh
in
neighbours
if
neigh
.
type
.
name
.
strip
().
lower
()
==
'hydrogen'
]
self
.
_choices
.
extend
(
sorted
(
hydrogens
))
def
select
(
self
,
names
):
sel
=
set
()
if
'*'
in
names
:
names
=
self
.
_choices
[
1
:]
vals
=
set
([
v
.
lower
()
for
v
in
names
])
sel
.
update
([
at
for
at
in
self
.
_universe
.
atomList
()
if
at
.
fullName
().
strip
().
lower
()
in
vals
])
return
sel
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