Skip to content
GitLab
Menu
Projects
Groups
Snippets
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
0193e21a
Commit
0193e21a
authored
Jun 15, 2016
by
Carl Poelking
Browse files
Archiving: fixes.
parent
b668b168
Changes
7
Show whitespace changes
Inline
Side-by-side
src/soap/atomicspectrum.cpp
View file @
0193e21a
...
...
@@ -159,7 +159,7 @@ void AtomicSpectrum::addQnlmNeighbour(Particle *nb, qnlm_t *nb_expansion) {
return
;
}
void
AtomicSpectrum
::
mergeQnlm
(
AtomicSpectrum
*
other
,
double
scale
)
{
void
AtomicSpectrum
::
mergeQnlm
(
AtomicSpectrum
*
other
,
double
scale
,
bool
gradients
)
{
// Function used to construct global spectrum as sum over atomic spectra.
// The result is itself an "atomic" spectrum (as data fields are largely identical,
// except for the fact that this summed spectrum does not have a well-defined center.
...
...
@@ -186,6 +186,7 @@ void AtomicSpectrum::mergeQnlm(AtomicSpectrum *other, double scale) {
mit
->
second
->
add
(
*
density
,
scale
);
}
// Particle-ID-resolved gradients
if
(
gradients
)
{
map_pid_qnlm_t
&
map_pid_qnlm_other
=
other
->
getPidQnlmMap
();
for
(
auto
it
=
map_pid_qnlm_other
.
begin
();
it
!=
map_pid_qnlm_other
.
end
();
++
it
)
{
int
pid
=
it
->
first
;
...
...
@@ -203,6 +204,7 @@ void AtomicSpectrum::mergeQnlm(AtomicSpectrum *other, double scale) {
// Add gradients ...
mit
->
second
.
second
->
addGradient
(
*
density_grad
);
}
}
return
;
}
...
...
src/soap/atomicspectrum.hpp
View file @
0193e21a
...
...
@@ -59,7 +59,7 @@ public:
qnlm_t
*
getQnlmGeneric
()
{
return
_qnlm_generic
;
}
map_qnlm_t
&
getQnlmMap
()
{
return
_map_qnlm
;
}
map_pid_qnlm_t
&
getPidQnlmMap
()
{
return
_map_pid_qnlm
;
}
void
mergeQnlm
(
AtomicSpectrum
*
other
,
double
scale
);
void
mergeQnlm
(
AtomicSpectrum
*
other
,
double
scale
,
bool
gradients
);
// XNKL METHODS
void
computePower
();
void
computePowerGradients
();
...
...
src/soap/cutoff.cpp
View file @
0193e21a
#include "soap/cutoff.hpp"
#include <boost/archive/binary_iarchive.hpp>
#include <boost/archive/binary_oarchive.hpp>
#include <boost/archive/text_iarchive.hpp>
#include <boost/archive/text_oarchive.hpp>
namespace
soap
{
...
...
@@ -77,6 +81,7 @@ void CutoffFunctionFactory::registerAll(void) {
CutoffFunctionOutlet
().
Register
<
CutoffFunctionHeaviside
>
(
"heaviside"
);
}
}
BOOST_CLASS_EXPORT_IMPLEMENT
(
soap
::
CutoffFunctionHeaviside
);
src/soap/cutoff.hpp
View file @
0193e21a
...
...
@@ -4,6 +4,8 @@
#include <string>
#include <math.h>
#include <vector>
#include <boost/serialization/base_object.hpp>
#include <boost/serialization/export.hpp>
#include "soap/base/exceptions.hpp"
#include "soap/base/objectfactory.hpp"
...
...
@@ -93,6 +95,9 @@ inline CutoffFunction *CutoffFunctionFactory::create(const std::string &key) {
}
}
}
}
/* CLOSE NAMESPACE */
BOOST_CLASS_EXPORT_KEY
(
soap
::
CutoffFunction
);
BOOST_CLASS_EXPORT_KEY
(
soap
::
CutoffFunctionHeaviside
);
#endif
src/soap/options.cpp
View file @
0193e21a
...
...
@@ -96,6 +96,30 @@ bool Options::doExcludeTargetId(int pid) {
return
(
it
==
_exclude_target_id
.
end
())
?
false
:
true
;
}
void
Options
::
generateExclusionLists
()
{
if
(
!
boost
::
python
::
len
(
_exclude_center_list
))
{
for
(
auto
it
=
_exclude_center
.
begin
();
it
!=
_exclude_center
.
end
();
++
it
)
{
if
(
it
->
second
)
_exclude_center_list
.
append
(
it
->
first
);
}
}
if
(
!
boost
::
python
::
len
(
_exclude_target_list
))
{
for
(
auto
it
=
_exclude_target
.
begin
();
it
!=
_exclude_target
.
end
();
++
it
)
{
if
(
it
->
second
)
_exclude_target_list
.
append
(
it
->
first
);
}
}
if
(
!
boost
::
python
::
len
(
_exclude_center_id_list
))
{
for
(
auto
it
=
_exclude_center_id
.
begin
();
it
!=
_exclude_center_id
.
end
();
++
it
)
{
if
(
it
->
second
)
_exclude_center_id_list
.
append
(
it
->
first
);
}
}
if
(
!
boost
::
python
::
len
(
_exclude_target_id_list
))
{
for
(
auto
it
=
_exclude_target_id
.
begin
();
it
!=
_exclude_target_id
.
end
();
++
it
)
{
if
(
it
->
second
)
_exclude_target_id_list
.
append
(
it
->
first
);
}
}
return
;
}
void
Options
::
registerPython
()
{
using
namespace
boost
::
python
;
void
(
Options
::*
set_int
)(
std
::
string
,
int
)
=
&
Options
::
set
;
...
...
src/soap/options.hpp
View file @
0193e21a
...
...
@@ -47,6 +47,9 @@ public:
boost
::
python
::
list
getExcludeCenterIdList
()
{
return
_exclude_center_id_list
;
}
boost
::
python
::
list
getExcludeTargetIdList
()
{
return
_exclude_target_id_list
;
}
// USED IN SERIALIZATION-LOAD: std::map TO boost::python::list
void
generateExclusionLists
();
// PYTHON
static
void
registerPython
();
...
...
@@ -57,13 +60,15 @@ public:
arch
&
_exclude_center
;
arch
&
_exclude_target
;
arch
&
_exclude_center_list
;
arch
&
_exclude_target_list
;
//
arch & _exclude_center_list;
//
arch & _exclude_target_list;
arch
&
_exclude_center_id
;
arch
&
_exclude_target_id
;
arch
&
_exclude_center_id_list
;
arch
&
_exclude_target_id_list
;
//arch & _exclude_center_id_list;
//arch & _exclude_target_id_list;
this
->
generateExclusionLists
();
return
;
}
...
...
src/soap/spectrum.cpp
View file @
0193e21a
...
...
@@ -129,13 +129,14 @@ AtomicSpectrum *Spectrum::computeGlobal() {
if
(
_global_atomic
)
throw
soap
::
base
::
APIError
(
"<Spectrum::computeGlobal> Already initialised."
);
_global_atomic
=
new
AtomicSpectrum
(
_basis
);
GLOG
()
<<
"Computing global spectrum ..."
<<
std
::
endl
;
bool
gradients
=
_options
->
get
<
bool
>
(
"spectrum.gradients"
);
for
(
auto
it
=
_atomspec_array
.
begin
();
it
!=
_atomspec_array
.
end
();
++
it
)
{
GLOG
()
<<
" Adding center "
<<
(
*
it
)
->
getCenter
()
->
getId
()
<<
" (type "
<<
(
*
it
)
->
getCenter
()
->
getType
()
<<
")"
<<
std
::
endl
;
_global_atomic
->
mergeQnlm
(
*
it
,
0.5
);
// <- Scale factor 0.5 necessary in order not to overcount pairs
_global_atomic
->
mergeQnlm
(
*
it
,
0.5
,
gradients
);
// <- Scale factor 0.5 necessary in order not to overcount pairs
}
_global_atomic
->
computePower
();
_global_atomic
->
computePowerGradients
();
if
(
gradients
)
_global_atomic
->
computePowerGradients
();
return
_global_atomic
;
}
...
...
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