To the fourth one proceeds thus. It seems that the definition of virtue usually assigned is not fitting, to wit, virtue is good quality of mind, by which one lives rightly, which no one uses badly, which God works in us without us. For virtue is human goodness, which is that which one having it good. But goodness does not seem to be good, as neither whiteness white. Therefore it is unfitting to say that virtue is good quality.
Further, no difference is more common than its genus, because it is divisive of the genus. But good is more common than quality, for it is converted with being. Therefore good ought not to be put in the definition of virtue as difference of quality.
Further, as Augustine says in De Trin. XII, where something occurs primarily that is not common to us and to cattle, it pertains to mind. But some virtues are also of irrational parts, as the Philosopher says in Ethic. III. Therefore not every virtue is good quality of mind.
Further, it seems rightness pertains to justice, so that the same things are called right and just. But justice is a species of virtue. Therefore right is unfittingly placed in the definition of virtue, as is said, by which one lives rightly.
Further, whoever is proud of something, uses it badly. But many are proud of virtue, for Augustine says, in the rule, that pride also ambushes good works that they may perish. Therefore it is false that no one uses virtue badly.
Further, man is justified through virtue. But Augustine, on John, He shall do greater than these, that he who created you without you will not justify you without you. It is therefore inappropriately said that God works in us without us.
But contrariwise is the authority of Augustine, from whose words the aforementioned definition is collected, and especially in On Free Will II.
I reply that it must be said that this definition completely encompasses the whole notion of virtue. For the complete notion of whatsoever thing is collected from all of its causes. But the aforementioned definition encompasses all causes of virtue.
(1) For the formal cause of virtue, as of anything, is taken from its genus and difference, so it is called good quality, for quality is the genus of virtue and good the difference. However, it would be a more fitting definition if habitude were put instead of quality, which is the closest genus.
(2) Now virtue does not have from-which matter, as neither do other accidents, but it has about-which matter and in-which matter, to wit, the subject. The about-which matter is the object of virtue, which was not able to be placed in the aforementioned definition, because through the object the virtue is determined to the species, but here is assigned the definition of common virtue. Thus the subject is put in the material cause's place, when it is said that it is good quality of mind.
(3) But the end of virtue, since it is working habitude, is the working itself. But it must be noted that some working habitudes are always to bad, such as vicious habitudes; while some are sometimes to good, sometimes to bad, as opinion has itself to true and to false; but virtue is habitude always having itself to good. Therefore, to distinguish virtue from those which always have themselves to bad, it is said, by which one lives rightly, but so as to distinguish it from those which sometimes have themselves to good, sometimes to bad, it is said, which no one uses badly.
(4) But the efficient cause of infused virtue, for which the definition is given, is God. According to this it is said, which God works in us without us. If this phrase is removed, the rest of the definition will be common to all virtues, both acquired and infused.
To the first therefore it must be said that what first falls into the intellect is being, whence we attribute everything apprehended by us to being, and so by consequence one and good, which are converted with being. Thus we say that beingness [essentia] is being and one and good, and that oneness is being and one and good, and likewise for goodness. But this does not have a place in specific forms, such as whiteness and health, for everything we apprehend, we do not apprehend under the notions of white or health. But nonetheless it must be considered that as accidents and non-subsisting forms are called beings, not because they themselves have actual being but because something is by him, so also they are called good and one, not indeed by some other goodness or oneness, but because something by them is good and one. So therefore virtue is also called good because by it something is good.
To the second it must be said that the good put in the definition of virtue is not common good, which is converted with being, and is in more than quality, but it is the good of reason, according to what Dionysius says in Div. Nom. ch IV, that the good of the soul is according to reason.
To the third it must be said that virtue is not able to be in the irrational part of the soul, save inasmuch as it participates reason, as is said in Ethic. I., as therefore reason, or mind is the proper subject of virtue.
To the fourth it must be said that justice is its own rightness that is constituted about external things that come into human use, which are the proper matter of justice, as will be obvious below. But rightness which implies order to due end and to divine law, which is the rule of human will, as was said above, is common to all virtue.
To the fifth it must be said that someone is able to use virtue badly as an object, such as when he feels badly about virtue when he hates it or is proud of it, but not as a source of use, so that the act of virtue is bad.
To the sixth it must be said that infused virtue is caused in us by God without our acting, yet not without our consenting. And so it must be understood when it is said that God works in us without us. But what is enacted through us, God does not cause in us without our acting, for he himself works in all will and nature.
[Thomas Aquinas, ST 2-1.55.4, my translation. The Latin is here, the Dominican Fathers translation is here.]
Thus, taking all of this together, virtue is rational habitude ordered solely to what is good by reason, by which one's actions are regulated according to due end and divine law. Infused virtue is caused by God with our consenting but not through our acting; acquired virtue is caused by God working through our own acting. (Note that Aquinas very clearly does not say in the reply to the sixth objection that acquired virtue is caused by us rather than God.)
This passage, incidentally, is why one should understand the discussions of virtue in the Summa to be primarily about infused virtue, although, of course, Aquinas often uses the analogy between acquired and infused moral virtues to explain the latter.
It's an interesting question how this definition relates to Aristotle's definition of virtue: virtue is habitude of choice consisting in a mean relative to us as determined by the reason of a prudent person. Aquinas's reorganization of the concept of habitude means that all rational habitudes involve choice in some way or another, so that is already here, and reason of a prudent person (who is concerned with regulation according to due end, which Aquinas elsewhere calls regulation by reason); the mean relative to us as decided by such reason is Aristotle's way of talking about regulating our action toward good. Thus, there is a way to identify a correspondence between the two.
Nonetheless, while St. Thomas doesn't think that Aristotle's definition is wrong, he thinks it has a serious limitation, one which comes up when he later discusses the mean of virtue. On Aquinas's account, all virtues can in some sense be said to involve a mean relative to us. Moral and intellectual virtues both essentially consist in a mean, and this is true whether they are acquired or infused. But theological virtues (faith, hope, charity) are more complicated because their proper rule and measure is God Himself, not us (even, as with the infused moral virtues, considering us as raised by grace to be members of the Kingdom of Heaven). This is not to say that they don't have a mean relative to us (they do because that's how we our structured); it's just that, since they are in fact ordered to God rather than us, that mean is incidental rather than essential to their nature, arising from our conditions rather than the conditions of the virtues themselves. What the theological virtues consist in by their own nature is not the mean of reason but the infinity of God.