Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
NP_TMcode
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Giacomo Mulas
NP_TMcode
Commits
866f3376
Commit
866f3376
authored
1 month ago
by
Giovanni La Mura
Browse files
Options
Downloads
Patches
Plain Diff
Implement CLUSTER dynamic handling of internal order
parent
d80df707
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/cluster/cluster.cpp
+86
-17
86 additions, 17 deletions
src/cluster/cluster.cpp
with
86 additions
and
17 deletions
src/cluster/cluster.cpp
+
86
−
17
View file @
866f3376
...
@@ -19,6 +19,7 @@
...
@@ -19,6 +19,7 @@
* \brief Implementation of the calculation for a cluster of spheres.
* \brief Implementation of the calculation for a cluster of spheres.
*/
*/
#include
<chrono>
#include
<chrono>
#include
<cmath>
#include
<cstdio>
#include
<cstdio>
#include
<exception>
#include
<exception>
#include
<fstream>
#include
<fstream>
...
@@ -240,7 +241,7 @@ void cluster(const string& config_file, const string& data_file, const string& o
...
@@ -240,7 +241,7 @@ void cluster(const string& config_file, const string& data_file, const string& o
logger
->
log
(
"INFO: Size of matrices to invert: "
+
to_string
((
int64_t
)
ndit
)
+
" x "
+
to_string
((
int64_t
)
ndit
)
+
".
\n
"
);
logger
->
log
(
"INFO: Size of matrices to invert: "
+
to_string
((
int64_t
)
ndit
)
+
" x "
+
to_string
((
int64_t
)
ndit
)
+
".
\n
"
);
time_logger
->
log
(
"INFO: Size of matrices to invert: "
+
to_string
((
int64_t
)
ndit
)
+
" x "
+
to_string
((
int64_t
)
ndit
)
+
".
\n
"
);
time_logger
->
log
(
"INFO: Size of matrices to invert: "
+
to_string
((
int64_t
)
ndit
)
+
" x "
+
to_string
((
int64_t
)
ndit
)
+
".
\n
"
);
str
(
sconf
,
cid
->
c1
);
str
(
sconf
->
_rcf
,
cid
->
c1
);
thdps
(
cid
->
c1
->
lm
,
cid
->
zpv
);
thdps
(
cid
->
c1
->
lm
,
cid
->
zpv
);
double
exdc
=
sconf
->
exdc
;
double
exdc
=
sconf
->
exdc
;
double
exri
=
sqrt
(
exdc
);
double
exri
=
sqrt
(
exdc
);
...
@@ -680,6 +681,7 @@ int cluster_jxi488_cycle(int jxi488, ScattererConfiguration *sconf, GeometryConf
...
@@ -680,6 +681,7 @@ int cluster_jxi488_cycle(int jxi488, ScattererConfiguration *sconf, GeometryConf
{
{
int
nxi
=
sconf
->
number_of_scales
;
int
nxi
=
sconf
->
number_of_scales
;
const
dcomplex
cc0
=
0.0
+
I
*
0.0
;
const
dcomplex
cc0
=
0.0
+
I
*
0.0
;
const
double
pi
=
acos
(
-
1.0
);
char
virtual_line
[
256
];
char
virtual_line
[
256
];
string
message
=
"INFO: running scale iteration "
+
to_string
(
jxi488
)
+
" of "
+
to_string
(
nxi
)
+
".
\n
"
;
string
message
=
"INFO: running scale iteration "
+
to_string
(
jxi488
)
+
" of "
+
to_string
(
nxi
)
+
".
\n
"
;
Logger
*
logger
=
new
Logger
(
LOG_DEBG
);
Logger
*
logger
=
new
Logger
(
LOG_DEBG
);
...
@@ -689,24 +691,24 @@ int cluster_jxi488_cycle(int jxi488, ScattererConfiguration *sconf, GeometryConf
...
@@ -689,24 +691,24 @@ int cluster_jxi488_cycle(int jxi488, ScattererConfiguration *sconf, GeometryConf
int
jer
=
0
;
int
jer
=
0
;
int
lcalc
=
0
;
int
lcalc
=
0
;
int
jaw
=
1
;
int
jaw
=
1
;
int
li
=
gconf
->
li
;
//
int li = gconf->li;
int
le
=
gconf
->
le
;
//
int le = gconf->le;
int
lm
=
0
;
//
int lm = 0;
if
(
le
>
lm
)
lm
=
le
;
//
if (le > lm) lm = le;
if
(
li
>
lm
)
lm
=
li
;
//
if (li > lm) lm = li;
int
nsph
=
sconf
->
number_of_spheres
;
const
int
nsph
=
sconf
->
number_of_spheres
;
np_int
mxndm
=
gconf
->
mxndm
;
const
np_int
mxndm
=
gconf
->
mxndm
;
int
iavm
=
gconf
->
iavm
;
const
int
iavm
=
gconf
->
iavm
;
int
inpol
=
gconf
->
in_pol
;
const
int
inpol
=
gconf
->
in_pol
;
int
npnt
=
gconf
->
npnt
;
const
int
npnt
=
gconf
->
npnt
;
int
npntts
=
gconf
->
npntts
;
const
int
npntts
=
gconf
->
npntts
;
int
isam
=
gconf
->
isam
;
const
int
isam
=
gconf
->
isam
;
int
jwtm
=
gconf
->
jwtm
;
const
int
jwtm
=
gconf
->
jwtm
;
np_int
ndit
=
2
*
nsph
*
cid
->
c1
->
nlim
;
//
np_int ndit = 2 * nsph * cid->c1->nlim;
int
isq
,
ibf
;
int
isq
,
ibf
;
int
last_configuration
;
int
last_configuration
;
int
num_configs
=
sconf
->
configurations
;
int
num_configs
=
sconf
->
configurations
;
int
ndirs
=
sa
->
nkks
;
const
int
ndirs
=
sa
->
nkks
;
int
oindex
=
-
1
;
int
oindex
=
-
1
;
int
jindex
=
jxi488
-
output
->
first_xi
+
1
;
int
jindex
=
jxi488
-
output
->
first_xi
+
1
;
...
@@ -716,7 +718,7 @@ int cluster_jxi488_cycle(int jxi488, ScattererConfiguration *sconf, GeometryConf
...
@@ -716,7 +718,7 @@ int cluster_jxi488_cycle(int jxi488, ScattererConfiguration *sconf, GeometryConf
double
xi
=
sconf
->
get_scale
(
jxi488
-
1
);
double
xi
=
sconf
->
get_scale
(
jxi488
-
1
);
double
exdc
=
sconf
->
exdc
;
double
exdc
=
sconf
->
exdc
;
double
exri
=
sqrt
(
exdc
);
double
exri
=
sqrt
(
exdc
);
int
idfc
=
(
int
)
sconf
->
idfc
;
const
int
idfc
=
(
int
)
sconf
->
idfc
;
double
vkarg
=
0.0
;
double
vkarg
=
0.0
;
if
(
idfc
>=
0
)
{
if
(
idfc
>=
0
)
{
cid
->
vk
=
xi
*
cid
->
wn
;
cid
->
vk
=
xi
*
cid
->
wn
;
...
@@ -729,6 +731,29 @@ int cluster_jxi488_cycle(int jxi488, ScattererConfiguration *sconf, GeometryConf
...
@@ -729,6 +731,29 @@ int cluster_jxi488_cycle(int jxi488, ScattererConfiguration *sconf, GeometryConf
output
->
vec_vk
[
jindex
-
1
]
=
cid
->
vk
;
output
->
vec_vk
[
jindex
-
1
]
=
cid
->
vk
;
output
->
vec_xi
[
jindex
-
1
]
=
xi
;
output
->
vec_xi
[
jindex
-
1
]
=
xi
;
}
}
// Dynamic order check
const
double
alamb
=
2.0
*
pi
/
cid
->
vk
;
double
size_par
=
2.0
*
pi
*
sqrt
(
exdc
)
*
sconf
->
get_radius
(
0
)
/
alamb
;
int
recommended_li
=
4
+
(
int
)
ceil
(
size_par
+
4.05
*
pow
(
size_par
,
1.0
/
3.0
));
if
(
recommended_li
!=
cid
->
c1
->
li
)
{
if
(
recommended_li
>
cid
->
c1
->
li
)
{
message
=
"WARNING: internal order "
+
to_string
(
cid
->
c1
->
li
)
+
" for scale iteration "
+
to_string
(
jxi488
)
+
" too low (recommended order is "
+
to_string
(
recommended_li
)
+
").
\n
"
;
logger
->
log
(
message
,
LOG_WARN
);
}
else
{
message
=
"INFO: lowering internal order from "
+
to_string
(
cid
->
c1
->
li
)
+
" to "
+
to_string
(
recommended_li
)
+
" for scale iteration "
+
to_string
(
jxi488
)
+
".
\n
"
;
logger
->
log
(
message
,
LOG_INFO
);
cid
->
update_orders
(
sconf
->
_rcf
,
recommended_li
,
recommended_li
);
}
cid
->
refinemode
=
2
;
}
int
li
=
cid
->
c1
->
li
;
int
le
=
cid
->
c1
->
le
;
int
lm
=
cid
->
c1
->
lm
;
np_int
ndit
=
2
*
nsph
*
cid
->
c1
->
nlim
;
// End of dynamic order check
hjv
(
exri
,
vkarg
,
jer
,
lcalc
,
cid
->
arg
,
cid
->
c1
);
hjv
(
exri
,
vkarg
,
jer
,
lcalc
,
cid
->
arg
,
cid
->
c1
);
if
(
jer
!=
0
)
{
if
(
jer
!=
0
)
{
output
->
vec_ier
[
jindex
-
1
]
=
1
;
output
->
vec_ier
[
jindex
-
1
]
=
1
;
...
@@ -837,6 +862,7 @@ int cluster_jxi488_cycle(int jxi488, ScattererConfiguration *sconf, GeometryConf
...
@@ -837,6 +862,7 @@ int cluster_jxi488_cycle(int jxi488, ScattererConfiguration *sconf, GeometryConf
}
}
}
}
#endif
#endif
cid
->
refinemode
=
0
;
#ifdef DEBUG_AM
#ifdef DEBUG_AM
VirtualAsciiFile
*
outam2
=
new
VirtualAsciiFile
();
VirtualAsciiFile
*
outam2
=
new
VirtualAsciiFile
();
string
outam2_name
=
output_path
+
"/c_AM2_JXI"
+
to_string
(
jxi488
)
+
".txt"
;
string
outam2_name
=
output_path
+
"/c_AM2_JXI"
+
to_string
(
jxi488
)
+
".txt"
;
...
@@ -2062,4 +2088,47 @@ ClusterIterationData::~ClusterIterationData() {
...
@@ -2062,4 +2088,47 @@ ClusterIterationData::~ClusterIterationData() {
delete
[]
cmullr
;
delete
[]
cmullr
;
delete
[]
cmul
;
delete
[]
cmul
;
}
}
int
ClusterIterationData
::
update_orders
(
double
**
rcf
,
int
inner_order
,
int
outer_order
)
{
int
result
=
0
;
int
old_li
=
c1
->
li
;
int
old_le
=
c1
->
le
;
int
old_lm
=
c1
->
lm
;
np_int
old_ndit
=
2
*
c1
->
nsph
*
c1
->
nlim
;
if
(
inner_order
!=
old_li
||
outer_order
!=
old_le
)
{
((
ParticleDescriptorCluster
*
)
c1
)
->
update_orders
(
inner_order
,
outer_order
);
const
int
ndi
=
c1
->
nsph
*
c1
->
nlim
;
const
np_int
ndit
=
2
*
ndi
;
for
(
int
zi
=
0
;
zi
<
old_lm
;
zi
++
)
{
for
(
int
zj
=
0
;
zj
<
3
;
zj
++
)
{
for
(
int
zk
=
0
;
zk
<
2
;
zk
++
)
{
delete
[]
zpv
[
zi
][
zj
][
zk
];
}
delete
[]
zpv
[
zi
][
zj
];
}
delete
[]
zpv
[
zi
];
}
delete
[]
zpv
;
zpv
=
new
double
***
[
c1
->
lm
];
for
(
int
zi
=
0
;
zi
<
c1
->
lm
;
zi
++
)
{
zpv
[
zi
]
=
new
double
**
[
3
];
for
(
int
zj
=
0
;
zj
<
3
;
zj
++
)
{
zpv
[
zi
][
zj
]
=
new
double
*
[
2
];
for
(
int
zk
=
0
;
zk
<
2
;
zk
++
)
{
zpv
[
zi
][
zj
][
zk
]
=
new
double
[
2
]();
}
}
}
str
(
rcf
,
c1
);
thdps
(
c1
->
lm
,
zpv
);
delete
[]
am
;
delete
[]
am_vector
;
am_vector
=
new
dcomplex
[
ndit
*
ndit
]();
am
=
new
dcomplex
*
[
ndit
];
for
(
int
ai
=
0
;
ai
<
ndit
;
ai
++
)
{
am
[
ai
]
=
(
am_vector
+
ai
*
ndit
);
}
}
return
result
;
}
// >>> END OF ClusterIterationData CLASS IMPLEMENTATION <<<
// >>> END OF ClusterIterationData CLASS IMPLEMENTATION <<<
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment