Open source software licences: Other options
Part of the article Open source software licences explained.
“Public domain” refers to material in which no copyright exists, either because it has expired or because the author has somehow legally disclaimed copyright. The main functional distinction between permissively-licensed and public domain material is that, because works in the public domain have no copyright, there is not even a copyright attribution to retain.
In some countries it isn't possible to disclaim all rights, so the concept of an author placing something universally in the public domain is somewhat theoretical. If you have any code you would like to transfer to the public domain—as may be appropriate for short illustrative snippets, for example—the closest practical means is CC0 from the Creative Commons (which is a rights disclaimer, not one of the standard CC licences).
Creative Commons licences are not intended for software. Use them for your data sets.
It's tempting, and in fact not uncommon, to provide code with terms saying that other developers can use it for academic purposes, or non-commercial purposes, or not-for-profit purposes, or only if they cite a certain paper.
A philosophical difficulty with this is that it perpetuates the closed circle of academic availability of results. Just as funding bodies are increasingly recommending publication in journals with open access policies—something that largely benefits non-academic readers who would not otherwise have access—so software code is increasingly seen as something that should contribute to a commons outside of formal academia.
It may also be a bad idea to get used to thinking of academic use as fundamentally different from any other use of the code. Academic use of code has no special legal status, and there is already a hazard that researchers may think they can use any code that is put in front of them (for example, GPL code, or examples from Numerical Recipes) in their work without consideration of the licence terms. This becomes a practical problem as soon as the researcher then goes on to publish their work. It is probably wiser to learn to use “industry standard” software licensing practices from the outset.
Finally, if you want to encourage people to cite your paper you can always just ask. There's no harm in adding a polite request in your code, separately from the licence itself so that it isn't legally binding and doesn't cloud the licence issue: those people who are in a position to be citing your work will likely do as you wish.
If “academic use only” is the only option for publishing at all, then it's clearly better than nothing. But consider other options first.
Briefly, because licensing is a complicated enough subject already, as this article has probably demonstrated.
There are hundreds of different software licences used for public distribution of source code, many invented ad-hoc during the past four decades and mostly used for only one or a handful of packages. When doing work that uses or refers to a number of other pieces of code, it can be very difficult to understand what the combination of licences actually permits you to do. Even adding a requirement to show an attribution to the user in an otherwise permissive licence, for example, makes it incompatible with the GPL and introduces uncertainty about how to comply in situations with novel distribution mechanisms or without user documentation.
The last decade or so has seen increasing consensus use of a much smaller number of licences (the ones described here). I believe this to have been beneficial.
That said, as with “academic-use only” licences, if the only way to get something released is to use some custom licence terms, then that's clearly better than nothing.