Example #1
0
void Molecule::insertResidues(Molecule add, int residue_start, int residue_end)
{

    int add_nResidues, this_nResidues;
    int ires_start = -1, ires_end = -1;

    add_nResidues = add.numberOfResidues();

    if (residue_start < 0 && residue_end < 0)
    {
        // Add whole chain
        ires_start = 0;
        ires_end = add_nResidues-1;
    }
    else
    {
        // Find beginning and ending ires
        for (int ires = 0; ires < add_nResidues; ires++)
        {
            if (residue_start == add.residues[ires].number)
                ires_start = ires;
            if (residue_end == add.residues[ires].number)
                ires_end = ires;
        }
    }

    if (ires_start < 0 || ires_end < 0)
    {
        std::cerr << " ires_start= " << ires_start << " ires_end= " << ires_end << std::endl;
        std::cerr << " residue_start= " << residue_start << " residue_end= " << residue_end << std::endl;
        REPORT_ERROR("OrigamiBuilder::insertBases ERROR: negative ires_start or ires_end");
    }

    for (int ires = ires_start; ires <= ires_end; ires++)
    {
        int my_res = add.residues[ires].number;
        bool have_inserted=false;
        for (int ii = 0; ii < numberOfResidues(); ii++)
        {
            if (residues[ii].number > my_res)
            {
                insertResidue(add.residues[ires], ii);
                have_inserted = true;
                break;
            }
        }
        if (!have_inserted)
            addResidue(add.residues[ires]);
    }

}
Example #2
0
Residue * Molecule::addResidue()
{
    Q_D(const Molecule);
    return addResidue(d->residues.size());
}