How to implement external src files?

Suppose that I want LAMMPS to read the source file downloaded from external sources. Are there any solutions to add the file?

Can you please provide more details? It is extremely difficult to provide specific advice to such an extremely general and somewhat confusing question.

What do you mean by “read the source”?
Are you talking about compiling additional features?
If yes, which and how dis you install LAMMPS and what platform are you on?
Have you already tried something along those lines? If yes, what? And what happened?

I mean the external code is c++ is not included in provided package. Yes, it is for additional features. I did install LAMMPS using CMAKE and I use WSL as a platform for running LAMMPS
Here is my additional source code reference:

You have to contact the author of this package. As far as I can tell, it will not work with a current LAMMPS version without modifications. The LAMMPS core code has had quite a few internal changes to modernize the code base and make it more consistent as well as updates for C++11 compatibility.

There is information about adding your own code to LAMMPS in this section of the manual: 3. Modifying & extending LAMMPS — LAMMPS documentation and we have some information about possibly needed updates here: 4.9. Notes for updating code written for older LAMMPS versions — LAMMPS documentation

But since this repository contains multiple files - I assume modified by the author - that also exist in the LAMMPS distribution and that have since seen significant and incompatible updates, merging the contents of that repository and LAMMPS itself is going to be tricky and will require a significant amount of C++ programming and software engineering skills.

1 Like

I did a little research on GitHub and my e-mail archive. The author of these files has not been active on GitHub for over 2.5 years, and was active on the LAMMPS mailing list 5-6 years ago. He identifies himself as a graduate student, so it is likely that he has graduated and moved on.

The questions I saw on the mailing list as well as the way the sources were dumped on GitHub without any documentation or instructions is not inspiring much confidence in the quality. There also is a mention of an implementation for applying an external magnetic field, which is a topic that has come up and discussed repeatedly and where the conclusion is that it cannot be implemented accurately within the current velocity Verlet framework that LAMMPS uses. So even if you get this to compile, I advise to be extremely careful and make thorough tests before using any of it for serious simulations.