示例#1
0
 LOOPOVERALL( aAtom, PROPERS, a1, ATOM, lTemp ) {
     LoopGetTorsion( &lTemp, &a1, &a2, &a3, &a4 );
     VP0(( "TORSION: %s - %s - %s - %s\n",
           sContainerFullDescriptor((CONTAINER)a1,s1),
           sContainerFullDescriptor((CONTAINER)a2,s2),
           sContainerFullDescriptor((CONTAINER)a3,s3),
           sContainerFullDescriptor((CONTAINER)a4,s4) ));
 }
示例#2
0
/*
 *      ResidueCheck
 *
 *	Author:	Christian Schafmeister (1991)
 *
 *      Check the RESIDUE and its contents as the whether or
 *      not calculations can be run on it.
 *
 *      Arguments:
 *              rRes -          Residue to check.
 *              iPErrors -      Add the number of errors found.
 *              iPWarnings -    Add the number of warnings found.
 */
void
ResidueCheck( RESIDUE rRes, int *iPErrors, int *iPWarnings )
{
LOOP            lContents;
CONTAINER       cCont;
STRING          sTemp;

        /* Print a warning if the residue is an unknown one */

    if ( bResidueFlagsSet( rRes, RESIDUEUNKNOWN ) ) {
        (*iPWarnings)++;
        VP0(( "Warning: Unknown residue: %s\n", 
                sContainerFullDescriptor( (CONTAINER)rRes, sTemp ) ));
    }

    lContents = lLoop( (OBJEKT)rRes, DIRECTCONTENTS );
    while ( cCont = (CONTAINER)oNext(&lContents) ) {
        ContainerCheck( cCont, iPErrors, iPWarnings );
    }
}
示例#3
0
/*
 *	XAUEPrintAllInternals
 *
 *	Author:	Christian Schafmeister (1991)
 *
 *	List all of the bonds, angles, and torsions that are on the
 *	selected ATOMs.
 */
