alphaMELTS 1.9 is available at the download and information site.
alphaMELTS 2 standalone & for MATLAB/Python are available on request
(see the Version 2 tab on the download site for more details).
For news of all MELTS software see the MELTS Facebook page.

Main Menu

Updated: enabling the WSL and installing the Rhyolite-MELTS GUI (new for 2020)

Started by Paula, July 04, 2020, 11:34:43 AM

Previous topic - Next topic


For 64-bit Windows 10, it is possible to enable the 'Windows Subsystem for Linux' (WSL) and use the latest rhyolite-MELTS version linked on the alphaMELTS links page. This version of the post assumes you are installing Ubuntu 20.04 LTS on the WSL 1, but instructions for other options are linked. Things that you should type at the command line are in bold in quote boxes; names you should substitute are in italics and comments are preceded by ellipsis (...). Note that by 'command line', we mean the Ubuntu bash shell that opens when you click the 'Ubuntu' program (or select it from the Windows Terminal) and not the Windows Command Prompt (cmd.exe).

There are now two versions of Ubuntu available for the WSL. If you search for 'ubuntu' in the Microsoft Store you will see three versions: 'Ubuntu' and 'Ubuntu 20.04 LTS' are currently the same, though are offered as separate installations; click 'More' under the software description for a fuller explanation. 'Ubuntu 18.04 LTS' is older and was previously called 'Ubuntu', when Ubuntu 16.04 LTS was the other alternative. For most purposes Ubuntu 20.04 LTS should be fine, and is easier to configure than previous Ubuntu WSL versions (especially for WSL 2). If you need to use Ubuntu 18.04 LTS for some reason, then follow the older version of this post.

As of the Windows 10 May 2020 Update (version 2004; build 19041 or higher), it is possible to enable the WSL 2. You can get more information on how to do this in Microsoft's Windows Subsystem for Linux Installation Guide for Windows 10. Whereas the original WSL was a compatibility layer that used Windows system tools underneath, WSL 2 uses virtualization. This potentially improves system performance; see the WSL 1 vs WSL 2 comparison. In our experience, rhyolite-MELTS opens quite a bit faster on WSL 2 that on WSL 1 (even though we have the files stored in the Windows filesystem), but enabling WSL 2 prevents VM alphaMELTS from running. Note that it is a bit more involved to get rhyolite-MELTS running in WSL 2 than WSL 1; X410 does most of the hard work for you (see the Choose and install an X server section) but you will need to edit the '.profile' settings file.

Enable the WSL, install ubuntu and some helper software

  • Open Settings (click either the Start button in the bottom LH corner or the Notification icon in the bottom RH corner; then click the cog icon). Type 'Windows features' in the search box and then select 'Turn Windows features on or off'. Scroll down and check the box beside 'Windows Subsystem for Linux'; click OK and reboot.
  • Open the Microsoft Store and search for 'ubuntu'. Choose 'Ubuntu', or 'Ubuntu 20.04', and select 'Get'.
  • Select 'Launch'. You will be prompted to enter a username and password for Linux. The username is case sensitive; it may, or may not, be the same as your Windows username but you should avoid spaces or special characters in it. The password should be different to your Windows password; you will need to enter it when installing or updating software at the Linux command line.
  • Optionally, download and install VS Code. This can be convenient for editing settings files (especially for WSL 2), as well as rhyolite-MELTS input files.
  • Next return to the Microsoft Store and install 'Windows Terminal'. From now on you should be able to copy commands in these instructions (using Ctrl+C) and then paste them to the Windows Terminal command line by with Ctrl+Shift+V.
