3.6: TQCSC | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
TOC | Group 2 | TQSTSC | TQINP | Group 3 | A-Z | Group 2 |
Use TQCSC to define a new set of system components.
FORTRAN: CALL TQCSC(NAME,NOERR)
C: tqcsc(name,&noerr)
;
Pascal: tqcsc(name,noerr)
;
Basic: Call tqcsc(name,noerr)
Name | Type | Value set on call or returned |
NAME | Array of CHARACTER |
Set to component names |
NOERR | INTEGER | Returns an error number |
NAME is a character array input including the NSCOM names (see TQNOSC) of the new set of linearly independent system components. The array may contain names of previous components and of phase constituents, each with a maximum length of 24 characters. The new components are numbered in the order in which they are supplied in this call. Note that NSCOM can be different from the total number of chemical elements in the system. Components may include, for example, oxides only, or phase-internal electrons.
Note that defining a new set of system components is not possible for a system that contains one or more phases modeled using the SUBO (Two-sublattice order/disorder) formalism.
TQNOSC, TQINSC, TQGNSC, TQSTSC
FORTRAN: | View plain source code |
C Changing system components
PROGRAM CAF11 IMPLICIT NONE
INTEGER NOERR, ISIO2 CHARACTER SCNAME*24, NEWSC(3)*24 DOUBLE PRECISION WMASS, STOI(3)
C Initialise ChemApp CALL TQINI(NOERR)
C Open the thermochemical data-file cosi.dat (system C-O-Si) C for reading CALL TQOPNA('cosi.dat', 10, NOERR)
C Read data-file CALL TQRFIL(NOERR)
C Close data-file CALL TQCLOS(10, NOERR)
C Set amount unit to gram, so we get the molecular mass in g/mol CALL TQCSU('Amount ', 'gram ', NOERR)
C Get the name of the first system component CALL TQGNSC(1, SCNAME, NOERR)
C Get its molecular mass CALL TQSTSC(1,STOI,WMASS,NOERR)
WRITE(*,FMT='(A)') 'Name of first system component: ' // SCNAME WRITE(*,FMT='(A,G12.5)') 'Molecular mass in g/mol: ', WMASS
Output:
Name of first system component: C Molecular mass in g/mol: 12.011 |
C Get the stoichiometry matrix of SiO2(quartz) CALL TQINP('SiO2(quartz) ',ISIO2,NOERR) CALL TQSTPC(ISIO2,1,STOI,WMASS,NOERR)
C Show the stoichiometry matrix of SiO2(quartz) WRITE(*,'(A)') 'Stoichiometry matrix of SiO2 ' // * 'in terms of system components C-O-Si:' WRITE(*,'(3G12.5)') STOI
Output:
Stoichiometry matrix of SiO2 in terms of system components C-O-Si: 0.0000 2.0000 1.0000 |
C Change system components from C-O-Si to SiO-Si2C-CO2. Note that C SiO-Si2C-CO2 form a system of three linearly independent components, C just as the three elements C-O-Si do. NEWSC(1) = 'SiO' NEWSC(2) = 'Si2C' NEWSC(3) = 'CO2'
CALL TQCSC(NEWSC,NOERR)
C Now get the name and molecular mass of the first system C component again WRITE(*,FMT='(A)') 'After changing the system components:'
C Get the name of the first system component CALL TQGNSC(1, SCNAME, NOERR)
C Get its molecular mass CALL TQSTSC(1,STOI,WMASS,NOERR) WRITE(*,FMT='(A)') 'Name of first system component: ' // SCNAME WRITE(*,FMT='(A,G12.5)') 'Molecular mass in g/mol: ', WMASS
Output:
After changing the system components: Name of first system component: SiO Molecular mass in g/mol: 44.085 |
C Get and display the new stoichiometry matrix for SiO2(quartz): CALL TQSTPC(ISIO2,1,STOI,WMASS,NOERR) WRITE(*,'(A)') 'Stoichiometry matrix of SiO2 ' // * 'in terms of system components SiO-Si2C-CO2:' WRITE(*,'(3G12.5)') STOI
Output:
Stoichiometry matrix of SiO2 in terms of system components SiO-Si2C-CO2: 1.5000 -0.25000 0.25000 |
END
C: | View plain source code |
/* Program cac11 */ /* Changing system components */
#include "cacint.h"
int main() { LI noerr, iSiO2; char scname[TQSTRLEN], newsc[4][TQSTRLEN]; DB wmass, stoi[3];
/* Initialise ChemApp */ tqini(&noerr);
/* Open the thermochemical data-file cosi.dat (system C-O-Si) for reading */ tqopna("cosi.dat",10,&noerr);
/* Read data-file */ tqrfil(&noerr);
/* Close data-file */ tqclos(10,&noerr);
/* Set amount unit to gram, so we get the molecular mass in g/mol */ tqcsu("Amount", "gram", &noerr);
/* Get the name of the first system component */ tqgnsc(1, scname, &noerr);
/* Get its molecular mass */ tqstsc(1, stoi, &wmass, &noerr);
printf("Name of first system component: %s\n", scname); printf("Molecular mass in g/mol: %g\n", wmass);
Output:
Name of first system component: C Molecular mass in g/mol: 12.011 |
/* Get the stoichiometry matrix of SiO2(quartz) */ tqinp("SiO2(quartz)",&iSiO2,&noerr); tqstpc(iSiO2,1,stoi,&wmass,&noerr);
/* Show the stoichiometry matrix of SiO2(quartz) */ printf("Stoichiometry matrix of SiO2 " "in terms of system components C-O-Si:\n"); printf("%6.3f %6.3f %6.3f\n", stoi[0], stoi[1], stoi[2]);
Output:
Stoichiometry matrix of SiO2 in terms of system components C-O-Si: 0.000 2.000 1.000 |
/* Change system components from C-O-Si to SiO-Si2C-CO2. Note that SiO-Si2C-CO2 form a system of three linearly independent components, just as the three elements C-O-Si do. */
/* Note that when using C/C++ in contrast to FORTRAN (see above), the array of chars which is passed to tqcsc ("newsc" below) has to consist of one more string than there are system components, and this one extra string has to be empty. This is needed by ChemApp's C/C++ Interface to properly pass arrays of chars to FORTRAN */ strcpy(newsc[0],"SiO"); strcpy(newsc[1],"Si2C"); strcpy(newsc[2],"CO2"); strcpy(newsc[3],"");
tqcsc((CHP)newsc,&noerr); /* Note that an explicit typecast has been used in the above call to tqcsc to avoid potential compiler warnings about newsc being an incompatible pointer type */
/* Now get the name and molecular mass of the first system component again */ printf("After changing the system components:\n");
/* Get the name of the first system component */ tqgnsc(1, scname, &noerr);
/* Get its molecular mass */ tqstsc(1, stoi, &wmass, &noerr);
printf("Name of first system component: %s\n", scname); printf("Molecular mass in g/mol: %g\n", wmass);
Output:
After changing the system components: Name of first system component: SiO Molecular mass in g/mol: 44.0854 |
/* Get and display the new stoichiometry matrix for SiO2(quartz): */ tqstpc(iSiO2,1,stoi,&wmass,&noerr); printf("Stoichiometry matrix of SiO2 " "in terms of system components SiO-Si2C-CO2:\n"); printf("%6.3f %6.3f %6.3f\n", stoi[0], stoi[1], stoi[2]);
Output:
Stoichiometry matrix of SiO2 in terms of system components SiO-Si2C-CO2: 1.500 -0.250 0.250 |
return 0;
}
ChemApp Programmer's Manual, Edition 3.6 | © GTT-Technologies, 2003 |