def test_raises_runtime_error(self, pt_blank_dir, grompp):
     from paratemp.sim_setup import compile_tprs
     dir_topo = pt_blank_dir.joinpath('TOPO')
     dir_topo.mkdir()
     number = 2
     with cd(dir_topo):
         with pytest.raises(RuntimeError):
             compile_tprs(start_temp=298,  scaling_exponent=0.025,
                          number=number,
                          template='../'+n_template,
                          structure='../*top',
                          base_name='nvt',
                          grompp_exe=grompp)
 def test_multi_structure(self, pt_blank_dir, grompp):
     from paratemp.sim_setup import compile_tprs
     from paratemp.tools import get_temperatures
     dir_topo = pt_blank_dir.joinpath('TOPO')
     dir_topo.mkdir()
     number = 2
     with cd(dir_topo):
         compile_tprs(start_temp=298,  scaling_exponent=0.025,
                      number=number,
                      template='../'+n_template,
                      multi_structure=True,
                      structure='../PT-out',
                      base_name='nvt',
                      grompp_exe=grompp)
     assert dir_topo.exists()
     for i in range(number):
         assert dir_topo.joinpath('nvt{}.tpr'.format(i)).exists()
     assert get_temperatures(
         str(dir_topo.joinpath('temperatures.dat'))).shape == (2,)
 def test_warns(self, pt_blank_dir, grompp):
     from paratemp.sim_setup import compile_tprs
     from paratemp.tools import get_temperatures
     dir_topo = pt_blank_dir.joinpath('TOPO')
     dir_topo.mkdir()
     number = 2
     with cd(dir_topo):
         with pytest.warns(UserWarning, match=r'Found \d+ structure files'):
             compile_tprs(start_temp=298,
                          scaling_exponent=0.025,
                          number=number,
                          template='../' + n_template,
                          structure='../*.gro',
                          base_name='nvt',
                          grompp_exe=grompp)
     assert dir_topo.exists()
     for i in range(number):
         assert dir_topo.joinpath('nvt{}.tpr'.format(i)).exists()
     assert get_temperatures(str(
         dir_topo.joinpath('temperatures.dat'))).shape == (2, )
 def test_raises_os_error(self, pt_blank_dir, grompp):
     from paratemp.sim_setup import compile_tprs
     dir_topo = pt_blank_dir.joinpath('TOPO')
     dir_topo.mkdir()
     number = 2
     with cd(dir_topo):
         with pytest.raises(OSError,
                            match='Incorrect number of '
                            'structure files found'):
             compile_tprs(start_temp=298,
                          scaling_exponent=0.025,
                          number=number,
                          template='../' + n_template,
                          multi_structure=True,
                          structure='../',
                          base_name='nvt',
                          grompp_exe=grompp)
         with pytest.raises(OSError, match='No structure file found'):
             compile_tprs(start_temp=298,
                          scaling_exponent=0.025,
                          number=number,
                          template='../' + n_template,
                          structure='../not-here.gro',
                          base_name='nvt',
                          grompp_exe=grompp)
         with pytest.raises(OSError, match='No topology file found'):
             compile_tprs(start_temp=298,
                          scaling_exponent=0.025,
                          number=number,
                          template='../' + n_template,
                          structure='../' + n_gro,
                          topology='../not-here.top',
                          base_name='nvt',
                          grompp_exe=grompp)