[ase-users] set_initial_magnetic_moments not working in loop?

Christoph Wolf wolf.christoph at qns.science
Fri Jun 5 08:34:36 CEST 2020


Dear all,

I have a molecule as Atoms object, I was trying to loop through all atoms
in that molecule to set the magnetic moment on only one of the species but
ase does not seem to allow that:

molecule=ase.build.molecule('methylenecyclopropane')

molecule.set_initial_magnetic_moments([0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0])

for atom in molecule:
    if atom.symbol == 'C':
        print(atom.index)
        atom.set_initial_magnetic_moments([1.0])


Traceback (most recent call last):
  File "test_magmom.py", line 21, in <module>
    atom.set_initial_magnetic_moments([0.1])
AttributeError: 'Atom' object has no attribute
'set_initial_magnetic_moments'

Is there a way to do this?

Thanks in advance and have a great weekend everyone!

Chris
-- 
Postdoctoral Researcher
Center for Quantum Nanoscience, Institute for Basic Science
Ewha Womans University, Seoul, South Korea
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listserv.fysik.dtu.dk/pipermail/ase-users/attachments/20200605/237158a3/attachment.html>


More information about the ase-users mailing list