Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
nomad-lab
soap-plus-plus
Commits
a856848a
Commit
a856848a
authored
Sep 21, 2016
by
Carl Poelking
Browse files
Mods for notebook integration.
parent
87851431
Changes
7
Hide whitespace changes
Inline
Side-by-side
src/soap/soapy/elements.py
View file @
a856848a
...
...
@@ -19,7 +19,7 @@ class PeriodicTable(object):
"H"
,
"He"
,
"Li"
,
"Be"
,
"B"
,
"C"
,
"N"
,
"O"
,
"F"
,
"Ne"
,
"Na"
,
"Mg"
,
"Al"
,
"Si"
,
"P"
,
"S"
,
"Cl"
,
"Ar"
,
"K
"
,
"Ca"
,
"Sc"
,
"Ti"
,
"V"
,
"Cr"
,
"Mn"
,
"Fe"
,
"Co"
,
"Ni"
,
"Cu"
,
"Zn"
,
"Ga"
,
"Ge"
,
"As"
,
"Se"
,
"Br"
,
"Kr"
,
"K"
,
"Ca"
,
"Sc"
,
"Ti"
,
"V"
,
"Cr"
,
"Mn"
,
"Fe"
,
"Co"
,
"Ni"
,
"Cu"
,
"Zn"
,
"Ga"
,
"Ge"
,
"As"
,
"Se"
,
"Br"
,
"Kr"
,
"Rb"
,
"Sr"
,
"Y"
,
"Zr"
,
"Nb"
,
"Mo"
,
"Tc"
,
"Ru"
,
"Rh"
,
"Pd"
,
"Ag"
,
"Cd"
,
"In"
,
"Sn"
,
"Sb"
,
"Te"
,
"I"
,
"Xe"
,
"Cs"
,
"Ba"
,
"La"
,
"Ce"
,
"Pr"
,
"Nd"
,
"Pm"
,
"Sm"
,
"Eu"
,
"Gd"
,
"Tb"
,
"Dy"
,
"Ho"
,
"Er"
,
"Tm"
,
"Yb"
,
"Lu"
,
...
...
src/soap/soapy/kernel.py
View file @
a856848a
...
...
@@ -232,7 +232,7 @@ class KernelAdaptorGlobalSpecific(object):
def
adaptScalar
(
self
,
atomic
):
xnklab_atomic
=
Xnklab
(
atomic
,
self
.
types
)
X
=
xnklab_atomic
.
reduce
()
x
_norm
=
X
/
np
.
dot
(
X
,
X
)
**
0.5
X
_norm
=
X
/
np
.
dot
(
X
,
X
)
**
0.5
return
X
,
X_norm
class
KernelAdaptorGeneric
(
object
):
...
...
src/soap/soapy/lagraph.py
View file @
a856848a
...
...
@@ -696,10 +696,11 @@ class ParticleGraph(object):
return
P
,
positions
def
mp_create_graph
(
config
,
options
,
log
):
soap
.
soapy
.
util
.
MP_LOCK
.
acquire
()
log
<<
log
.
item
<<
"Graph('%s') PID=%d"
%
(
\
config
.
config_file
,
mp
.
current_process
().
pid
)
<<
log
.
endl
soap
.
soapy
.
util
.
MP_LOCK
.
release
()
if
log
:
soap
.
soapy
.
util
.
MP_LOCK
.
acquire
()
log
<<
log
.
item
<<
"Graph('%s') PID=%d"
%
(
\
config
.
config_file
,
mp
.
current_process
().
pid
)
<<
log
.
endl
soap
.
soapy
.
util
.
MP_LOCK
.
release
()
graph
=
ParticleGraph
(
config
.
config_file
,
config
.
atoms
,
options
)
return
graph
...
...
src/soap/soapy/lamatch.py
View file @
a856848a
...
...
@@ -6,19 +6,21 @@ import kernel as kern
import
lagraph
def
compare_graphs_average
(
g1
,
g2
,
options
):
P1
=
g1
.
P
# TODO Use KernelFunctionFactory here
xi
=
options
[
'basekernel'
][
'kernel.xi'
]
P1_avg
=
np
.
average
(
g1
.
P
,
axis
=
0
)
P1_avg
=
P1_avg
/
np
.
dot
(
P1_avg
,
P1_avg
)
**
0.5
P2
=
g2
.
P
P2_avg
=
np
.
average
(
g2
.
P
,
axis
=
0
)
P2_avg
=
P2_avg
/
np
.
dot
(
P2_avg
,
P2_avg
)
**
0.5
print
P1
.
shape
,
P2
.
shape
,
P1_avg
.
shape
,
P2_avg
.
shape
return
np
.
dot
(
P1_avg
,
P2_avg
)
#
print P1.shape, P2.shape, P1_avg.shape, P2_avg.shape
return
np
.
dot
(
P1_avg
,
P2_avg
)
**
xi
def
compare_graphs_global
(
g1
,
g2
,
options
):
# TODO Use KernelFunctionFactory here
xi
=
options
[
'basekernel'
][
'kernel.xi'
]
assert
g1
.
P
.
shape
[
0
]
==
1
# Global descriptor computed?
assert
g2
.
P
.
shape
[
0
]
==
1
# Global descriptor computed?
return
np
.
dot
(
g1
.
P
[
0
],
g2
.
P
[
0
])
return
np
.
dot
(
g1
.
P
[
0
],
g2
.
P
[
0
])
**
xi
def
compare_graphs_rematch
(
g1
,
g2
,
options
):
if
options
[
'graph'
][
'hierarchical'
]:
...
...
src/soap/soapy/momo.py
View file @
a856848a
...
...
@@ -4,7 +4,10 @@ import commands
import
argparse
import
time
import
numpy
as
np
from
lxml
import
etree
try
:
from
lxml
import
etree
except
ImportError
:
pass
boolean_dict
=
\
{
'true'
:
True
,
'1'
:
True
,
'yes'
:
True
,
...
...
src/soap/tools/extract.py
View file @
a856848a
import
numpy
as
np
import
numpy.linalg
from
momo
import
osio
,
endl
,
flush
from
..soapy
import
momo
osio
=
momo
.
osio
endl
=
momo
.
endl
flush
=
momo
.
flush
class
Xnklab
(
object
):
def
__init__
(
self
,
atomic
,
types_global
):
...
...
src/soap/tools/inverse.py
View file @
a856848a
import
numpy
as
np
import
numpy.linalg
from
momo
import
osio
,
endl
,
flush
from
..soapy
import
momo
osio
=
momo
.
osio
endl
=
momo
.
endl
flush
=
momo
.
flush
def
compute_X
(
Qr
):
# Q is N x (2*L+1) real-valued matrix
...
...
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