Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set KIM pointer appropriately for Energy #1727

Merged
merged 1 commit into from Oct 16, 2019
Merged

Set KIM pointer appropriately for Energy #1727

merged 1 commit into from Oct 16, 2019

Conversation

yafshar
Copy link
Collaborator

@yafshar yafshar commented Oct 15, 2019

Summary

  • enhancement

There are cases in lammps where eflag_global=0, while KIM-API would always set the global compute-energy-flag to true. This setting is due to the way that the pointer is passed to the KIM.

if (KIM_SupportStatus_NotEqual(kim_model_support_for_energy, KIM_SUPPORT_STATUS_notSupported)) kimerror = kimerror || KIM_ComputeArguments_SetArgumentPointerDouble(pargs, KIM_COMPUTE_ARGUMENT_NAME_partialEnergy, &(eng_vdwl));

Here eng_vdwl is a double variable, and it's reference to KIM is never NULL. It causes extra computation of energy in model drivers in KIM.

Author(s)

Yaser Afshar | Research Associate
Aerospace Engineering & Mechanics | University of Minnesota
Address: 100 Union St SE, Shepherd Labs 301,
Minneapolis, MN 55455, United States

Licensing

By submitting this pull request, I agree, that my contribution will be included in LAMMPS and redistributed under either the GNU General Public License version 2 (GPL v2) or the GNU Lesser General Public License version 2.1 (LGPL v2.1).

Backward Compatibility

The pull request will not break backward compatibility for inputs

Post Submission Checklist

Please check the fields below as they are completed after the pull request has been submitted. Delete lines that don't apply

  • The feature or features in this pull request is complete
  • Licensing information is complete
  • Corresponding author information is complete
  • The source code follows the LAMMPS formatting guidelines
  • Suitable new documentation files and/or updates to the existing docs are included
  • The added/updated documentation is integrated and tested with the documentation build system
  • The feature has been verified to work with the conventional build system
  • The feature has been verified to work with the CMake based build system
  • A package specific README file has been included or updated
  • One or more example input decks are included

@yafshar yafshar marked this pull request as ready for review October 15, 2019 16:55
@@ -762,7 +757,24 @@ void PairKIM::set_argument_pointers()
int kimerror;
kimerror = KIM_ComputeArguments_SetArgumentPointerDouble(
pargs, KIM_COMPUTE_ARGUMENT_NAME_coordinates, &(atom->x[0][0]));

// Set KIM pointer appropriately for Energy
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yafshar I think you need to handle the case where the KIM Model has the partialEnergy argument as required (i.e., a non-null pointer must be set). Currently, it seems to assume the model has partialEnergy as optional.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ellio167 Fixed it.

@akohlmey akohlmey merged commit d02f806 into lammps:master Oct 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants