Running a thermal expansion simulation for FCC Aluminum

Hello,

I have never used Lammps and the KIM api before, and I wanted to get a very simple lattice parameter versus temperature curve for Aluminum using the Mendelev potential
(https://openkim.org/dev-kim-item/TE_957040092249_000-and-MO_106969701023_002-tr)

It seems like this has already been done, as the above link shows the result for the coefficient of thermal expansion, which is just the slope of the curve that I wish to plot. I wished to get some guidance about what’s the best way to tweak the thermal expansion test to get the plot I want.

I use a Mac (OS X 10.9.5) and downloaded the latest lammps and kim-api tarballs from the corresponding websites, but I am struggling to install the KIM_API, which I thought was necessary before i went along installing Lammps.

I tried ./configure in the kim-api-v1.8.2 folder, but that somehow didn’t find any compilers

checking for the GNU Compiler Suite (gcc, g++, gfortran)… no

checking for the INTEL Compiler Suite (icc, icpc, ifort)… no

unable to identify a complete compiler suite. Exiting.

Then I tried just using ‘make’ by renaming the example makefile, but it gave me an error saying:

make: *** No rule to make target `/Users/Ishan/kim-api-v1.8.2/build_system/Makefile.Generic’. Stop.

Can someone please guide me through this process?(If possible, both the installation of KIM and Lammps?) Thank you very much in advance!

Sincerely,
Ishan Tembhekar

Hello Ishan,

Thanks for your message. I'll try to walk you through the process.

Things are a bit more complicated on OS X due to the lack of a native fortran compiler and some bugs in the gfortran compiler on OS X....

First, you need to get a consistent set of compilers (c, c++, and fortran are all required) installed on you mac.

I recommend the homebrew (https://brew.sh) system. Unfortunately, homebrew has ended support for OS X 10.9.

In that case, I would suggest the MacPorts (https://www.macports.org) system which appears to still have support for 10.9 (Mavericks). (I'm afraid I've never used macports, so I won't be much help in getting is setup...) With macports you will need to install the GNU compiler collection (GCC) version 4.8 or later. You will also need to be sure that the GCC is compiled with the "multi-lib" option so that you can compile for 32 bit execution (this is due to a gfortran bug on os x). I think to do this with macports you need to use the "universal" option, as in

   port install gcc48 +universal

Once you have this done, I think the kim api will configure and compile OK for you.

(alternatively, you could consider using virtual box and vagrant (or docker, etc.) to setup a Ubuntu or other Linux virtual environment which is more straight forward to work with...)

I think we can leave it here for now. Once you have this worked out send a new message and we can help you with using and modifying the Test you mention.

Cheers,

Ryan

Hello Prof Elliot,

Thank you so much for the lightening fast response! I did what you mentioned, and then tried ./configure, but it didnt work. I am wondering if I have to put any additional flags in the command ? My terminal looks like this: (at this point, I had just put the port install command once again to double check)

Ishans-MacBook-Pro:kim-api-v1.8.2 Ishan$ sudo port install gcc48 +universal

Password:

—> Computing dependencies for gcc48

—> Cleaning gcc48

—> Scanning binaries for linking errors

—> No broken files found.

Ishans-MacBook-Pro:kim-api-v1.8.2 Ishan$ ./configure

checking for the GNU Compiler Suite (gcc, g++, gfortran)… no

checking for the INTEL Compiler Suite (icc, icpc, ifort)… no

unable to identify a complete compiler suite. Exiting.

Ishans-MacBook-Pro:kim-api-v1.8.2 Ishan$

Thank you once again, for all the help!

Sincerely,
Ishan

Hi Ishan,

Good progress, I think.

Probably your shell environment needs to be updated in order to find the newly installed compilers.

Try just opening a new terminal window and see if it works from there. Otherwise, you'll need to figure out how to get the following commands to execute without error from the command line:

    gcc \-\-version     g++ --version
   $ gfortran --version

This page might be helpful

https://guide.macports.org/chunked/installing.shell.html

Another possibility is that macports installed the compilers with different names. For example, with homebrew I have gcc as gcc-4.8

To deal with this sort of situation you need to use arguments to the configure script. In particular, here is the command I have to use to get things to work on my macOS (10.12) system.

$ ./configure "--prefix=/Users/relliott/local" "--system-arch=32bit" "LDFLAGS+=-read_only_relocs suppress" "CXX=g++-4.8" "CC=gcc-4.8" "FC=gfortran-4.8"

In this case, I'm setting the install location to /Users/relliott/local and then compiling in 32 bit mode and adding a flag for the liner (due to a gfortran bug on os X) and setting the names of the compilers.

See how it goes and let us know how you get along.

Cheers,

Ryan

Hi Prof Elliot,

I think I made some progress. (all the things I try, are in a new terminal, to make sure that stuff like the .profile is properly sourced)

i installed gfortran for mavericks because I couldn’t find it, from an online source here, and then modified the command you provided a bit, to successfully construct a Makefile!

But despite giving the LD path the location for the gfortran libraries (also modified in .profile, in addition to providing in the command line), it is giving the following error:

Ishans-MacBook-Pro:kim-api-v1.8.2 Ishan$ ./configure “–prefix=/Users/Ishan/Desktop/kim” “LDFLAGS+=/usr/local/gfortran/lib” “CXX=/usr/bin/g++” “CC=/usr/bin/gcc” “FC=/usr/local/bin/gfortran”

checking for the GNU Compiler Suite (gcc, g++, gfortran)… yes

checking for the system linker… Darwin

checking for the system architecture… 64bit

using link type of… dynamic-load

configure: creating ./config.status

config.status: creating ./Makefile.KIM_Config

Ishans-MacBook-Pro:kim-api-v1.8.2 Ishan$ make

Creating… KIM_Config file… src/Makefile.KIM_Config.

Creating… KIM_Config file… src/utils/Makefile.KIM_Config.

Creating… KIM_Config file… src/model_drivers/Makefile.KIM_Config.

Creating… KIM_Config file… src/models/Makefile.KIM_Config.

Creating… KIM_Config file… examples/Makefile.KIM_Config.

Creating… KIM_Config file… examples/models/Makefile.KIM_Config.

Creating… KIM_Config file… examples/model_drivers/Makefile.KIM_Config.

Creating… User Config file… /Users/Ishan/Downloads/kim-api-v1.8.2/.kim-api/config-v1.

Creating… KIM_Config_Helper file… examples/openkim_tests/Makefile.KIM_Config_Helper.

Creating… KIM_Config_Helper file… examples/simulators/Makefile.KIM_Config_Helper.

Ishans-MacBook-Pro:kim-api-v1.8.2 Ishan$ ./configure
"--prefix=/Users/Ishan/Desktop/kim" "LDFLAGS+=/usr/local/gfortran/lib"
"CXX=/usr/bin/g++" "CC=/usr/bin/gcc" "FC=/usr/local/bin/gfortran"

It might be as simple as changing

"LDFLAGS+=/usr/local/gfortran/lib"

to

"LDFLAGS+=-L/usr/local/gfortran/lib"

it that doesn't work,

run configure again with the --build-verbosity=full option and send the output of make....

Ryan

Hi Prof Elliot,

You are absolutely right! That change worked! I followed it with make install, which created the kim folder on my Desktop.
Does this mean I am all set with kim-api? Would the next steps be to try and install lammps with the kim libraries linked? I am unsure what comes next.

Thank you once again!

Sincerely,
Ishan

Hi Ishan,

Great! Actually, this is quite interesting. I was not aware of the binary gfortran packages for OS X. It looks like they may have figured out how to avoid the gfortran bug that I was alluding to... (the need to use 32bit was part of the bug workaround that I had found.) I'll have to try out these binaries on my own setup... !

Anyway, Yes, your next step should be to (1) put the kim-api bin directory on your global path and then (2) build lammps with its kim package:

(1) you probably also need to do:

   make install-set-default-to-v1

then make sure that the "kim-api-build-config" utility is on the path.

(2) Now you should be ready to build lammps from the lammps/src directory

make yes\-kim make mpi # or make serial etc...

Ryan

Hi Prof Elliot,

(1) Done and
(2) Done.

The lammps make mpi serial command took a few mins, but seems to have created a bunch of object files and finished without errors. I did not give any specific paths, so I guess it is installed globally and I can just use “lammps …blah” ?

I have also downloaded the download and download dependencies from here, so maybe I can now modify it? Or would you say I have ways to go before I get there?

Thank you so much once again. I really, really appreciate this help!

Sincerely,
Ishan

I did not give any specific paths, so I guess it is installed globally and I can just use "lammps ...blah" ?

lammps usually doesn't install anywhere. The executable is generally just found in the lammps/src/ direction.

I have also downloaded the download and download dependencies from here
<https://openkim.org/dev-kim-item/LinearThermalExpansionCoeff_fcc_Al__TE_957040092249_000>,
so maybe I can now modify it? Or would you say I have ways to go before I
get there?

There are some more steps...

Take a look at the attached presentation that I just gave yesterday at the LAMMPS 2017 workshop (this presentation will eventually be posted at the workshop website: http://lammps.sandia.gov/workshops.html).

The presentation shows how to run a different test, but should give you a good idea of how to simply run the test you are interested in. If you get that working, then you will probably want to learn more by reading through the Test Driver "runner" code (a python script) and then the "lammps.in.template" file which is part of the Test Driver that you are interested in.

Cheers,

Ryan

LAMMPS-KIM-tutorial-2017.pdf (5.29 MB)

Hi Prof Elliot,

Thank you so much for the presentation. I will look through it and get back to you if I have more queries.

I did take a look at the models and the python script “runner” from the files I downloaded yesterday. I guess the main step I am missing is how to load these models on kim so that I can run…well…‘runner’.

(There was a command in there "cmd = ‘lammps -in ’ + lminput + ’ > output/screen.out’ which made me think that I had to have lammps installed somewhere…I guess the question was silly in retrospect)

In the presentation it seems like one can load the necessary models by running the Install.py script (which I don’t think exists in the latest version that I can download, which is 31Mar-17)

Since my last email, I did the following things:

  1. I compiled lammps as a shared library (i guess it is not important but did it so that I can use it with python in the future)
    make yes-kim
    make serial mode=shlib
    make install-python

This worked just fine, and I even ran the python test given on lammps website which didn’t give errors

  1. in the lammps/src folder, this generated an executable lmp_serial
    I used it to test kim by running the example in.kim.lj.lmp from the src directory (as is given in the presentation too)
    I got that working as well.

Now I think the only step I am missing is to load the model for thermal expansion for the specific potential and the general dependency as given online.
I guess reading the presentation will give me a better idea on how to do that. Once I figure that out, I should be able to tweak the ‘runner’ file to get the test I want.

Thank you once again for your time and your help!

Sincerely,
Ishan

Hi Prof. Elliot,

I went through the presentation, which is extremely helpful, and I think I understood where my mistake was.
Right in the beginning, when I downloaded the kim-api from the website, after the configure step that we talked about above, I should have added all models using ‘make add-OpenKIM’ before running the ‘make all’ and ‘make install’ command. (Instead I proceeded to do “make” without actually adding anything, and that had completed without errors. After that I had gone on to install lammps and gotten stuck there. )

So I tried doing that, but that didn’t go according to plan. Before adding all the models, I tried adding all the examples, and I am facing some system architecture errors which I think are because of gfortran maybe? This is what I am doing:

guest-docking-lee-1-0067:kim-api-v1.8.2 Ishan$ make add-examples

  • adding… ex_model_driver_P_LJ … copied to /Users/Ishan/Downloads/kim-api-v1.8.2/src/model_drivers

  • adding… ex_model_driver_P_Morse … copied to /Users/Ishan/Downloads/kim-api-v1.8.2/src/model_drivers

  • adding… ex_model_Al_PF_ErcolessiAdams … copied to /Users/Ishan/Downloads/kim-api-v1.8.2/src/models

  • adding… ex_model_Ar_P_LJ … copied to /Users/Ishan/Downloads/kim-api-v1.8.2/src/models

  • adding… ex_model_Ar_P_MLJ_C … copied to /Users/Ishan/Downloads/kim-api-v1.8.2/src/models

  • adding… ex_model_Ar_P_MLJ_CLUSTER_C … copied to /Users/Ishan/Downloads/kim-api-v1.8.2/src/models

  • adding… ex_model_Ar_P_MLJ_CLUSTER_F03 … copied to /Users/Ishan/Downloads/kim-api-v1.8.2/src/models

  • adding… ex_model_Ar_P_MLJ_F03 … copied to /Users/Ishan/Downloads/kim-api-v1.8.2/src/models

  • adding… ex_model_Ar_P_MLJ_MI_OPBC_H_F … copied to /Users/Ishan/Downloads/kim-api-v1.8.2/src/models

  • adding… ex_model_Ar_P_MLJ_NEIGH_PURE_H_F … copied to /Users/Ishan/Downloads/kim-api-v1.8.2/src/models

  • adding… ex_model_Ar_P_MLJ_NEIGH_RVEC_F … copied to /Users/Ishan/Downloads/kim-api-v1.8.2/src/models

  • adding… ex_model_Ar_P_Morse … copied to /Users/Ishan/Downloads/kim-api-v1.8.2/src/models

  • adding… ex_model_ArNe_P_MLJ_NEIGH_RVEC_F … copied to /Users/Ishan/Downloads/kim-api-v1.8.2/src/models

  • adding… ex_model_Cu_PF_Johnson … copied to /Users/Ishan/Downloads/kim-api-v1.8.2/src/models

  • adding… ex_model_Ne_P_fastLJ … copied to /Users/Ishan/Downloads/kim-api-v1.8.2/src/models

  • adding… ex_model_Ne_P_LJ … copied to /Users/Ishan/Downloads/kim-api-v1.8.2/src/models

  • adding… ex_model_Ne_P_LJ_NEIGH_PURE_H … copied to /Users/Ishan/Downloads/kim-api-v1.8.2/src/models

  • adding… ex_model_Ne_P_MLJ_NEIGH_RVEC_H … copied to /Users/Ishan/Downloads/kim-api-v1.8.2/src/models

  • adding… ex_model_Ne_P_Morse … copied to /Users/Ishan/Downloads/kim-api-v1.8.2/src/models

guest-docking-lee-1-0067:kim-api-v1.8.2 Ishan$ make all

Hi Ishan,

Yes, this is the gfortran bug I mentioned. (Last night I confirmed that the OS X gfortran binaries you are using also have this bug....)

To get around this, you need to use the following configuration options

"--system-arch=32bit"

and

"LDFLAGS+=-read_only_relocs suppress"

Then things should work from the kim api side.

This will also mean that you need to compile lammps in 32bit mode. (g++ -m32)

Ryan