Evolution of species interactions determines microbial community productivity in new environments

Diversity generally increases ecosystem productivity over short timescales. Over longer timescales, both ecological and evolutionary responses to new environments could alter productivity and diversity–productivity relationships. In turn, diversity might affect how component species adapt to new conditions. We tested these ideas by culturing artificial microbial communities containing between 1 and 12 species in three different environments for ∼60 generations. The relationship between community yields and diversity became steeper over time in one environment. This occurred despite a general tendency for the separate yields of isolates of constituent species to be lower at the end if they had evolved in a more diverse community. Statistical comparisons of community and species yields showed that species interactions had evolved to be less negative over time, especially in more diverse communities. Diversity and evolution therefore interacted to enhance community productivity in a new environment.


Introduction
Diversity generally increases measures of ecosystem functioning; for example, biomass and productivity tend to be higher in experimental communities that contain more species (Bell et al., 2005;Hooper et al., 2005). This occurs because more diverse communities are more likely to both include highly productive species and use a wider range of resources as a result of niche differences among species (Loreau and Hector, 2001). The shape of the relationship depends on the types of species interactions ( Figure 1; Connolly et al., 2013). Diversity can also increase robustness of community functioning to environmental perturbations, for example, the productivity of experimental bacteria communities exposed to different abiotic conditions (Awasthi et al., 2014). Most studies, however, have measured functioning over short timescales of a few generations. Understanding how ecological and evolutionary processes affect functioning over longer timescales is needed to predict, for example, how insect and plant communities respond to climate change or gut microbes to antibiotic treatments (Norberg et al., 2001;Isbell et al., 2011;Reich et al., 2012).
Changes in functioning in a new environment will depend in part on ecological changes in the composition and relative abundance of species. Some species will grow better in new conditions than others, and poorly growing species might go extinct (Steudel et al., 2012;Mori et al., 2013). Functioning will then depend on the traits of the surviving species after ecological sorting rather than the original species complement. Changes in functioning might also depend on evolution of traits of constituent species in response to selection from new environmental conditions or from shifts in the surrounding biotic community. Evolution might improve ecosystem functioning. For example, evolution of enhanced growth of constituent species, on average, would increase community productivity. In addition, selection for greater specialisation and niche partitioning could increase the range of resource use and total growth of the community (Gravel et al., 2011;Lawrence et al., 2012). Alternatively, evolution might decrease productivity if some species evolve to monopolise resources, to inhibit other species via toxin production or in other ways destabilise the community (Bell, 2007).
Crucially, the extent of evolution might itself depend on diversity. Recent theory predicts that the average rate of evolution declines with the number of species in a community (Johansson, 2008;de Mazancourt et al., 2008). This occurs either because the average population size decreases or because ecological interactions such as competition limit the opportunity for new phenotypes to evolve (Price and Kirkpatrick, 2009). Alternatively, greater diversity might increase evolution by increasing the strength of biotic interactions (Liow et al., 2011) or amplifying the strength of selection caused by an environmental change (Osmond and de Mazancourt, 2013;Pekkonen et al., 2013). The effects of evolution on functioning might also vary systematically with diversity. Loeuille (2010) showed that evolution of interaction strengths enhanced stability of theoretical Lotka-Volterra communities with o30 species but reduced stability in more diverse communities. Although the model did not consider productivity, similar effects could be envisaged for productivity.
Few studies have tested these ideas empirically. Selecting for increased specialisation of bacteria species led to steeper diversity-productivity relationship in community microcosms (Gravel et al., 2011). However, the species evolved separately rather than in a community. Species interactions between five co-occurring bacterial species have been shown to stimulate divergence in resource use, leading to enhanced productivity of the entire community (Lawrence et al., 2012). Yet, it remained unclear whether similar effects would be found with increasing numbers of species: coevolution might be constrained as diversity increases.
We investigated the effects of diversity and evolution on community productivity using artificial communities of bacteria isolated from pools among the roots of beech trees, called tree-holes. Previous work showed that overall productivity increases with diversity in this system (Bell et al., 2005) and that evolution in simple communities can promote functioning (Lawrence et al., 2012). Here, we used replicated microcosms of 1, 2, 3, 6 and 12 species to determine how evolution and productivity varies with increasing diversity under changed environmental conditions. Microcosms were cultured using serial transfer for B20 generations in standard laboratory conditions and then in three different environments for a further circa 60 generations: standard beech-leaf tea medium that mimics natural resources for these species; a lower pH5 environment, still grown on beech tea, chosen to reflect an acidity at the extreme of what is found in tree-holes and because pH is the main determinant of community diversity and composition in broad surveys (Griffiths et al., 2011); and an alternative resource environment, namely spruce tea that has a higher carbon to nitrogen ratio and proportion of cellulose to lignin (Kalbitz et al., 2006).
Changes in community productivity during the experiment could result because some species went extinct, because surviving species evolved to grow better (or worse) or because species evolved greater (or lesser) niche differences or by other means altered their interactions (Figure 1b). Each of these processes could affect the relationship between productivity and diversity. By comparing responses of monocultures and whole communities, we partitioned observed changes into those caused by ecological sorting, those due to additive changes in species yields and those due to evolution in the strength and nature of species interactions. Evolution of species interactions was the main contributor to changing productivity across ecosystems, especially in more diverse microcosms. We cannot infer the mechanism of species interactions based on data here. However, previous evidence on a single simplified community supports the hypothesis that changes result from changing resource use.

