Author Topic: [FAQ] Where are my rhyolite-MELTS output files?  (Read 2568 times)

Paula

  • Administrator
  • Hero Member
  • *****
  • Posts: 467
    • View Profile
    • My GPS Division profile
[FAQ] Where are my rhyolite-MELTS output files?
« on: November 25, 2017, 09:13:19 am »
We often get messages that go something like this:
Quote
I used the downloaded rhyolite-MELTS. I was able to input a composition, save it to a .melts file in MyFolder, and run the calculation successfully. The program said that the output had been recorded to melts.out but it is not in MyFolder and not in the folder where Melts-rhyolite-public is. I cannot find melts.out or any other output files in Finder either.

The problem is probably that the user double-clicked the Melts-rhyolite-public executable to open it. On *nix if the Melts-rhyolite-public file is double-clicked, the behaviour will be as expected i.e. it will open in the folder where it is located (though on Linux there may be other issues with double-clicking). On Mac it will always open in your home space (i.e. /Users/your_username). Furthermore, by default Finder does not have the user's home space listed in the Sidebar. So, unless you use Spotlight to search for melts.out, you are unlikely to find the rhyolite-MELTS output files by browsing in Finder.

A better approach is to open the Terminal program. Navigate to the folder where the Melts-rhyolite-public is located, using 'cd path_to_MELTS' (cd = 'change directory'). Then type './Melts-rhyolite-public'. This way rhyolite-MELTS will always open in the path_to_MELTS folder. When you open one of the .melts file input/output dialogues it will start in path_to_MELTS, and the melts.out and the .tbl output will be written to path_to_MELTS (you don't get any choice about this location).

Whilst it is an improvement on double-clicking the Melts-rhyolite-public executable, always running rhyolite-MELTS in the same place can also be problematic. You need to explicitly move all the .tbl files out of the folder between rhyolite-MELTS runs. Otherwise, if the phase assemblage differs between run 1 and run 2, melts.out and all the .tbl files for phases in run 2 will be overwritten but any other .tbl files from run 1 will still be hanging around. If you use the Combine tbl function from MELTS for Excel you will get a mixture of results from both runs.

Better is to make sure Melts-rhyolite-public, or a link to it, is in your Path. That way can make a new folder for the current run's output, and open rhyolite-MELTS in it the (empty) folder via Terminal. If you have worked through the Rhyolite-MELTS error: "Illegal Instruction: 4" or "Segmentation fault: 11" fix, or have installed alphaMELTS you have almost everything ready. Otherwise, see the How to edit .profile (or .bash_profile) section below.

If you have not installed alphaMELTS then open Terminal, if it is not already open, and type the following:
Quote
mkdir ~/bin
If you have installed alphaMELTS, but you did not use the default location for the links_folder (i.e. '~/bin') then substitute links_folder for 'bin' in the following.

You can either put the Melts-rhyolite-public executable in the 'bin' folder or you can put it elsewhere and make a link to it (similar to an 'alias', or 'shortcut' on Windows). Don't do both of these things though, as it is possible on Mac to overwrite a file with a link to itself! To make a link to the Melts-rhyolite-public executable when it is located in, say, the 'Documents' folder type this in Terminal:
Quote
cd ~/bin
... you need to navigate to where the link it going to be, not where the Melts-rhyolite-public executable is
ln -sf ../Documents/Melts-rhyolite-public Melts-rhyolite
... note that '..' means up one directory level
I use 'Melts-rhyolite' as the name for the link, to distinguish it from the file that it is pointing to (and to help avoid accidental overwriting). If you want the link to be called 'Melts-rhyolite-public' then replace 'Melts-rhyolite' with '.', or put your own name for the link. '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 if the location of the target executable changes (e.g. a newer version of the rholite-MELTS GUI become available or you move the Melts-rhyolite-public file for some reason) then this is required to overwrite the original link.

Finally, exit Terminal and open it again. You should be able to navigate to a folder in Terminal, and open rhyolite-MELTS there:
Quote
mkdir melts_output_folder
... if the folder does not already exist
cd melts_output_folder
Melts-rhyolite
... note that there is no './' in front of 'Melts-rhyolite'
When you are finished the run, melts.out and all the .tbl files should be in melts_output_folder.

How to edit .profile (or .bash_profile)

The .profile and .bash_profile files are hidden, which can make them a bit difficult to edit on Mac. The following section works through how to do that. 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 (...).
  • The first thing to check is whether you have .profile or .bash_profile. Open Terminal, if it not already open.
    Quote
    cd
    ... this just ensures that you are in your home directory
    ls -a
    ... 'ls' stands for 'list' and '-a' for 'all' so it shows all file in your home directory
    If you have either .profile or .bash_profile then skip to part 3; otherwise go to part 2.

  • If you have neither .profile or .bash_profile you can download the example profile file from the alphaMELTS GitList server. Right-click on 'Raw' and choose 'Save File As...' or similar. Then open Terminal:
    Quote
    cd path_to_the_downloaded_file
    ... the path will usually be 'Downloads' by default
    cat profile
    ... then press the 'tab' key, before hitting 'return', as your browser may have added '.txt' to the end of the filename
    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:
    Quote
    # ~/.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
        PATH="$HOME/bin:$PATH"
        export PATH
    fi

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

    # 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
    fi
    If it does then type you can continue:
    Quote
    mv profile ~/.profile
    ... add '.txt' or press the tab key after the first 'profile', if needed, to complete the file name
    ... '~' is shorthand for your home space on Mac
    ... there should be no space before or after the'.'

  • If '.bash_profile' exists you should edit that, otherwise edit '.profile'. Open the Terminal program, if not already open:
    Quote
    open .profile
    ... substitute '.bash_profile' if appropriate
    ... you should find that it opens in your default text editor
    open -a TextEdit .profile
    ... use this alternative command if your default text editor is not TextEdit, but you want to use it here
    Copy and paste (Apple Key + c, and Apple Key + v respectively) the necessary line(s) and add it to the bottom of the '.profile' file.
    Quote
    # set PATH so it includes user's private bin if it exists
    if [ -d "$HOME/bin" ] ; then
        PATH="$HOME/bin:$PATH"
        export PATH
    fi


If bash is not your default shell

In macOS Catalina the default shell is zsh, but if you upgraded from Mojave then you may still have bash. Similarly, if your machine is (considerably) older, or if it is a university machine then you should check whether bash, or tcsh, is the default shell. One way to do this is the open the Terminal program and type 'echo $0' (that is 'zero', not uppercase 'o') at the command line. If it says '-zsh' or '-tcsh' then you will need to type 'bash -l' and press enter (that is lowercase 'L', not 'one') each time you open Terminal, before starting rhyolite-MELTS.

Hope this helps!
Paula


« Last Edit: November 02, 2020, 12:58:52 pm by Paula »