Set up the ubuntu command line

  • Open Windows Terminal, if it is not already open. If you click the 'V' drop-down menu 'Ubuntu' (or 'Ubuntu-20.04') should be one of the options.
  • Sometimes Windows Terminal will map Ctrl+C and Ctrl+V to copy and paste (in addition to Ctrl+Shift+C and Ctrl+Shift+V, respectively). You should probably disable that so that Ctrl+C can be used to break out if a program hangs or gets in a loop. In Windows Terminal, go to Settings in the drop-down menu. If you installed VS Code the settings will open in that, but if not you may be asked to choose a text editor e.g. Notepad to edit the settings. Scroll to the bottom. Comment out ('//') or edit the lines under 'keybindings'. For example, you might replace "ctrl+c" and "ctrl+v" with "alt+c" and "alt+v" respectively:
    ... e.g. replace
    { "command": {"action": "copy", "singleLine": false }, "keys": "ctrl+c" }'
    { "command": "paste", keys: "ctrl+v" },

    ... with
    //{ "command": {"action": "copy", "singleLine": false }, "keys": "ctrl+c" }'
    //{ "command": "paste", keys: "ctrl+v" },

    ... or
    { "command": {"action": "copy", "singleLine": false }, "keys": "alt+c" }'
    { "command": "paste", keys: "alt+v" },

  • Note that you can use ubuntu commands and Linux software to modify your regular files on Windows. For WSL 1, you should generally not use Windows programs to modify the ubuntu files (by which we mean the ubuntu system files and the files in your ubuntu home space). So, it's a good idea to keep all your working files in your usual Windows folders and set up links so that you can access them from the command line:
    ... this just ensures that you are in your ubuntu home directory
    ln -sf /mnt/c/Users/your_windows_username/Downloads .
    ... the space between 'Downloads' and '.' is required
    ... if you copy and paste the command then use the left arrow and delete to replace 'your_windows_username' with the actual name of the folder that your Windows files are stored in
    ... if the 'your_windows_username' folder has spaces in its name you need to put a '\' before each one e.g:
    ln -sf /mnt/c/Users/your\ windows\ username/Downloads .
    You can now switch to the folder by typing 'cd Downloads'. If you don't want the link to be called 'Downloads' then replace '.' with your choice of link name e.g. 'MyFiles'. 'ln' stands for 'link'; '-s' is for 'symbolic', so if you delete the link you do not delete the original file (much like Windows shortcuts); '-f' is for 'force', which makes no difference at this point but should you change your mind about where you want the 'MyFiles' link to point to, then is required to overwrite the original.
  • Substitute 'Downloads' and repeat the above for any other folders that you would like to be able to access from the command line while running rhyolite-MELTS, such as 'Documents' or 'Desktop'.
  • For WSL 2 there may be a performance benefit to storing working files in ubuntu, but it will be easier to keep regular backups if you transfer the output to a Windows folder. So it is probably still worth setting up links.
  • Finally before we continue to the next step, we want to move a settings file that may be overwritten. The original Ubuntu WSL didn't have this file, but the Ubuntu 20.04 LTS version does.
    ... this just ensures that you are in your ubuntu home directory
    mv .profile profile_backup
    ... where there is a space before the '.' but not after; a file beginning with with '.' is a hidden file in Linux
Install alphaMELTS or alphaMELTS 2 (optional)

If you want to install alphaMELTS, then if you do that now it will do the next steps for you. Download the file. You should be able to unzip it on Windows. Put the extracted folder in 'Downloads' (or your choice of folder, as long as you have set up a link to it in ubuntu). Open ubuntu, if it is not already open. Navigate to the folder where is using 'cd' (which stands for 'change directory'). E.g:
cd Downloads
cd alphamelts_

... if you press the 'tab' key at this point it should complete the folder name
... depending how you extracted the files, you may to repeat the previous command to descend into the folder where the .command scripts are
For alphaMELTS 2 using the same procedure but substitute 'install2.command' for 'install.command', and 'package' for 'alphamelts_wsl_version'; 'install2.command' will select the appropriate executable for the operating system ('alphamelts_linux' in the case of the WSL).

Choose the default settings offered by install(2).command i.e. press 'enter' to each folder suggestion, and then 'y' when it asks whether to continue with the installation. This means it will make a 'bin' folder for you to put links in, set the Path to include the 'bin' folder, and set up the DISPLAY variable that rhyolite-MELTS will need (though if you decide to use the WSL 2 you will need to edit the DISPLAY variable).
mv .profile profile
... where there is a space before the '.' but not after; a file beginning with with '.' is a hidden file in Linux
cat profile_backup profile > .profile
Finally close the ubuntu tab (type 'exit' or use the X in the top right hand corner) and open it again.

If you did not install alphaMELTS 1.X

