def test_MMM2D(self): self.S.box_l = (10, 10, 10) self.S.cell_system.set_layered(n_layers=10,use_verlet_lists=False) self.S.periodicity=1,1,0 mmm2d=(el.MMM2D(prefactor=1,maxPWerror=1E-7)) self.S.actors.add(mmm2d) self.S.integrator.run(0) if self.generate_data: n=len(self.S.part) data=np.hstack((self.S.part[:].id.reshape((n,1)),self.S.part[:].pos_folded,self.S.part[:].q.reshape((n,1)),self.S.part[:].f)) np.savetxt(tests_common.abspath( "data/coulomb_mixed_periodicity_system.data"),data) self.compare("mmm2d (compared to stored data)", energy=True) self.S.actors.remove(mmm2d)
WCA_cut = 2.**(1. / 6.) system.non_bonded_inter[0, 1].lennard_jones.set_params(epsilon=1.0, sigma=1.0, cutoff=WCA_cut, shift="auto") system.non_bonded_inter[0, 0].lennard_jones.set_params(epsilon=1.0, sigma=1.0, cutoff=WCA_cut, shift="auto") energy = system.analysis.energy() print("Before Minimization: E_total=", energy['total']) system.minimize_energy.init(f_max=10, gamma=50.0, max_steps=1000, max_displacement=0.2) system.minimize_energy.minimize() energy = system.analysis.energy() print("After Minimization: E_total=", energy['total']) system.thermostat.set_langevin(kT=0.1, gamma=1.0) mmm2d = electrostatics.MMM2D(prefactor=10.0, maxPWerror=1e-3, const_pot=1, pot_diff=50.0) system.actors.add(mmm2d) visualizer.run(1)