Beispiel #1
0
/*
 *      ResidueConnect
 *
 *	Author:	Christian Schafmeister (1991)
 *
 *      Connect two residues together at the connection points
 *      specified
 *
 *      Arguments:
 *      rResA           - First Residue
 *      iConnectA       - The connection point on the first Residue
 *      rResB           - Second Residue
 *      iConnectB       - The connection point on the second Residue
 */
void
ResidueConnect( RESIDUE rResA, int iConnectA, RESIDUE rResB, int iConnectB )
{

    if ( !bResidueConnectUsed(rResA,iConnectA) )
        DFATAL( ("Connection %d is not used", iConnectA ) );
    if ( !bResidueConnectUsed(rResB,iConnectB) )
        DFATAL( ("Connection %d is not used", iConnectB ) );
        
    AtomBondTo( rResA->aaConnect[iConnectA],
                rResB->aaConnect[iConnectB] );
}
Beispiel #2
0
/*
 *	zuePXAUEUnitEditorForSubWidget
 *
 *	Author:	Christian Schafmeister (1991)
 *
 *	Return a pointer to the UnitEditor field in the
 *	collection of UnitEditors for the particular
 *	Widget.
 *
 *	The caller can provide ANY
 */
static UNITEDITORt *
zuePXAUEUnitEditorForSubWidget( Widget wSub )
{
    int		i;
    UNITEDITORt	*uePCur;
    Widget		wTop;

    /* First find the TOP Widget for the UNITEDITOR */
    /* Do this by climbing up the Widget hierarchy */
    /* until we find a Widget of the proper class */


    wTop = wSub;
    while ( wTop != NULL ) {
        if ( XtClass(wTop) == UNITEDITORCLASS ) break;
        wTop = XtParent(wTop);
    }

    /* Now find the UNITEDITOR that is associated with */
    /* the TOP Widget */

    uePCur = PVAI(SvaEditors,UNITEDITORt,0);
    for ( i=0; i<iVarArrayElementCount(SvaEditors); i++, uePCur++ ) {
        if ( uePCur->wTop == wTop )
            return(uePCur);
    }

    DFATAL(( "Could not find a UnitEditor" ));
    return(NULL);	/* for lint */
}
Beispiel #3
0
/*
 *      llListLoop
 *
 *	Author:	Christian Schafmeister (1991)
 *
 *      Prepare the list to be looped over.
 *      Calls to ListNext will return the next object in the list.
 */
LISTLOOP
llListLoop( LIST lList )
{
    if ( lList == NULL )
	DFATAL(( "llListLoop called with NULL list\n" ));
    return(lList->nPFirstNode);
}
Beispiel #4
0
/*
 *	zcPXABPTVerifyElement
 *
 *	Verify the element to make sure that it is acceptable.
 *	If it is then return NULL, otherwise return a message
 *	describing the error.
 */
static char *
zcPXABPTVerifyElement( TABLE tTable, int iCol, int iRow, char *cPData )
{
double		dValue;

    switch ( iCol ) {
	    case TYPE1C:
		if ( strlen( cPData ) == 0 ) {
		    return("Type1 must have name.");
		} else if ( !isalpha(*cPData) ) {
		    return("First character must be alphabetic.");
		} else if ( strlen(cPData)>MAXTYPELEN-1 ) {
		    sprintf( SsError, 
			"Type1 name cannot be longer than %d characters.",
			MAXTYPELEN-1 );
		    return(SsError);
		}
		break;
	    case TYPE2C:
		if ( strlen( cPData ) == 0 ) {
		    return("Type2 must have name.");
		} else if ( !isalpha(*cPData) ) {
		    return("First character must be alphabetic.");
		} else if ( strlen(cPData)>MAXTYPELEN-1 ) {
		    sprintf( SsError, 
			"Type2 name cannot be longer than %d characters.",
			MAXTYPELEN-1 );
		    return(SsError);
		}
		break;
	    case KBC:
		if ( !bStringToDouble( cPData, &dValue ) ) {
		    return("Invalid character in Kb field.");
		}
		break;
	    case R0C:
		if ( !bStringToDouble( cPData, &dValue ) ) {
		    return("Invalid character in R0 field.");
		}
		break;
	    case DESCC:
		if ( strlen(cPData)>DESCLEN-1 ) {
		    sprintf( SsError, "%s %d characters.",
			"Parameter Description cannot be longer than",
			DESCLEN-1 );
		    return(SsError);
		}
		break;
	    default:
		DFATAL(("Unexpected column in zcPXABPTVerifyElement: %d", 
				iCol ));
    }
    return(NULL);
}
/*
 *	zXAHPTAcceptRow
 * 
 */
