KLIFF and GULP

Dear Developer,

I hope this message finds you well. I am reaching out to you for assistance as I am currently working with the KLIFF software to fit a potential function. Once I have obtained the potential function, I am uncertain about how to proceed with invoking it within GULP. Following the official examples, I attempted to use the kim_model command, however, the energy output I received was zero.
Upon further investigation and consultation with relevant forums, it appears that there is a requirement to compile both KIM and GULP. I am writing to inquire if you could provide guidance on how to achieve this compilation process.
Given that my proficiency in programming is limited, I would greatly appreciate it if you could offer a detailed example or a step-by-step guide to assist me through this process. Your prompt response would be eagerly anticipated and is of immense help to me.
Thank you very much for your time and assistance in this matter.

Warm regards,

Li Ma

Hi,

Do you get zero energy with existing KIM models from OpenKIM.org as well, or only with your own model fitted with KLIFF?

Whether it’s the existing models on OpenKIM.org or the models I fitted using KLIFF, I have installed both, but the energy I obtain is zero in both cases. This issue is likely related to compilation, but I am unsure of how to address it. I hope you can provide some insight or a solution.

I have never used GULP before, but I was able to install it and run a KIM model just now. If we are having complicated issues, we may have to ask in the GULP forum (I know that you already asked and got no response, but I think with more information you may get a better response).

Here is some basic questions and info.
I was able to run the basic GULP example on the openkim.org front page as follows:

  1. I downloaded and extracted GULP 6.2, and was able to compile it with KIM support by running
    ./mkgulp -k
    from the Src directory.
  2. I installed the required potential by running
    kim-api-collections-management install user LJ_Shifted_Bernardes_1958HighCutoff_Ar__MO_242741380554_004
  3. Then, I was able to run the example and get a reasonable output.

Can you try these steps and see if you get a reasonable output? If not, can you attach your output file?

Thank you very much for your help. After switching to the GULP-6.2 version, I was able to successfully run the official example case (ex_model_Ar_P_LJ) of GULP. However, when I executed the command ‘kim-api-collections-management install user LJ_Shifted_Bernardes_1958HighCutoff_Ar__MO_242741380554_004’ to install the required potential, GULP output an error with the message ‘ERROR: error calling KIM model create’. I have uploaded the relevant files to the compressed folder. Upon executing the command ‘kim-api-collections-management list’, the installed potential is shown in the figure below:

test-ex_model_Ar_P_LJ.zip (9.1 MB)

test-LJ_Shifted_Bernardes_1958HighCutoff_Ar__MO_242741380554_004.zip (9.1 MB)

Thank you again for your help.

Curious. I wonder if the issue is some weirdness with Conda directories. Instead of doing
kim-api-collections-management install user ..., can you try kim-api-collections-management install system ...?

You will first need to delete the items from your user collections using
kim-api-collections-management remove LJ_Shifted_Bernardes_1958HighCutoff_Ar__MO_242741380554_004
kim-api-collections-management remove LJ_Shifted__MD_498634107543_004

Thank you for your reply. I have deleted the original model and tried the following three commands, but all of them failed. I have uploaded the relevant files for your review.
kim-api-collections-management install user LJ_Shifted_Bernardes_1958HighCutoff_Ar__MO_242741380554_004
kim-api-collections-management install system LJ_Shifted_Bernardes_1958HighCutoff_Ar__MO_242741380554_004
wget https://openkim.org/download/LJ_Shifted_Bernardes_1958HighCutoff_Ar__MO_242741380554_004.txz
kim-api-collections-management install user LJ_Shifted_Bernardes_1958HighCutoff_Ar__MO_242741380554_004.zip (9.6 MB)
kim-api-collections-management install system LJ_Shifted_Bernardes_1958HighCutoff_Ar__MO_242741380554_004.zip (9.6 MB)
wget httpsopenkim.orgdownloadLJ_Shifted_Bernardes_1958HighCutoff_Ar__MO_242741380554_004.txz.zip (9.6 MB)

Can you post the output of kim-api-collections-management list after kim-api-collections-management install system LJ_Shifted_Bernardes_1958HighCutoff_Ar__MO_242741380554_004?

(kliff_env) user@user-virtual-machine:~/test$ kim-api-collections-management install system LJ_Shifted_Bernardes_1958HighCutoff_Ar__MO_242741380554_004
Downloading… LJ_Shifted_Bernardes_1958HighCutoff_Ar__MO_242741380554_004
This item needs its driver ‘LJ_Shifted__MD_498634107543_004’, but it is not currently installed.
Trying to find it at openkim.org.
Downloading… LJ_Shifted__MD_498634107543_004
[100%] Built target LJ_Shifted__MD_498634107543_004
Install the project…
– Install configuration: “Release”
– Installing: /home/user/anaconda3/envs/kliff_env/lib/openkim-models/model-drivers/LJ_Shifted__MD_498634107543_004/libkim-api-model-driver.so
[100%] Built target LJ_Shifted_Bernardes_1958HighCutoff_Ar__MO_242741380554_004
Install the project…
– Install configuration: “Release”
– Installing: /home/user/anaconda3/envs/kliff_env/lib/openkim-models/portable-models/LJ_Shifted_Bernardes_1958HighCutoff_Ar__MO_242741380554_004/libkim-api-portable-model.so