Materials and methods
Species and media Samples of water were collected from a single treehole among the roots of a beech tree in Silwood Park, Berkshire, UK, in November 2008, and aliquots were spread on R2A agar plates (Oxoid Ltd, Basingstoke, UK). Twelve isolates were chosen that  (Foster and Bell, 2012).
Negative interactions, such as competition for shared resources, lead the community to grow worse than the sum of the species yields. Additive growth equal to the sum of monoculture growth (dashed line) is expected if species use non-overlapping resources and do not interact in other ways. Synergistic indicates that one or both species benefit so that combined growth is greater than additive. The frequency of different types will determine the shape of the relationship between community growth and species richness. Note that this classification focuses on net effects rather than mechanisms: for example, resource use, toxin production, signalling and interactions mediated by phage could all affect net interactions. (b) Community growth can change over time via three mechanisms, shown with an initially negative interaction as an example: (i) Ecological sorting occurs through the loss of one of the species, leading to lower community growth in this example; (ii) Evolution changes the growth of each species but their interaction (represented by the grey area) remains the same (which we call additive evolution; in this example growth of both species increase); (iii) Evolution alters the strength of the species interaction even if separate growths remain unchanged (in this example at time t there is no longer a negative interaction).
Evolution of community productivity F Fiegna et al had different growth phenotypes on agar plates that would allow for their separation from mixed cultures at the end of the experiment. The 16S rDNA sequences showed that species belonged to six bacterial families and four phyla (Table 1; 16S sequences deposited in Genbank, accession numbers KJ598020-KJ598031; Supplementary Methods). Beech tea medium was prepared by autoclaving 50 g of beech tree leaves in 500 ml of dH20, filtering it and diluting 32-fold in water. Spruce tea was prepared using 50 g of spruce needles in 500 ml water, and diluting it 32-fold. The media were supplemented with R2A agar ingredients (Reasoner et al., 1979) to increase growth rates and thereby increase the number of generations during the experiment (Supplementary Methods). Beech tea and spruce tea media were initially pH 7.1 and 6.8, respectively, and were buffered to pH 7 and the beech tea for the pH5 treatment was buffered to pH5 by adding phosphate buffer (Supplementary Methods).