static void
zXAHPTAcceptRow( TABLE tTable, int iRow, STRING col[] )
{
double			dA, dB;
HBONDPARMTABLEt		*hptPCur;
PARMSET			psParmSet;

	hptPCur = (HBONDPARMTABLEt*)PXATClientPointer(tTable);
	psParmSet = hptPCur->psParmSet;
    
	/*
	 *  convert the numeric fields
	 */
	bStringToDouble( col[2], &dA );
	bStringToDouble( col[3], &dB );

	/*
	 *  add or update row
	 */
	if ( iRow > iParmSetTotalHBondParms( psParmSet ) )
		DFATAL(( "programming err 1 in zXAHPTAcceptRow\n" ));

	if ( iRow == iParmSetTotalHBondParms( psParmSet ) ) {
		/*
		 *  need to add row to table
		 */
		MESSAGE(( "Adding hbond parameter %s-%s.\n", col[0], col[1] ));
        	if ( iRow != iParmSetAddHBond( psParmSet, col[0], col[1],
				dA, dB, col[4] ) ) 
			DFATAL(( "programming err 2 in zXABHPTAcceptRow\n" ));
	} else {
		/*
		 *  update row in place
		 */
		ParmSetUpdateHBond( psParmSet, iRow, col[0], col[1],
				&dA, &dB, col[4] );
	}

}
Beispiel #6
0
/*
 *	zXABPTAcceptRow
 * 
 *	Accept/update table. Caller must check row 1st.
 */
static void
zXABPTAcceptRow( TABLE tTable, int iRow, STRING col[])
{
double		dKb, dR0;
PARMSET		psParmSet;
BONDPARMTABLEt	*bptPCur;
  	
    bptPCur = (BONDPARMTABLEt*)PXATClientPointer(tTable);
    psParmSet = bptPCur->psParmSet;

    /*
     *  convert the numeric fields
     */
    bStringToDouble( col[2], &dKb);
    bStringToDouble( col[3], &dR0);

    /*
     *  add or update row
     */
    if ( iRow > iParmSetTotalBondParms( psParmSet ) ) 
	DFATAL(( "programming err 1 in zXABPTAcceptRow\n" ));

    if ( iRow == iParmSetTotalBondParms( psParmSet ) ) {
	/*
	 *  need to add row to table
	 */
    	VP0(( "Adding bond parameter %s-%s.\n", col[0], col[1] ));
        if ( iRow != iParmSetAddBond( psParmSet, col[0], col[1], 
				dKb, dR0, col[4] ) ) 
		DFATAL(( "programming err 2 in zXABPTAcceptRow\n" ));
    } else {
	/*
	 *  update row in place
	 */
	ParmSetUpdateBond( psParmSet, iRow, col[0], col[1], &dKb, &dR0, col[4]);
    }

}
Beispiel #7
0
/*
 *	zcPXABPTGetElement
 *
 *	Get the values for the elements of the TABLE from the
 *	particular Bond Parmeter Entry.
 */
static char *
zcPXABPTGetElement( TABLE tTable, int iX, int iY )
{
#define	DBLFMT	"%1.4lf"
BONDPARMTABLEt*	bptPCur;
char          	sType1[MAXTYPELEN];
char         	sType2[MAXTYPELEN];
double         	dKb, dR0;
char		sDesc[DESCLEN];


    bptPCur = (BONDPARMTABLEt*)PXATClientPointer(tTable);

    ParmSetBond( bptPCur->psParmSet, iY , sType1, sType2, &dKb, &dR0, sDesc);

    switch ( iX ) {
	    case TYPE1C:
	    	strcpy( SsBuffer, sType1 );
		return( SsBuffer );
		break;
	    case TYPE2C:
	    	strcpy( SsBuffer, sType2 );
		return( SsBuffer );
		break;
	    case KBC:
		sprintf( SsBuffer, DBLFMT, dKb);
		return(SsBuffer);
		break;
	    case R0C:
	    	sprintf( SsBuffer, DBLFMT, dR0);
		return(SsBuffer);
		break;
	    case DESCC:
	    	strcpy( SsBuffer, sDesc );
		return( SsBuffer );
		break;
	    default:
		DFATAL(("Unexpected iX in zcPXABPTGetElement: %d", iX));
    }
    return(NULL);	/* for lint */
}
Beispiel #8
0
/*
 *	XAUESetDrawingElement
 *
 *	Author:	Christian Schafmeister (1991)
 */