This step make a 'bin' folder, which is short for 'binary' and is a folder where we will put a link (shortcut) to rhyolite-MELTS. It will set the Path to include the 'bin' folder,  so that you can run rhyolite-MELTS from anywhere on the system. It also sets up the DISPLAY variable that rhyolite-MELTS will need. Open ubuntu, if it is not already open:
... this just ensures that you are in your ubuntu home directory
mkdir bin
... which means make a directory called 'bin' (where 'directory' is what is called 'folder' on Windows)
... this downloads a settings file because going through a Windows-based browser causes problems with line-endings etc.
cat profile
This last command just prints the file we just downloaded, so we can check that it downloaded OK before using it. The output should look like this:
# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    export PATH

# For the Rhyolite-MELTS graphical user interface on the Windows Subsystem for Linux with Xming
if [[ $(uname -r) =~ Microsoft ]] ; then
   export DISPLAY=:0

# For the Rhyolite-MELTS graphical user interface on Macs, using the 10.8+ or 10.12+ executable:
# If you get "Segmentation fault: 11" (10.8+) or "Illegal instruction: 4" (10.12+)
# then include the following and try the 10.8+ executable.
if [[ $(uname) =~ Darwin ]] ; then
   export DYLD_LIBRARY_PATH=/opt/X11/lib/flat_namespace:$DYLD_LIBRARY_PATH
If it does then type you can continue. If you decide to use the WSL 2 you will need to edit the DISPLAY variable in the .profile file. Otherwise:
cat profile_backup profile > .profile
... where there is a space before the '.' but not after; a file beginning with with '.' is a hidden file in Linux
... this closes ubuntu; when you next open it the settings file will be read and acted upon

Download and set up rhyolite-MELTS

  • Download the 64-bit Ubuntu 18.04 LTS rhyolite-MELTS/pMELTS executable from the alphaMELTS links page. You should be able to unzip it on Windows. Put the extracted file in 'Downloads' (or your choice of folder, as long as you have set up a link to it in ubuntu). Open ubuntu, if it is not already open:
    cd ~/bin
    ... '~' is shorthand for your home space on ubuntu
    ln -sf ../Downloads/Melts-rhyolite-public Melts-rhyolite
    ... see the 'Set up the ubuntu command line' section for an explanation of the 'ln' command; note that '..' means up one directory level
    Since we added the 'bin' folder to the Path you will be able to open rhyolite-MELTS from any folder by typing 'Melts-rhyolite'. (Without these settings you would need to navigate to the folder containing Melts-rhyolite-public and type './Melts-rhyolite-public', where '.' means the current directory.)
  • If you installed VS Code then type 'code'. The first time it will install VS Code Server, which allows you to open files stored in ubuntu for editing. As noted above, you should only store/edit files on ubuntu if you are using WSL 2.
  • You shouldn't need to install anything else within ubuntu, but you will want to apply updates from time to time. 'apt' is the ubuntu package manager. If you get a message about updates being available then type the following:
    sudo apt update
    ... enter your password
    sudo apt upgrade
    sudo apt full-upgrade

    ... choose 'y' as appropriate

Choose and install an X server

You will need to install an X server. We recommend X410 for simplicity, especially if you have a HiDPI screen, and have tested it on WSL 1 and WSL 2. It is a paid app with a nominal price of ~$50, but is seemingly always on sale so the price is actually closer to $10. To install X410 you will need a Microsoft account. There is a free trial option or you can buy it if you have a payment option set up. Open the Microsoft Store and search for 'X410'. If you are not able to install X410, then Xming is an affordable alternative (~$15) that we have tested on WSL 1, but not WSL 2 (pros and cons of Xming versus X410 are described on the earlier version of this post). There are also free alternatives but we have not tried them out.

Start X410 by double-clicking. Test rhyolite-MELTS by typing 'Melts-rhyolite' at the command line and 'n' to select version 1.0.2. If the display is very small, x410 has an option to fix the scaling. Scroll down to the 'Built-in DPI Scaling: section of Running X410 on HiDPI Screens. For rhyolite-MELTS try the 'Default' setting first, but if this doesn't work (x410 crashes) then try 'High Quality'; for other software you will probably be able to use 'High Quality'. See other Howto entries on the Choung Networks site for more details, including how to use X410 with WSL 2.

You will not need to repeat all these steps next time. Just select 'Ubuntu' from the Windows Terminal program, navigate to the folder where your input (.melts) files are, and type 'Melts-rhyolite'.

Any problems, please let me know,