ProSHADE: ProSHADE_internal_data Namespace Reference

| ProSHADE 0.7.5.4 (MAR 2021) Protein Shape Detection

Classes | Functions
ProSHADE_internal_data Namespace Reference

This namespace contains the structure and functions required for data reading and storing their derivates. More...

## Classes
class | ProSHADE_data
| This class contains all inputed and derived data for a single structure. More...

## Functions
std::vector< std::vector< proshade_double > > | computeGroupElementsForGroup (proshade_double xAx, proshade_double yAx, proshade_double zAx, proshade_signed fold)
| This function computes the group elements as rotation matrices (except for the identity element) for any cyclic point group given as axis and fold. More...
std::vector< std::vector< proshade_double > > | joinElementsFromDifferentGroups (std::vector< std::vector< proshade_double > > *first, std::vector< std::vector< proshade_double > > *second, proshade_double matrixTolerance, bool combine)
| This function joins two group element lists using only unique elements. More...

## Detailed Description

This namespace contains the structure and functions required for data reading and storing their derivates.

The ProSHADE_internal_data namespace contains the data structure. It also has the data derivates storing variables, but it does not provide the computation code except for the forward declarations. The user should not need to access this namespace when using the library.

## Function Documentation

## ◆ computeGroupElementsForGroup()

std::vector< std::vector< proshade_double > > ProSHADE_internal_data::computeGroupElementsForGroup | ( | proshade_double | xAx,
|  | proshade_double | yAx,
|  | proshade_double | zAx,
|  | proshade_signed | fold
| ) |  |

This function computes the group elements as rotation matrices (except for the identity element) for any cyclic point group given as axis and fold.

Parameters

  [in] | xAx | The x-axis element of the axis vector of the point group axis.
  [in] | yAx | The y-axis element of the axis vector of the point group axis.
  [in] | zAx | The z-axis element of the axis vector of the point group axis.
  [in] | fold | The fold of the point group.
  [out] | val | A vector containing vectors of 9 (rotation matrix) for each group element for the requested group, except for the identity element.

Definition at line 2333 of file ProSHADE_data.cpp.

2334 {
2335 //================================================ Initialise variables
2336 std::vector< proshade_double > angList;
2337 std::vector<std::vector< proshade_double > > ret;
2338
2339 //================================================ Allocate memory
2340 proshade_double* rotMat = new proshade_double[9];
2341 ProSHADE_internal_misc::checkMemoryAllocation ( rotMat, __FILE__, __LINE__, __func__ );
2342
2343
2344 //================================================ Normalise the axis to have magnitude of 1.0
2345 proshade_double normF = std::sqrt( std::pow ( xAx, 2.0 ) + std::pow ( yAx, 2.0 ) + std::pow ( zAx, 2.0 ) );
2346 xAx /= normF;
2347 yAx /= normF;
2348 zAx /= normF;
2349
2350 //================================================ Determine the list of angles
2351 if ( fold % 2 == 0 )
2352 {
2353 //============================================ If fold is even, add the negative angles
2354 for ( proshade_double iter = static_cast < proshade_double > ( -( ( fold / 2 ) - 1 ) ); iter <= static_cast < proshade_double > ( fold / 2 ); iter++ )
2355 {
2356 ProSHADE_internal_misc::addToDoubleVector ( &angList, ( ( 2.0 * M_PI ) / static_cast<proshade_double> ( fold ) ) * iter );
2357 }
2358 }
2359 else
2360 {
2361 //============================================ If fold is odd, do the same as for even, but start one index earlier
2362 for ( proshade_double iter = static_cast < proshade_double > ( -fold / 2 ); iter <= static_cast < proshade_double > ( fold / 2 ); iter++ )
2363 {
2364 ProSHADE_internal_misc::addToDoubleVector ( &angList, ( ( 2.0 * M_PI ) / static_cast<proshade_double> ( fold ) ) * iter );
2365 }
2366 }
2367
2368 //================================================ For each detected angle
2369 for ( proshade_unsign iter = 0; iter < static_cast < proshade_unsign > ( angList.size() ); iter++ )
2370 {
2371 //============================================ Compute the rotation matrix
2372 ProSHADE_internal_maths::getRotationMatrixFromAngleAxis ( rotMat, xAx, yAx, zAx, angList.at(iter) );
2373
2374 //============================================ Convert to vector of vectors of doubles and save to ret
2375 std::vector < proshade_double > retEl;
2376 for ( proshade_unsign matIt = 0; matIt < 9; matIt++ )
2377 {
2378 ProSHADE_internal_misc::addToDoubleVector ( &retEl, rotMat[matIt] );
2379 }
2380 ProSHADE_internal_misc::addToDoubleVectorVector ( &ret, retEl );
2381 }
2382
2383 //================================================ Release memory
2384 delete[] rotMat;
2385
2386 //================================================ Done
2387 return ( ret );
2388
2389 }