Evolution experiment
Each species was cultured in monoculture, in a full mix of all 12 species, and in two alternative compositions in two-, three-and six-species mixtures in turn using a random partitioned design (Bell et al., 2005). In the two-species mixtures, the species were subdivided into six random pairs. If two species with similar growth morphology were assigned together (for example, both had white colonies), one was swapped randomly with one species from another pair to maximise distinguishability. The procedure was repeated with different random pairings to obtain the second set of compositions for the two-species mixtures. An equivalent procedure was used to assign the  Table S1).
To start the microcosms, species were inoculated at approximately the same optical density (OD) at 595 nm into 10 ml of medium in glass test tubes in the appropriate experimental mixtures. All assemblages were replicated thrice (3 Â 37 ¼ 111 microcosms). Microcosms were kept at room temperature and static. Alternating every 3 or 4 days, an aliquot (150 ml) was transferred to fresh medium to maintain microcosms in a state of active growth and cell doubling during the experiment. After 2 weeks in standard beech tea medium, aliquots from each microcosm were transferred into three separate tubes: one with standard beech tea, one with pH5 beech tea and one with spruce tea (3 Â 111 ¼ 333 microcosms). Transfers to fresh medium were performed alternating every 3 or 4 days maintaining the appropriate environmental treatment for each tube. Cultures were kept for further 5 weeks.
We measured the biomass yield of each microcosm during each serial transfer period as the maximum OD minus the starting OD. OD is a robust measure of biomass and scaling factors to convert from OD to g dry weight are fairly constant across organisms (Myers et al., 2013). We considered biomass rather than cell densities because biomass is directly comparable across microcosms and better reflects productivity (Awasthi et al., 2014). Changes in biomass during the experiment could in principle represent changes in either cell size or cell numbers, but for resource-based interactions, biomass should more directly reflect resource consumption and the impact on other species than cell numbers.
The number of doublings, that is, generations, was estimated by summing log 2 (OD.end/OD.start) for each growth period in each microcosm. Across species in monocultures, this ranged from 62 to 91 in beech tea, 60 to 87 in pH5 tea and 21 to 70 generations in spruce tea for each species. The mean number of generations after transfer to the new environments was 56.2 in beech and pH5 tea and 28.3 in spruce tea. Note that this calculation assumes cell sizes were constant during each growth period but not among species or over the whole duration of the experiment (that is, if the scaling constant to convert from OD to number of cells is x in one time period, it cancels in x*OD.end/x*OD.start).

Growth assays to measure changes in species yields
We measured evolution of constituent species by isolating them from final microcosms and performing growth assays together with stored ancestral isolates (those used to initiate the experiment). Aliquots of all microcosms were plated onto R2A plates in order to detect the presence of each species. We estimate a lower detection limit of B1 in 10 000. Samples of all species present were isolated based on their colony morphology and the identity of species that co-occurred with others of similar morphology checked by sequencing 16S (of 85 such isolates, 71 were identified correctly by morphology, and the remainder were reassigned to the correct identification; Supplementary Table S2). Isolates were stored in glycerol at À 80 1C. For growth assays, frozen samples of ancestral and evolved isolates were re-inoculated into 150 ml of the medium they grew on during the experiment. OD was measured every 24 h for 5 days. We thereby measured whether species evolved generally increased growth yields, and whether the extent of changes varied among microcosms.

