Skip to content

Commit

Permalink
fix primitive option
Browse files Browse the repository at this point in the history
  • Loading branch information
qzhu2017 committed Jul 8, 2023
1 parent eeacab9 commit 3fb898f
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions pyxtal_ff/descriptors/SO3.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import division
import numpy as np
from ase.neighborlist import NeighborList, NewPrimitiveNeighborList
from ase.neighborlist import NeighborList, PrimitiveNeighborList
from optparse import OptionParser
from scipy.special import sph_harm, spherical_in
from ase import Atoms
Expand Down Expand Up @@ -32,8 +32,8 @@ def __init__(self, nmax=3, lmax=3, rcut=3.5, alpha=2.0, derivative=True, stress=
self._type = "SO3"
self.cutoff_function = cutoff_function
self.weight_on = weight_on
self.PrimitiveNeighborList = primitive
return
self.primitive = primitive
#return

def __str__(self):
s = "SO3 descriptor with Cutoff: {:6.3f}".format(self.rcut)
Expand Down Expand Up @@ -180,7 +180,7 @@ def clear_memory(self):
'''
attrs = list(vars(self).keys())
for attr in attrs:
if attr not in {'_nmax', '_lmax', '_rcut', '_alpha', '_derivative', '_stress', '_cutoff_function', 'weight_on'}:
if attr not in {'_nmax', '_lmax', '_rcut', '_alpha', '_derivative', '_stress', '_cutoff_function', 'weight_on', 'primitive'}:
delattr(self, attr)
return

Expand Down Expand Up @@ -324,11 +324,12 @@ def build_neighbor_list(self, atom_ids=None):
atom_ids = range(len(atoms))

cutoffs = [self.rcut/2]*len(atoms)
if self.PrimitiveNeighborList:
nl = NewPrimitiveNeighborList(cutoffs, self_interaction=False, bothways=True, skin=0.0)
if self.primitive:
nl = PrimitiveNeighborList(cutoffs, self_interaction=False, bothways=True, skin=0.0)
nl.build(atoms.pbc, atoms.cell, atoms.get_scaled_positions())
else:
nl = NeighborList(cutoffs, self_interaction=False, bothways=True, skin=0.0)
nl.update(atoms)
nl.update(atoms)

center_atoms = []
neighbors = []
Expand Down

0 comments on commit 3fb898f

Please sign in to comment.