LLNL / quandary

Optimal control for open quantum systems
MIT License
49 stars 9 forks source link

Extending Gate Class #11

Closed relugzosiraba closed 2 years ago

relugzosiraba commented 2 years ago

It says in the manual that “New, user-defined gates can be easily added to the code by extending the Gate class in the corresponding .cpp and .hpp files.”. Is this really enough? It seems that I also need to make changes in https://github.com/LLNL/quandary/blob/master/src/optimproblem.cpp (see, for example, lines 75-82).

I want to add a new gate which depend on a new parameter other than the ones provided in Gate class, let’s call the parameter gate_param_. Other than updating gate.hpp and gate.cpp, what else should I change?

When Quandary parses the .cfg file, will it look for gate_param and expect a list of gate parameters without further changes? If not, what should I do to define gate_param as a configuration option in .cfg file?

relugzosiraba commented 2 years ago

I think I’ve figured it out. I’ve updated the following files to define parametrized gates. I will commit the changes soon.

Files to be updated:

optimproblem.hpp
gate.hpp

optimproblem.cpp
main.cpp
gate.cpp

.cfg files
steffi7574 commented 2 years ago

Great! Please create a pull request then. Thanks!