Skip to content

Commit f2f483a

Browse files
authored
Merge pull request #2 from wcwitt/main
Make website release-ready
2 parents 5bb5267 + 7149e05 commit f2f483a

35 files changed

Lines changed: 12419 additions & 331 deletions

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,6 @@ build
22
external/lbfgs/lbfgs_um
33
pyrofess/__pycache__
44
test/__pycache__
5+
website/source/user-guide/generated
6+
website/build
7+
.ipynb_checkpoints

CMakeLists.txt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,11 @@ target_include_directories(profess PUBLIC ${LIBXC_INCLUDE_DIR})
6565
target_link_directories(profess PUBLIC ${LIBXC_LIBRARY_DIR})
6666
target_link_libraries(profess PUBLIC xc)
6767

68-
# pyrofess
69-
pybind11_add_module(pyrofess MODULE pyrofess/pyrofess.cpp)
70-
target_link_libraries(pyrofess PUBLIC profess)
68+
# profess-pybind
69+
pybind11_add_module(profess-pybind MODULE pyrofess/pyrofess.cpp)
70+
target_link_libraries(profess-pybind PUBLIC profess)
71+
set_target_properties(profess-pybind PROPERTIES OUTPUT_NAME profess)
7172

72-
# pyrofess extras
73+
# profess-pybind extras
7374
pybind11_add_module(extras MODULE pyrofess/extras.cpp)
7475
target_link_libraries(extras PUBLIC profess)

external/ase

Submodule ase updated from 17c53aa to d626b21

include/ions.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class Ions
3232
std::vector<std::function<double(double)>>
3333
ft_potential_derivatives();
3434

35-
Ions& add_ion_type_coulomb(double z);
35+
Ions& add_ion_type_coulomb(double z, double cutoff=-1.0);
3636
Ions& add_ion_type_recpot(std::string filename);
3737
Ions& add_ion_type_harmonic_compactified(double w, double r1, double r2);
3838
Ions& add_ion_type_generic(

include/system.hpp

Lines changed: 32 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,22 @@ namespace profess
1313

1414
class System
1515
{
16-
public:
1716

17+
public:
18+
// public constructors (named constructor idiom)
19+
static
20+
System create(
21+
std::array<std::array<double,3>,3> box_vectors,
22+
double energy_cutoff,
23+
std::array<std::string,2> units={"b","h"});
24+
static
25+
System create_from_grid_shape(
26+
std::array<std::array<double,3>,3> box_vectors,
27+
std::array<size_t,3> grid_shape,
28+
std::string unit={"b"});
29+
private:
1830
System(std::array<size_t,3> grid_shape);
19-
20-
static std::array<size_t,3> get_shape(
21-
std::array<std::array<double,3>,3> box_vectors,
22-
double energy_cutoff,
23-
std::array<std::string,2> units={"b","h"});
24-
31+
public:
2532
// rule of five
2633
// copy construction/assignment disabled b/c class has unique ptrs
2734
~System() = default;
@@ -47,7 +54,8 @@ class System
4754
System& add_coulomb_ions(
4855
double z,
4956
std::vector<std::array<double,3>> coords,
50-
std::string unit={"b"});
57+
std::string unit={"b"},
58+
double cutoff=-1.0);
5159
System& add_harmonic_ions();
5260

5361
std::vector<std::array<double,3>> ions_xyz_coords(std::string unit);
@@ -57,29 +65,31 @@ class System
5765
System& add_ion_electron_functional();
5866
System& add_luo_karasiev_trickey_functional(double a=1.3,
5967
double tiny_den=1e-12);
60-
System& add_libxc_functional(std::vector<int>);
61-
System& add_kinetic_class_a_functional(
68+
System& add_libxc_functional(std::vector<int> xc_func_ids);
69+
System& add_generic_nonlocal_a_functional(
6270
double a,
6371
double b,
6472
std::function<double(double)> f,
6573
std::function<double(double)> fp,
66-
double den0);
74+
double den0=-1);
6775
System& add_perdew_burke_ernzerhof_functional();
6876
System& add_perdew_zunger_functional();
69-
System& add_perrot_functional(double den0);
70-
System& add_smargiassi_madden_functional(double den0);
77+
System& add_perrot_functional(double den0=-1.0);
78+
System& add_smargiassi_madden_functional(double den0=-1.0);
7179
System& add_thomas_fermi_functional();
7280
System& add_wang_govind_carter_functional(
73-
double den0,
81+
double den0=-1.0,
7482
double alpha=(5.0+std::sqrt(5.0))/6.0,
7583
double beta=(5.0-std::sqrt(5.0))/6.0,
7684
double gamma=2.7);
77-
System& add_wang_govind_carter_1999_i_functional(double den0);
78-
System& add_wang_teter_functional(double den0);
85+
System& add_wang_govind_carter_1999_i_functional(double den0=-1.0);
86+
System& add_wang_teter_functional(double den0=-1.0);
7987
System& add_weizsaecker_functional();
8088

8189
System& remove_functional(std::string name);
8290

91+
System& add_ion_ion_interaction();
92+
8393
// basic information about the system
8494
double energy(std::string unit={"h"});
8595
std::tuple<double, Double3D> energy_potential(bool compute_ion_ion=true);
@@ -89,9 +99,10 @@ class System
8999
double pressure(std::string unit={"h/b3"});
90100
double enthalpy(std::string unit={"h"});
91101
double energy_cutoff(std::string unit={"h"});
102+
double total_ion_charge();
92103

93104
// basic manipulations
94-
System& distribute_electrons_uniformly(const double electrons);
105+
System& add_electrons(double electrons=-1.0);
95106
System& move_ions(
96107
std::vector<std::array<double,3>> xyz_coords,
97108
std::string length_unit={"b"});
@@ -110,6 +121,10 @@ class System
110121
double energy_tol=1e-5,
111122
size_t window_size=3,
112123
size_t max_iter=100);
124+
125+
private:
126+
127+
bool _ion_ion_interaction = false;
113128
};
114129