Success!
(kliff_env) user@user-virtual-machine:~/test$ kim-api-collections-management list

Knowledgebase of Interatomic Models (KIM) — Model Collections Listing

kim-api :
kim-api 2.3.0+GNU.GNU.GNU
kim-api-uid :
2.3.0+GNU.GNU.GNU.2023-12-14-00-51-00

kim-api configuration file:
/home/user/.kim-api/2.3.0+GNU.GNU.GNU.2023-12-14-00-51-00/config

Environment Variables:

KIM_API_CMAKE_PREFIX_DIR:
–empty–

KIM_API_CONFIGURATION_FILE:
–empty–

KIM_API_MODEL_DRIVERS_DIR:
–empty–

KIM_API_PORTABLE_MODELS_DIR:
–empty–

KIM_API_SIMULATOR_MODELS_DIR:
–empty–

===============================================================================

Current Working Directory Collection

Model Drivers: ‘/home/user/test’
–empty–

Portable Models: ‘/home/user/test’
–empty–

Simulator Models: ‘/home/user/test’
–empty–

Environment Variable Collection

Model Drivers: --empty–
–empty–

Portable Models: --empty–
–empty–

Simulator Models: --empty–
–empty–

User Collection

Model Drivers: ‘/home/user/.kim-api/2.3.0+GNU.GNU.GNU.2023-12-14-00-51-00/model-drivers-dir’
–empty–

Portable Models: ‘/home/user/.kim-api/2.3.0+GNU.GNU.GNU.2023-12-14-00-51-00/portable-models-dir’
–empty–

Simulator Models: ‘/home/user/.kim-api/2.3.0+GNU.GNU.GNU.2023-12-14-00-51-00/simulator-models-dir’
–empty–

System Collection

Model Drivers: ‘/home/user/anaconda3/envs/kliff_env/lib/openkim-models/model-drivers’
EDIP__MD_506186535567_002
LJ_Shifted__MD_498634107543_004
LJ_Truncated__MD_132729421025_001
LennardJones612__MD_414112407348_003
ex_model_driver_P_LJ
ex_model_driver_P_Morse

Portable Models: ‘/home/user/anaconda3/envs/kliff_env/lib/openkim-models/portable-models’
LJ_Shifted_Bernardes_1958HighCutoff_Ar__MO_242741380554_004
LennardJones_Ar
ex_model_Ar_P_LJ
ex_model_Ar_P_MLJ_Fortran
ex_model_Ar_P_Morse
ex_model_Ar_P_Morse_07C
ex_model_Ar_P_Morse_07C_w_Extensions
ex_model_Ar_P_Morse_MultiCutoff
ex_model_Ar_SLJ_MultiCutoff

Simulator Models: ‘/home/user/anaconda3/envs/kliff_env/lib/openkim-models/simulator-models’
Sim_LAMMPS_LJcut_AkersonElliott_Alchemy_PbAu

(kliff_env) user@user-virtual-machine:~/test$

Hi, I figured out the issue – you have two installations of the KIM API, one in your Conda environment (probably installed as a KLIFF dependency), and one in /usr/local/, which is the one that gulp connects to. This is why the default model works (since all installations come with it), but any new ones don’t work. I’m guessing it is a requirement for you to use the Conda installation of the API so you can use your KLIFF models? If so, I will need some time to find a solution.

Thank you very much for your help. After I completely removed KLIFF and GULP, I first installed KIM-API and GULP, and then installed the corresponding models, which allowed them to run normally. For models trained with KLIFF, I copied the model files to the path /usr/local/lib/kim-api/portable-models , and then used the command sudo kim-api-collections-management install system to install them, which resulted in successful operation. Once again, I appreciate your assistance.

I’m sorry to bother you again, but after using GULP with a KIM potential to perform structural optimization, the final lattice constants and atomic coordinates did not change. I was wondering if, when you use GULP with a KIM potential for structural optimization, do the final lattice constants and atomic coordinates change?
Ar.zip (9.6 MB)

Hi,

This is does not appear to be a KIM issue – I was able to figure out that if I replace “grad conp” with “opti conp” in the input file, it performs optimization. You can especially see this if you perturb the initial positions and cell dimensions.

In the future, please test your input scripts with a non-KIM potential first in order to make sure it is indeed an issue with KIM and not your input file – I happened to figure this out with some quick guesses, but I am not a GULP expert! If you are having issues even with a non-KIM potential, please ask in the GULP forum.

By the way, I also figured out that you can continue using your conda installation of the KIM API if you wish. You need to set the environment variable LD_LIBRARY_PATH to where libkim-api.so is located:
export LD_LIBRARY_PATH='/your/conda/environment/path/lib/'

This needs to be done once every time you re-start your shell, or it looks like you can make it done automatically when you activate your conda environment:

Ideally, you should change the paths starting on line 171 of mkgulp before you build, but if your system installation of the KIM API is the same version, it shouldn’t matter, only LD_LIBRARY_PATH

Okay, ‘opti’ is indeed the keyword for structural optimization. I will set up the environment variables according to your method. I apologize for the disturbance during this period, and once again, I greatly appreciate your help. :slightly_smiling_face:

1 Like