コード例 #1
0
ファイル: test_strain.py プロジェクト: arosen93/rASE
def test_strain_hcp(asap3):
    cu = bulk('Cu', 'hcp', a=a / sqrt(2))
    cu.cell[1, 0] -= 0.05
    cu *= (6, 6, 3)

    cu.calc = asap3.EMT()
    f = StrainFilter(cu)
    opt = MDMin(f, dt=0.01)
    opt.run(0.01)
コード例 #2
0
def test_strain_emt():
    """This test checks that the StrainFilter works using the default
    built-in EMT calculator."""

    import numpy as np
    from ase.constraints import StrainFilter
    from ase.optimize.mdmin import MDMin
    from ase.calculators.emt import EMT
    from ase.build import bulk

    cu = bulk('Cu', 'fcc', a=3.6)

    class EMTPlus(EMT):
        def get_stress(self, atoms):
            return np.zeros(6)

    cu.calc = EMTPlus()
    f = StrainFilter(cu)
    opt = MDMin(f, dt=0.01)
    opt.run(0.1, steps=2)
コード例 #3
0
def test_vacancy():
    from ase import Atoms
    from ase.optimize import QuasiNewton
    from ase.neb import NEB
    from ase.optimize.mdmin import MDMin
    try:
        from asap3 import EMT
    except ImportError:
        pass
    else:

        a = 3.6
        b = a / 2
        initial = Atoms('Cu4',
                        positions=[(0, 0, 0),
                                   (0, b, b),
                                   (b, 0, b),
                                   (b, b, 0)],
                        cell=(a, a, a),
                        pbc=True)
        initial *= (4, 4, 4)
        del initial[0]
        images = [initial] + [initial.copy() for i in range(6)]
        images[-1].positions[0] = (0, 0, 0)
        for image in images:
            image.calc = EMT()
            #image.calc = ASAP()

        for image in [images[0], images[-1]]:
            QuasiNewton(image).run(fmax=0.01)
        neb = NEB(images)
        neb.interpolate()

        for a in images:
            print(a.positions[0], a.get_potential_energy())

        dyn = MDMin(neb, dt=0.1, trajectory='mep1.traj')
        #dyn = QuasiNewton(neb)
        print(dyn.run(fmax=0.01, steps=25))
        for a in images:
            print(a.positions[0], a.get_potential_energy())
コード例 #4
0
def test_strain_fcc(asap3):
    cu = bulk('Cu', a=a) * (6, 6, 6)
    cu.calc = asap3.EMT()
    f = StrainFilter(cu, [1, 1, 1, 0, 0, 0])
    opt = MDMin(f, dt=0.01)
    t = Trajectory('Cu.traj', 'w', cu)
    opt.attach(t)
    opt.run(0.001)
コード例 #5
0
def test_strain_hcp(asap3):
    cu = bulk('Cu', 'hcp', a=a / sqrt(2))
    cu.cell[1, 0] -= 0.05
    cu *= (6, 6, 3)

    cu.calc = asap3.EMT()
    f = StrainFilter(cu)
    opt = MDMin(f, dt=0.01)
    t = Trajectory('Cu.traj', 'w', cu)
    opt.attach(t)
    opt.run(0.01)
コード例 #6
0
def test_unitcellfilter():
    from math import sqrt
    from ase import Atoms
    from ase.optimize import LBFGS
    from ase.constraints import UnitCellFilter
    from ase.io import Trajectory
    from ase.optimize.mdmin import MDMin
    try:
        from asap3 import EMT
    except ImportError:
        pass
    else:
        a = 3.6
        b = a / 2
        cu = Atoms('Cu', cell=[(0, b, b), (b, 0, b),
                               (b, b, 0)], pbc=1) * (6, 6, 6)
        cu.set_calculator(EMT())
        f = UnitCellFilter(cu, [1, 1, 1, 0, 0, 0])
        opt = LBFGS(f)
        t = Trajectory('Cu-fcc.traj', 'w', cu)
        opt.attach(t)
        opt.run(5.0)

        # HCP:
        from ase.build import bulk
        cu = bulk('Cu', 'hcp', a=a / sqrt(2))
        cu.cell[1, 0] -= 0.05
        cu *= (6, 6, 3)
        cu.set_calculator(EMT())
        print(cu.get_forces())
        print(cu.get_stress())
        f = UnitCellFilter(cu)
        opt = MDMin(f, dt=0.01)
        t = Trajectory('Cu-hcp.traj', 'w', cu)
        opt.attach(t)
        opt.run(0.2)
