def test_make_function_output(self): """Check make() function creates expected forcefield file""" # read a forcefield from the output of make([--0--]) self.ff.make(np.zeros(self.ff.np)) os.rename(self.ff.fnms[0], self.options['ffdir'] + '/test_zeros.' + self.filetype) self.options['forcefield'] = ['test_zeros.' + self.filetype] ff_zeros = forcefield.FF(self.options) self.assertEqual( self.ff, ff_zeros, msg="make([0]) produced a different output forcefield") os.remove(self.options['ffdir'] + '/test_zeros.' + self.filetype) # read a forcefield from the output of make([--1--]) self.ff.make(np.ones(self.ff.np)) os.rename(self.ff.fnms[0], self.options['ffdir'] + '/test_ones.' + self.filetype) self.options['forcefield'] = ['test_ones.' + self.filetype] ff_ones = forcefield.FF(self.options) self.assertNotEqual( self.ff, ff_ones, msg="make([1]) produced an unchanged output forcefield") os.remove(self.options['ffdir'] + '/test_ones.' + self.filetype)
def test_FF_yields_consistent_results(self): """Check whether multiple calls to FF yield the same result""" self.logger.debug("\nChecking consistency of ForceField constructor\n") self.assertEqual( forcefield.FF(self.options), forcefield.FF(self.options), msg= "\nGot two different forcefields despite using the same options as input" )
def setUp(self): # options used in 001_water_tutorial self.logger.debug("\nSetting up options...\n") self.options = forcebalance.parser.gen_opts_defaults.copy() self.options.update({ 'root': os.getcwd() + '/test/files', 'penalty_additive': 0.01, 'jobtype': 'NEWTON', 'forcefield': ['water.itp'] }) self.logger.debug(str(self.options) + '\n') os.chdir(self.options['root']) self.logger.debug("Creating forcefield using above options... ") self.ff = forcefield.FF(self.options) self.ffname = self.options['forcefield'][0][:-3] self.filetype = self.options['forcefield'][0][-3:] self.logger.debug("ok\n")
def setup_method(self, method): super(TestGbsFF, self).setup_method(method) self.cwd = os.path.dirname(os.path.realpath(__file__)) os.chdir(os.path.join(self.cwd, 'files')) self.logger.debug("Setting up options...\n") self.options = forcebalance.parser.gen_opts_defaults.copy() self.options.update({ 'root': os.getcwd(), 'penalty_additive': 0.01, 'jobtype': 'NEWTON', 'forcefield': ['cc-pvdz-overlap-original.gbs'] }) self.logger.debug(str(self.options) + '\n') self.logger.debug("Creating forcefield using above options... ") self.ff = forcefield.FF(self.options) self.ffname = self.options['forcefield'][0][:-3] self.filetype = self.options['forcefield'][0][-3:] self.logger.debug("ok\n")