Ignore:
Timestamp:
Jun 7, 2008, 1:21:53 PM (17 years ago)
Author:
Frederik Heber <heber@…>
Children:
d11f22
Parents:
a89a22
Message:

Working version of PAS transformation (tested on C-S-H cluster) and code scaffold of VolumeOfConvexEnvelope that's untested so far

PAS simply calculates inertia tensor, diagonalizes it via GSL and transforms molecule into eigenvector system such that z axis is eigenvector of biggest eigenvalue.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • molecuilder/src/builder.cpp

    ra89a22 r32b6dc  
    484484 * \param *mol the molecule with all the atoms
    485485 */
    486 static void MeasureAtoms(periodentafel *periode, molecule *mol)
     486static void MeasureAtoms(periodentafel *periode, molecule *mol, config *configuration)
    487487{
    488488  atom *first, *second, *third;
     
    496496  cout << Verbose(0) << " b - calculate bond length between two atoms" << endl;
    497497  cout << Verbose(0) << " c - calculate bond angle" << endl;
     498  cout << Verbose(0) << " d - calculate principal axis of the system" << endl;
     499  cout << Verbose(0) << " e - calculate volume of the convex envelope" << endl;
    498500  cout << Verbose(0) << "all else - go back" << endl;
    499501  cout << Verbose(0) << "===============================================" << endl;
     
    553555      cout << Verbose(0) << (acos(x.ScalarProduct((const vector *)&y)/(y.Norm()*x.Norm()))/M_PI*180.) << " degrees" << endl;         
    554556      break;
     557    case 'd':
     558        cout << Verbose(0) << "Evaluating prinicipal axis." << endl;
     559        cout << Verbose(0) << "Shall we rotate? [0/1]: ";
     560        cin >> Z;
     561        if ((Z >=0) && (Z <=1))
     562          mol->PrincipalAxisSystem((ofstream *)&cout, (bool)Z);
     563        else
     564          mol->PrincipalAxisSystem((ofstream *)&cout, false);
     565        break;
     566    case 'e':
     567        cout << Verbose(0) << "Evaluating volume of the convex envelope.";
     568        mol->VolumeOfConvexEnvelope((ofstream *)&cout, configuration->GetIsAngstroem());
     569        break;
    555570  }
    556571};
     
    745760            cout << "\t-f <dist> <order>\tFragments the molecule in BOSSANOVA manner and stores config files in same dir as config." << endl;
    746761            cout << "\t-h/-H/-?\tGive this help screen." << endl;
     762            cout << "\t-m\tAlign in PAS with greatest EV along z axis." << endl;
    747763            cout << "\t-p <file>\tParse given xyz file and create raw config file from it." << endl;
    748764            cout << "\t-r\t\tConvert file from an old pcp syntax." << endl;
     
    945961              }
    946962              break;
     963            case 'm':
     964              ExitFlag = 1;
     965              cout << Verbose(0) << "Evaluating prinicipal axis." << endl;
     966              mol->PrincipalAxisSystem((ofstream *)&cout, true);
     967              break;
    947968            default:   // no match? Step on
    948969              argptr++;
     
    11511172
    11521173      case 'l': // measure distances or angles
    1153         MeasureAtoms(periode, mol);
     1174        MeasureAtoms(periode, mol, &configuration);
    11541175        break;
    11551176
     
    11641185        mol->CreateAdjacencyList((ofstream *)&cout, tmp1, configuration.GetIsAngstroem());
    11651186        //mol->CreateListOfBondsPerAtom((ofstream *)&cout);
    1166         Subgraphs = mol->DepthFirstSearchAnalysis((ofstream *)&cout, false, MinimumRingSize);
     1187        Subgraphs = mol->DepthFirstSearchAnalysis((ofstream *)&cout, MinimumRingSize);
    11671188        while (Subgraphs->next != NULL) {
    11681189          Subgraphs = Subgraphs->next;
Note: See TracChangeset for help on using the changeset viewer.