Statistical analyses
We used linear models to analyse productivityrichness relationships in each environment in the initial growth period following transfer into the separate environments. To infer species interactions, we compared observed community yields A j to the sum of monoculture yields of constituent species, Sa i d i,j where a i is the monoculture yield of species i and d i,j indicates presence (1) or absence (0) of species i in community j. A value of the ratio A j /Sa i d i,j of 1 indicates that community yields are additive and hence there is no interaction, o1 indicates a negative interaction and 41 indicates a positive interaction (Figure 1a). To test for variation in species interactions among treatments, we fitted a linear model of community yields against the sum of monoculture yields, A j ¼ b t ¼ 0 (E,S,Sa i d i,j ), with slopes and intercepts that vary with environment, E, and log(richness), S. We simplified the model using stepwise removal (step function in R (R Core Team, 2014)). We call this baseline 'model 0'. Under neutrality, we expect slope ¼ 1 and intercept ¼ 0; fitted values summarise the pattern of interactions in each treatment.
We used a linear mixed effects model (using lme in the nlme library in R (Pinheiro et al., 2014)) to investigate whether the productivity-richness relationship in each environment changed over time. Fixed effects were time, species richness, environment and their two-and three-way interactions, and the random effect was microcosm that takes account of pseudoreplication due to repeated measures (Lindstrom and Bates, 1990). We fitted the model using maximum likelihood and simplified fixed effects using the stepAIC function in MASS. The simplified model was refitted using REML to report results. We used further models and data manipulation to explore the possible cause of changes.
(1) To estimate the changes caused by extinction (Figure 1b, case i), we used a modified version of model 0 to estimate predicted community yields at week 5 assuming that the only change was species extinction: , where e i,j is a binary term indicating survival (1) or extinction (0) of species i in community j. We called this model 1.

Evolution of community productivity
By keeping slopes and intercepts the same as week 0, we assumed no net changes in species interactions over time. The accuracy of prediction was judged by regressing the observed change in community yields, A j,t ¼ 5 À A j,t ¼ 0, with the predicted change in community yields, b t ¼ 0 (E,S,Sa i d i,j e i,j ) À A j,t ¼ 0 , and summarised by adjusted R 2 and the Akaike information criterion (AIC).
(2) Similarly, to estimate changes caused by additive evolution of species yields, we constructed model 2 that predicted A j,t ¼ 5 as b t ¼ 0 (E,S,Sa i,t ¼ 5 d i,j ) assuming the only change was in monoculture yields. We repeated this using species yields measured from final isolates of species from each community at week 5, b t ¼ 0 (E,S,Sb i,j,t ¼ 5 d i,j ), called model 3. We selected the model yielding the lowest AIC for the regression between observed and predicted changes in community yields as the preferred model for additive evolution in species yields. We also constructed models with combinations of extinction and additive evolution in species yields, for example, b t ¼ 0 (E,S,Sb i,j,t ¼ 5 d i,j j e i,j ), and compared all models using AIC.
(3) Selecting the best model from those above, we fitted a new version of that model assuming that mean species interactions within environment and richness treatments also changed, that is, fitting new slopes and intercepts. As model 2 was best (see Results), we fitted b t ¼ 5 (E,S,Sa i,t ¼ 5 d i,j ) that we call model 4. The additional variation explained by adding evolution of species interactions was calculated as the increase in adjusted R 2 .
The above approach allows separate effects to be teased apart but does so by splitting up the data. To test whether species interactions changed over time using all data, we fitted a linear mixed effects model to observed community yields at the start (t ¼ 0 at the start of the environmental treatments) and end (t ¼ 5 weeks): A j,t ¼ b(E,S,t, Sa i,t ¼ 5 d i,j ) with microcosm as a random effect. We compared the model with one without time using analysis of variance. A significant effect of time indicates changes in interaction strengths: changes due to additive evolution of species yields would be accounted for by the final term Sa i,t ¼ 5 d i,j instead.

