当前位置: 首页>>代码示例>>C++>>正文


C++ Complex::getAtomsWithName方法代码示例

本文整理汇总了C++中Complex::getAtomsWithName方法的典型用法代码示例。如果您正苦于以下问题:C++ Complex::getAtomsWithName方法的具体用法?C++ Complex::getAtomsWithName怎么用?C++ Complex::getAtomsWithName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Complex的用法示例。


在下文中一共展示了Complex::getAtomsWithName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: test_solve_weights

bool TestANMProteinRRT::test_solve_weights(){

    // Define the dimension of a point
    unsigned int dimension = 3;

    //------------------------------------
    // Load a 3-residue peptide of alanine
    //------------------------------------
    System system;
    ComplexBuilder complexBuilder;
    Complex * complex = complexBuilder.build("src/Molecules/Test/Data/ProteinResiduesSamples/plop_ala.pdb");
    Solvent* solvent = SolventGenerator::createSolvent(*complex,false);

    // Get the number of CA
    vector<Atom*> c_alphas = complex->getAtomsWithName(AtomNames::CA);
    unsigned int c_alphas_size = c_alphas.size();

    // Backup old points
    vector<Point> old_points;
    for(unsigned int i =0; i < c_alphas.size();++i){
        old_points.push_back(c_alphas[i]->toPoint());
    }


    //------------------------------------------
    //Create the Minimizer and ANM Calculator
    //------------------------------------------
    ConstraintParams * constraintParams;
    EnergyCalculator * energyCalculator;
    MinParams * anmMinParameters;
    Minimizer * anmMinimizer;

    string json_contents = Utils::fileToString("src/PathPlanning/RRT/Variations/ANMRRT/ANMProteinRRT/Test/Data/anm_config.conf");

    Json::Value root;
    Json::Reader reader;

    bool parsedSuccess = reader.parse(json_contents, root, false);

    if(!parsedSuccess){
        cout << "Failed to parse JSON" << endl << reader.getFormatedErrorMessages() << endl;
        exit(1);
    }

    Json::Value dummy_general_block;

    //	Json::Value & generalConfigurationBlock, Json::Value & jsonBlock,
    //							string defaultConfigurationPath, string sectionName

    // Parse ANM
    Json::Value jSonANMBlock 		= JsonUtils::searchSection(dummy_general_block, root,  JsonDefaultBlockPaths::EMPTY_PATH,
                                                                      Configuration_ANM::BLOCK_NAME);
    // Parse Minimizer
    Json::Value jSonMinimizerBlock 	= JsonUtils::searchSection(dummy_general_block, jSonANMBlock, JsonDefaultBlockPaths::EMPTY_PATH,
                                                                        Configuration_ANM::MINIMIZER);

    MinimizerBuilder minimizerBuilder;
    minimizerBuilder.createFromConfiguration(jSonMinimizerBlock, dummy_general_block,solvent, &system,
                                            &constraintParams, &energyCalculator, &anmMinParameters,
                                                    &anmMinimizer);
    ANM_Params * anmParameters;
    ANMCalculator * anmCalculator;
    ANMCalculatorBuilder anmCalculatorBuilder;
    anmCalculatorBuilder.createFromConfiguration(jSonANMBlock, NULL, NULL, NULL, &anmParameters, &anmCalculator);

    //---------------------------

    vector<double> weights;
//	weights.push_back(0.09252450);
//	weights.push_back(-0.01409195);
//	weights.push_back(0.112372);
    weights.push_back(0.8);
    weights.push_back(-0.45);
    weights.push_back(0.73);
//	weights.push_back(0.4);
//	weights.push_back(-0.0682);
//	weights.push_back(0.54);

    anmCalculator->getParameters()->setWeights(weights);

    cout<<"Computing ANM"<<flush<<endl;
    anmCalculator->compute(complex);

    cout<<"Minimizing"<<flush<<endl;
    anmCalculator->minimize(anmMinParameters,complex,energyCalculator,anmMinimizer);

    cout<<"Writing file"<<flush<<endl;
    PDBWriter::write("src/PathPlanning/RRT/Variations/ANMRRT/ANMProteinRRT/Test/Temp/post_anm.pdb",*complex,PELEFORMAT);

    // Store new points (after ANM)
    vector<Point> new_points;
    for(unsigned int i =0; i < c_alphas.size();++i){
        new_points.push_back(c_alphas[i]->toPoint());
    }

    // Write Arrow descriptions
    /*cout<<"draw color white"<<endl<<"draw materials off"<<endl;
    for(unsigned int i =0; i < c_alphas_size; ++i){
        printf("draw line  { %8.3f %8.3f %8.3f } { %8.3f %8.3f %8.3f }\n",old_points[i].getX(),old_points[i].getY(),old_points[i].getZ(),
                new_points[i].getX(),new_points[i].getY(),new_points[i].getZ());
//.........这里部分代码省略.........
开发者ID:victor-gil-sepulveda,项目名称:PathPlanning-RRT,代码行数:101,代码来源:TestANMProteinRRT.cpp

示例2: test_expansion

bool TestANMProteinRRT::test_expansion(){
        //------------------------------------
        // Load a 3-residue peptide of alanine
        //------------------------------------
        System system;
        ComplexBuilder complexBuilder;
        Complex * complex = complexBuilder.build("src/Molecules/Test/Data/ProteinResiduesSamples/plop_ala.pdb");
        Solvent* solvent = SolventGenerator::createSolvent(*complex,false);

        // Get the number of CA
        vector<Atom*> c_alphas = complex->getAtomsWithName(AtomNames::CA);
        unsigned int c_alphas_size = c_alphas.size();

        // Backup old points
        vector<Point> old_points;
        for(unsigned int i =0; i < c_alphas.size();++i){
            old_points.push_back(c_alphas[i]->toPoint());
        }

        //-------------------------------------

        //------------------------------------------
        //Create the Minimizer and ANM Calculator
        //------------------------------------------
        PathPlanning::Tools::ANMObjectsPackage pack(&system, complex,solvent);
        pack.populateANMObjects("src/PathPlanning/RRT/Variations/ANMRRT/ANMProteinRRT/Test/Data/anm_config.conf");
        //---------------------------

        //----------------------------
        // Doing the anm calculation step is mandatory (to compute the eigenvetors)
        //----------------------------
        // In this initial case, as the eigenvector computation and direction computation are coupled
        vector<double> final_weights;
        final_weights.push_back(0.8);
        final_weights.push_back(-0.45);
        final_weights.push_back(0.73);
        pack.anmCalculator->getParameters()->setWeights(final_weights);
        pack.anmCalculator->compute(pack.complex);

        //---------------------------
        // Create a solver
        //---------------------------
        Solver solver(pack.anmCalculator->getParameters()->getNumbermodes(), c_alphas_size*3);
        //solver.setDistModificator(0.74);
        //---------------------------


        //---------------------------
        // Create a boundaries object
        //---------------------------
        RangedBoundDescriptor rbd(-1,1,c_alphas_size*3);
        rbd.setBoundaries(NULL);
        //----------------------------

        //---------------------------
        // Create start and end nodes
        //---------------------------
        vector<double> initial_weights;
        initial_weights.push_back(0);
        initial_weights.push_back(0);
        initial_weights.push_back(0);

        ANMProteinConfiguration* initial_conf = new ANMProteinConfiguration(complex, pack.anmCalculator, &rbd, initial_weights);
        ANMProteinConfiguration* final_conf = 	new ANMProteinConfiguration(complex, pack.anmCalculator, &rbd,final_weights);

        //---------------------------

        //------------------------------------------
        //Create Node Expansor
        //------------------------------------------
        RRTNode initial_node;
        RRTNode objective_node;
        initial_node.setDataP(initial_conf);
        objective_node.setDataP(final_conf);

        ANMProteinRRTExpansionAlgorithm expansor(&pack,&solver);

        RRTNode* expanded = expansor.expand(&initial_node,&objective_node);

        ANMProteinConfiguration* expanded_conf = (ANMProteinConfiguration*)(expanded->getData());

        vector<double>& x =  expanded_conf->getWeights();
        for(unsigned int i =0; i < x.size();++i){
            cout<<x[i]<<endl;
        }
        //------------------------------------------

        // Compare configurations
        delete expanded;

        return true;
}
开发者ID:victor-gil-sepulveda,项目名称:PathPlanning-RRT,代码行数:92,代码来源:TestANMProteinRRT.cpp


注:本文中的Complex::getAtomsWithName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。