Example #1
0
        print("sputter event detected, equilibration...")
        displacement = True
        sputteringevents[0, nosputt] = nel
        # electron number
        sputteringevents[1, nosputt] = theta
        # scattering angle chosen
        sputteringevents[2, nosputt] = E_t
        # transferred Energy to atom
        sputteringevents[3, nosputt] = atomid
        # atom chosen for energy transfer
        #sputteringevents[4,nosputt] = partdisp;	# atom lost
        #sputteringevents[5,nosputt] = 1;		# element1
        nosputt += 1

        # reset LAMMPS:
        L.clear()
        #L.close()
        lmp = lammps()
        L = PyLammps(ptr=lmp)
        L.read_restart("restartfromprevdispl.equil")

        L.pair_style("hybrid", "eam/alloy", "lj/cut", 10.0, "tersoff")
        L.pair_coeff("* * eam/alloy NiAu_Zhou.eam.alloy Au Ni NULL")
        L.pair_coeff(1, 3, "lj/cut", epsAuC, sigAuC, 10.0)
        L.pair_coeff(2, 3, "lj/cut", epsNiC, sigNiC, 10.0)
        L.pair_coeff("* *", "tersoff", "SiC.tersoff", "NULL NULL C")

        L.compute("K", "all", "ke/atom")
        L.compute("P", "all", "pe/atom")
        L.compute(
            "coordno", "all", "coord/atom", "cutoff", NNthresh
    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)