Productivity-richness relationship immediately after transfer to new environments
In the first growth period following transfer into the different environments, microcosms displayed a classical increase in community yield with increasing richness, but the slope differed among environments (dashed lines, Figure 2, interaction between environment and log.richness, F 2, 327 ¼ 3.1, P ¼ 0.047; Supplementary Table S3). Yields on spruce tea (in red) were uniformly lower across all microcosms than in beech tea (in orange, t ¼ À 7.5, d.f. ¼ 327, Po0.0001). The slope of the curve was similar in beech and spruce tea (t ¼ 0.76, d.f. ¼ 327, P ¼ 0.4).
In contrast, yields in the pH5 medium (in green) were similar to beech tea in monocultures (t ¼ 0.3, d.f. ¼ 327, P ¼ 0.8) but was higher and increased more steeply in diverse microcosms relative to control beech tea (slope of yield with richness in The shape of increase in yields with species richness was consistent with generally negative species interactions. The yields of two-species mixtures, for example, were only on average 52.3 ± 7.1%, 58.0 ± 4.8% and 75.1 ± 20.7% of the expected additive yields in the control beech, pH5 and spruce media, respectively (t-tests of the ratio of observed and additive yields repeated for dicultures in each environment in turn, t ¼ À 13.5, À 17.8 and À 2.5, d.f. ¼ 35, Po0.0001, Po0.0001 and P ¼ 0.019, respectively, Figure 3a). Yields were even lower relative to additive expectation in more diverse microcosms (for example, ranging between 9.9% and 16.1% in the 12-species communities; in a linear model, the slope with additive prediction becomes shallower at higher richness; t ¼ À 9.6, d.f. ¼ 219, Po0.0001, Supplementary Table S4). An additional 25.5% of variation was explained by composition and its interaction with environment, indicating that the community yield also depended on which combinations of species were cultured together (composition, F 24, 149 ¼ 25.7, Po0.0001; interaction with environment, F 48, 149 ¼ 6.1, Po0.0001).
Changes in the productivity-richness relationship over time The relationship between community yields and richness changed relatively little over time in control beech tea (Figure 2, increasingly darker lines  Figure 2 The relationship between yield following a serial transfer event and the number of species in a microcosm. Orange ¼ beech tea medium; green ¼ pH5 beech tea medium; red ¼ spruce tea medium. The dashed lines indicate the fitted curve for yields immediately after being transferred into the different environments (that is, after 2 weeks of culturing on beech tea). Solid lines are the fitted curves for later time periods during the experiment: 1, 2, 4 and 5 weeks after transfer to the new environments respectively for increasingly darker lines. Curves become steeper over time in pH5 medium and lower over time in spruce tea. The observed yields for communities with two or more species at the start plotted against the sum of the monoculture yields of constituent species. Orange ¼ beech tea medium; green ¼ pH5 medium; red ¼ spruce tea medium. The dashed line shows the 1:1 relationship. (b) The observed yields for communities with two or more species at the end plotted against the sum of the yields of constituent species measured from community isolates. The proportion of communities displaying synergistic growth did not change over time (4.0% in week 0 versus 3.6% in week 5, z ¼ À 0.25, d.f. ¼ 448, P ¼ 0.81, general linear model with binomial errors) but was significantly higher in spruce tea than the other media (9.3% communities versus 1.3%; z ¼ 2.7, d.f. ¼ 446, P ¼ 0.007) and in less diverse microcosms (t ¼ À 2.4, d.f. ¼ 446, P ¼ 0.019). (c) Mean interaction index, calculated as the ratio of observed to expected additive yields, shown across richness levels and for the start and end of the experiment in beech tea. A value of 1 would be additive growth, that is, no interaction, and values of o1 indicate negative interactions. The 95% confidence intervals are shown. (d) Mean interactions in pH5 tea.

Evolution of community productivity
(e) Mean interactions in spruce tea.

Table 2
Comparison of alternative predictors of the change in community yields between week 0 and week 5 Predictor of final yields Description AIC Adjusted R 2 t P Monoculture changes only À 905.2 0.177 7.02 o0.0001 Monoculture changes only (measured from community isolates) À 903.1 0.170 6.84 o0.0001 Monoculture plus species interactions changes À 948.0 0.320 10.3 o0.0001 Monoculture þ species interactions by composition À 1218 0.795 29.5 o0.0001 Abbreviation: AIC, Akaike information criterion. a i,t ¼ x : monoculture yields of species i at week x; b t ¼ x (E,S): slopes fitted between community yields and S(a i,t ¼ 0 d i,j ) at week x in each environment, E, and richness level, S; d i,j : the presence (1) or absence (0) of each species in community j at the start; e i,j : the survival (1) or extinction (0) of each species in community j by the end; b i,t ¼ 5 : monoculture yields of isolates of species i extracted from community j at week 5; C: a factor with levels denoting each community composition.  Table S5). There was no significant change in average yields at any level of richness in the control beech tea. There was a significant decline in average yields in spruce tea (linear mixed effects model, t ¼ À 2.4, d.f. ¼ 1320, P ¼ 0.017), equating to a 30% decline across richness levels.
In contrast, the relationship in the pH5 medium became significantly steeper during the course of the experiment (interaction between time and richness in the pH5 treatment, coefficient ¼ 2.43 Â 10 À 5 , t ¼ 2.97, d.f. ¼ 1320, P ¼ 0.003). The more diverse communities now grew better than had the ancestral communities, whereas there was no significant change in average yields of monocultures over time (effect of time in pH5 environment, just monocultures included, t ¼ À 1.1, d.f. ¼ 141, P ¼ 0.26). We explore three possible causes for the change in relationships through time in the subsequent sections.

Ecological sorting
The first possible cause of changes in community growth over time is that ecological sorting led to the loss of species in some communities (Figure 1a, case i). Across all environments, species extinction rates increased from nearly 0 in monocultures to 74% in 12-species communities on control beech tea (Supplementary Figure S1). Extinction rates were significantly higher in pH5 and spruce tea media than in control beech tea (84% and 86%, respectively, in 12-species communities, z43, d.f. ¼ 326, Po0.005 for both comparisons, generalised linear model with binomial errors). Extinction alone, however, was insufficient to explain changes in community yields: predicted changes in yields due to loss of species alone explained 0.35% of the variation in the changes in community yields between the start and the end of the experiment (a nonsignificant fraction; model 1, Table 2 and Supplementary Figure S2a).

Evolution of species yields
The second possible cause of changes in community growth over time is that yields of constituent species changed but the strength of interactions between them remained constant (Figure 1b, case ii: additive evolution). For example, if the species with highest yields evolved even higher yields, this could lead to a disproportionate increase in yield of more diverse communities (which are more likely to include them). Some monocultures did evolve higher yields on average by the end of the experiment (for example, species THB22 and 39 in beech tea; Supplementary Figure S3). In spruce tea, monocultures had lower yields at the end than at the start (mixed effects model, effect of time in spruce treatment, t ¼ À 2.5, d.f. ¼ 426, P ¼ 0.014; Supplementary Figure S3). The change in community yields during the experiment was significantly predicted by the change in monoculture yields (explaining 17.7% of the variation; model 2, Table 2 and Supplementary Figure S2). The observed (dots) and fitted (lines) yields of species isolates from communities relative to the growth rate of ancestral isolates. Orange ¼ beech tea; green ¼ pH5 beech tea; red ¼ spruce tea. Species that evolved in more diverse communities have significantly lower yields (and less on average than the ancestral isolates) when subsequently grown in monoculture than those from less diverse communities.  Figure 5 (a) Observed changes in community yields, A i,t ¼ 5 À A i,t ¼ 0 , between the start and the end of the experiment extracted from data in Figure 2. Predicted changes in community yields because of (b) species extinction from model 1 in Table 2, (c) additive evolution of species yields from model 2 and (d) systematic changes in species interactions within environment and richness treatments, calculated as predicted changes from model 4 minus predicted changes from model 2. Additive evolution reproduces the changes in control beech tea and spruce tea, but evolution of species interactions is needed to reproduce the changes in pH5 tea.

Evolution of community productivity F Fiegna et al
A further complication is that species might have evolved different yields in communities than in monocultures, so that monocultures at the end might not reflect changes in yields of component species in communities. We isolated all the surviving species from each microcosm at the end, regrew them in monoculture and then tested whether their yields in isolation varied significantly depending on the species richness of the community they had evolved in. On average, yields of isolates declined with increasing diversity of the source community in all three environments (t ¼ À 3.2, d.f. ¼ 421, P ¼ 0.0015, Figure 4). The change in yield relative to the ancestral isolates was lower in pH5 tea and spruce tea than in control beech tea across all diversity levels (t ¼ À 4.0 and À 4.6, respectively, d.f. ¼ 421, Po0.0001). Replacing yields for surviving species with those measured from final community isolates did not improve the predictability of community yields (model 3, Table 2 and Supplementary Fig. S2; explains 17.0% of variation, AIC ¼ À 903.1; model 2 using yields measured from monoculture isolates, AIC ¼ À 905.2).
Although additive evolution of species yields explained changes in the productivity-richness relationship in beech tea and spruce tea over time, it could not alone explain the steepening productivityrichness relationship in pH5 tea (Figure 5c).

Evolution of species interactions
The final explanation for observed changes in community yields over time is that species interactions evolved during the experiment (Figure 1b, case ii). We plotted the yields of communities at the end against the sum of monoculture yields at the end ( Figure 3b) and compared patterns with those at the start of the experiment. There was no consistent change in the strength of interactions in control beech tea and spruce tea (Figures 3c and e): observed changes of community yields in spruce tea were predicted well by the sum of species yields. In contrast, interactions became less negative in pH5 tea: observed yields were higher relative to additive yields than they had been at the start, across all richness levels (Figure 3d). In a linear mixed effects model, the slope between observed and additive yields in pH5 tea became less negative over time Table  S6). Allowing model coefficients to vary with time, that is, for species interactions to change systematically within environment and richness treatments, explained nearly twice as much variation (model 4, Table 2, explained 33.9%) as the best model with fixed species interactions (model 2), and was necessary to explain the observed steepening of the productivityrichness relationship in pH5 tea (Figure 5d).
To conclude, 0.35% of variation in the change in community yields between the start and the end of the experiment was explained by species extinction, 17.7% by additive evolution of species yields and 14.3% ( ¼ 32.0-17.7%) by systematic changes in species interactions within richness and environment treatments. The latter fraction was responsible for the steepening of the productivity-richness relationships over time in pH5 tea. A further 47.5% of variation in the change in community yields was explained by changes in species interactions within particular compositions and environments (model 5, Table 2). The remaining 20.5% was residual variation among the 3 replicates of each composition by environment treatment.