コード例 #7
0
def test_unitcellfilter(asap3):
    a = 3.6
    b = a / 2
    cu = Atoms('Cu', cell=[(0, b, b), (b, 0, b), (b, b, 0)], pbc=1) * (6, 6, 6)
    cu.calc = asap3.EMT()
    f = UnitCellFilter(cu, [1, 1, 1, 0, 0, 0])
    opt = LBFGS(f)
    t = Trajectory('Cu-fcc.traj', 'w', cu)
    opt.attach(t)
    opt.run(5.0)

    # HCP:
    from ase.build import bulk
    cu = bulk('Cu', 'hcp', a=a / sqrt(2))
    cu.cell[1, 0] -= 0.05
    cu *= (6, 6, 3)
    cu.calc = asap3.EMT()
    print(cu.get_forces())
    print(cu.get_stress())
    f = UnitCellFilter(cu)
    opt = MDMin(f, dt=0.01)
    t = Trajectory('Cu-hcp.traj', 'w', cu)
    opt.attach(t)
    opt.run(0.2)
コード例 #8
0
from ase import Atoms
from ase.constraints import StrainFilter
from ase.optimize.mdmin import MDMin
from ase.io import PickleTrajectory
try:
    from asap3 import EMT
except ImportError:
    pass
else:
    a = 3.6
    b = a / 2
    cu = Atoms('Cu', cell=[(0, b, b), (b, 0, b), (b, b, 0)], pbc=1) * (6, 6, 6)

    cu.set_calculator(EMT())
    f = StrainFilter(cu, [1, 1, 1, 0, 0, 0])
    opt = MDMin(f, dt=0.01)
    t = PickleTrajectory('Cu.traj', 'w', cu)
    opt.attach(t)
    opt.run(0.001)

    # HCP:
    from ase.lattice.surface import hcp0001
    cu = hcp0001('Cu', (1, 1, 2), a=a / sqrt(2))
    cu.cell[1, 0] += 0.05
    cu *= (6, 6, 3)

    cu.set_calculator(EMT())
    f = StrainFilter(cu)
    opt = MDMin(f, dt=0.01)
    t = PickleTrajectory('Cu.traj', 'w', cu)
    opt.attach(t)
コード例 #9
0
ファイル: strain_emt.py プロジェクト: lqcata/ase
"""This test checks that the StrainFilter works using the default
built-in EMT calculator."""

from ase.constraints import StrainFilter
from ase.optimize.mdmin import MDMin
from ase.calculators.emt import EMT
from ase.structure import bulk

cu = bulk('Cu', 'fcc', a=3.6)

cu.set_calculator(EMT(fakestress=True))
f = StrainFilter(cu)
opt = MDMin(f, dt=0.01)
opt.run(0.1, steps=2)
コード例 #10
0
ファイル: unitcellfilter.py プロジェクト: lqcata/ase
from ase.optimize.lbfgs import LBFGS
from ase.optimize.mdmin import MDMin
try:
    from asap3 import EMT
except ImportError:
    pass
else:
    a = 3.6
    b = a / 2
    cu = Atoms('Cu', cell=[(0, b, b), (b, 0, b), (b, b, 0)], pbc=1) * (6, 6, 6)
    cu.set_calculator(EMT())
    f = UnitCellFilter(cu, [1, 1, 1, 0, 0, 0])
    opt = LBFGS(f)
    t = PickleTrajectory('Cu-fcc.traj', 'w', cu)
    opt.attach(t)
    opt.run(5.0)

    # HCP:
    from ase.lattice.surface import hcp0001
    cu = hcp0001('Cu', (1, 1, 2), a=a / sqrt(2))
    cu.cell[1, 0] += 0.05
    cu *= (6, 6, 3)
    cu.set_calculator(EMT())
    print cu.get_forces()
    print cu.get_stress()
    f = UnitCellFilter(cu)
    opt = MDMin(f, dt=0.01)
    t = PickleTrajectory('Cu-hcp.traj', 'w', cu)
    opt.attach(t)
    opt.run(0.2)
コード例 #11
0
def test_strain():
    from math import sqrt
    from ase import Atoms
    from ase.constraints import StrainFilter
    from ase.optimize.mdmin import MDMin
    from ase.io import Trajectory
    try:
        from asap3 import EMT
    except ImportError:
        pass
    else:
        a = 3.6
        b = a / 2
        cu = Atoms('Cu', cell=[(0,b,b),(b,0,b),(b,b,0)], pbc=1) * (6, 6, 6)

        cu.set_calculator(EMT())
        f = StrainFilter(cu, [1, 1, 1, 0, 0, 0])
        opt = MDMin(f, dt=0.01)
        t = Trajectory('Cu.traj', 'w', cu)
        opt.attach(t)
        opt.run(0.001)

    # HCP:
        from ase.build import bulk
        cu = bulk('Cu', 'hcp', a=a / sqrt(2))
        cu.cell[1,0] -= 0.05
        cu *= (6, 6, 3)

        cu.set_calculator(EMT())
        f = StrainFilter(cu)
        opt = MDMin(f, dt=0.01)
        t = Trajectory('Cu.traj', 'w', cu)
        opt.attach(t)
        opt.run(0.01)
コード例 #12
0
ファイル: vacancy.py プロジェクト: JConwayAWT/PGSS14CC
    a = 3.6
    b = a / 2
    initial = Atoms('Cu4',
                    positions=[(0, 0, 0),
                               (0, b, b),
                               (b, 0, b),
                               (b, b, 0)],
                    cell=(a, a, a),
                    pbc=True)
    initial *= (4, 4, 4)
    del initial[0]
    images = [initial] + [initial.copy() for i in range(6)]
    images[-1].positions[0] = (0, 0, 0)
    for image in images:
        image.set_calculator(EMT())
        #image.set_calculator(ASAP())

    for image in [images[0], images[-1]]:
        QuasiNewton(image).run(fmax=0.01)
    neb = NEB(images)
    neb.interpolate()

    for a in images:
        print a.positions[0], a.get_potential_energy()

    dyn = MDMin(neb, dt=0.1, trajectory='mep1.traj')
    #dyn = QuasiNewton(neb)
    print dyn.run(fmax=0.01, steps=25)
    for a in images:
        print a.positions[0], a.get_potential_energy()
コード例 #13
0
ファイル: strain.py プロジェクト: JConwayAWT/PGSS14CC
from ase import Atoms
from ase.constraints import StrainFilter
from ase.optimize.mdmin import MDMin
from ase.io import PickleTrajectory
try:
    from asap3 import EMT
except ImportError:
    pass
else:
    a = 3.6
    b = a / 2
    cu = Atoms('Cu', cell=[(0,b,b),(b,0,b),(b,b,0)], pbc=1) * (6, 6, 6)

    cu.set_calculator(EMT())
    f = StrainFilter(cu, [1, 1, 1, 0, 0, 0])
    opt = MDMin(f, dt=0.01)
    t = PickleTrajectory('Cu.traj', 'w', cu)
    opt.attach(t)
    opt.run(0.001)

# HCP:
    from ase.lattice.surface import hcp0001
    cu = hcp0001('Cu', (1, 1, 2), a=a / sqrt(2))
    cu.cell[1,0] += 0.05
    cu *= (6, 6, 3)

    cu.set_calculator(EMT())
    f = StrainFilter(cu)
    opt = MDMin(f, dt=0.01)
    t = PickleTrajectory('Cu.traj', 'w', cu)
    opt.attach(t)
コード例 #14
0
ファイル: lmp-rlx.py プロジェクト: ssrokyz/tools
## atoms
atoms = read('POSCAR_1_Kooi')

