Beispiel #1
0
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
Beispiel #2
0
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