!JEiuNJLuxedbohAOuH:matrix.org

ASE

192 Members
Atomic Simulation Environment — https://wiki.fysik.dtu.dk/ase/ — Channel for discussions, support, and development of ASE3 Servers

Load older messages


SenderMessageTime
22 Mar 2024
@pvst:matrix.orgpvstRedacted or Malformed Event14:24:30
23 Mar 2024
@shivansh_tiwari:matrix.orgShivansh Tiwari joined the room.07:49:27
@shivansh_tiwari:matrix.orgShivansh TiwariHi everyone, I need some help in ase. I have created a 2d lattice and trying to apply Lennard jones potential. but it is giving me nan values. Is lennard algo is only for 3d lattices? Please anyone clarify07:51:25
@shivansh_tiwari:matrix.orgShivansh TiwariAnyone kindly reply13:01:22
@tinywater_123:matrix.orgtinywater_123How to fix the c-axis during lattice optimization and use it to optimize 2d materials?13:45:15
@tinywater_123:matrix.orgtinywater_123ecf = ExpCellFilter(atoms, mask=[True, True, False, False, False, False]) Does it work?13:50:48
@mikaelkuisma1:matrix.orgMikael KuismaHmm... if those vectors are ( https://wiki.fysik.dtu.dk/ase/ase/filters.html#the-strainfilter-class ) xx, yy, zz, yz, xz, xy AND c-axis is cartesian z (strain is represented Cartesian, not wrt unit cell vectors), then it would be True, True, False, False, False, True]. c2db also has that https://gitlab.com/asr-dev/asr/-/blob/master/asr/relax.py#L205 13:56:48
@tinywater_123:matrix.orgtinywater_123atoms = ExpCellFilter(atoms, mask=[True, True, False, False, False, True]) opt = FIRE(atoms) THIS?14:11:54
@mikaelkuisma1:matrix.orgMikael Kuisma seems correct, maybe add assert np.allclose(atoms.cell[2,:2],0) to make sure c-axis is along z 16:09:01
@mikaelkuisma1:matrix.orgMikael Kuismabtw, ExpCellFilter has been replaced by FrechetCellFilter16:09:36
@mikaelkuisma1:matrix.orgMikael Kuisma

https://wiki.fysik.dtu.dk/ase/ase/filters.html#the-frechetcellfilter-class

The initial implementation of ExpCellFilter gave inconsistent gradients for cell variables (matrix log of the deformation tensor). If you would like to keep the previous behavior, please use ExpCellFilter.
16:10:22
24 Mar 2024
@sirmarcel:matrix.orgsirmarcel
In reply to @shivansh_tiwari:matrix.org
Hi everyone, I need some help in ase. I have created a 2d lattice and trying to apply Lennard jones potential. but it is giving me nan values. Is lennard algo is only for 3d lattices? Please anyone clarify
please file an issue with a minimal working example and tag me (@sirmarcel), i can take a look, i rewrote the LJ potential a while back
15:46:08
26 Mar 2024
@tinywater_123:matrix.orgtinywater_123

from ase.constraints import FixedLine
c = FixedLine(
indices=[atom.index for atom in atoms if atom.symbol == 'Cu'],
direction=[1, 0, 0],
)
atoms.set_constraint(c)

When I run this code in my latop

c = FixedLine(
^^^^^^^^^^
TypeError: FixedLine.init() got an unexpected keyword argument 'indices'

15:25:38
@mikaelkuisma1:matrix.orgMikael Kuismatoo old ase version?20:56:43
@mikaelkuisma1:matrix.orgMikael Kuisma

works for me

>>> from ase.build import bulk
>>> atoms = bulk('Cu') * (2,2,2)
>>> from ase.constraints import FixedLine
>>> c = FixedLine(
... indices=[atom.index for atom in atoms if atom.symbol == 'Cu'],
... direction=[1, 0, 0],
... )
>>> c
FixedLine(indices=[0 1 2 3 4 5 6 7], [1.0, 0.0, 0.0])
>>> import ase
>>> ase.__version__
'3.23.0b1'


20:57:04
27 Mar 2024
@tinywater_123:matrix.orgtinywater_123
In reply to @mikaelkuisma1:matrix.org

works for me

>>> from ase.build import bulk
>>> atoms = bulk('Cu') * (2,2,2)
>>> from ase.constraints import FixedLine
>>> c = FixedLine(
... indices=[atom.index for atom in atoms if atom.symbol == 'Cu'],
... direction=[1, 0, 0],
... )
>>> c
FixedLine(indices=[0 1 2 3 4 5 6 7], [1.0, 0.0, 0.0])
>>> import ase
>>> ase.__version__
'3.23.0b1'


print( ase.version)
3.22.1

08:16:42
@tinywater_123:matrix.orgtinywater_123Is this too old?08:16:53
@tinywater_123:matrix.orgtinywater_123

This is my source code:

class FixedLine(FixConstraintSingle):
"""Constrain an atom index a to move on a given line only.

The line is defined by its vector *direction*."""

def __init__(self, a, direction):
    self.a = a
    self.dir = np.asarray(direction) / sqrt(np.dot(direction, direction))

def get_removed_dof(self, atoms):
    return 2

def adjust_positions(self, atoms, newpositions):
    step = newpositions[self.a] - atoms.positions[self.a]
    x = np.dot(step, self.dir)
    newpositions[self.a] = atoms.positions[self.a] + x * self.dir

def adjust_forces(self, atoms, forces):
    forces[self.a] = self.dir * np.dot(forces[self.a], self.dir)

def __repr__(self):
    return 'FixedLine(%d, %s)' % (self.a, self.dir.tolist())

def todict(self):
    return {'name': 'FixedLine',
            'kwargs': {'a': self.a, 'direction': self.dir.tolist()}}
09:08:05
@tinywater_123:matrix.orgtinywater_123

So i change me code to this

c = FixedPlane([atom.index for atom in atoms if atom.symbol == 'Ba'], direction=[0, 0, 1],)
It does not have the indices

09:10:10
@sebastianecheverrir:matrix.org@sebastianecheverrir:matrix.orgHi! Bringing back the topic of ABCFIRE. Could one of you please take a look at the status of this merge request? https://gitlab.com/ase/ase/-/merge_requests/3284 I think it is almost ready!15:45:46
3 Apr 2024
@akwari:matrix.orgGael Huynh joined the room.13:33:51
4 Apr 2024
@askhl:matrix.orgAsk Hjorth Larsen Bar is open over in #ase-bar:matrix.org 19:38:25
5 Apr 2024
@sebastianecheverrir:matrix.org@sebastianecheverrir:matrix.orgimage.png
Download image.png
08:10:56
@sebastianecheverrir:matrix.org@sebastianecheverrir:matrix.org

Ask Hjorth Larsen: Andrew Rosen

Thanks for taking the time to review the merge request. There is one comment that I did not understand, would you mind elaborating a bit more?

08:11:40
@sebastianecheverrir:matrix.org@sebastianecheverrir:matrix.org *

Ask Hjorth Larsen: Andrew Rosen

Thanks for taking the time to review the merge request. There is one comment that I did not understand, would you mind elaborating a bit more? (See image above)

08:12:00
@askhl:matrix.orgAsk Hjorth Larsen Hi sebastianecheverrir . One moment 13:07:19
@askhl:matrix.orgAsk Hjorth Larsen
    opt = FIRE2(a,
                dt=0.1,
                maxstep=0.2,
                dtmax=1.0,
                Nmin=20,
                finc=1.1,
                fdec=0.5,
                astart=0.25,
                fa=0.99)
    opt.run(fmax=0.001)
    e1 = a.get_potential_energy()
    n1 = opt.nsteps

    a = system_setup()

    reset_history = []

    def callback(a, r, e, e_last):
        reset_history.append([e - e_last])

    opt = FIRE2(a,
                dt=0.1,
                maxstep=0.2,
                dtmax=1.0,
                Nmin=20,
                finc=1.1,
                fdec=0.5,
                astart=0.25,
                fa=0.99,
                abc=True,
                position_reset_callback=callback)

Here (for example) there are two calls to FIRE2. Many of the parameters are the same. What about:

def new_fire2():
13:10:44
@askhl:matrix.orgAsk Hjorth Larsen *
    opt = FIRE2(a,
                dt=0.1,
                maxstep=0.2,
                dtmax=1.0,
                Nmin=20,
                finc=1.1,
                fdec=0.5,
                astart=0.25,
                fa=0.99)
    opt.run(fmax=0.001)
    e1 = a.get_potential_energy()
    n1 = opt.nsteps

    a = system_setup()

    reset_history = []

    def callback(a, r, e, e_last):
        reset_history.append([e - e_last])

    opt = FIRE2(a,
                dt=0.1,
                maxstep=0.2,
                dtmax=1.0,
                Nmin=20,
                finc=1.1,
                fdec=0.5,
                astart=0.25,
                fa=0.99,
                abc=True,
                position_reset_callback=callback)

Here (for example) there are two calls to FIRE2. Many of the parameters are the same. What about:

def new_fire2(arg1, arg2):
    return FIRE2(<all the things that are the same go here>)
13:11:40
@askhl:matrix.orgAsk Hjorth Larsen *
    opt = FIRE2(a,
                dt=0.1,
                maxstep=0.2,
                dtmax=1.0,
                Nmin=20,
                finc=1.1,
                fdec=0.5,
                astart=0.25,
                fa=0.99)
    opt.run(fmax=0.001)
    e1 = a.get_potential_energy()
    n1 = opt.nsteps

    a = system_setup()

    reset_history = []

    def callback(a, r, e, e_last):
        reset_history.append([e - e_last])

    opt = FIRE2(a,
                dt=0.1,
                maxstep=0.2,
                dtmax=1.0,
                Nmin=20,
                finc=1.1,
                fdec=0.5,
                astart=0.25,
                fa=0.99,
                abc=True,
                position_reset_callback=callback)

Here (for example) there are two calls to FIRE2. Many of the parameters are the same. What about:

def new_fire2(arg1, arg2):
    return FIRE2(arg1=arg1, arg2=arg2, <all the things that are the same go here>)
13:11:55
@askhl:matrix.orgAsk Hjorth Larsen Or you can put all the variables that are the same into a dictionary and pass it as FIRE(..., **kwargs) 13:12:45

Show newer messages


Back to Room ListRoom Version: 5