Building LCModel

In this instance, the outcome was identical with and without -ffast-math. That said: these are simple mega-press datasets quantified with the mega-press-3 sptype (implies nobase: no baseline model) and nsimul=0, so it’s also possible that the minor differences arise in one of those areas…

1 Like

So I finally got around to building LC Model on my MAC. Seems to have worked fine (once I modified the test control file from Martin appropriately).

I will have to add the LCModel directory to my PATH and do a few more things to optimise it’s usage - but underway at least.
Next question though,
Does anyone know where I can find a tool to convert Philips .SDAT/.SPAR data to LCModels RAW format?
I have some old datab previously run using LC-Model, and want to see how this build compares. (I saved the RAW files for the WS data, but not the USW files).

Hey Paul,

In R you could do:

read_mrs("in_file.SPAR") %>% write_mrs("out_file.RAW", format = "lcm_raw")

I managed to compile the code on Visual Studio 2017 with the Intel Fortran compiler for Windows 10 platform. I’ve compiled for both x86 and x64 but no noticeable differences in the performance (I too got almost instantaneous processing time with 32-bit).

I could share the VS project folder if anyone’s interested.

1 Like

Hi Paul,

FID-A works as well using the io_loadspec_sdat and io_lcmwrite functions. Osprey uses them to (optionally) save the final pre-processed data.

Good luck!

1 Like

@admin Thanks so much for these useful instructions! I ran Osprey-generated files on my macOS Big Sur and got identical results as with the official build.


Has anyone had any luck getting the makebasis command to run? I’m on a mac and can run data using a control file but haven’t been able to do anything else.

yes that would be great, was also planning on giving the windows compile with VS a try


I have uploaded the VS2017 project file to GitHub. Let me know if you have any issues (this is my first attempt at using the “GitHub plugin for VS” so it may have errors)


Worked like a charm, downloaded the project and have compiled in VS2019 using bot the IFX Intel® Fortran Compiler and IFORT Intel® Fortran Compiler Classic.

Was able to compile both the win32 and x64 versions and both give output.
For me it seemed like the x64 was slightly faster.


1 Like

Hi @TiffanyB,

Afraid we didn’t get the code for makebasis. As far as I’m aware, we only have the linux binary for this.

There are a few preprepared basis sets available from:

spant had a function that does a simelar job to makebasis for simulated basis signals:

basis <- sim_basis_1h_brain_press(lcm_compat = TRUE)
write_basis(basis, "your_basis_file.BASIS")



Excellent function, @martin !

@TiffanyB, I think the original makebasis function was designed to process in-vitro spectra, so it looks for all sorts of funky peaks like formate and the DSS standard.
With simulated data, we can omit almost all of these tedious steps and just write them into the .basis file with the appropriate header info. Martin’s function should do that just fine - in Osprey, we have a function io_writelcmBASIS as well that converts an Osprey basis set (i.e. a collection of FID-A structures) into an LCModel .basis file.

What format do your basis functions come in?

1 Like

I ended up installing it on a linux VM which worked, but that’s really handy to know both of those options are out there, thank you!

Cheers Georg, and @martin and @TiffanyB for the make_basis discussion, that was going to be my next set of questions - when I get the chance to get back to tinkering with data again, but glad to see some one has asked it for me!

Has anyone tried to compile LCModel on macOS Big Sur on a Mac with an Apple Silicon M1 chip? I downloaded the relevant (though experimental) gfortran version, but I get a bunch of errors when I try to compile using @admin’s instructions.

So they gave you a fancy new computer, I see :wink:
What are the errors you get?

Yep :slight_smile:

I’ve attached a markdown file containing the messages I get when I run the first line of the compiling instructions. There’s a bunch of warnings and then a bunch of errors (from line 97). It’s not clear to me what may be going wrong. (98.9 KB)

For Windows users, here is a quick and easy way to run Ubuntu Linux within Windows 10 using the included Hyper-V (Virtualization) Manager:


Hi @mmikkel, have you solved this, and do you know if this is a Big Sur issue - or an M1 chip issue?
I’ve recently upgraded my OS to Big SUR, but still have an intel chip set, so may want to check my LC-MODEL build still works. It’s been a while since I’ve gotten my hands dirty with data, but I’m trying to get back to it. Hope the new Job post is working out. @admin I saw your recent tweets about the new version of Osprey including LCModel, so will be investigating that as well.

1 Like

I just updated my Intel i5 MacBook to Big Sur 11.5.2, and the executable compiled on Catalina still produces an identical output.