def test_system(): system = System(box_size=[5, 5, 5]) # No molecules yet in the system assert len(system) == 0 system += h2o assert len(system) == 1 system.add_molecules(h2o, 10) assert len(system) == 11 two_waters = [h2o, h2o] system += two_waters assert len(system) == 13 assert system.n_unique_molecules == 1 assert str(system) == 'H2O_13' or str(system) == 'OH2_13' # Should be able to print an xyz file of the configuration system.configuration().save(filename='test.xyz') assert os.path.exists('test.xyz') os.remove('test.xyz')
def test_dftb_plus(): water_box = System(box_size=[5, 5, 5]) config = water_box.configuration() config.set_atoms(xyz_filename=os.path.join(here, 'data', 'h2o_10.xyz')) if 'GT_DFTB' not in os.environ or not os.environ['GT_DFTB'] == 'True': return config.run_dftb() assert config.energy is not None forces = config.forces assert type(forces) is np.ndarray assert forces.shape == (30, 3) # Should all be non-zero length force vectors in ev Å^-1 assert all(0 < np.linalg.norm(force) < 70 for force in forces)