Sensitivity analyses
We performed two further analyses to check sensitivity to our assumptions. First, assuming that species that had gone extinct by the end were already contributing little to community yields at the start, we repeated the above analyses but excluded species that were extinct by the end from the calculation of sum of monoculture yields at the start and used final richness instead of starting richness. Conclusions were the same as reported above (Supporting Results S1, Supplementary Table  S7). Second, to check whether results were because of the dominant effects of a few species, we fitted alternative models with separate coefficients for each species, that is, A j ¼ b(E,S,t,a i d i,j ). A simplified linear mixed effect model of community yields over time retained terms for yields of all the species in the model (Supplementary Table S8). Focusing on pH5 tea, coefficients increased in THB6, 20, 22 and 39 over time, whereas no species displayed decreased coefficients in the simplified model (Supplementary Table S9), and hence the less negative interactions over time.

Discussion
Our results show that diversity affected how both collective growth of communities and yields of constituent species changed over time. The largest effect occurred in pH5 media, in which the relationship between community yields and diversity, already steeper than in the other media at the start, became even steeper by the end. One possible explanation for this change is that one or a few species evolved higher yields over time, and because they are more likely to be contained in more diverse microcosms than in less diverse microcosms, this would steepen the relationship. Partitioning the change into separate effects, we found that changes in beech tea and spruce tea could indeed be explained by adding together the effects of observed changes of each species in monoculture. However, this was insufficient to explain the increase in community yields in pH5 tea. Instead, interactions between species must have changed: communities now grew better relative to the yields of their constituent species than expected Evolution of community productivity based on the levels of interactions fitted at the start of the experiment. Although it has been found that coevolution might occur less in more diverse communities than in pairwise systems (Futuyma and Agrawal, 2009;terHorst, 2010), we found greater change in species interactions in more diverse microcosms.
Further information came from comparing patterns of community growth with the growth of constituent species. When species were isolated from communities at the end of the experiment, their yields were lower when isolated from more diverse communities. One explanation for this finding is that competition reduced the rate of adaptation to new conditions in those media and led to lower final yields, as predicted in the models of de Mazancourt et al. (2008) and Johansson (2008). By this mechanism alone (that is, adding up separate species effects), the growth rate of communities containing those species should be lower than the growth rate of the best growing species in monoculture. Instead, in pH5 tea, community yields evolved to be higher in more diverse microcosms and more so than predicted by the effects of adding together changes in yields of the surviving constituent species. This is consistent with the alternative that species evolved less negative interactions. For example, the decline in yields of constituent species when grown in isolation might reflect increased specialisation on a subset of resources relative to those used by monoculture isolates of the same species. Although testing this mechanism was impractical for the number of microcosms here, we demonstrated it previously using spectroscopy and competition assays in a community of five of the same species studied here (Lawrence et al., 2012).
Another possible mechanism, again demonstrated in the previous study of Lawrence et al. (2012), is that species evolved to use the waste products of other species. This could lead to higher collective growth than expected from separate growth of isolates in monocultures. Without direct evidence of resource use here, however, there could be other mechanisms such as synergistic benefits of excreted enzymes for breaking down substrates or benefits of metabolising or otherwise neutralising toxic compounds in the medium, such as tannins. We had no evidence that phage were present in our cultures, but in principle apparent competition mediated by phage could also have played a role (Brockhurst et al., 2006). Separating the role of alternative interactions in determining overall patterns of community yields would be an interesting topic for future study.
Further work would be needed to identify specific mechanisms for the patterns we observed. We initially chose environmental treatments to differ in two different ways: a change in physical environment (pH) and in resource availability (the greater carbon/nitrogen ratio and different secondary compounds of spruce needles compared with beech leaves). As expected, both species and communities grew far slower initially on spruce tea than on control beech tea and indeed never evolved to cope well with this medium: this could reflect having half as many generations in spruce tea and hence less chance to adapt than in the other environments. In contrast, pH5 tea displayed equivalent yields of monocultures but higher yields of diverse microcosms initially. In general terms, pH5 might have modified chemistry of the tea and freed up additional resources that species used differently to one another. Without detailed chemical investigation, which was prohibitive for the number of species and microcosms here, we cannot explain why patterns differed between environments. Future work on how microbial communities respond to new environments will require greater understanding of specific mechanisms, including quantification of resource use and other interactions (c.f., Turnbull et al., 2013), for example by using artificial media containing known resources (Replansky and Bell, 2009;Langenheder et al., 2010) that would facilitate assays of resource use. Tracking species abundances in detail over time would also be useful in future to reconstruct changes in ecological interactions.
To conclude, diversity not only improved productivity as measured by total community biomass yield at the start of the experiment, but also promoted the evolution of improved productivity in the pH5 media over time. The timescales of B60 generations are relevant for short-term changes in microbial communities and similar processes could operate over decades in annual organisms responding to current climate change. Our microcosms contained less diversity than real communities and no immigration, and hence there was less scope for ecological sorting than would be expected in natural tree-holes. Real communities are open to colonisation and hence diversity might be preserved by immigration of preadapted types previously found in other areas, for example those with already lower optimum pH. There was also potentially more scope for evolution because of serial transfer. In wild tree-holes, resources will arrive more sporadically and species will alternate between high-resource and low-resource conditions on a haphazard basis. We now need studies of wild or semi-wild communities to understand how function changes in new environments.