Skip to content

Commit

Permalink
update to 2.3.0. Fix tests and MacOS numpy bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
matt-chan committed Dec 7, 2021
1 parent deee884 commit 0980bc9
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 43 deletions.
11 changes: 8 additions & 3 deletions conda/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% set version = "2.2.0" %}
{% set version = "2.3.0" %}

package:
name: horton
Expand All @@ -8,7 +8,7 @@ source:
path: ..

build:
number: 1
number: 3
binary_relocation: true

requirements:
Expand All @@ -20,7 +20,7 @@ requirements:
- make
- git
host:
- python {{ python }}
- python 3.8
- numpy
- scipy
- cython
Expand All @@ -38,8 +38,13 @@ requirements:
- libint
- cython
test:
requires:
- nose
imports:
- horton
commands:
- nosetests -v horton


about:
summary: "Helpful Open-source Research TOol for N-fermion systems"
Expand Down
23 changes: 11 additions & 12 deletions data/examples/hf_dft/rks_water_mgga.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,18 +89,17 @@
}
# BEGIN AUTOGENERATED CODE. DO NOT CHANGE MANUALLY.
rt_previous = {
'energy': -76.407936399996032,
'energy': -76.40793639999603,
'grid': -9.361522808603524,
'hartree': 46.863292284107445,
'kin': 76.04013863983127,
'ne': -199.10702002940846,
'nn': 9.157175036429987,
'orb_alpha': np.array([
-18.88140274471057, -0.92689455671943777, -0.48003995365965246,
-0.3068412737938469, -0.23305348781949642, 0.055765650587591052,
0.13876252429050115, 0.78022341323374989, 0.82177783193535281,
0.86268998494640037, 0.89541154561880765, 1.0425268139841128, 1.3431492859747944,
1.7062096596569536, 1.7110987254283361, 1.7506809108152641, 2.2882571842385735,
2.5849159392493357
-18.88111781424959, -0.9268543449664615, -0.48002911517925373,
-0.30683434349364513, -0.2330605499821571, 0.0557054298179647,
0.13869017199033926, 0.7800372422845757, 0.8216102286054293, 0.8625906847694965,
0.8952633368928019, 1.042433280068831, 1.3430244064105015, 1.706049355089985,
1.7109366502306933, 1.7505342468014848, 2.2877661960982287, 2.5842347375036807
]),
'grid': -9.361522808603524,
'hartree': 46.86311076030199,
'kin': 76.04019446027614,
'ne': -199.10689384840063,
'nn': 9.1571750364299866,
}
34 changes: 17 additions & 17 deletions data/examples/hf_dft/uks_methyl_mgga.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,25 +96,25 @@
# BEGIN AUTOGENERATED CODE. DO NOT CHANGE MANUALLY.
rt_previous = {
'energy': -39.836677347925914,
'grid': -6.447581456959345,
'hartree': 28.092648155263227,
'kin': 39.36712413305364,
'ne': -109.92865317406965,
'nn': 9.079784942663636,
'orb_alpha': np.array([
-10.019635076738147, -0.61357555665158736, -0.3628121339087883,
-0.36276528782852813, -0.19070293326772045, 0.071676580515679725,
0.1451627609382326, 0.14520445336541474, 0.51037249458810541, 0.55245497246844399,
0.55247011455993678, 0.66897270052023006, 0.84604700858521387,
0.84613026545140801, 0.89858158554272938, 1.6194517568114566, 1.6194677518472744,
1.9300340527577873, 2.0952910889031027, 2.0961171453114171
-10.01932345515595, -0.6135259960982921, -0.36276560205876457,
-0.3627187398579602, -0.19075935105245162, 0.07150035135891722,
0.14494635637871764, 0.14498775711923603, 0.510315601262867, 0.5521868550528035,
0.5522018808304408, 0.6683335215978065, 0.8453792117712211, 0.8454609326443266,
0.8983531847806548, 1.619269238542316, 1.6192862967691806, 1.9292046668075504,
2.093858169207324, 2.0946697177558007
]),
'orb_beta': np.array([
-10.004003922798798, -0.5755426452796184, -0.35601452017897062,
-0.35588391063394165, -0.06548534259187741, 0.098337149121920125,
0.1595980803482438, 0.15986087404787613, 0.56917620502894739, 0.56946718254784001,
0.60089298391388379, 0.70441988947800527, 0.87990225342684414,
0.88198311255364803, 0.95807927778738833, 1.7277678928512459, 1.7299240596423406,
2.0576938854035931, 2.174113280602203, 2.1750154723644353
-10.003689426590137, -0.5754877487524174, -0.3559723619217707,
-0.35584153775415894, -0.06554258134740852, 0.09814780282274696,
0.1593816751966446, 0.15964525579884276, 0.5688913029872666, 0.5691828001315896,
0.6008399202646769, 0.7037253351266851, 0.8792123495562243, 0.8812997469246673,
0.957810069192318, 1.7275803186575, 1.729736365896011, 2.0569028489921184,
2.1726342557791885, 2.173521534951844
]),
'grid': -6.447610544950923,
'hartree': 28.092381575581616,
'kin': 39.36717793738765,
'ne': -109.9284112586079,
'nn': 9.0797849426636361,
}
2 changes: 1 addition & 1 deletion horton/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
'''The main HORTON Package'''


