def get_potential_energy(self, a=None):
if a is None:<EOL><INDENT>a = self.a<EOL><DEDENT>if self.mask is None:<EOL><INDENT>return -np.sum(np.dot(a.get_positions()[self.mask], self.force))<EOL><DEDENT>else:<EOL><INDENT>return -np.sum(np.dot(a.get_positions(), self.force))<EOL><DEDENT>
Calculate potential energy.