/* * DictionaryDescribe * * Author: Christian Schafmeister (1991) * * Describe the DICTIONARY. */ void DictionaryDescribe( DICTIONARY dDict ) { DICTLOOP dlLoop; VP0(( "Dictionary with %d elements.\n", iDictionaryElementCount(dDict) )); dlLoop = ydlDictionaryLoop(dDict); while ( yPDictionaryNext( dDict, &dlLoop ) ) { VP0(( "%40s = %lX\n", sDictLoopKey(dlLoop), PDictLoopData(dlLoop) )); } }
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) )); }
/* * ListDescribe * * Author: Christian Schafmeister (1991) * * Fill the string with a description of the list. * It is the callers responsibility to ensure that * the string is long enough to store the description. */ void ListDescribe( LIST lList ) { OBJEKT oObj; int iSize; LISTLOOP llL; iSize = iCollectionSize(lList); VP0(( "List size=%d\n", iSize )); llL = (LISTLOOP)PCollectionLoop( (COLLECTION)lList ); if ( llL == NULL ) return; while ( (oObj = oCollectionNext( (COLLECTION)lList, (GENP *)&llL )) != NULL ) { Describe( oObj ); } VP0(( "--End of list\n" )); }
/* * 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) )); }
/* * XAHPTPopupTable (X, Athena, HydrogenBond Parameter Table) * * Popup a table for editing the parameter files. * Register the callback to be called when the TABLE * is destroyed. */ void XAHPTPopupTable( Widget wCreated, Widget wWidget, PARMSET psParmSet, VFUNCTION fCallback ) { HBONDPARMTABLEt *hptPNew; int iCount; /* First create a place to put the PARM TABLE data */ MALLOC( hptPNew, HBONDPARMTABLEt*, sizeof(HBONDPARMTABLEt) ); hptPNew->fDestroyCallback = fCallback; hptPNew->wTop = wWidget; hptPNew->psParmSet = psParmSet; /* First create the table for the PARM TABLE */ iCount = iParmSetTotalHBondParms( psParmSet ); XATPopupTable( wCreated, wWidget, "hParmTableShell", 5, iCount, "hParmRow", "hParmAddRow", zcPXAHPTGetElement, zcPXAHPTVerifyElement, zcPXAHPTVerifyRow, zXAHPTAcceptRow, NULL, NULL, zXAHPTDestroyTable, 0, (GENP)hptPNew ); if ( !iCount ) { VP0(( "There are no Hydrogen Bond parameters in this PARMSET.\n")); VP0(("You may add some using the menu if you wish.\n" )); } }
OBJEKT AMBER_add_source(char *filename) { FILE *fCmds; fCmds = FOPENCOMPLAIN( filename, "r" ); if ( fCmds != NULL ) { if ( bINPUTMAXDEPTH() ) { VP0(( "Source commands are nested too deep!\n" )); } else { /* Push the file onto the input file stack. The main */ /* parsing routine will continue parsing until there are */ /* no more files on the input file stack. */ VP0(( "----- Source: %s\n", GsBasicsFullName )); INPUTPUSHFILE( fCmds ); VP0(( "----- Source of %s done\n", GsBasicsFullName )); } } return(NULL); }
/* * 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 ); } }
static void zMol2FileWriteContainer( MOL2WRITEt *pwPFile, CONTAINER cCont, int choice ) { //const char C_TERMINAL_PREFIX = 'C'; //const char N_TERMINAL_PREFIX = 'N'; const int RESIDUE_NAME_LENGTH = 4; LOOP lContents; ATOM aAtom; char *cPTemp; cPTemp = sContainerName(cCont); strncpy( pwPFile->sResidueName, cPTemp, RESIDUE_NAME_LENGTH ); pwPFile->sResidueName[ RESIDUE_NAME_LENGTH ] = '\0'; if ( strlen(cPTemp) > RESIDUE_NAME_LENGTH ) { VP0(( " Truncating residue name for PDB format: %s -> %s\n", sContainerName(cCont), pwPFile->sResidueName )); } /* } */ if ( iObjectType(cCont) == ATOMid ) { zMol2FileWriteAtomRecord( pwPFile, (ATOM)cCont, choice); pwPFile->iResidueSeq++; } else if ( iObjectType(cCont) == RESIDUEid ) { RESIDUE rRes = (RESIDUE) cCont; pwPFile->iResidueSeq = rRes->iTemp; if ( pwPFile->iResidueSeq == 0 ) pwPFile->iResidueSeq = 1; lContents = lLoop( (OBJEKT)cCont, DIRECTCONTENTSBYSEQNUM ); while ( (aAtom = (ATOM)oNext(&lContents)) ) { zMol2FileWriteAtomRecord( pwPFile, aAtom, choice); } } else if ( iObjectType(cCont) == MOLECULEid ) { lContents = lLoop( (OBJEKT)cCont, ATOMS ); while ( (aAtom = (ATOM)oNext(&lContents)) ) { zMol2FileWriteAtomRecord( pwPFile, aAtom, choice ); } pwPFile->iResidueSeq++; } }
static char * zMol2FileWriteResidueContainer( MOL2WRITEt *pwPFile, CONTAINER cCont ) { //const char C_TERMINAL_PREFIX = 'C'; //const char N_TERMINAL_PREFIX = 'N'; const int RESIDUE_NAME_LENGTH = 3; //LOOP lContents; char *cPTemp; RESIDUE rRes; cPTemp = sContainerName(cCont); strncpy( pwPFile->sResidueName, cPTemp, RESIDUE_NAME_LENGTH ); /* The intentional side effect is to truncate long names. */ pwPFile->sResidueName[ RESIDUE_NAME_LENGTH ] = '\0'; if ( strlen(cPTemp) > RESIDUE_NAME_LENGTH ) { VP0(( " Truncating residue name for PDB format: %s -> %s\n", sContainerName(cCont), pwPFile->sResidueName )); } rRes = (RESIDUE) cCont; return(sContainerName(cCont)); }
/* * 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]); } }
/* Main function, write the Mol3 file */ void Mol3Write( FILE *fOut, UNIT uUnit, int choice ){ int i,j,iResNumber = 0; VARARRAY vaRes; STRING sName; char* cPTemp; Mol2Write( fOut, uUnit, choice ); fprintf(fOut, "@<TRIPOS>HEADTAIL\n") ; /* Write the HEAD in the file */ if ( aUnitHead(uUnit) != NULL ){ iResNumber=(((CONTAINER)aUnitHead(uUnit))->cContainedBy)->iSequence; cPTemp = ((CONTAINER)aUnitHead(uUnit))->sName; strncpy( sName, cPTemp, 4 ); if ( strlen(cPTemp) > 4 ) { VP0(( " Truncating residue name for PDB format: %s -> %s\n", ((CONTAINER)aUnitHead(uUnit))->sName, sName )); fprintf(fOut,"%s %d\n",sName,iResNumber); } else { fprintf(fOut,"%s %d\n",((CONTAINER)aUnitHead(uUnit))->sName,iResNumber); } } else { fprintf(fOut,"0 0\n"); } /* Write the TAIL in the file */ if ( aUnitTail(uUnit) != NULL ){ iResNumber=(((CONTAINER)aUnitTail(uUnit))->cContainedBy)->iSequence; cPTemp = ((CONTAINER)aUnitTail(uUnit))->sName; strncpy( sName, cPTemp, 4 ); if ( strlen(cPTemp) > 4 ) { VP0(( " Truncating residue name for PDB format: %s -> %s\n", ((CONTAINER)aUnitTail(uUnit))->sName, sName )); fprintf(fOut,"%s %d\n",sName,iResNumber); } else{ fprintf(fOut,"%s %d\n",((CONTAINER)aUnitTail(uUnit))->sName,iResNumber); } }else{ fprintf(fOut,"0 0\n"); } fprintf(fOut,"@<TRIPOS>RESIDUECONNECT\n"); /* Write Atoms Connect for every Residue */ vaRes=uUnit->vaResidues; for (i = 0; i < iVarArrayElementCount((VARARRAY)vaRes); i++) { SAVERESIDUEt prRes = *PVAI(vaRes, SAVERESIDUEt, i); fprintf(fOut,"%d",prRes.iSequenceNumber); for (j = 0; j <= 5; j++) { if ( prRes.rResidue->aaConnect[j] != NULL ){ cPTemp = sContainerName(prRes.rResidue->aaConnect[j]); strncpy( sName, cPTemp, 4 ); if ( strlen(cPTemp) > 4 ) { VP0(( " Truncating residue name for PDB format: %s -> %s\n", sContainerName(prRes.rResidue->aaConnect[j]), sName )); fprintf(fOut," %s",sName); }else{ fprintf(fOut," %s",sContainerName(prRes.rResidue->aaConnect[j]) ); } }else{ fprintf(fOut," 0"); } } fprintf(fOut,"\n"); } }
/* * ResidueDescribe * * Author: Christian Schafmeister (1991) * * Call the specific routine for the class to print a description * of the RESIDUE to the file fOut. * * Arguments: * oObject - The object to describe. * */ void ResidueDescribe( RESIDUE rResidue ) { int i; LOOP lContents; OBJEKT oObj; STRING sTemp; VP0(( "RESIDUE name: %s\n", rResidue->cHeader.sName )); if ( bResidueFlagsSet( rResidue, RESIDUEUNKNOWN ) ) VP0(( "!!!This is an unknown residue!\n" )); VP0(( "RESIDUE sequence number: %d\n", iContainerSequence(rResidue) )); VP0(( "RESIDUE PDB sequence number: %d\n", iResiduePdbSequence(rResidue) )); VP0(( "Type: %s\n", sResidueTypeNameFromChar(cResidueType(rResidue)) )); if ( cResidueType(rResidue) == RESTYPESOLVENT ) { VP0(( "Solvent imaging atom: " )); if ( aResidueImagingAtom(rResidue) == NULL ) { VP0(( "None.\n" )); } else { VP0(( "%s\n", sContainerDescriptor((CONTAINER)aResidueImagingAtom(rResidue),sTemp) )); } } VP0(( "Connection atoms:\n" )); for ( i=0; i<MAXCONNECT; i++ ) { if ( bResidueConnectUsed(rResidue,i) ) { VP0(( " Connect atom %d: %s\n", i, sContainerDescriptor( (CONTAINER)rResidue->aaConnect[i], sTemp ) )); } } if ( rResidue->vaImpropers ) { VP0(( "No improper torsions\n" )); } else { VP0(( "Improper torsions:\n" )); } BasicsResetInterrupt(); VP0(( "Contents: \n" )); lContents = lLoop( (OBJEKT)rResidue, DIRECTCONTENTS ); while ( oObj = oNext(&lContents ) ) { VP0(( "%s\n", sContainerDescriptor( (CONTAINER)oObj, sTemp ) )); if ( bBasicsInterrupt() ) { BasicsResetInterrupt(); VP0(( "Interrupted\n" )); break; } } }