XtCallbackProc
XAUESetDrawingElement( Widget wCur, caddr_t PArg, caddr_t PAppData )
{
    int		iElement;
    Widget		wTank;

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

    wTank = zwXAUETank( wCur );


    iElement = iElementNumber(PArg);
    if ( iElement == NOELEMENT ) {
        DFATAL(( "ACTION: Illegal element in XAUESetDrawingElement: %s",
                 PArg ));
    } else {
        TankSetDrawingElement((TANK) wTank, iElement );
        MESSAGE(( "Set current drawing element to: %s\n", PArg ));
    }
    DisplayerReleaseUpdates();
    PopCurrentPrintSink();
    return NULL;
}
/*
 *	zcPXAHPTGetElement
 *
 *	Get the values for the elements of the TABLE from the
 *	particular Atom Parmeter Entry.
 */
static char *
zcPXAHPTGetElement( TABLE tTable, int iX, int iY )
{
#define	DBLFMT	"%1.4lf"
HBONDPARMTABLEt		*hptPCur;
PARMSET			psParmSet;
char			sType1[MAXTYPELEN], sType2[MAXTYPELEN];
double			dA, dB;
char			sDesc[DESCLEN];

    hptPCur = (HBONDPARMTABLEt*)PXATClientPointer(tTable);
    psParmSet = hptPCur->psParmSet;

    ParmSetHBond( psParmSet, iY, sType1, sType2, &dA, &dB, sDesc );

    switch ( iX ) {
	    case TYPE1C:
	    	strcpy( SsBuffer , sType1 );
		break;
	    case TYPE2C:
	    	strcpy( SsBuffer , sType2 );
		break;
	    case AC:
		sprintf( SsBuffer, DBLFMT, dA);
		break;
	    case BC:
	    	sprintf( SsBuffer, DBLFMT, dB);
		break;
	    case DESCC:
	    	strcpy( SsBuffer , sDesc );
		break;
	    default:
		DFATAL(("Unexpected iX in zcPXAHPTGetElement: %d", iX));
    }
    return( SsBuffer );
}
Beispiel #10
0
/*
 *	mMessAdd
 *
 *	Author:	Christian Schafmeister (1991)
 *
 *	Add a message to the list, determine which function it is
 *	in and set the messages Print flag to that of its function.
 *
 *	The first part of the message must look like:
 *		@(\w+) (\w+)|(text)
 *		Where $1 == Filename.
 *		      $2 == line number.
 *		      $3 == Mess text.
 *	Or:
 *		#(\w+) (\w+)
 *		Where $1 == Filename.
 *		      $2 == line number.
 *	Or:
 *		!(text)
 *		      $1 == Text.
 *
 *	The first example is a normal message, the second example
 *	comes from a stack trace. Stack trace messages are ALWAYS
 *	printed.
 *
 */
MESS
mMessAdd( char *sText )
{
STRING		sFile;
int		iLine;
BOOL		bPrint, bTrace;
MESS		mMess;
char		*cPText;
char		cType;
int		iScanned, iFunction;

    iScanned = sscanf( sText, "%c%s %d", &cType, sFile, &iLine );

    cType = sText[0];
    switch ( cType ) {
	case PRINT_MESSAGE:
	case PRINT_TRACE:
	    iScanned = sscanf( sText, "%c%s %d", &cType, sFile, &iLine );
	    if ( iScanned != 3 ) {
		DFATAL(( "Illegal (file:line number) combination in message: |%s|\n",
			sText ));
	    }
	    iFunction = iFunctionFindWithFilenameLine( sFile, iLine );
	    break;
	case PRINT_ALWAYS:
	    iFunction = NO_FUNCTION;
	    break;
	default:
	    cType = PRINT_ALWAYS;
	    iFunction = NO_FUNCTION;
	    break;
    }

    MALLOC( mMess, MESS, sizeof(MESSt) ); 
    MALLOC( cPText, char*, strlen(sText)+1 );

    mMess->cType = cType;
    mMess->iFunction = iFunction;
    strcpy( cPText, sText );
    mMess->cPText = cPText;
    switch ( cType ) {
	case PRINT_MESSAGE:
	    mMess->bPrint = bFunctionPrint(iFunction);
	    break;
	case PRINT_TRACE:
	case PRINT_ALWAYS:
	    mMess->bPrint = TRUE;
	    break;
    }

    mMess->mNext = NULL;
    if ( GmMesss == NULL ) {
	GmMesss = mMess;
	GmLastMess = mMess;
    } else {
	GmLastMess->mNext = mMess;
	GmLastMess = mMess;
    }

    return(mMess);
}