def on_layout(self, cvs, system): Box.on_layout(self, cvs, system) Atom.on_layout(self, cvs, system) x0 = self.x_bot[0] x1 = self.x_bot[1] system.add(x0 == self.llx + (1. / 4) * self.width, weight=self.weight) system.add(x1 == self.llx + (3. / 4) * self.width, weight=self.weight) system.add(self.height >= x1 - x0)
def on_layout(self, cvs, system): Box.on_layout(self, cvs, system) Atom.on_layout(self, cvs, system) width = self.width llx = self.llx n_top = self.n_top x_top = self.x_top if n_top > 0: dx = width / (2 * n_top) x = llx + dx for i in range(n_top): system.add(x_top[i] == x, weight=self.weight) x += 2 * dx n_bot = self.n_bot x_bot = self.x_bot if n_bot > 0: dx = width / (2 * n_bot) x = llx + dx for i in range(n_bot): system.add(x_bot[i] == x, weight=self.weight) x += 2 * dx
def on_layout(self, cvs, system): Box.on_layout(self, cvs, system) Atom.on_layout(self, cvs, system) system.add(self.x_bot[0] == self.x_top[0]) x = 0.5 * (self.llx + self.urx) system.add(self.x_bot[0] == x, 1.0)