115130
}

pyrofess/ase_tools.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ def init_optimizer(atoms, algorithm):
2727
return optimizer
2828

2929
def minimize_forces(system, algorithm, fmax=1e-4, steps=100):
30-
atoms = Atoms('H' + str(system.ions.count()),
31-
positions=system.ions.xyz_coords(),
30+
atoms = Atoms('H' + str(len(system.ions_xyz_coords())),
31+
positions=system.ions_xyz_coords(),
3232
cell=system.box_vectors(),
3333
pbc=True)
3434
atoms.calc = Profess(system)
@@ -44,8 +44,8 @@ def minimize_stress(
4444
hydrostatic_strain=False,
4545
constant_volume=False,
4646
scalar_pressure=0.0):
47-
atoms = Atoms('H' + str(system.ions.count()),
48-
positions=system.ions.xyz_coords(),
47+
atoms = Atoms('H' + str(len(system.ions_xyz_coords())),
48+
positions=system.ions_xyz_coords(),
4949
cell=system.box_vectors(),
5050
pbc=True)
5151
atoms.calc = Profess(system)
@@ -67,7 +67,7 @@ def minimize_forces_stress(
6767
hydrostatic_strain=False,
6868
constant_volume=False,
6969
scalar_pressure=0.0):
70-
atoms = Atoms('H' + str(system.ions.count()),
70+
atoms = Atoms('H' + str(len(system.ions_xyz_coords())),
7171
positions=system.ions_xyz_coords(),
7272
cell=system.box_vectors(),
7373
pbc=True)
@@ -102,4 +102,4 @@ def optimize_geometry(init_system, box_vectors, xyz_coords, energy_cutoff):
102102
return system
103103
else:
104104
box_vectors = np.array(system.box.vectors()).T
105-
xyz_coords = np.array(system.ions.xyz_coords())
105+
xyz_coords = np.array(system.ions_xyz_coords())

0 commit comments

Comments
 (0)