Santiago Ramón y Cajal’s Advice for a Young Investigator (translated by Neely Swanson and Larry W. Swanson, and published by MIT Press) has some great stuff about research, rest, and distraction.

First, on the mental toughness you need to do good work:

To bring scientific investigation to a happy end once appropriate methods have been determined, we must hold firmly in mind the goal of the project. The object here is to focus the train of thought on more and more complex and accurate associations between images based on observation and ideas slumbering in the unconscious—ideas that only vigorous concentration of mental energy can raise to the conscious level. One must achieve total absorption; expectation and focused attention are not enough. We must take advantage of all lucid moments, whether they occur during the meditation following prolonged rest; during the super-intense mental work nerve cells achieve when fired by concentration; or during scientific discussion, whose impact often generates unanticipated intuition like sparks from steel….

The forging of new truth almost always requires severe abstention and renunciation. During the so-called intellectual incubation period, the investigator should ignore everything unrelated to the problem of interest, like a somnambulist attending only to the voice of the hypnotist. In the lecture room, on walks, in the theater, in conversation, and even in reading for pleasure, seek opportunities for insight, comparisons, and hypotheses that add at least some clarity to the problem one is obsessed with. Nothing is useless during this process of adjustment. The first glaring errors, as well as the wrong turns ventured on by the imagination, are necessary because in the end they lead us down the correct path.

However, while this sort of toughness and monk-like focus is important, it can also be good to take a break.

If a solution fails to appear after all of this, and yet we feel success is just around the corner, try resting for a while. Several weeks of relaxation and quiet in the countryside brings calmness and clarity to the mind. Like the early morning frost, this intellectual refreshment withers the parasitic and nasty vegetation that smothers the good seed.

As the same time, he advised against distraction, which he regarded as different from rest.

In Spain, where laziness is a religion rather than a vice, there is little appreciation for how the monumental work of German chemists, naturalists, and physicians is accomplished—especially when it would appear that the time required to execute the plan and assemble a bibliography might involve decades! Yet these books have been written in a year or two, quietly and without feverish haste. The secret lies in the method of work; in taking advantage of as much time as possible for the activity; in not retiring for the day until at least two or three hours are dedicated to the task; in wisely constructing a dike in front of the intellectual dispersion and waste of time required by social activity; and finally, in avoiding as much as possible the malicious gossip of the café and other entertainment—which squanders our nervous energy (sometimes even causing disgust) and draws us away from our main task with childish conceits and futile pursuits….

The harm in certain things that are too distracting lies not so much in the time they steal from us as in the enervation they bring to the creative tension of the mind, and in the loss they cause to that quality of tone that nerve cells acquire when adapted to a particular subject.

Of course we don’t recommend the elimination of all distractions. However, those of the investigator should always be light and promote the association of new ideas. A stroll outside, contemplating works of art and photography, enjoying scenes such as monuments in different lands, the enchantment of music—and more than anything else the companionship of a person who understands us and carefully avoids all serious and reflective conversation—are the best ways for the laboratory worker to relax. Along these lines, it is wise to follow the advice of Buffon, who justified his abandon in conversation (which displeased many of those who admired the nobility, along with his elegant writing style) by noting: “These are my moments of rest.”…

Thus, it is clear beyond doubt that great scientific undertakings require intellectual vigor, as well as severe discipline of the will and continuous subordination of all one’s mental powers to an object of study. Harm is caused unconsciously by the biographers of illustrious scholars when they attribute great scientific conquests to genius rather than to hard work and patience.