3.2: TQINSC

TOCGroup 2TQCSUTQGNSCGroup 3A-ZGroup 2

GET-INDEX-NUMBER-OF-SYSTEM-COMPONENT

Use TQINSC to get the index number of a specified system component.

Synopsis

FORTRAN: CALL TQINSC(NAME,INDEXS,NOERR)

C: tqinsc(name,&indexs,&noerr);

Pascal: tqinsc(name,indexs,noerr);

Basic: Call tqinsc(name,indexs,noerr)


Name Type Value set on call or returned
NAME CHARACTER Set to a component name
INDEXS INTEGER Returns the index number for the component
NOERR INTEGER Returns an error number

The input variable NAME is permitted to have a maximum length of 24 characters. The returned value for INDEXS is normally used as input to other ChemApp subroutines. The index number stays the same for a specific component as long as the system components remain unchanged (see TQCSC).

See also

TQNOSC, TQGNSC, TQSTSC, TQCSC

Examples

FORTRAN:View plain source code



C Handling system components
PROGRAM CAF10 IMPLICIT NONE
INTEGER NOERR, NSCOM, I CHARACTER FNAME*12, SCNAME*24
C Initialise ChemApp CALL TQINI(NOERR)
FNAME = 'cosi.dat'
C Open the thermochemical data-file cosi.dat (system C-O-Si) C for reading CALL TQOPNA(FNAME, 10, NOERR)
C Read data-file CALL TQRFIL(NOERR)
C Close data-file CALL TQCLOS(10, NOERR)
C Get the number of system components CALL TQNOSC(NSCOM, NOERR)
WRITE(*,FMT='(A,I3)') 'Number of system components ' // * 'in file ' // FNAME // ':', NSCOM

Output:
Number of system components in file cosi.dat    :  3

C Print the names of all system components WRITE(*,FMT='(A)') 'Names of system components:'
DO I=1, NSCOM CALL TQGNSC(I, SCNAME, NOERR) WRITE(*,FMT='(I2,A)') I, ': ' // SCNAME ENDDO

Output:
Names of system components:
 1: C                       
 2: O                       
 3: Si

C Get the index number of a system component CALL TQINSC('C ', I, NOERR) WRITE(*,FMT='(A,I2,A)') 'C (Carbon) is system component no. ', * I, ' in file ' // FNAME

Output:
C (Carbon) is system component no.  1 in file cosi.dat

END

C:View plain source code




/* Program cac10 */ /* Handling system components */
#include "cacint.h"
int main() { LI noerr, nscom, i; char fname[13], scname[TQSTRLEN];

/* Initialise ChemApp */ tqini(&noerr);
strcpy(fname,"cosi.dat");
/* Open the thermochemical data-file cosi.dat (system C-O-Si) for reading */ tqopna(fname,10,&noerr);
/* Read data-file */ tqrfil(&noerr);
/* Close data-file */ tqclos(10,&noerr);
/* Get the number of system components */ tqnosc(&nscom, &noerr);
printf("Number of system component in file %s: %li\n", fname, nscom);

Output:
Number of system component in file cosi.dat: 3

/* Print the names of all system components */ printf("Names of system components:\n");
for (i = 1; i <= nscom; i++) { tqgnsc(i, scname, &noerr); printf("%li: %s\n", i, scname); }

Output:
Names of system components:
1: C
2: O
3: Si

/* Get the index number of a system component */ tqinsc("C", &i, &noerr); printf("C (Carbon) is system component no. %li in file %s\n", i, fname);

Output:
C (Carbon) is system component no. 1 in file cosi.dat

return 0;
}


ChemApp Programmer's Manual, Edition 3.6© GTT-Technologies, 2003