Skip to content

Commit c938102

Browse files
authored
Merge pull request #84 from avmarchenko/master
Fixes for PCF integration
2 parents 5b5306e + 884b05a commit c938102

File tree

6 files changed

+40
-15
lines changed

6 files changed

+40
-15
lines changed

exatomic/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
1919
.. _atomic: https://en.wikipedia.org/wiki/Atomic_units
2020
"""
21-
__exatomic_version__ = (0, 3, 5)
21+
__exatomic_version__ = (0, 3, 6)
2222
__version__ = '.'.join((str(v) for v in __exatomic_version__))
2323

2424

exatomic/algorithms/neighbors.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,10 @@ def _slice_atoms_molecules(universe, sources, restrictions, n):
7272
if isinstance(n, (int, np.int32, np.int64)):
7373
n = [n]
7474
labels = universe.atom.get_atom_labels()
75-
universe.atom['label'] = labels
75+
del_label = False
76+
if 'label' not in universe.atom.columns:
77+
del_label = True
78+
universe.atom['label'] = labels
7679
labels = labels.unique()
7780
symbols = universe.atom['symbol'].unique()
7881
classification = universe.molecule['classification'].unique()
@@ -121,7 +124,8 @@ def _slice_atoms_molecules(universe, sources, restrictions, n):
121124
other_atoms = other_atoms[other_atoms['symbol'].isin(syms)]
122125
if len(lbls) > 0:
123126
other_atoms = other_atoms[other_atoms['label'].isin(lbls)]
124-
del universe.atom['label']
127+
if del_label:
128+
del universe.atom['label']
125129
return source_atoms, other_atoms, source_molecules, other_molecules, n
126130

127131

exatomic/algorithms/pcf.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def radial_pair_correlation(universe, a, b, dr=0.05, start=1.0, stop=13.0,
7979
nb = universe.atom[universe.atom["symbol"] == b].groupby("frame").size().mean()
8080
if a == b:
8181
nb -= 1
82-
n = hist.cumsum()/nn*na*nb # Compute pair count
82+
n = hist.cumsum()/nn*na*nb*4/3*np.pi*bmax**3/v_cell
8383
r = (bins[1:] + bins[:-1])/2*Length["au", length]
8484
unit = "au"
8585
if length in ["A", "angstrom", "ang"]:
@@ -90,5 +90,6 @@ def radial_pair_correlation(universe, a, b, dr=0.05, start=1.0, stop=13.0,
9090
df = pd.DataFrame.from_dict({rlabel: r, glabel: g, nlabel: n})
9191
if window > 1:
9292
df = df.rolling(window=window).mean()
93+
df = df.iloc[window:]
9394
df.set_index(rlabel, inplace=True)
9495
return df

exatomic/basis.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -542,23 +542,27 @@ class SlaterTypeBasisFunction(SymbolicFunction):
542542
expr = r**kr * x**kx * y**ky * z**kz * sy.exp(-zeta*r)
543543

544544
@classmethod
545-
def eval(cls, xa=None, ya=None, za=None, kx=None, ky=None, kz=None, kr=None, zeta=None):
545+
def eval(cls, xa=None, ya=None, za=None, kx=None, ky=None, kz=None,
546+
kr=None, zeta=None):
547+
"""
548+
"""
546549
subs = {}
547-
if xa:
550+
if xa is not None:
548551
subs[cls.xa] = xa
549-
if ya:
552+
if ya is not None:
550553
subs[cls.ya] = ya
551-
if za:
554+
if za is not None:
552555
subs[cls.za] = za
553-
if kr:
556+
if kr is not None:
554557
subs[cls.kr] = kr
555-
if kx:
558+
if kx is not None:
556559
subs[cls.kx] = kx
557-
if ky:
560+
if ky is not None:
558561
subs[cls.ky] = ky
559-
if kz:
562+
if kz is not None:
560563
subs[cls.kz] = kz
561-
if zeta:
564+
if zeta is not None:
562565
subs[cls.zeta] = zeta
566+
print(subs)
563567
expr = cls.expr.subs(subs)
564568
return super().new_expression(expr, "vectorize")

meta.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
package:
22
name: exatomic
3-
version: "0.3.5"
3+
version: "0.3.6"
44

55
source:
6-
git_rev: v0.3.5
6+
git_rev: v0.3.6
77
git_url: https://github.com/exa-analytics/exatomic.git
88

99
requirements:

requirements.txt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,18 @@
1+
numpy
2+
scipy
3+
matplotlib
4+
sqlalchemy
5+
pandas
6+
networkx
7+
sympy
8+
seaborn
9+
traitlets
10+
jupyter
11+
notebook
12+
ipywidgets
13+
ipyparallel
14+
sphinx
15+
nose
16+
numba
117
sphinxcontrib-autoanysrc
218
exa

0 commit comments

Comments
 (0)