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

Macro for wrapping input lines #25

Closed
stefanbringuier opened this issue Oct 2, 2022 · 4 comments
Closed

Macro for wrapping input lines #25

stefanbringuier opened this issue Oct 2, 2022 · 4 comments

Comments

@stefanbringuier
Copy link

Does anyone have some thoughts on a macro to wrap lammps input script lines with command(lmp,line), something along the lines of:

macro command(lmp,lines)
	lmpcmds = quote
	    for l in $(lines)
	        command($(lmp),l)
	    end
	end
	return lmpcmds
end

In particular, say we already have an input script we want to use, so we read it in and wrap it with the macro and then add additional commands when that are needed.

@vchuravy
Copy link
Member

vchuravy commented Oct 3, 2022

Sounds reasonable, do you want to open a PR for this?

@stefanbringuier
Copy link
Author

Sounds reasonable, do you want to open a PR for this?

Yep, will work on it.

@stefanbringuier
Copy link
Author

Sounds reasonable, do you want to open a PR for this?

Yep, will work on it.

Tried to give this a try but seems there is some async behavior with LMP(), or at least I think this is the issue since its spawning a lammps instance for each command before it fails:

image

Note the same example works fine when using the standard approach, ex, command(lmp,lammps-input-line). The digest(example) function call just formats a string with into a Vector{String} and removes \n and \t etc.

@vchuravy
Copy link
Member

vchuravy commented Jul 1, 2024

command can now parse multiline statements. Maybe that's enough?

@vchuravy vchuravy closed this as completed Jul 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants