[ase-users] Problem with visualizing atoms

Sepide Araban sepide.araban at gmail.com
Tue Apr 20 17:48:49 CEST 2021


Dear Ask,
Thank you for your reply, here is the one script(I created it from a part
of a bigger script and run it), I turned on the computer and run the
script, it worked and showed 3 images. I closed the windows and  run the
script for the second time, it showed nothing (no windows, no errors, no
messages). It seems that I have to restart the computer every time but what
about when it shows one less image.
I run the script in serial mode.
Does 'view' work in parallel mode?
«««««««««
from ase import Atoms, io, o ptimize
from gpaw import GPAW, FermiDirac
from gpaw.cluster import Cluster
from gpaw.lrtddft import LrTDDFT
from ase.cluster.cubic import BodyCenteredCubic
from ase.visualize import view
import numpy as np
a0=.53#.053nm
n=20
d = n*a0 # starting distance
#Na particle
surfaces = [(1, 0, 0), (1, 1, 0), (1, 1, 1)]
layers = [1, 5, 5]
lc = 4.28#0.428nm
atoms1 = BodyCenteredCubic('Na', surfaces, layers, latticeconstant=lc)
view(atoms1)
positions1=atoms1.get_positions()
positions2=positions1
positions2[:,2]=positions2[:,2]+d
positions1=atoms1.get_positions()
d=Atoms('Na9',positions2)
dp=d.get_positions()
view(d)
positions3=np.vstack((positions1,positions2))
c=Atoms('Na18',positions3)
cp=c.get_positions()
view(c)
#s = Cluster(symbols='Na18',positions=cp)
#view(s)
««««««««

I have another question about the script, if you answer that too I wouId
appreciate. I want to have two nanoparticles (or more) at a distance 'd'
from each other.
1 First I creat one nanoparticle and optimized it
2 I creat another one, optimize it and shift it by d.
3  I attach them (or creat a new atoms with all positions of 2
nanoparticles and a new vacuum) and insert a new vacuum for all 2
nanoparticles.
4 I run ground state and ...

-Is that correct?
-Is it necessary to define a cluster of nanoparticles or a simulation box ?
or atoms and vacuum or even unitcell is enough?


I don't know if the information is enough or  there are some other
professional Linux or python scripts that I don't know how to extract. I
hope that it would be enough. Please let me know if it's not.
I am really sorry for taking your time. I would appreciate if you answer my
questions.

Thank you very much
Best regards
Show quoted text


---------- Forwarded message ---------
From: Ask Hjorth Larsen <asklarsen at gmail.com>
Date: Tue, 20 Apr 2021, 14:31
Subject: Re: [ase-users] (no subject)
To: Sepide Araban <sepide.araban at gmail.com>


Dear Sepide,

please send replies including attachments to the list.

Best regards
Ask

Am Di., 20. Apr. 2021 um 11:27 Uhr schrieb Sepide Araban
<sepide.araban at gmail.com>:
>
> Dear Ask,
> Thank you for your reply, here is the one script(I created it from a part
of a bigger script and run it), I turned on the computer and run the
script, it worked and showed 3 images. I closed the windows and  run the
script for the second time, it showed nothing (no windows, no errors, no
messages). It seems that I have to restart the computer every time but what
about when it shows one less image.
> I run the script in serial mode.
> Does 'view' work in parallel mode?
> «««««««««
> from ase import Atoms, io, o ptimize
> from gpaw import GPAW, FermiDirac
> from gpaw.cluster import Cluster
> from gpaw.lrtddft import LrTDDFT
> from ase.cluster.cubic import BodyCenteredCubic
> from ase.visualize import view
> import numpy as np
> a0=.53#.053nm
> n=20
> d = n*a0 # starting distance
> #Na particle
> surfaces = [(1, 0, 0), (1, 1, 0), (1, 1, 1)]
> layers = [1, 5, 5]
> lc = 4.28#0.428nm
> atoms1 = BodyCenteredCubic('Na', surfaces, layers, latticeconstant=lc)
> view(atoms1)
> positions1=atoms1.get_positions()
> positions2=positions1
> positions2[:,2]=positions2[:,2]+d
> positions1=atoms1.get_positions()
> d=Atoms('Na9',positions2)
> dp=d.get_positions()
> view(d)
> positions3=np.vstack((positions1,positions2))
> c=Atoms('Na18',positions3)
> cp=c.get_positions()
> view(c)
> #s = Cluster(symbols='Na18',positions=cp)
> #view(s)
> ««««««««
>
> I have another question about the script, if you answer that too I wouId
appreciate. I want to have two nanoparticles (or more) at a distance 'd'
from each other.
> 1 First I creat one nanoparticle and optimized it
> 2 I creat another one, optimize it and shift it by d.
> 3  I attach them (or creat a new atoms with all positions of 2
nanoparticles and a new vacuum) and insert a new vacuum for all 2
nanoparticles.
> 4 I run ground state and ...
>
> -Is that correct?
> -Is it necessary to define a cluster of nanoparticles or a simulation box
?
> or atoms and vacuum or even unitcell is enough?
>
>
> I don't know if the information is enough or  there are some other
professional Linux or python scripts that I don't know how to extract. I
hope that it would be enough. Please let me know if it's not.
> I am really sorry for taking your time. I would appreciate if you answer
my questions.
>
> Thank you very much
> Best regards
>
> On Mon, 19 Apr 2021, 22:12 Ask Hjorth Larsen, <asklarsen at gmail.com> wrote:
>>
>> Dear Sepide,
>>
>> Am Mo., 19. Apr. 2021 um 12:58 Uhr schrieb Sepide Araban via ase-users
>> <ase-users at listserv.fysik.dtu.dk>:
>> >
>> > Dear ASE developers,
>> > I have a problem with ase gui (ase.visualize), I would appreciate if
you answer and solve my problem. When I use for Ex. view(atoms) it
sometimes works and sometimes does not work and shows nothing without any
error or messages. It somtimes shows one structure less than what I have
writen in my codes for Ex. I have two lines view(), but it opens just one
window and it does not show the second one. How can I fix this problem?
There is almost nothing about it on the net or I couldn't find anything. I
can write the structure to the .png file but it covers just one angle of
view and I need to see other sides of the structure as well.
>>
>> Please always attach standalone script and any files necessary to
>> reproduce the problem.
>>
>> Best regards
>> Ask
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listserv.fysik.dtu.dk/pipermail/ase-users/attachments/20210420/24150492/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: NaDimer.py
Type: text/x-python
Size: 794 bytes
Desc: not available
URL: <http://listserv.fysik.dtu.dk/pipermail/ase-users/attachments/20210420/24150492/attachment-0001.py>


More information about the ase-users mailing list