def setUp(self): self.symbols = ['Mg','O'] self.param_names = ['chrg_Mg', 'chrg_O', 'MgMg_A', 'MgMg_rho', 'MgMg_C', 'OO_A', 'OO_rho', 'OO_C', 'MgO_A', 'MgO_rho', 'MgO_C'] self.pot = potential.Buckingham(symbols = self.symbols)
def test_to_string_w_param_dict(self): param_dict = {} param_dict['chrg_Mg'] = +2.0 param_dict['chrg_O'] = -2.0 param_dict['MgMg_A'] = 0.0 param_dict['MgMg_rho'] = 0.5 param_dict['MgMg_C'] = 0.0 param_dict['MgO_A'] = 821.6 param_dict['MgO_rho'] = 0.3242 param_dict['MgO_C'] = 0.0 param_dict['OO_A'] = 2274.00 param_dict['OO_rho'] = 0.1490 param_dict['OO_C'] = 27.88 pot_orig = potential.Buckingham(symbols = symbols) print(pot_orig.to_string(param_dict))
def setUp(self): self.symbols = ['Mg','O'] self.param_names = ['chrg_Mg', 'chrg_O', 'MgMg_A', 'MgMg_rho', 'MgMg_C', 'OO_A', 'OO_rho', 'OO_C', 'MgO_A', 'MgO_rho', 'MgO_C'] self.param_dict = {} self.param_dict['chrg_Mg'] = +2.0 self.param_dict['chrg_O'] = -2.0 self.param_dict['MgMg_A'] = 0.0 self.param_dict['MgMg_rho'] = 0.5 self.param_dict['MgMg_C'] = 0.0 self.param_dict['MgO_A'] = 821.6 self.param_dict['MgO_rho'] = 0.3242 self.param_dict['MgO_C'] = 0.0 self.param_dict['OO_A'] = 2274.00 self.param_dict['OO_rho'] = 0.1490 self.param_dict['OO_C'] = 27.88 self.pot_orig = potential.Buckingham(symbols = self.symbols)
def setUp(self): symbols = ['Mg', 'O'] fname = 'potential.mod' param_dict = {} param_dict['chrg_Mg'] = +2.0 param_dict['chrg_O'] = -2.0 param_dict['MgMg_A'] = 0.0 param_dict['MgMg_rho'] = 0.5 param_dict['MgMg_C'] = 0.0 param_dict['MgO_A'] = 821.6 param_dict['MgO_rho'] = 0.3242 param_dict['MgO_C'] = 0.0 param_dict['OO_A'] = 2274.00 param_dict['OO_rho'] = 0.1490 param_dict['OO_C'] = 27.88 self.buck = potential.Buckingham(symbols=symbols) self.buck.param = param_dict.copy() self.task = lammps_task.LammpsMinimizeStructure(fname, self.buck)
gulp_input_filename = 'gulp.in' #task = GulpPhononCalculation(task_name,task_directory) #### TEST POTENTIAL POTENTIAL #### #print('----- test that buckingham potential provides the right format -----') #task.potential = potential.Buckingham(['Mg','O']) #task.param_dict = copy.deepcopy(param_dict) #print(task.potential.gulp_potential_section_to_string(param_dict)) #### TEST IF WE CAN CAN WRITE THE INPUT FILE #### #gulp_input_filename = os.path.join(task.task_directory,'gulp.in') #poscar_input_filename = os.path.join('rsrc','MgO_NaCl_prim.vasp') #task.write_gulp_input_file(\ # filename=gulp_input_filename, # poscar=vasp_input_filename) #### TEST IF WE CAN RUN THE BUCKINGHAM POTENTIAL #### #task.structure_filename = os.path.join('rsrc','MgO_NaCl_prim.vasp') #task.run() task = GulpPhononCalculation(task_name, task_directory) task.potential = potential.Buckingham(['Mg', 'O']) task.param_dict = copy.deepcopy(param_dict) task.structure_file = os.path.join(\ task.task_directory, vasp_input_filename) task.write_gulp_input_file(\ filename=os.path.join(task.task_directory,gulp_input_filename), poscar=vasp_input_filename) task.run()
import pypospack.task.lammps as tsk_lammps import pypospack.potential as potential if __name__ == '__main__': task_name = 'task_name' task_directory = 'task_name' task = tsk_lammps.LammpsSimulation(\ task_name = task_name, task_directory = task_directory) print('task.status:{}'.format(task.status)) pot = potential.Buckingham(['Mg', 'O']) task.potential = pot print('write_lammps_input_file():{}'.format( task.lammps_input_file_to_string()))
def test_attr_param_dict(self): for p in self.param_names: self.assertEqual( self.pot_clone.param[p], self.pot_orig.param[p]) if __name__ == '__main__': # unittest.main() symbols = ['Mg','O'] param_names = ['chrg_Mg', 'chrg_O', 'MgMg_A', 'MgMg_rho', 'MgMg_C', 'OO_A', 'OO_rho', 'OO_C', 'MgO_A', 'MgO_rho', 'MgO_C'] param_dict = {} param_dict['chrg_Mg'] = +2.0 param_dict['chrg_O'] = -2.0 param_dict['MgMg_A'] = 0.0 param_dict['MgMg_rho'] = 0.5 param_dict['MgMg_C'] = 0.0 param_dict['MgO_A'] = 821.6 param_dict['MgO_rho'] = 0.3242 param_dict['MgO_C'] = 0.0 param_dict['OO_A'] = 2274.00 param_dict['OO_rho'] = 0.1490 param_dict['OO_C'] = 27.88 pot_orig = potential.Buckingham(symbols = symbols) print(pot_orig.to_string(param_dict))