Version 2 (modified by toby, 3 years ago) (diff)


Compiling GSAS-II Fortran Modules for Windows

GSAS-II requires a small number of Fortran routines that are incorporated as Python packages (.pyd files). GSAS-II is distributed with these files compiled for a number of python versions, but if you are using something that does not match what we distribute, you may need to compile the Fortran routines yourself using the NumPy f2py routine and the compiler of your choice. Both G77 (32-bit Python only) and GFortran have been successful on the platforms we have tried.

Probably the easiest way to do this is with the Anaconda Python distribution, which allows a compiler and scons to be installed in a single step:

conda install scons numpy m2w64-gcc-fortran

You may want to specify a particular numpy version using

conda install scons numpy=1.17 m2w64-gcc-fortran

To help with compiling the programs, use the Python scons routine inside the GSASII\fsource directory. If you are lucky, this routine will find the needed compiler and python program, set all options correctly for you and run all steps needed to prepare the .pyd files. This is done by

(1) running cmd.exe to open a "DOS" window,

(2) use the volume name (when not C:) and the cd command to set your working directory to ...\GSASII\fsource and

(3) simply typing "scons" in the window. There will be a very large volume of output on the console; it should say "scons: done building targets." at the very end if successful.

If you need to change any options, type "scons help" to see a list of the possible command-line arguments and the values for the options. For testing, help can be used with command-line options to see how they will change the variables.