예제 #1
0
    def test_change_potential(self):
        L = PyLammps()
        L.file(IncludeTests.ATOMS_SETUP_FILE)

        # set non-bonded potential
        L.pair_style('lj/cut', 5.0)
        L.pair_coeff(1, 1, 1.0, 1.0)

        # set different non-bonded potential
        L.velocity('all create', 1.0, 54321, 'mom no rot no')

        # import time integration setting from include file
        L.file(IncludeTests.VERLET_CONFIG_FILE)

        L.minimize(1.0e-10, 1.0e-10, 100, 1000)

        L.reset_timestep(0)  # set timestep counter to zero

        L.thermo(10)         # thermo output every 10 steps

        L.run(100, 'post no')

        # continue run with different potential
        L.pair_style('morse', 5.0)
        L.pair_coeff(1, 1, 1.0, 5.0, 1.12)

        L.run(100)
예제 #2
0
    def test_real_units(self):
        L = PyLammps()
        L.units('real') # angstrom, kcal/mol, femtoseconds
        L.atom_style('atomic')
        L.boundary('p p p')

        L.lattice('none', 1.0)

        # create simulation cell
        L.region('r1 block', -15.0, 15.0, -15.0, 15.0, -15.0, 15.0)
        L.create_box(1, 'r1')

        # argon
        L.mass(1, 39.948002)
        L.pair_style('lj/cut', 8.5)
        L.pair_coeff(1, 1, 0.2379, 3.405)

        L.timestep(10.0)

        L.create_atoms(1, 'single', -1.0, 0.0, 0.0)
        L.create_atoms(1, 'single',  1.0, 0.0, 0.0)

        L.velocity('all create', 250.0, 54321, 'mom no rot no')

        L.minimize(1.0e-10, 1.0e-10, 100, 1000)

        L.reset_timestep(0)

        L.thermo(100)
        L.fix('f1 all nve')
        L.run(1000)
예제 #3
0
    def test_run_post_no_pre_no(self):
        L = PyLammps()
        L.file(IncludeTests.ATOMS_SETUP_FILE)

        # set non-bonded potential
        L.pair_style('lj/cut', 5.0)
        L.pair_coeff(1, 1, 1.0, 1.0)

        # set different non-bonded potential
        L.velocity('all create', 1.0, 54321, 'mom no rot no')

        # import time integration setting from include file
        L.file(IncludeTests.VERLET_CONFIG_FILE)

        L.minimize(1.0e-10, 1.0e-10, 100, 1000)

        L.reset_timestep(0)  # set timestep counter to zero

        L.thermo(10)         # thermo output every 10 steps

        L.run(100, 'post no') # don't print post run information

        L.run(100, 'pre no')  # don't to pre-run preparation (not needed, if no change)
예제 #4
0
simulation.create_rods(box=None)

# ROD DYNAMICS
py_lmp.fix("thermostat", "all", "langevin", run_args.temp, run_args.temp,
           run_args.damp, seed)  #, "zero yes")

simulation.set_rod_dynamics("nve", opt=["mol", model.rod_states[0]])

py_lmp.neigh_modify("every 1 delay 1")
py_lmp.timestep(run_args.dt)

# THERMALIZE INITIAL CONFIGURATION
simulation.deactivate_state(0, vx_eps=5.0)
py_lmp.run(1000)
simulation.activate_state(0)
py_lmp.reset_timestep(0)

# GROUPS & COMPUTES
if hasattr(run_args, 'label_micelles'):
    micelle_group = 'sol_tips'
    sol_tip_bead_type = model.state_structures[0][0][-1]
    py_lmp.variable(micelle_group, 'atom',
                    '"type == {:d}"'.format(sol_tip_bead_type))
    py_lmp.group(micelle_group, 'dynamic', simulation.rods_group, 'var',
                 micelle_group, 'every', out_freq)
    micelle_compute = "micelle_ID"
    if hasattr(run_args, 'micelle_cutoff'):
        micelle_cutoff = run_args.micelle_cutoff
    else:
        SS_tip_int_key = model.eps[(sol_tip_bead_type, sol_tip_bead_type)][1]
        SS_tip_int_range = model.int_types[SS_tip_int_key][1]
예제 #5
0
    def test_use_data_file(self):
        L = PyLammps()
        L.units('real') # angstrom, kcal/mol, femtoseconds
        L.atom_style('atomic')
        L.boundary('p p p')

        L.lattice('none', 1.0)

        # create simulation cell
        L.region('r1 block', -15.0, 15.0, -15.0, 15.0, -15.0, 15.0)
        L.create_box(1, 'r1')

        # argon
        L.mass(1, 39.948002)
        L.pair_style('lj/cut', 8.5)
        L.pair_coeff(1, 1, 0.2379, 3.405)

        L.timestep(10.0)

        L.create_atoms(1, 'single', -1.0, 0.0, 0.0)
        L.create_atoms(1, 'single',  1.0, 0.0, 0.0)

        L.velocity('all create', 250.0, 54321, 'mom no rot no')

        L.minimize(1.0e-10, 1.0e-10, 100, 1000)

        L.reset_timestep(0)

        L.thermo(100)
        L.fix('f1 all nve')
        L.run(1000)

        L.write_restart('run.restart')
        L.write_data('run.data')

        L2 = PyLammps()
        L2.units('real')           # angstrom, kcal/mol, femtoseconds
        L2.atom_style('atomic')
        L2.boundary('p p p')

        L2.pair_style('lj/cut', 8.5)
        L2.read_data('run.data')

        L2.timestep(10.0)

        L2.thermo(100)
        L2.fix('f1 all nve')
        L2.run(1000)

        # reset status. forget all settings. delete system
        L2.clear()

        L2.read_restart('run.restart')

        L2.thermo(100)
        L2.fix('f1 all nve')
        L2.run(1000)

        os.remove('run.restart')
        os.remove('run.data')

        self.assertEqual(L.system, L2.system)