__version__ = '2.1.0'
__version__ = '2.3.0'


# Extensions are imported first to call fpufix as early as possible
Expand Down
19 changes: 9 additions & 10 deletions horton/grid/poisson.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,13 @@
# --
'''Becke-style numerical Poisson solver'''


import numpy as np

from horton.log import timer, biblio
from horton.grid.cext import CubicSpline, PotentialExtrapolation
from horton.grid.ode2 import solve_ode2
from horton.grid.radial import RadialGrid


__all__ = ['solve_poisson_becke']


Expand All @@ -47,15 +45,16 @@ def solve_poisson_becke(density_decomposition):
density).
'''
biblio.cite('becke1988_poisson', 'the numerical integration of the Poisson equation')
np.seterr(invalid="print")

lmax = np.sqrt(len(density_decomposition)) - 1
assert lmax == int(lmax)
lmax = int(lmax)

result = []
counter = 0
for l in range(0, lmax+1):
for m in range(-l, l+1):
for l in range(0, lmax + 1):
for m in range(-l, l + 1):
rho = density_decomposition[counter]
rtf = rho.rtransform
rgrid = RadialGrid(rtf)
Expand All @@ -64,21 +63,21 @@ def solve_poisson_becke(density_decomposition):
# u = r*V in Eq. (21) in Becke's paper. After this transformation,
# the boundary conditions can be implemented such that the output
# is more accurate.
fy = -4*np.pi*rho.y
fd = -4*np.pi*rho.dx
fy = -4 * np.pi * rho.y
fd = -4 * np.pi * rho.dx
f = CubicSpline(fy, fd, rtf)
b = CubicSpline(2/radii, -2/radii**2, rtf)
a = CubicSpline(-l*(l+1)*radii**-2, 2*l*(l+1)*radii**-3, rtf)
b = CubicSpline(2 / radii, -2 / radii ** 2, rtf)
a = CubicSpline(-l * (l + 1) * radii ** -2, 2 * l * (l + 1) * radii ** -3, rtf)
# Derivation of boundary condition at rmax:
# Multiply differential equation with r**l and integrate. Using
# partial integration and the fact that V(r)=A/r**(l+1) for large
# r, we find -(2l+1)A=-4pi*int_0^infty r**2 r**l rho(r) and so
# V(rmax) = A/rmax**(l+1) = integrate(r**l rho(r))/(2l+1)/rmax**(l+1)
V_rmax = rgrid.integrate(rho.y*radii**l)/radii[-1]**(l+1)/(2*l+1)
V_rmax = rgrid.integrate(rho.y * radii ** l) / radii[-1] ** (l + 1) / (2 * l + 1)
# Derivation of boundary condition at rmin:
# Same as for rmax, but multiply differential equation with r**(-l-1)
# and assume that V(r)=B*r**l for small r.
V_rmin = rgrid.integrate(rho.y*radii**(-l-1))*radii[0]**(l)/(2*l+1)
V_rmin = rgrid.integrate(rho.y * radii ** (-l - 1)) * radii[0] ** (l) / (2 * l + 1)
bcs = (V_rmin, None, V_rmax, None)
v = solve_ode2(b, a, f, bcs, PotentialExtrapolation(l))
result.append(v)
Expand Down

0 comments on commit 0980bc9

Please sign in to comment.