Example #1
0
def myfcc(symbol, pbc):
    "Make an fcc lattice with standard lattice constant"
    if ismaster:
        a = FaceCenteredCubic(symbol=symbol, size=(10,10,10), pbc=pbc)    
        dx = 0.01 * np.sin(0.1 * np.arange(len(a) * 3))
        dx.shape = (len(a),3)
        a.set_positions(a.get_positions() + dx)
        a.set_momenta(np.zeros((len(a),3)))
        #view(a)
    else:
        a = None
    if isparallel:
        a = MakeParallelAtoms(a, cpulayout)
    return a
Example #2
0
if ismaster:
    atoms = FaceCenteredCubic(size=(2,10,10), symbol="Cu", pbc=False,
                              latticeconstant = 3.5)
else:
    atoms = None

if isparallel:
    atoms = MakeParallelAtoms(atoms, cpulayout)
atoms.set_calculator(asap3.EMT())
natoms = atoms.get_number_of_atoms()
    
ReportTest("Number of atoms", natoms, 800, 0)

# Make a small perturbation of the momenta
atoms.set_momenta(1e-6 * random.random([len(atoms), 3]))
print "Initializing ..."
predyn = VelocityVerlet(atoms, 0.5)
try:
    predyn.run(2500)
except:
    print atoms.arrays['positions']
    print atoms.arrays['momenta']
    print atoms.arrays['momenta'].shape
    print atoms.get_masses()
    print atoms.get_masses().shape
    
    raise

initr = atoms.get_positions()
initp = atoms.get_momenta()
Example #3
0
#AsapThreads()

cpulayout = (1, 1, 2)

element = 'Pt'
size = (20, 20, 100)

master = world.rank == 0

if master:
    atoms = FaceCenteredCubic(symbol=element,
                              size=size,
                              pbc=(True, True, False))
    atoms.center(vacuum=10.0, axis=2)
    atoms.set_momenta(np.zeros((len(atoms), 3)))
    # Select an atom to get a kick
    r = atoms.get_positions()
    uc = atoms.get_cell()
    x = r[:, 0] - 0.5 * uc[0, 0]
    y = r[:, 1] - 0.5 * uc[1, 1]
    z = r[:, 2]
    zprime = z - 0.01 * (x * x + y * y)
    n = np.argmax(zprime)
    #a = atoms[n]
    #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:
Example #4
0
tolerance = 0.01
timestep = 5 # fs
frict = 0.001
temp = 100 # K
repeats = 5

# Set up atoms in a regular simple-cubic lattice.
initial = FaceCenteredCubic(directions=[[1,0,0],[0,1,0],[0,0,1]],
                            size = (1,5,5), symbol="Cu", latticeconstant=3.5,
                            pbc=False, debug=0)
initial.set_calculator(EMT())
    
ReportTest("Number of atoms", len(initial), 100, 0)

# Make a small perturbation of the momenta
initial.set_momenta(1e-6 * np.random.normal(size=[len(initial), 3]))
print "Initializing (1) ..."
predyn = VelocityVerlet(initial, 0.5)
predyn.run(2500)

initial2 = FaceCenteredCubic(directions=[[1,0,0],[0,1,0],[0,0,1]],
                             size = (4,4,4), symbol="Cu", debug=0)
initial2.set_calculator(EMT())
# Make a small perturbation of the momenta
initial2.set_momenta(1e-6 * np.random.normal(size=[len(initial2), 3]))
print "Initializing (2) ..."
predyn = VelocityVerlet(initial2, 0.5)
predyn.run(2500)


class TemperatureMonitor:
Example #5
0
else:
    raise ValueError, ("Cannot run on %d CPUs." % (worldsize, ))

elements = [29]
epsilon = [0.15]
sigma = [2.7]

if ismaster:
    initial = FaceCenteredCubic(directions=((1, 0, 0), (0, 1, 0), (0, 0, 1)),
                                size=(40, 40, 40),
                                symbol="Cu",
                                latticeconstant=1.09 * sigma[0] * 1.41,
                                pbc=(1, 1, 0))
    momenta = sqrt(2 * 63.5 * units.kB * 400) * sin(arange(3 * len(initial)))
    momenta.shape = (-1, 3)
    initial.set_momenta(momenta)
    stdout = sys.stdout
    print "Number of atoms:", len(initial)
else:
    initial = None
    stdout = open("/dev/null", "w")

for cpulayout in layout:
    if cpulayout:
        print >> stdout, "Test with layout " + str(cpulayout)
        atoms = MakeParallelAtoms(initial, cpulayout)
        natoms = atoms.get_number_of_atoms()
    else:
        print >> stdout, "Serial test"
        atoms = Atoms(initial)
        natoms = len(atoms)
Example #6
0
else:
    raise ValueError, ("Cannot run on %d CPUs." % (worldsize,))

elements = [29]
epsilon  = [0.15]
sigma    = [2.7]


if ismaster:
    initial = FaceCenteredCubic(directions=((1,0,0),(0,1,0),(0,0,1)),
                                size=(40,40,40), symbol="Cu",
                                latticeconstant=1.09*sigma[0]*1.41,
                                pbc=(1,1,0))
    momenta = sqrt(2*63.5 * units.kB * 400) * sin(arange(3*len(initial)))
    momenta.shape = (-1,3)
    initial.set_momenta(momenta)
    stdout = sys.stdout
    print "Number of atoms:", len(initial)
else:
    initial = None
    stdout = open("/dev/null", "w")

for cpulayout in layout:
    if cpulayout:
        print >>stdout, "Test with layout "+str(cpulayout)
        atoms = MakeParallelAtoms(initial, cpulayout)
        natoms = atoms.get_number_of_atoms()
    else:
        print >>stdout, "Serial test"
        atoms = Atoms(initial)
        natoms = len(atoms)
Example #7
0
fast = False

#AsapThreads()

cpulayout = (1,1,2)

element = 'Pt'
size = (20,20,100)

master = world.rank == 0

if master:
    atoms = FaceCenteredCubic(symbol=element, size=size, pbc=(True, True, False))
    atoms.center(vacuum=10.0, axis=2)
    atoms.set_momenta(np.zeros((len(atoms),3)))
    # Select an atom to get a kick
    r = atoms.get_positions()
    uc = atoms.get_cell()
    x = r[:,0] - 0.5 * uc[0,0]
    y = r[:,1] - 0.5 * uc[1,1]
    z = r[:,2]
    zprime = z - 0.01 * (x * x + y * y)
    n = np.argmax(zprime)
    #a = atoms[n]
    #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: