Example #1
0
    #dp = np.sqrt(2 * a.mass * 1000.0)
    #a.momentum = np.array([0, 0, dp])
    t = np.zeros(len(atoms), int)
    t[n] = 1
    atoms.set_tags(t)
else:
    atoms = None
atoms = MakeParallelAtoms(atoms, cpulayout)
print len(atoms), atoms.get_number_of_atoms()
atoms.set_calculator(EMT())

traj = PickleTrajectory("UnBalance.traj", "w", atoms)
if fast:
    atoms.get_forces()
    traj.write()
    for i in range(50):
        print "\n\n\n\n*** STEP %i ***\n\n\n\n\n" % (i, )
        r = atoms.get_positions()
        r += atoms.get_tags().reshape((-1, 1)) * np.array([
            [0, 0, 20.0],
        ])
        atoms.set_positions(r)
        atoms.get_forces()
        traj.write()
else:
    dyn = VelocityVerlet(atoms, 5 * units.fs)
    logger = MDLogger(dyn, atoms, 'UnBalance.log', stress=True, peratom=True)
    dyn.attach(logger, interval=10)
    dyn.attach(traj, interval=100)
    dyn.run(10000)
Example #2
0
    #dp = np.sqrt(2 * a.mass * 1000.0)
    #a.momentum = np.array([0, 0, dp])
    t = np.zeros(len(atoms), int)
    t[n] = 1
    atoms.set_tags(t)
else:
    atoms = None
atoms = MakeParallelAtoms(atoms, cpulayout)
print len(atoms), atoms.get_number_of_atoms()
atoms.set_calculator(EMT())

traj = PickleTrajectory("UnBalance.traj", "w", atoms)
if fast:
    atoms.get_forces()
    traj.write()
    for i in range(50):
        print "\n\n\n\n*** STEP %i ***\n\n\n\n\n" % (i,)
        r = atoms.get_positions()
        r += atoms.get_tags().reshape((-1,1)) * np.array([[0, 0, 20.0],])
        atoms.set_positions(r)
        atoms.get_forces()
        traj.write()
else:
    dyn = VelocityVerlet(atoms, 5*units.fs)
    logger = MDLogger(dyn, atoms, 'UnBalance.log', stress=True, peratom=True)
    dyn.attach(logger, interval=10)
    dyn.attach(traj, interval=100)
    dyn.run(10000)