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
docking
ocladock
Commits
e10762fd
Commit
e10762fd
authored
Dec 10, 2018
by
Diogo Martins
Browse files
issue #36 uniform 3D rotation sampling of ref_ori_angles
parent
0c18c0a7
Changes
1
Hide whitespace changes
Inline
Side-by-side
host/src/getparameters.cpp
View file @
e10762fd
...
...
@@ -678,11 +678,6 @@ void gen_initpop_and_reflig(Dockpars* mypars,
qy
=
sqrt
(
u1
)
*
sin
(
PI_TIMES_2
*
u3
);
qz
=
sqrt
(
u1
)
*
cos
(
PI_TIMES_2
*
u3
);
///// box muller
///u1 = (float) myrand();
///u1 = (float) myrand();
///u1 = (float) myrand();
// convert to angle representation
rotangle
=
2.0
*
acos
(
qw
);
s
=
sqrt
(
1.0
-
(
qw
*
qw
));
...
...
@@ -729,9 +724,13 @@ void gen_initpop_and_reflig(Dockpars* mypars,
mypars
->
ref_ori_angles
[
1
]
=
190.279
;
mypars
->
ref_ori_angles
[
2
]
=
190.279
;
#else
mypars
->
ref_ori_angles
[
0
]
=
(
float
)
floor
(
myrand
()
*
360
*
100
)
/
100.0
;
mypars
->
ref_ori_angles
[
1
]
=
(
float
)
floor
(
myrand
()
*/
*
360
*/
180
*
100
)
/
100.0
;
mypars
->
ref_ori_angles
[
2
]
=
(
float
)
floor
(
myrand
()
*
360
*
100
)
/
100.0
;
// mypars->ref_ori_angles[0] = (float) floor(myrand()*360*100)/100.0;
// mypars->ref_ori_angles[1] = (float) floor(myrand()*/*360*/180*100)/100.0;
// mypars->ref_ori_angles[2] = (float) floor(myrand()*360*100)/100.0;
// mypars->ref_ori_angles[0] = 0.0;
// mypars->ref_ori_angles[1] = 0.0;
// mypars->ref_ori_angles[2] = 0.0;
#endif
//Writing first initial population to initpop.txt
...
...
@@ -789,14 +788,46 @@ void gen_initpop_and_reflig(Dockpars* mypars,
// Enable only for debugging.
// These specific values of rotational genes (in axis-angle space)
// correspond to a quaternion for NO rotation.
//ref_ori_angles[3*i] = 0.0f;
//ref_ori_angles[3*i+1] = 0.0f;
//ref_ori_angles[3*i+2] = 0.0f;
// ref_ori_angles[3*i] = 0.0f;
// ref_ori_angles[3*i+1] = 0.0f;
// ref_ori_angles[3*i+2] = 0.0f;
// Enable for release.
ref_ori_angles
[
3
*
i
]
=
0.0
;
//(float) (myrand()*360.0); //phi
ref_ori_angles
[
3
*
i
+
1
]
=
0.0
;
//(float) (myrand()*180.0); //theta
ref_ori_angles
[
3
*
i
+
2
]
=
0.0
;
//float) (myrand()*360.0); //angle
// ref_ori_angles[3*i] = (float) (myrand()*360.0); //phi
// ref_ori_angles[3*i+1] = (float) (myrand()*180.0); //theta
// ref_ori_angles[3*i+2] = (float) (myrand()*360.0); //angle
// uniform distr.
// generate random quaternion
u1
=
(
float
)
myrand
();
u2
=
(
float
)
myrand
();
u3
=
(
float
)
myrand
();
qw
=
sqrt
(
1.0
-
u1
)
*
sin
(
PI_TIMES_2
*
u2
);
qx
=
sqrt
(
1.0
-
u1
)
*
cos
(
PI_TIMES_2
*
u2
);
qy
=
sqrt
(
u1
)
*
sin
(
PI_TIMES_2
*
u3
);
qz
=
sqrt
(
u1
)
*
cos
(
PI_TIMES_2
*
u3
);
// convert to angle representation
rotangle
=
2.0
*
acos
(
qw
);
s
=
sqrt
(
1.0
-
(
qw
*
qw
));
if
(
s
<
0.001
){
// rotangle too small
x
=
qx
;
y
=
qy
;
z
=
qz
;
}
else
{
x
=
qx
/
s
;
y
=
qy
/
s
;
z
=
qz
/
s
;
}
theta
=
acos
(
z
);
phi
=
atan2
(
y
,
x
);
ref_ori_angles
[
3
*
i
]
=
phi
/
DEG_TO_RAD
;
ref_ori_angles
[
3
*
i
+
1
]
=
theta
/
DEG_TO_RAD
;
ref_ori_angles
[
3
*
i
+
2
]
=
rotangle
/
DEG_TO_RAD
;
#endif
}
...
...
Write
Preview
Supports
Markdown
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