-
Notifications
You must be signed in to change notification settings - Fork 25
How do I start writing a new tool?
Grossfield Lab edited this page Jun 13, 2022
·
6 revisions
The first question is whether you want or need to write the tool in C++ or whether you can just use the python layer. My recommendation is that unless you know you're going to need very high performance, it's usually better to write a python version -- it's much faster for prototyping, you can easily pull in great functionality from scipy and other libraries, and in the vast majority of cases the final computational performance is more than adequate.
Instructions for getting started writing a C++ tool will be in a separate page, but many of these suggestions apply to both python and C++.
Ok, so you've decided to write a tool in python, and you've got the dreaded empty text editor. What next? I have a few suggestions that might help:
- Look in Packages/PyLOOS at some of the existing tools. In particular, look at the ones with names starting with
simple_*
; these are skeletons that lay out what a tool that does a particular class of task (e.g. performs a calculation on a trajectory) would look like. The other tools in that directory are functional and useful (at least I think so), and will give you an idea of how we intended LOOS to be used. If you're curious about C++, look in Packages/User, which has similar skeletons in C++. - If you're trying to figure out what functionality exists in LOOS, the online class documentation is a great place to start, in particular the entry for the
AtomicGroup
class.AtomicGroup
is designed to be the workhouse class in LOOS; our basic idea was that every common task one might want to do with a group of atoms should be doable in 1 line of code, and nearly all of that functionality ended up as methods to theAtomicGroup
class. - Getting your editor to do automatic completion for classes, methods, etc, will almost certainly make your development go quicker, especially at first. We've got a few hints on how to set your editors up.
- For a high-level summary of LOOS, you can read the slides of a talk I give on LOOS. Or, you could watch me give the talk.