当前位置: 首页>>代码示例>>Python>>正文


Python FaceCenteredCubic.set_momenta方法代码示例

本文整理汇总了Python中ase.lattice.cubic.FaceCenteredCubic.set_momenta方法的典型用法代码示例。如果您正苦于以下问题:Python FaceCenteredCubic.set_momenta方法的具体用法?Python FaceCenteredCubic.set_momenta怎么用?Python FaceCenteredCubic.set_momenta使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ase.lattice.cubic.FaceCenteredCubic的用法示例。


在下文中一共展示了FaceCenteredCubic.set_momenta方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: myfcc

# 需要导入模块: from ase.lattice.cubic import FaceCenteredCubic [as 别名]
# 或者: from ase.lattice.cubic.FaceCenteredCubic import set_momenta [as 别名]
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
开发者ID:auag92,项目名称:n2dm,代码行数:16,代码来源:parallelPotentials.py

示例2: FaceCenteredCubic

# 需要导入模块: from ase.lattice.cubic import FaceCenteredCubic [as 别名]
# 或者: from ase.lattice.cubic.FaceCenteredCubic import set_momenta [as 别名]
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()
开发者ID:auag92,项目名称:n2dm,代码行数:32,代码来源:parallelLangevin.py

示例3: FaceCenteredCubic

# 需要导入模块: from ase.lattice.cubic import FaceCenteredCubic [as 别名]
# 或者: from ase.lattice.cubic.FaceCenteredCubic import set_momenta [as 别名]
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:
开发者ID:auag92,项目名称:n2dm,代码行数:33,代码来源:LongLangevin.py

示例4: FaceCenteredCubic

# 需要导入模块: from ase.lattice.cubic import FaceCenteredCubic [as 别名]
# 或者: from ase.lattice.cubic.FaceCenteredCubic import set_momenta [as 别名]
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)
开发者ID:auag92,项目名称:n2dm,代码行数:33,代码来源:parallelLennardJones.py

示例5: FaceCenteredCubic

# 需要导入模块: from ase.lattice.cubic import FaceCenteredCubic [as 别名]
# 或者: from ase.lattice.cubic.FaceCenteredCubic import set_momenta [as 别名]
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:
开发者ID:auag92,项目名称:n2dm,代码行数:32,代码来源:UnBalance.py


注:本文中的ase.lattice.cubic.FaceCenteredCubic.set_momenta方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。