Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nexus: extend structure plotting capabilities #3220

Merged
merged 3 commits into from
Jun 4, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions nexus/lib/structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -3072,7 +3072,7 @@ def voronoi_species_radii(self):


# test needed
# get nearest neighbors according to constrants (voronoi, max distance, coord. number)
# get nearest neighbors according to constraints (voronoi, max distance, coord. number)
def nearest_neighbors(self,indices=None,rmax=None,nmax=None,restrict=False,voronoi=False,distances=False,**spec_max):
if indices is None:
indices = arange(len(self.pos))
Expand Down Expand Up @@ -5032,7 +5032,7 @@ def write_fhi_aims(self,filepath=None):
#end def write_fhi_aims


def plot2d_ax(self,ix,iy,*args,**kwargs):
def plot2d_ax(self,ix=0,iy=1,*args,**kwargs):
if self.dim!=3:
self.error('plot2d_ax is currently only implemented for 3 dimensions')
#end if
Expand All @@ -5049,7 +5049,7 @@ def plot2d_ax(self,ix,iy,*args,**kwargs):
#end def plot2d_ax


def plot2d_pos(self,ix,iy,*args,**kwargs):
def plot2d_pos(self,ix=0,iy=1,*args,**kwargs):
if self.dim!=3:
self.error('plot2d_pos is currently only implemented for 3 dimensions')
#end if
Expand All @@ -5063,6 +5063,20 @@ def plot2d_pos(self,ix,iy,*args,**kwargs):
#end def plot2d_pos


def plot2d_points(self,points,ix=0,iy=1,*args,**kwargs):
if self.dim!=3:
self.error('plot2d_points is currently only implemented for 3 dimensions')
#end if
iz = list(set([0,1,2])-set([ix,iy]))[0]
pp = np.array(points,dtype=float)
a = self.axes[iz]
for i in range(len(pp)):
pp[i] -= dot(a,pp[i])/dot(a,a)*a
#end for
plot(pp[:,ix],pp[:,iy],*args,**kwargs)
#end def plot2d_points


def plot2d(self,pos_style='b.',ax_style='k-'):
if self.dim!=3:
self.error('plot2d is currently only implemented for 3 dimensions')
Expand Down