===== Connection to the Thermo-Calc PC using X2Go: ===== ----------------------------------------- 1) Install the X2Go Client software on your computer: available at [wiki.x2go.org](https://wiki.x2go.org). 2) Open the software and add a new session (click on **Session -> New session**). 3) In the session settings, enter the following information: - **Host:** 193.49.173.62 - **Username:** Your EMSE username - **SSH Port:** 22 - **Session Type:** ICEWM 4) Leave the other options as default and save the session. 5) Click on the saved session to start the SSH connection. A window will prompt you for your username and password—use your usual EMSE credentials. 6) Once connected, click on the **Start Menu** icon (bottom left), go to the **Other** section, and click on the **Thermo-Calc** icon. The software should launch. 7) During the first use, Thermo-Calc will ask you to activate the license. Select **Online Activation Mode**, then enter: - **Login:** Lic-100117@thermocalc.com - **Password:** Please contact Quentin Gaillard or Julien Favre by e-mail to request this password. The cost of obtaining the password is a coffee and a croissant. FYI, this activation will generate a permanent key somewhere in your hidden files, eliminating the need to repeat this process for future uses. 8) **/!\ Once finished, properly close the session!** Disconnect by clicking the **Start Menu** -> **Logout**. In the popup window, click **Log out**. **Never shut down the PC**, as it would make it inaccessible to all users. ----------------------------------------- Useful Commands: - To check running processes, open a terminal and type: ``` top ``` Thermo-Calc appears under the name **java**. - To terminate a running process, type: ``` kill -9 XXX ``` Replace **XXX** with the **PID number** from the first column of the `top` command. ----------------------------------------- **File Transfer:** To transfer files to/from the virtual machine, you can use **Filezilla**: Install **Filezilla** on your host computer: [https://filezilla-project.org](https://filezilla-project.org). Launch Filezilla and use the following settings: - **Host:** 193.49.173.62 - **Username & Password:** Your EMSE credentials - **Port:** 22 ----------------------------------------- **Alternative Connection Method - SSH-X** - **/!\ Whenever possible, prefer the previous method.** 1) Install an SSH client, such as **Putty** ([www.putty.org](https://www.putty.org)). 2) Open **Putty** and enter the following details: - **Host Name:** 193.49.173.62 - **Port:** 22 3) In the left-side menu, expand **SSH** (click on the `+` sign) and select **X11**. 4) In the **X11** tab, check the box **Enable X11 forwarding**. 5) Return to the **Session** tab and click **Open**. 6) The session will start. Enter your credentials: - **Login as:** Your EMSE username - **Password:** Your EMSE password 7) In the terminal, type: ``` Thermo-Calc ``` and press **Enter**. Thermo-Calc should open with a graphical interface. 8) **If your X2Go session is frozen**, you can log in via a simple SSH terminal (without the X11 option) and use the following commands to close the stuck X2Go session: - View running processes: ``` top ``` Then, search for a process named x2gosession in the list and note its Process ID (PID). - Kill the X2Go session: ``` kill -9 XXX ``` (Replace **XXX** with the process ID from `top`.) ----------------------------------------- **Alternative file transfer method (SSH/Linux) - SSH-X/SSHFS** If you are connecting to the remote pc with **SSH**, you can 'mount' the remote pc's folders to your computed, and thus not need an **SSH** client. 1) Install **sshfs** via your package manager (ex: `apt install sshfs` on unbuntu) 2) Create a folder (directory) on **your** computer to act as a mount point (ex: `mkdir ~/thermocalc-remote`, meaning you create a directory called `thermocalc-remote` in your personnal folder) 3) Use the following command to mount the remote pc folder to the one you just created : ``` sshfs -o idmap=user @193.49.173.62:/home/local/EMSE2000/ ~/thermocalc-remote ``` to be sure about the right path on the remote server, when in ssh, you can type `pwd` which will show you the path to the current (remote) folder 4) *Extra tip* you can even create an alias in your (*local*) terminal to not have to type this big command : - Edit your (*local*) `~/.bashrc` file and add this at the end of the file (if I am M. Jean Bon, creating the alias `mountemse` or whichever name you choose) : ``` # Custom aliases alias mountemse="sshfs -o idmap=user jean.bon@193.49.173.62:/home/local/EMSE2000/jean.bon ~/thermocalc-remote" ``` - Then restart a terminal session so that the change can go into effect, and type the command `mountemse` and after a password prompt, you will mount your remote folder on the thermocalc pc on your local machine, so that you can access its content from your file manager seamlessly. ----------------------------------------- ===== Scripting with TC-Python : ===== ----------------------------------------- Thermo-Calc can be used through a Python API, allowing for scripting and automated calculations: 🔗 [TC-Python Documentation](https://thermocalc.com/support/documentation/tc-python-help/) **Using TC-Python** To use TC-Python, you need to launch a Python IDE. The recommended IDE is **Spyder**, as it directly utilizes the libraries installed on the PC without requiring a virtual environment. Click on the **Spyder** icon in the **Programming** section of the Start Menu. **First-Time Setup** Once the IDE is launched, make sure to import the **tc_python** library. Additionally, for the first use, you must run the Python script located at: ``` /opt/Thermo-Calc/2025a/SDK/TC-Python/Examples/Miscellaneous/pyex_M_04_license.py ``` Executing this script will prompt you to enter your **username and password** (the same credentials as before). This process will generate a permanent key, stored in hidden folders, so you won’t need to repeat this step in the future. **Running Scripts with TC-Python** Once set up, you can develop or run scripts with **TC-Python**. Example scripts are available at: ``` /opt/Thermo-Calc/2025a/SDK/TC-Python/Examples/ ``` **Documentation** You can also access the official documentation at: ``` /opt/Thermo-Calc/2025a/Manuals/TC-Python/index.html ``` ----------------------------------------- ===== Utilisation de l'API PyCharm : ===== ----------------------------------------- /!\ Utilisation déconseillée... A la première utilisation de PyCharm, il va falloir rentrer l’interpréteur python a utiliser. Pour cela aller dans Settings > Python Interpreter. Dans le menu déroulant choisir "Show All" et cliquer sur "Add" Sur la nouvelle fenêtre, à gauche, cliquer sur "System Interpreter" et vous pourrez choisir quelle version de Python utiliser (3.6 / 2.7 / autre ...). Une fois l’interpréteur choisi, PyCharm va ajouter toutes les librairies installées. L'ensemble des librairies utilisables est indiqué dans Settings > Python Interpreter. ----------------------------------------- ===== Utilisation de la console de Thermocalc ===== ----------------------------------------- Un calcul dans la console passe part plusieurs étapes (modules) : 1) Module DATABASE : c'est ici qu'il faut choisir la base de donnée à utiliser, les éléments à considérer pour le calcul ou éventuellement ajouter ou enlever des phases. 2) Module POLY-3 : c'est ici qu'il faut renseigner les détails du calcul à faire. Conditions initiales / Type de traitement à faire (single point / 1D / diagramme de phase...). Quand toutes les conditions sont bonnes il faut lancer le calcul. 3) Module POST : c'est le post traitement du calcul. Tout ce qui concerne affichage des résultats sur la partie graphique ou récuperer les résultats sous forme d'image, de fichier txt ou autre. **Des exemples de calcul peuvent être trouvé dans le dossier de Thermocalc :** /opt/Thermo-Calc/2021a/Examples/Console-Mode/Thermo-Calc Les commandes de base de la console de Thermocalc : # Commandes générales go [module] #change de module help [fonction] #aide sur la fonction ? #donne de l'aide sur les différents choix possibles pour répondre à une question * #tous les éléments ou toutes les phases . #dérivée # Module DATABASE sw (switch) #change de bases de données def-sys [composants] (define-system) #définit le système get #charge les fonctions thermodynamiques du système défini l-syst [argument] (list-system) #liste les phases du système défini rej [argument] (reject) #rejette phases (ph) ou permet de réinitialiser le système (sys) # Module POLY-3 s-c [conditions] (set-conditions) #fixe des conditions pour le calcul l-c (list-conditions) #liste les conditions c-e (compute-equilibrium) #effectue le calcul d'équilibre dans les conditions données l-e (list-equilibrium) #liste le résultat du calcul d'équilibre ent-sym f (enter-symbol function) #définit une fonction ch-st ph [phase]=[statut] (change-status phase) #change le statut d'une ou plusieurs phases (entered ou suspended) s-a-v [n°][variable][limite] (set-axis-variable) #définit un axe de variable step [option] #calcule selon un axe variable (NORMAL: calcul phases stables, SEPARATE: calcul de chaque phase séparément) map #calcule selon deux axes save #vide la mémoire et efface le contenu des calculs précédents po (post) #va au sous-module graphique # Sous-module POST (sous-module de POLY-3) s-d-a (set-diagram-axis) #définit les axes du tracé s-s-s (set-scaling status) #définit les limites du tracé s-l (set-label) #met des label sur les courbes s-d-ty (set-diagram type) #passe en diagramme triangulaire s-t-s 1 (set-tieline-status) #trace les conodes pl (plot) #trace le diagramme ba (back) #retourne dans POLY-3 # Fonctions thermodynamiques # H, S, G sont l'enthalpie, l'entropie et l'énergie de Gibbs. Si rien n'est spécifié, ce sont les grandeurs pour le système. On utilise généralement les grandeurs molaires en rajoutant M comme suffixe. On peut ensuite préciser si on souhaite pour une phase donnée. Par exemple : # GM(bcc) : énergie de Gibbs molaire de la phase bcc # HM(*) : enthalpie molaire de toutes les phases # Some of the state variables that can be used in conditions are: T temperature in the system P pressure in the system N total system size (in moles) B total system site (in grams) N() mole number of a component in the system X() mole fraction of a component in the system B() mass (grams) of a component in the system W() mass fraction of a component in the system ACR() activity of a component in the system MUR() chemical potential of a component in the system N(,) mole number of a component in a phase X(,) mole fraction of a component in a phase B(,) mass (grams) of a component in a phase W(,) mass fraction of a component in a phase ACR(,) activity of a component in a phase MUR(,) chemical potential of a component in a phase H enthalpy in the whole system HM() enthalpy of a phase (per mole) === Tracer un pseudo-binaire tout en gardant l'alliage initial identique : === Exemple : ajout de Ni dans un alliage Fe50Cr50 où on veut garder la proportion Fe/Cr constante. go da #on rentre dans le module DATABASE sw TCFE9 #on veut travailler avec la base de donnée TCFE9 def-sys fe ni cr #définition des éléments à utiliser get #chargement de ces conditions go pol #on rentre dans le module POLY-3 s-c n=1 p=1e5 T=1000 N(ni)=0.5 N(fe)-N(cr)=0 #on donne nos conditions : n=1mol / T=1000K / P=1e5 Pa / Quantité de Ni au départ / Condition sur Fe et Cr pour garder Fe/Cr constant l-c #affiche nos conditions pour vérifier que l'on a bien le bon nombre de degré de liberté c-e #calcule l'équilibre au point de départ défini par s-c l-e,,, #affiche l'équilibre au point de départ (activité / phases / compositions) s-a-v 1 N(ni) 0 1,,, #définition du 1er axe de variation. Ici on veut un diagramme de phase donc 2 données à faire varier : N(Ni) et T s-a-v 2 T 400 1600,,,, #définition du 2e axe de variation map #lancement du calcul qui prendra en compte les 2 axes définis. post #on rentre dans le module POST plot #on demande d'afficher le résultats. Par défaut il affiche les 2 axes de variable ici T en fonction de N(Ni) soit le diagramme de phase. Possibilité de changer l'affichage avec la commande s-d-a