Niggli-reduced cell C++ implementation
Dear Cctbx community, Firstly I'd like to say thank you to Rolf, Nicholas and Paul for their expertly thought through implementation of the reduced cell algorithm. I've found it to be extremely useful for my work. My code is all in C++ and I'd like to be able to use the Krivy-Gruber algorithm. My understanding is that only the reduced (Buerger) unit cell algorithm is implemented in C++ [1] which guarantees shortest lengths but not unique angles. From my understanding the Krivy-Gruber would also guarantee me uniqueness of unit cell angles, however this is only implemented in Python [2]. Sorry to be so verbose, I just wanted to check that I was on the right page. Would it be possible for me to implement the Krivy-Gruber in C++ by adding in the epsilon_relative to the parameter and following the procedure found in the python version? Many thanks, -Martin [1] http://cctbx.sourceforge.net/current/c_plus_plus/classcctbx_1_1uctbx_1_1fast... [2] http://cctbx.sourceforge.net/current/python/cctbx.uctbx.krivy_gruber_1976.ht... -- Martin Uhrin Tel: +44 207 679 3466 Department of Physics & Astronomy Fax:+44 207 679 0595 University College London [email protected] Gower St, London, WC1E 6BT, U.K. http://www.cmmp.ucl.ac.uk
Hi Martin,
I might be able to save you some effort here ;-)
On Thu, Mar 22, 2012 at 5:24 PM, Martin Uhrin
My code is all in C++ and I'd like to be able to use the Krivy-Gruber algorithm.
I've put my C++ implementation of the Krivy-Gruber algorithm described in that paper (doi:10.1107/S010876730302186X) under the BSD license in this project: http://github.com/dlonie/XtalComp The actual algorithm starts here: http://github.com/dlonie/XtalComp/blob/master/xtalcomp.cpp#L1538 It uses a linear algebra library that ships with XtalComp, but could be easily adapted to remove that dependency. I've also implemented it here using the Eigen linear algebra library: https://github.com/dlonie/avogadro/blob/master/libavogadro/src/extensions/cr... The code in this last link is technically licensed under GPLv2+, but I'll gladly provide it under a BSD-ish license if you're interested. Hope this helps, Dave
Hi Martin,
You're very welcome to add a C++ version of the Krivy-Gruber algorithm to
cctbx if that's what you had in mind.
I'm not sure what's better, generalizing the fast-minimum-reduction code,
or just having an independent implementation.
Ralf
On Thu, Mar 22, 2012 at 2:24 PM, Martin Uhrin
Dear Cctbx community,
Firstly I'd like to say thank you to Rolf, Nicholas and Paul for their expertly thought through implementation of the reduced cell algorithm. I've found it to be extremely useful for my work.
My code is all in C++ and I'd like to be able to use the Krivy-Gruber algorithm. My understanding is that only the reduced (Buerger) unit cell algorithm is implemented in C++ [1] which guarantees shortest lengths but not unique angles. From my understanding the Krivy-Gruber would also guarantee me uniqueness of unit cell angles, however this is only implemented in Python [2]. Sorry to be so verbose, I just wanted to check that I was on the right page.
Would it be possible for me to implement the Krivy-Gruber in C++ by adding in the epsilon_relative to the parameter and following the procedure found in the python version?
Many thanks, -Martin
[1] http://cctbx.sourceforge.net/current/c_plus_plus/classcctbx_1_1uctbx_1_1fast... [2] http://cctbx.sourceforge.net/current/python/cctbx.uctbx.krivy_gruber_1976.ht...
-- Martin Uhrin Tel: +44 207 679 3466 Department of Physics & Astronomy Fax:+44 207 679 0595 University College London [email protected] Gower St, London, WC1E 6BT, U.K. http://www.cmmp.ucl.ac.uk
_______________________________________________ cctbxbb mailing list [email protected] http://phenix-online.org/mailman/listinfo/cctbxbb
Dear David and Rolf,
thank you for your encouragement.
David: I'm more than happy to port your implementation to cctbx if you're
happy with this. Of course I don't want to step on your toes so if you'd
rather do it yourself (or not at all) that's cool.
There may be some licensing issues to sort out as it looks like cctbx has a
custom (non viral) license but the BSD license is likely compatible.
On first impression I think a new class would be the way to go but I'd have
to look at the two algorithms in greater detail to be sure.
All the best,
-Martin
On 22 March 2012 22:00, Ralf Grosse-Kunstleve
Hi Martin, You're very welcome to add a C++ version of the Krivy-Gruber algorithm to cctbx if that's what you had in mind. I'm not sure what's better, generalizing the fast-minimum-reduction code, or just having an independent implementation. Ralf
On Thu, Mar 22, 2012 at 2:24 PM, Martin Uhrin
wrote: Dear Cctbx community,
Firstly I'd like to say thank you to Rolf, Nicholas and Paul for their expertly thought through implementation of the reduced cell algorithm. I've found it to be extremely useful for my work.
My code is all in C++ and I'd like to be able to use the Krivy-Gruber algorithm. My understanding is that only the reduced (Buerger) unit cell algorithm is implemented in C++ [1] which guarantees shortest lengths but not unique angles. From my understanding the Krivy-Gruber would also guarantee me uniqueness of unit cell angles, however this is only implemented in Python [2]. Sorry to be so verbose, I just wanted to check that I was on the right page.
Would it be possible for me to implement the Krivy-Gruber in C++ by adding in the epsilon_relative to the parameter and following the procedure found in the python version?
Many thanks, -Martin
[1] http://cctbx.sourceforge.net/current/c_plus_plus/classcctbx_1_1uctbx_1_1fast... [2] http://cctbx.sourceforge.net/current/python/cctbx.uctbx.krivy_gruber_1976.ht...
-- Martin Uhrin Tel: +44 207 679 3466 Department of Physics & Astronomy Fax:+44 207 679 0595 University College London [email protected] Gower St, London, WC1E 6BT, U.K. http://www.cmmp.ucl.ac.uk
_______________________________________________ cctbxbb mailing list [email protected] http://phenix-online.org/mailman/listinfo/cctbxbb
_______________________________________________ cctbxbb mailing list [email protected] http://phenix-online.org/mailman/listinfo/cctbxbb
-- Martin Uhrin Tel: +44 207 679 3466 Department of Physics & Astronomy Fax:+44 207 679 0595 University College London [email protected] Gower St, London, WC1E 6BT, U.K. http://www.cmmp.ucl.ac.uk
Hi Martin,
On Fri, Mar 23, 2012 at 6:35 AM, Martin Uhrin
I'm more than happy to port your implementation to cctbx if you're happy with this. Of course I don't want to step on your toes so if you'd rather do it yourself (or not at all) that's cool.
There may be some licensing issues to sort out as it looks like cctbx has a custom (non viral) license but the BSD license is likely compatible.
Sure, feel free to do so -- I'd have done it myself by now, but free time is scarce these days. It looks like cctbx is also licensed under the "New" BSD license, so there should be no worries about that. Dave
Hi Martin,
Let me know if you need svn write access to check in your changes. All I
need is your sourceforge user id.
Ralf
On Fri, Mar 23, 2012 at 3:35 AM, Martin Uhrin
Dear David and Rolf,
thank you for your encouragement.
David: I'm more than happy to port your implementation to cctbx if you're happy with this. Of course I don't want to step on your toes so if you'd rather do it yourself (or not at all) that's cool.
There may be some licensing issues to sort out as it looks like cctbx has a custom (non viral) license but the BSD license is likely compatible.
On first impression I think a new class would be the way to go but I'd have to look at the two algorithms in greater detail to be sure.
All the best, -Martin
On 22 March 2012 22:00, Ralf Grosse-Kunstleve
wrote: Hi Martin, You're very welcome to add a C++ version of the Krivy-Gruber algorithm to cctbx if that's what you had in mind. I'm not sure what's better, generalizing the fast-minimum-reduction code, or just having an independent implementation. Ralf
On Thu, Mar 22, 2012 at 2:24 PM, Martin Uhrin
wrote: Dear Cctbx community,
Firstly I'd like to say thank you to Rolf, Nicholas and Paul for their expertly thought through implementation of the reduced cell algorithm. I've found it to be extremely useful for my work.
My code is all in C++ and I'd like to be able to use the Krivy-Gruber algorithm. My understanding is that only the reduced (Buerger) unit cell algorithm is implemented in C++ [1] which guarantees shortest lengths but not unique angles. From my understanding the Krivy-Gruber would also guarantee me uniqueness of unit cell angles, however this is only implemented in Python [2]. Sorry to be so verbose, I just wanted to check that I was on the right page.
Would it be possible for me to implement the Krivy-Gruber in C++ by adding in the epsilon_relative to the parameter and following the procedure found in the python version?
Many thanks, -Martin
[1] http://cctbx.sourceforge.net/current/c_plus_plus/classcctbx_1_1uctbx_1_1fast... [2] http://cctbx.sourceforge.net/current/python/cctbx.uctbx.krivy_gruber_1976.ht...
-- Martin Uhrin Tel: +44 207 679 3466 Department of Physics & Astronomy Fax:+44 207 679 0595 University College London [email protected] Gower St, London, WC1E 6BT, U.K. http://www.cmmp.ucl.ac.uk
_______________________________________________ cctbxbb mailing list [email protected] http://phenix-online.org/mailman/listinfo/cctbxbb
_______________________________________________ cctbxbb mailing list [email protected] http://phenix-online.org/mailman/listinfo/cctbxbb
-- Martin Uhrin Tel: +44 207 679 3466 Department of Physics & Astronomy Fax:+44 207 679 0595 University College London [email protected] Gower St, London, WC1E 6BT, U.K. http://www.cmmp.ucl.ac.uk
_______________________________________________ cctbxbb mailing list [email protected] http://phenix-online.org/mailman/listinfo/cctbxbb
Dear cctbxers,
I've finally found the time to play around with a C++ version of the KG
algorithm and I've come across a result I don't understand. I've tried
both David's C++ and the cctbx python niggli_cell() implementations and
they both give the roughly the same answer.
I'm reducing the following cell with two, equivalent, representations (a,
b, c, alpha, beta, gamma):
Before:
1: 4.630811 4.630811 4.630811 90 90 90
2: 3.27448 5.67156 5.67156 99.5941 106.779 90
After:
1: 4.63081 4.63081 4.63081 90 90 90
2: 3.27448 5.67154 5.67156 99.5941 90 106.778
Looking at the trace, cell 1 undergoes step 3 and finishes while cell 2
undergoes steps 2, 3, 7 and 4.
Does anyone know why these haven't converged to the same cell?
Many thanks,
-Martin
On 23 March 2012 17:12, Ralf Grosse-Kunstleve
Hi Martin, Let me know if you need svn write access to check in your changes. All I need is your sourceforge user id. Ralf
On Fri, Mar 23, 2012 at 3:35 AM, Martin Uhrin
wrote: Dear David and Rolf,
thank you for your encouragement.
David: I'm more than happy to port your implementation to cctbx if you're happy with this. Of course I don't want to step on your toes so if you'd rather do it yourself (or not at all) that's cool.
There may be some licensing issues to sort out as it looks like cctbx has a custom (non viral) license but the BSD license is likely compatible.
On first impression I think a new class would be the way to go but I'd have to look at the two algorithms in greater detail to be sure.
All the best, -Martin
On 22 March 2012 22:00, Ralf Grosse-Kunstleve
wrote:
Hi Martin, You're very welcome to add a C++ version of the Krivy-Gruber algorithm to cctbx if that's what you had in mind. I'm not sure what's better, generalizing the fast-minimum-reduction code, or just having an independent implementation. Ralf
On Thu, Mar 22, 2012 at 2:24 PM, Martin Uhrin
wrote:
Dear Cctbx community,
Firstly I'd like to say thank you to Rolf, Nicholas and Paul for their expertly thought through implementation of the reduced cell algorithm. I've found it to be extremely useful for my work.
My code is all in C++ and I'd like to be able to use the Krivy-Gruber algorithm. My understanding is that only the reduced (Buerger) unit cell algorithm is implemented in C++ [1] which guarantees shortest lengths but not unique angles. From my understanding the Krivy-Gruber would also guarantee me uniqueness of unit cell angles, however this is only implemented in Python [2]. Sorry to be so verbose, I just wanted to check that I was on the right page.
Would it be possible for me to implement the Krivy-Gruber in C++ by adding in the epsilon_relative to the parameter and following the procedure found in the python version?
Many thanks, -Martin
[1] http://cctbx.sourceforge.net/current/c_plus_plus/classcctbx_1_1uctbx_1_1fast... [2] http://cctbx.sourceforge.net/current/python/cctbx.uctbx.krivy_gruber_1976.ht...
-- Martin Uhrin Tel: +44 207 679 3466 Department of Physics & Astronomy Fax:+44 207 679 0595 University College London [email protected] Gower St, London, WC1E 6BT, U.K. http://www.cmmp.ucl.ac.uk
_______________________________________________ cctbxbb mailing list [email protected] http://phenix-online.org/mailman/listinfo/cctbxbb
_______________________________________________ cctbxbb mailing list [email protected] http://phenix-online.org/mailman/listinfo/cctbxbb
-- Martin Uhrin Tel: +44 207 679 3466 Department of Physics & Astronomy Fax:+44 207 679 0595 University College London [email protected] Gower St, London, WC1E 6BT, U.K. http://www.cmmp.ucl.ac.uk
_______________________________________________ cctbxbb mailing list [email protected] http://phenix-online.org/mailman/listinfo/cctbxbb
_______________________________________________ cctbxbb mailing list [email protected] http://phenix-online.org/mailman/listinfo/cctbxbb
-- Martin Uhrin Tel: +44 207 679 3466 Department of Physics & Astronomy Fax:+44 207 679 0595 University College London [email protected] Gower St, London, WC1E 6BT, U.K. http://www.cmmp.ucl.ac.uk
Hi Martin,
Based on
iotbx.lattice_symmetry --unit_cell="4.630811 4.630811 4.630811 90 90 90"
and
iotbx.lattice_symmetry --unit_cell="3.27448 5.67156 5.67156 99.5941 106.779
90"
the first unit cell is (obviously) cubic, the second is only monoclinic.
Even with
iotbx.lattice_symmetry --unit_cell="3.27448 5.67156 5.67156 99.5941 106.779
90" --delta=20
it only comes back as orthorhombic.
Is this what you expect?
Ralf
On Tue, Apr 24, 2012 at 10:57 AM, Martin Uhrin
Dear cctbxers,
I've finally found the time to play around with a C++ version of the KG algorithm and I've come across a result I don't understand. I've tried both David's C++ and the cctbx python niggli_cell() implementations and they both give the roughly the same answer.
I'm reducing the following cell with two, equivalent, representations (a, b, c, alpha, beta, gamma):
Before:
1: 4.630811 4.630811 4.630811 90 90 90 2: 3.27448 5.67156 5.67156 99.5941 106.779 90
After:
1: 4.63081 4.63081 4.63081 90 90 90 2: 3.27448 5.67154 5.67156 99.5941 90 106.778
Looking at the trace, cell 1 undergoes step 3 and finishes while cell 2 undergoes steps 2, 3, 7 and 4.
Does anyone know why these haven't converged to the same cell?
Many thanks, -Martin
On 23 March 2012 17:12, Ralf Grosse-Kunstleve
wrote: Hi Martin, Let me know if you need svn write access to check in your changes. All I need is your sourceforge user id. Ralf
On Fri, Mar 23, 2012 at 3:35 AM, Martin Uhrin
wrote: Dear David and Rolf,
thank you for your encouragement.
David: I'm more than happy to port your implementation to cctbx if you're happy with this. Of course I don't want to step on your toes so if you'd rather do it yourself (or not at all) that's cool.
There may be some licensing issues to sort out as it looks like cctbx has a custom (non viral) license but the BSD license is likely compatible.
On first impression I think a new class would be the way to go but I'd have to look at the two algorithms in greater detail to be sure.
All the best, -Martin
On 22 March 2012 22:00, Ralf Grosse-Kunstleve < [email protected]> wrote:
Hi Martin, You're very welcome to add a C++ version of the Krivy-Gruber algorithm to cctbx if that's what you had in mind. I'm not sure what's better, generalizing the fast-minimum-reduction code, or just having an independent implementation. Ralf
On Thu, Mar 22, 2012 at 2:24 PM, Martin Uhrin < [email protected]> wrote:
Dear Cctbx community,
Firstly I'd like to say thank you to Rolf, Nicholas and Paul for their expertly thought through implementation of the reduced cell algorithm. I've found it to be extremely useful for my work.
My code is all in C++ and I'd like to be able to use the Krivy-Gruber algorithm. My understanding is that only the reduced (Buerger) unit cell algorithm is implemented in C++ [1] which guarantees shortest lengths but not unique angles. From my understanding the Krivy-Gruber would also guarantee me uniqueness of unit cell angles, however this is only implemented in Python [2]. Sorry to be so verbose, I just wanted to check that I was on the right page.
Would it be possible for me to implement the Krivy-Gruber in C++ by adding in the epsilon_relative to the parameter and following the procedure found in the python version?
Many thanks, -Martin
[1] http://cctbx.sourceforge.net/current/c_plus_plus/classcctbx_1_1uctbx_1_1fast... [2] http://cctbx.sourceforge.net/current/python/cctbx.uctbx.krivy_gruber_1976.ht...
-- Martin Uhrin Tel: +44 207 679 3466 Department of Physics & Astronomy Fax:+44 207 679 0595 University College London [email protected] Gower St, London, WC1E 6BT, U.K. http://www.cmmp.ucl.ac.uk
_______________________________________________ cctbxbb mailing list [email protected] http://phenix-online.org/mailman/listinfo/cctbxbb
_______________________________________________ cctbxbb mailing list [email protected] http://phenix-online.org/mailman/listinfo/cctbxbb
-- Martin Uhrin Tel: +44 207 679 3466 Department of Physics & Astronomy Fax:+44 207 679 0595 University College London [email protected] Gower St, London, WC1E 6BT, U.K. http://www.cmmp.ucl.ac.uk
_______________________________________________ cctbxbb mailing list [email protected] http://phenix-online.org/mailman/listinfo/cctbxbb
_______________________________________________ cctbxbb mailing list [email protected] http://phenix-online.org/mailman/listinfo/cctbxbb
-- Martin Uhrin Tel: +44 207 679 3466 Department of Physics & Astronomy Fax:+44 207 679 0595 University College London [email protected] Gower St, London, WC1E 6BT, U.K. http://www.cmmp.ucl.ac.uk
_______________________________________________ cctbxbb mailing list [email protected] http://phenix-online.org/mailman/listinfo/cctbxbb
Dear Ralf,
you're quite right! I was looking at my basis along with the lattice which
lead me to think that the two systems should be equivalent when indeed the
lattices are not!
Thanks for pointing this out.
I'll get back to you once I'm ready with a version for the repository.
Best,
-Martin
On 24 April 2012 20:42, Ralf Grosse-Kunstleve
Hi Martin,
Based on
iotbx.lattice_symmetry --unit_cell="4.630811 4.630811 4.630811 90 90 90"
and
iotbx.lattice_symmetry --unit_cell="3.27448 5.67156 5.67156 99.5941 106.779 90"
the first unit cell is (obviously) cubic, the second is only monoclinic. Even with
iotbx.lattice_symmetry --unit_cell="3.27448 5.67156 5.67156 99.5941 106.779 90" --delta=20
it only comes back as orthorhombic.
Is this what you expect?
Ralf
On Tue, Apr 24, 2012 at 10:57 AM, Martin Uhrin
wrote: Dear cctbxers,
I've finally found the time to play around with a C++ version of the KG algorithm and I've come across a result I don't understand. I've tried both David's C++ and the cctbx python niggli_cell() implementations and they both give the roughly the same answer.
I'm reducing the following cell with two, equivalent, representations (a, b, c, alpha, beta, gamma):
Before:
1: 4.630811 4.630811 4.630811 90 90 90 2: 3.27448 5.67156 5.67156 99.5941 106.779 90
After:
1: 4.63081 4.63081 4.63081 90 90 90 2: 3.27448 5.67154 5.67156 99.5941 90 106.778
Looking at the trace, cell 1 undergoes step 3 and finishes while cell 2 undergoes steps 2, 3, 7 and 4.
Does anyone know why these haven't converged to the same cell?
Many thanks, -Martin
On 23 March 2012 17:12, Ralf Grosse-Kunstleve
wrote:
Hi Martin, Let me know if you need svn write access to check in your changes. All I need is your sourceforge user id. Ralf
On Fri, Mar 23, 2012 at 3:35 AM, Martin Uhrin
wrote:
Dear David and Rolf,
thank you for your encouragement.
David: I'm more than happy to port your implementation to cctbx if you're happy with this. Of course I don't want to step on your toes so if you'd rather do it yourself (or not at all) that's cool.
There may be some licensing issues to sort out as it looks like cctbx has a custom (non viral) license but the BSD license is likely compatible.
On first impression I think a new class would be the way to go but I'd have to look at the two algorithms in greater detail to be sure.
All the best, -Martin
On 22 March 2012 22:00, Ralf Grosse-Kunstleve < [email protected]> wrote:
Hi Martin, You're very welcome to add a C++ version of the Krivy-Gruber algorithm to cctbx if that's what you had in mind. I'm not sure what's better, generalizing the fast-minimum-reduction code, or just having an independent implementation. Ralf
On Thu, Mar 22, 2012 at 2:24 PM, Martin Uhrin < [email protected]> wrote:
Dear Cctbx community,
Firstly I'd like to say thank you to Rolf, Nicholas and Paul for their expertly thought through implementation of the reduced cell algorithm. I've found it to be extremely useful for my work.
My code is all in C++ and I'd like to be able to use the Krivy-Gruber algorithm. My understanding is that only the reduced (Buerger) unit cell algorithm is implemented in C++ [1] which guarantees shortest lengths but not unique angles. From my understanding the Krivy-Gruber would also guarantee me uniqueness of unit cell angles, however this is only implemented in Python [2]. Sorry to be so verbose, I just wanted to check that I was on the right page.
Would it be possible for me to implement the Krivy-Gruber in C++ by adding in the epsilon_relative to the parameter and following the procedure found in the python version?
Many thanks, -Martin
[1] http://cctbx.sourceforge.net/current/c_plus_plus/classcctbx_1_1uctbx_1_1fast... [2] http://cctbx.sourceforge.net/current/python/cctbx.uctbx.krivy_gruber_1976.ht...
-- Martin Uhrin Tel: +44 207 679 3466 Department of Physics & Astronomy Fax:+44 207 679 0595 University College London [email protected] Gower St, London, WC1E 6BT, U.K. http://www.cmmp.ucl.ac.uk
_______________________________________________ cctbxbb mailing list [email protected] http://phenix-online.org/mailman/listinfo/cctbxbb
_______________________________________________ cctbxbb mailing list [email protected] http://phenix-online.org/mailman/listinfo/cctbxbb
-- Martin Uhrin Tel: +44 207 679 3466 Department of Physics & Astronomy Fax:+44 207 679 0595 University College London [email protected] Gower St, London, WC1E 6BT, U.K. http://www.cmmp.ucl.ac.uk
_______________________________________________ cctbxbb mailing list [email protected] http://phenix-online.org/mailman/listinfo/cctbxbb
_______________________________________________ cctbxbb mailing list [email protected] http://phenix-online.org/mailman/listinfo/cctbxbb
-- Martin Uhrin Tel: +44 207 679 3466 Department of Physics & Astronomy Fax:+44 207 679 0595 University College London [email protected] Gower St, London, WC1E 6BT, U.K. http://www.cmmp.ucl.ac.uk
_______________________________________________ cctbxbb mailing list [email protected] http://phenix-online.org/mailman/listinfo/cctbxbb
_______________________________________________ cctbxbb mailing list [email protected] http://phenix-online.org/mailman/listinfo/cctbxbb
-- Martin Uhrin Tel: +44 207 679 3466 Department of Physics & Astronomy Fax:+44 207 679 0595 University College London [email protected] Gower St, London, WC1E 6BT, U.K. http://www.cmmp.ucl.ac.uk
participants (3)
-
David Lonie
-
Martin Uhrin
-
Ralf Grosse-Kunstleve