def lmps_min(s, name, settings): """pysimm.apps.polymatic.lmps_min Runs LAMMPS minimization for the Polymatic algorithm. Args: s: :class:`~pysimm.system.System` to minimize name: name of simulation settings: object containing Polymatic settings Returns: result from :func:`~pysimm.lmps.minimize` """ if settings.polym.min.cluster: nanohub = { 'cores': int(settings.polym.min.nanohub_cores), 'walltime': int(settings.polym.min.nanohub_walltime) } log_name = '%s' % '_'.join(name.split()) else: nanohub = {} log_name = 'logs/%s' % '_'.join(name.split()) if settings.polym.min.user_input: lmps.run(s, lammps_in=settings.polym.min.min_in, name='initial optimization', print_to_screen=False, nanohub=nanohub) else: result = lmps.minimize(s, name=name, cutoff=settings.polym.min.nb_cutoff, sd_etol=settings.polym.min.sd_etol, sd_ftol=settings.polym.min.sd_ftol, sd_maxiter=settings.polym.min.sd_maxiter, sd_maxeval=settings.polym.min.sd_maxeval, cg_etol=settings.polym.min.cg_etol, cg_ftol=settings.polym.min.cg_ftol, cg_maxiter=settings.polym.min.cg_maxiter, cg_maxeval=settings.polym.min.cg_maxeval, log=log_name, np=settings.np, nanohub=nanohub) if settings.polym.min.cluster: shutil.move(log_name, 'logs') return result
def lmps_cycle_npt_md(s, bonds, settings): """pysimm.apps.polymatic.lmps_cycle_npt_md Runs LAMMPS npt cycle md for the Polymatic algorithm. Args: s: :class:`~pysimm.system.System` to minimize bonds: number of bond to be made settings: object containing Polymatic settings Returns: result from lmps.md """ if settings.polym.cycle_npt.cluster: nanohub = { 'cores': int(settings.polym.cycle_npt.nanohub_cores), 'walltime': int(settings.polym.cycle_npt.nanohub_walltime) } log_name = 'cycle_npt_%03d' % bonds else: nanohub = {} log_name = 'logs/cycle_npt_%03d' % bonds if settings.polym.cycle_npt.user_input: lmps.run(s, lammps_in=settings.polym.cycle_npt.step_in, name='bond %d cycle npt' % bonds, print_to_screen=False, nanohub=nanohub) else: result = lmps.md(s, name='bond %d cycle npt' % bonds, ensemble='nvt', cutoff=settings.polym.cycle_npt.nb_cutoff, temp=settings.polym.cycle_npt.temp, new_v=True, pressure=settings.polym.cycle_npt.pressure, length=settings.polym.cycle_npt.length, log=log_name, np=settings.np, nanohub=nanohub) if settings.polym.cycle_npt.cluster: shutil.move(log_name, 'logs') return result
def lmps_step_md(s, bonds, attempt, settings): """pysimm.apps.polymatic.lmps_step_md Runs LAMMPS step md for the Polymatic algorithm. Args: s: :class:`~pysimm.system.System` to minimize bonds: number of bond to be made attempt: number of bonding attempt settings: object containing Polymatic settings Returns: result from :func:`~pysimm.lmps.md` """ if settings.polym.step.cluster: nanohub = { 'cores': int(settings.polym.step.nanohub_cores), 'walltime': int(settings.polym.step.nanohub_walltime) } log_name = 'step_%03d_%03d' % (bonds, attempt) else: nanohub = {} log_name = 'logs/step_%03d_%03d' % (bonds, attempt) if settings.polym.step.user_input: lmps.run(s, lammps_in=settings.polym.step.step_in, name='bond %s attempt #%d' % (bonds + 1, attempt), print_to_screen=False, nanohub=nanohub) else: result = lmps.md(s, name='bond %s: attempt #%d' % (bonds + 1, attempt), ensemble='nvt', cutoff=settings.polym.step.nb_cutoff, temp=settings.polym.step.temp, new_v=True, length=settings.polym.step.length, log=log_name, np=settings.np, nanohub=nanohub) if settings.polym.step.cluster: shutil.move(log_name, 'logs') return result