## ◆ joinElementsFromDifferentGroups()

std::vector< std::vector< proshade_double > > ProSHADE_internal_data::joinElementsFromDifferentGroups | ( | std::vector< std::vector< proshade_double > > * | first,
|  | std::vector< std::vector< proshade_double > > * | second,
|  | proshade_double | matrixTolerance,
|  | bool | combine
| ) |  |

This function joins two group element lists using only unique elements.

Parameters

  [in] | first | Vector of group elements.
  [in] | second | Vector of group elements.
  [in] | matrixTolerance | The maximum trace error for rotation matrices to be still considered the same.
  [in] | combine | Should the element combinations be added as well?
  [out] | ret | A vector of group elements containing all unique elements from both input element groups.

Definition at line 2486 of file ProSHADE_data.cpp.

2487 {
2488 //================================================ Initialise variables
2489 std::vector< std::vector< proshade_double > > ret;
2490
2491 //================================================ Add the first list to ret, checking for uniqueness
2492 for ( proshade_unsign elIt = 0; elIt < static_cast<proshade_unsign> ( first->size() ); elIt++ )
2493 {
2494 if ( !checkElementAlreadyExists( &ret, &first->at(elIt), matrixTolerance ) )
2495 {
2496 ProSHADE_internal_misc::addToDoubleVectorVector ( &ret, first->at(elIt) );
2497 }
2498 }
2499
2500 //================================================ Add the second list to ret, checking for uniqueness
2501 for ( proshade_unsign elIt = 0; elIt < static_cast<proshade_unsign> ( second->size() ); elIt++ )
2502 {
2503 if ( !checkElementAlreadyExists( &ret, &second->at(elIt), matrixTolerance ) )
2504 {
2505 ProSHADE_internal_misc::addToDoubleVectorVector ( &ret, second->at(elIt) );
2506 }
2507 }
2508
2509 //================================================ Multiply all combinations of first and second and check for uniqueness
2510 if ( combine )
2511 {
2512 for ( proshade_unsign gr1 = 0; gr1 < static_cast<proshade_unsign> ( first->size() ); gr1++ )
2513 {
2514 for ( proshade_unsign gr2 = 0; gr2 < static_cast<proshade_unsign> ( second->size() ); gr2++ )
2515 {
2516 //==================================== Multiply the two rotation matrices
2517 std::vector< proshade_double > product = ProSHADE_internal_maths::multiplyGroupElementMatrices ( &first->at(gr1), &second->at(gr2) );
2518
2519 //==================================== Add
2520 if ( !checkElementAlreadyExists( &ret, &product, matrixTolerance ) )
2521 {
2522 ProSHADE_internal_misc::addToDoubleVectorVector ( &ret, product );
2523 }
2524
2525 }
2526 }
2527 }
2528
2529 //================================================ Done
2530 return ( ret );
2531
2532 }
ProSHADE_internal_misc::addToDoubleVector
void addToDoubleVector(std::vector< proshade_double > *vecToAddTo, proshade_double elementToAdd)
Adds the element to the vector.
Definition: ProSHADE_misc.cpp:77
ProSHADE_internal_maths::getRotationMatrixFromAngleAxis
void getRotationMatrixFromAngleAxis(proshade_double *rotMat, proshade_double x, proshade_double y, proshade_double z, proshade_double ang)
This function converts the axis-angle representation to the rotation matrix representation.
Definition: ProSHADE_maths.cpp:1343
ProSHADE_internal_misc::checkMemoryAllocation
void checkMemoryAllocation(chVar checkVar, std::string fileP, unsigned int lineP, std::string funcP, std::string infoP="This error may occurs when ProSHADE requests memory to be\n : allocated to it and this operation fails. This could\n : happen when not enough memory is available, either due to\n : other processes using a lot of memory, or when the machine\n : does not have sufficient memory available. Re-run to see\n : if this problem persists.")
Checks if memory was allocated properly.
Definition: ProSHADE_misc.hpp:65
ProSHADE_internal_misc::addToDoubleVectorVector
void addToDoubleVectorVector(std::vector< std::vector< proshade_double > > *vecToAddTo, std::vector< proshade_double > elementToAdd)
Adds the element to the vector of vectors.
Definition: ProSHADE_misc.cpp:210
ProSHADE_internal_maths::multiplyGroupElementMatrices
std::vector< proshade_double > multiplyGroupElementMatrices(std::vector< proshade_double > *el1, std::vector< proshade_double > *el2)
This function computes matrix multiplication using the ProSHADE group element matrix format as input ...
Definition: ProSHADE_maths.cpp:2141
checkElementAlreadyExists
bool checkElementAlreadyExists(std::vector< std::vector< proshade_double > > *elements, std::vector< proshade_double > *elem, proshade_double matrixTolerance)
This function checks if the element list already contains a given matrix.
Definition: ProSHADE_data.cpp:2419