XtCallbackProc
XAUEPrintAllInternals( Widget wCur, caddr_t PAppData, caddr_t PArg )
{
    UNIT		uUnit;
    ATOM		aAtom;
    LOOP		lSelected;
    LOOP		lTemp;
    ATOM		a1, a2, a3, a4;
    STRING		s1, s2, s3, s4;

    PushCurrentPrintSink(ziXAUEPrintSink(wCur));
    DisplayerAccumulateUpdates();

    /* Define where the output should go */


    /* Get the UNIT being edited and put it */
    /* in an ASSOC to pass it to the command */
    /* handler */

    VP0(( "--- Bonds, angles, torsions of selected ATOMs\n" ));
    uUnit = zuXAUEUnit( wCur );
    lSelected = lLoop((OBJEKT) uUnit, ATOMS );
    LoopDefineVisibleAtoms( &lSelected, ATOMSELECTED );
    while ( (aAtom = (ATOM)oNext(&lSelected)) ) {
        VP0(( "Looking at atom: %s\n",
              sContainerFullDescriptor((CONTAINER)aAtom,s1) ));

        LOOPOVERALL( aAtom, BONDS, a1, ATOM, lTemp ) {
            LoopGetBond( &lTemp, &a1, &a2 );
            VP0(( "BOND: %s - %s\n",
                  sContainerFullDescriptor((CONTAINER)a1,s1),
                  sContainerFullDescriptor((CONTAINER)a2,s2) ));
        }
        LOOPOVERALL( aAtom, ANGLES, a1, ATOM, lTemp ) {
            LoopGetAngle( &lTemp, &a1, &a2, &a3 );
            VP0(( "ANGLE: %s - %s - %s\n",
                  sContainerFullDescriptor((CONTAINER)a1,s1),
                  sContainerFullDescriptor((CONTAINER)a2,s2),
                  sContainerFullDescriptor((CONTAINER)a3,s3) ));
        }
示例#4
0
文件: model.c 项目: swails/ambermini
/*
 *	zModelBuildMockExternals
 *
 *	Author:	Christian Schafmeister (1991)
 *
 *	Build mock external coordinates using the torsional INTERNALs
 *	in iaTorsions.  Build the coordinates for the ATOMs around
 *	(a1) and (a2) and set the flag (fKnownSet) for the ATOMs
 *	that got mock coordinates, reset it for the rest.
 */
static void
zModelBuildMockExternals( MODELTORSIONt *mtPTorsions,
                          INTERNAL iaTorsions[], int iTorsions )
{
    VECTOR		vTemp;
    INTERNAL	iInt;
    MODELATOMt	*maPNew, *maPCur;
    MODELATOMt	*maPC1, *maPC2, *maPC3;
    MODELATOMt	*maPTemp1, *maPTemp2, *maPTemp3, *maPTemp4;
    BOOL		bGotOne;
    int		i, j, iLeft;
#ifdef DEBUG
    STRING		s1, s2, s3, s4;
#endif

    /* Define coordinates for the central ATOMs */

    VectorDef( &vTemp, 0.0, 0.0, 0.0 );
    mtPTorsions->maX.vPos = vTemp;
    mtPTorsions->maX.bPosKnown = TRUE;

    VectorDef( &vTemp, 1.0, 0.0, 0.0 );
    mtPTorsions->maY.vPos = vTemp;
    mtPTorsions->maY.bPosKnown = TRUE;

    /* Tell the outer ATOMs that they dont have */
    /* positions defined */

    for ( i=0; i<mtPTorsions->iXBonds; i++ ) {
        mtPTorsions->maaXBonds[i].bPosKnown = FALSE;
    }
    for ( i=0; i<mtPTorsions->iYBonds; i++ ) {
        mtPTorsions->maaYBonds[i].bPosKnown = FALSE;
    }

    /* Place the first ATOM in the XY plane */

    iLeft = iTorsions;
    iInt = iaTorsions[0];
    VectorDef( &vTemp, 1.0, 1.0, 0.0 );
    maPCur = ((MODELATOMt*)PAtomTempPtr(aInternalAtom1(iInt)));
    maPCur->vPos = vTemp;
    maPCur->bPosKnown = TRUE;

    MESSAGE(( "=======  Started mock coords from: %s\n",
              sContainerFullDescriptor((CONTAINER)aInternalAtom1(iInt),s1) ));

    /* Now start looping through the torsions, looking for */
    /* those that have one ATOM defined and then build the */
    /* coordinate for the other ATOM and clear the INTERNAL */
    /* from the ARRAY */

    MESSAGEEXECUTE( {
        MESSAGE(( "========  %d Torsions to build mock coords from:\n",
        iTorsions ));
        for ( i=0; i<iTorsions; i++ ) {
            MESSAGE(( "------- Known torsion: %s - %s - %s - %s\n",
            sContainerFullDescriptor((CONTAINER)aInternalAtom1(iaTorsions[i]),s1),
            sContainerFullDescriptor((CONTAINER)aInternalAtom2(iaTorsions[i]),s2),
            sContainerFullDescriptor((CONTAINER)aInternalAtom3(iaTorsions[i]),s3),
            sContainerFullDescriptor((CONTAINER)aInternalAtom4(iaTorsions[i]),s4) ));
        }
    } );
示例#5
0
文件: model.c 项目: swails/ambermini
/*
 *	ModelTorsion
 *
 *	Author:	Christian Schafmeister (1991)
 *
 */
static void
ModelTorsion( MODELTORSIONt *mtPTorsions, int iBondX, int iBondY, double dVal )
{
    MODELATOMt	*maPA, *maPX, *maPY, *maPD;
#ifdef DEBUG
    STRING		s1, s2, s3, s4;
#endif

    if ( iBondX >= mtPTorsions->iXBonds ||
            iBondY >= mtPTorsions->iYBonds ) {
        return;
    }
    /*
    if (this)
    fprintf(stderr, "ibond  %d %d\n", iBondX, iBondY);
    */

    maPA = &(mtPTorsions->maaXBonds[iBondX]);
    maPX = &(mtPTorsions->maX);
    maPY = &(mtPTorsions->maY);
    maPD = &(mtPTorsions->maaYBonds[iBondY]);
    if ( !(maPA->bBuildInternals || maPD->bBuildInternals) ) {
        /*
        if (this)
        fprintf(stderr, " %s needs internals\n",
        sAtomName(maPA->aAtom));
        */
        return;
    }

    /* If the coordinates for the atoms are defined then */
    /* measure the torsion angle between them and use that for */
    /* the internal */

    if ( maPA->bPosKnown &&
            maPX->bPosKnown &&
            maPY->bPosKnown &&
            maPD->bPosKnown ) {
        /*
        if (this)
        fprintf(stderr, " %s replacing dval\n",
        sAtomName(maPA->aAtom));
        */
        dVal = dVectorAtomTorsion( &(maPA->vPos),
                                   &(maPX->vPos),
                                   &(maPY->vPos),
                                   &(maPD->vPos) );
    }

    /* Create an INTERNAL only if there isn't one already */

    if ( !iInternalFindTorsion( maPA->aAtom,
                                maPX->aAtom,
                                maPY->aAtom,
                                maPD->aAtom ) ) {
        /*
        if (this)
        fprintf(stderr, " %s adding internal %f\n", sAtomName(maPA->aAtom),
        dVal/DEGTORAD);
        */
        iInternalTorsion( maPA->aAtom,
                          maPX->aAtom,
                          maPY->aAtom,
                          maPD->aAtom,
                          dVal );
        MESSAGE(( "++++Torsion INTERNAL: %lf to %s - %s - %s - %s\n",
                  dVal/DEGTORAD,
                  sContainerFullDescriptor((CONTAINER)maPA->aAtom,s1),
                  sContainerFullDescriptor((CONTAINER)maPX->aAtom,s2),
                  sContainerFullDescriptor((CONTAINER)maPY->aAtom,s3),
                  sContainerFullDescriptor((CONTAINER)maPD->aAtom,s4) ));
    } else {
        MESSAGE(( "Torsional INTERNAL already exists\n" ));
    }
}
示例#6
0
/*
 *      ResidueMutate
 *
 *	Author:	Christian Schafmeister (1991)
 *
 *      Mutate the RESIDUE (rOld) into the RESIDUE (rNew).
 *      Do this by superimposing the coordinates from rOld onto
 *      rNew, breaking all the bonds from rOld to other residues,
 *      and rejoining them to identically named atoms in rNew,
 *      then building the coordinates for the rest of the atoms in rNew.
 *      The new RESIDUE rNew should not be bonded to anything else, it
 *      should also have EXTERNAL coordinates defined, but no INTERNALS.
 *
 */
void
ResidueMutate( RESIDUE rNew, RESIDUE rOld )
{
LOOP            lAtoms, lSpan;
ATOM            aNew, aNeighbor, aOld, aAtom, aSpan, aTemp;
STRING          sTemp, sSpan;
int             i, iDum;
FLAGS		fBondFlags;

    MESSAGE(( "Mutating: %s to: %s\n", sContainerName( rOld ),
                sContainerName(rNew) ));

                /* Build internal coordinates for the new RESIDUE */

    lAtoms = lLoop( (OBJEKT)rNew, ATOMS );
    BuildInternalsUsingFlags( &lAtoms, 
			ATOMPOSITIONKNOWN, 
			0,
			0, 
			ATOMPOSITIONKNOWN,
			&iDum, &iDum, &iDum );

                /* Define the coordinates, and the flags */
                /* if there are bonds out of the old RESIDUE, break them */
                /* and rejoin them to identically named atoms in the new */
                /* RESIDUE */

    lAtoms = lLoop( (OBJEKT)rOld, ATOMS );
    FOREACH( aOld, ATOM, lAtoms ) {
        MESSAGE(( "Searching for atom in new residue with name: %s\n",
                        sContainerName(aOld) ));
        aNew = (ATOM)cContainerFindName( (CONTAINER)rNew, ATOMid,
                                             sContainerName(aOld) );
                                             
                /* If there is a cooresponding ATOM with the same name */
                /* then define its flags and coordinates */
                
        if ( aNew != NULL ) {
            MESSAGE(( "--- Found one\n" ));
            AtomSetPosition( aNew, vAtomPosition(aOld) );
            AtomDefineFlags( aNew, fAtomFlags(aOld) );
        } else {
            MESSAGE(( "--- No atom found\n" ));
        }

                /* Search for bonds out of the old RESIDUE */
        
        for ( i=0; i<iAtomCoordination(aOld); i++ ) {
            aNeighbor = aAtomBondedNeighbor( aOld, i );
	    MESSAGE(( "--- Looking at neighbor: %s\n",
			sContainerFullDescriptor( (CONTAINER)aNeighbor, sTemp ) ));
            if ( rOld != (RESIDUE)cContainerWithin(aNeighbor) ) {
                fBondFlags = fAtomBondFlags( aOld, i );
                AtomRemoveBond( aOld, aNeighbor );
                MESSAGE(( "Removing a bond to: %s\n",
                        sContainerFullDescriptor( (CONTAINER)aNeighbor, sTemp ) ));
                if ( aNew != NULL ) {
                    MESSAGE(( "--- And rejoining it to: %s\n",
                                sContainerFullDescriptor( (CONTAINER)aNew, sTemp ) ));
                    AtomBondToFlags( aNew, aNeighbor, fBondFlags );
                } else {
                    MESSAGE(( "--- Not rejoining it to anything.\n" ));
        VP1(( "There is no atom in residue: %s with the name: %s.\n" ));
        VP1(( "--- No bond could be made to the missing atom.\n" ));
                }
            }
        }
    }