## calc
calc = LAMMPS(
    specorder=['Ge', 'Sb', 'Te'],
    parameters={
        'units': 'metal',
        'boundary': 'p p p',
        'box': 'tilt large',
        'pair_style': 'deepmd frozen_model.pb',
        'pair_coeff': ' ',
        'mass': ['1 72.64', '2 121.76', '3 127.60'],
    },
    files=['frozen_model.pb'],
    # keep_tmp_files=True,
)
atoms.set_calculator(calc)

## rlx
# from ase.optimize.bfgslinesearch import BFGSLineSearch as BFGSL
# from ase.optimize.gpmin.gpmin import GPMin
from ase.optimize.mdmin import MDMin
dyn = MDMin(
    atoms=atoms,
    trajectory='rlx-tmp.traj',
    # force_consistent=False,
    dt=0.1,
)
dyn.run(fmax=1e-2)
コード例 #15
0
ファイル: test_strain.py プロジェクト: arosen93/rASE
def test_strain_fcc(asap3):
    cu = bulk('Cu', a=a) * (6, 6, 6)
    cu.calc = asap3.EMT()
    f = StrainFilter(cu, [1, 1, 1, 0, 0, 0])
    opt = MDMin(f, dt=0.01)
    opt.run(0.001)
コード例 #16
0
    pass
else:

    a = 3.6
    b = a / 2
    initial = Atoms('Cu4',
                    positions=[(0, 0, 0), (0, b, b), (b, 0, b), (b, b, 0)],
                    cell=(a, a, a),
                    pbc=True)
    initial *= (4, 4, 4)
    del initial[0]
    images = [initial] + [initial.copy() for i in range(6)]
    images[-1].positions[0] = (0, 0, 0)
    for image in images:
        image.set_calculator(EMT())
        #image.set_calculator(ASAP())

    for image in [images[0], images[-1]]:
        QuasiNewton(image).run(fmax=0.01)
    neb = NEB(images)
    neb.interpolate()

    for a in images:
        print a.positions[0], a.get_potential_energy()

    dyn = MDMin(neb, dt=0.1, trajectory='mep1.traj')
    #dyn = QuasiNewton(neb)
    print dyn.run(fmax=0.01, steps=25)
    for a in images:
        print a.positions[0], a.get_potential_energy()
コード例 #17
0
def test_strain_emt():
    cu = bulk('Cu', 'fcc', a=3.6)
    cu.calc = EMT()
    f = StrainFilter(cu)
    opt = MDMin(f, dt=0.01)
    opt.run(0.1, steps=2)
コード例 #18
0
"""This test checks that the StrainFilter works using the default
built-in EMT calculator."""

import numpy as np
from ase.constraints import StrainFilter
from ase.optimize.mdmin import MDMin
from ase.calculators.emt import EMT
from ase.structure import bulk

cu = bulk('Cu', 'fcc', a=3.6)

class EMTPlus(EMT):
    def get_stress(self, atoms):
        return np.zeros(6)

cu.set_calculator(EMTPlus())
f = StrainFilter(cu)
opt = MDMin(f, dt=0.01)
opt.run(0.1, steps=2)
コード例 #19
0
ファイル: vacancy.py プロジェクト: misdoro/python-ase
    a = 3.6
    b = a / 2
    initial = Atoms('Cu4',
                    positions=[(0, 0, 0),
                               (0, b, b),
                               (b, 0, b),
                               (b, b, 0)],
                    cell=(a, a, a),
                    pbc=True)
    initial *= (4, 4, 4)
    del initial[0]
    images = [initial] + [initial.copy() for i in range(6)]
    images[-1].positions[0] = (0, 0, 0)
    for image in images:
        image.set_calculator(EMT())
        #image.set_calculator(ASAP())

    for image in [images[0], images[-1]]:
        QuasiNewton(image).run(fmax=0.01)
    neb = NEB(images)
    neb.interpolate()

    for a in images:
        print(a.positions[0], a.get_potential_energy())

    dyn = MDMin(neb, dt=0.1, trajectory='mep1.traj')
    #dyn = QuasiNewton(neb)
    print(dyn.run(fmax=0.01, steps=25))
    for a in images:
        print(a.positions[0], a.get_potential_energy())