Skip to content
Open
Show file tree
Hide file tree
Changes from 5 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
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,15 @@ int main() {
// --------------------------------------------------------------------------------------------

// --------------------------------------------------------------------------------------------
// docs:xyz ../data/water.structure.xyz
// start-cell-run
// Load a molecular structure (water molecule) from XYZ file
Comment thread
eimrek marked this conversation as resolved.
Outdated
auto structure = Structure::from_xyz_file("../data/water.structure.xyz");
auto structure = Structure::from_xyz(R"(3
Comment thread
eimrek marked this conversation as resolved.
Outdated
Water molecule
O 0.000000 0.000000 0.000000
H 0.758602 0.000000 0.504284
H -0.758602 0.000000 0.504284
)");
int charge = 0;

// First, run SCF to get molecular orbitals
Expand Down
7 changes: 6 additions & 1 deletion docs/source/_static/examples/cpp/ansatz.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

// Ansatz usage examples.
// --------------------------------------------------------------------------------------------
// docs:xyz ../data/h2.structure.xyz
// start-cell-create
#include <iostream>
#include <qdk/chemistry.hpp>
Expand All @@ -13,7 +14,11 @@ using namespace qdk::chemistry::algorithms;

int main() {
// Load H2 structure from XYZ file
Comment thread
eimrek marked this conversation as resolved.
Outdated
auto structure = Structure::from_xyz_file("../data/h2.structure.xyz");
auto structure = Structure::from_xyz(R"(2
Comment thread
eimrek marked this conversation as resolved.
Outdated
H2 molecule
H 0.000000 0.000000 0.000000
H 0.000000 0.000000 0.740848
)");

// SCF
auto scf_solver = ScfSolverFactory::create();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,14 @@ auto mp2_calculator =
// -----------------------------------------------------------------------------

// -----------------------------------------------------------------------------
// docs:xyz ../data/h2.structure.xyz
// start-cell-run
// Load H2 structure from XYZ file
Comment thread
eimrek marked this conversation as resolved.
Outdated
auto structure = Structure::from_xyz_file("../data/h2.structure.xyz");
auto structure = Structure::from_xyz(R"(2
Comment thread
eimrek marked this conversation as resolved.
Outdated
H2 molecule
H 0.000000 0.000000 0.000000
H 0.000000 0.000000 0.740848
)");

// Run initial SCF to get reference wavefunction
auto scf_solver = ScfSolverFactory::create();
Expand Down
8 changes: 7 additions & 1 deletion docs/source/_static/examples/cpp/hamiltonian.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,15 @@

// Hamiltonian usage examples.
// --------------------------------------------------------------------------------------------
// docs:xyz ../data/water.structure.xyz
// start-cell-hamiltonian-creation
// Load structure from XYZ file
Comment thread
eimrek marked this conversation as resolved.
Outdated
auto structure = Structure::from_xyz_file("../data/water.structure.xyz");
auto structure = Structure::from_xyz(R"(3
Comment thread
eimrek marked this conversation as resolved.
Outdated
Water molecule
O 0.000000 0.000000 0.000000
H 0.758602 0.000000 0.504284
H -0.758602 0.000000 0.504284
)");

// Run initial SCF to get orbitals
auto scf_solver = ScfSolverFactory::create();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,14 @@ hamiltonian_constructor->settings().set("eri_method", "direct");
// --------------------------------------------------------------------------------------------

// --------------------------------------------------------------------------------------------
// docs:xyz ../data/h2.structure.xyz
// start-cell-construct
// Load structure from XYZ file
Comment thread
eimrek marked this conversation as resolved.
Outdated
auto structure = std::make_shared<Structure>(
Structure::from_xyz_file("../data/h2.structure.xyz"));
auto structure = std::make_shared<Structure>(Structure::from_xyz(R"(2
Comment thread
eimrek marked this conversation as resolved.
Outdated
H2 molecule
H 0.000000 0.000000 0.000000
H 0.000000 0.000000 0.740848
)"));

// Run a SCF to get orbitals
auto scf_solver = ScfSolverFactory::create();
Expand Down
8 changes: 7 additions & 1 deletion docs/source/_static/examples/cpp/localizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,15 @@ int main() {
// --------------------------------------------------------------------------------------------

// --------------------------------------------------------------------------------------------
// docs:xyz ../data/water.structure.xyz
// start-cell-localize
// Load H2O molecule from XYZ file
Comment thread
eimrek marked this conversation as resolved.
Outdated
auto structure = Structure::from_xyz_file("../data/water.structure.xyz");
auto structure = Structure::from_xyz(R"(3
Comment thread
eimrek marked this conversation as resolved.
Outdated
Water molecule
O 0.000000 0.000000 0.000000
H 0.758602 0.000000 0.504284
H -0.758602 0.000000 0.504284
)");

// Obtain orbitals from SCF calculation
auto scf_solver = ScfSolverFactory::create();
Expand Down
7 changes: 6 additions & 1 deletion docs/source/_static/examples/cpp/orbitals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

// Orbitals usage examples.
// --------------------------------------------------------------------------------------------
// docs:xyz ../data/h2.structure.xyz
// start-cell-create
#include <iostream>
#include <qdk/chemistry.hpp>
Expand All @@ -14,7 +15,11 @@ using namespace qdk::chemistry::algorithms;
int main() {
// Obtain orbitals from a SCF calculation
// Load H2 molecule from XYZ file
Comment thread
eimrek marked this conversation as resolved.
Outdated
auto structure = Structure::from_xyz_file("../data/h2.structure.xyz");
auto structure = Structure::from_xyz(R"(2
Comment thread
eimrek marked this conversation as resolved.
Outdated
H2 molecule
H 0.000000 0.000000 0.000000
H 0.000000 0.000000 0.740848
)");

// Obtain orbitals from a SCF calculation
auto scf_solver = ScfSolverFactory::create();
Expand Down
17 changes: 15 additions & 2 deletions docs/source/_static/examples/cpp/quickstart.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,23 @@ using namespace qdk::chemistry;

int main() {
// ---------------------------------------------------------------------------
// docs:xyz ../data/para_benzyne.structure.xyz
// start-cell-structure
// Load para-benzyne structure from XYZ file
Comment thread
eimrek marked this conversation as resolved.
Outdated
auto structure = std::make_shared<data::Structure>(
data::Structure::from_xyz_file("../data/para_benzyne.structure.xyz"));
auto structure =
std::make_shared<data::Structure>(data::Structure::from_xyz(R"(10
Comment thread
eimrek marked this conversation as resolved.
Outdated
para-Benzyne
C 0.000000 1.396000 0.000000
C 1.209077 0.698000 0.000000
C 1.209077 -0.698000 0.000000
C 0.000000 -1.396000 0.000000
C -1.209077 -0.698000 0.000000
C -1.209077 0.698000 0.000000
H 2.151000 1.242000 0.000000
H 2.151000 -1.242000 0.000000
H -2.151000 -1.242000 0.000000
H -2.151000 1.242000 0.000000
)"));

std::cout << "Created structure with " << structure->get_num_atoms()
<< " atoms" << std::endl;
Expand Down
7 changes: 6 additions & 1 deletion docs/source/_static/examples/cpp/scf_solver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,14 @@ int main() {
// --------------------------------------------------------------------------------------------

// --------------------------------------------------------------------------------------------
// docs:xyz ../data/h2.structure.xyz
// start-cell-run
// Load structure from XYZ file
Comment thread
eimrek marked this conversation as resolved.
Outdated
auto structure = Structure::from_xyz_file("../data/h2.structure.xyz");
auto structure = Structure::from_xyz(R"(2
Comment thread
eimrek marked this conversation as resolved.
Outdated
H2 molecule
H 0.000000 0.000000 0.000000
H 0.000000 0.000000 0.740848
)");

// Run the SCF calculation
auto [E_scf, wfn] = scf_solver->run(structure, 0, 1, "def2-tzvpp");
Expand Down
8 changes: 6 additions & 2 deletions docs/source/_static/examples/cpp/serialization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

// Serialization usage examples.
// --------------------------------------------------------------------------------------------
// docs:xyz ../data/h2.structure.xyz
// start-cell-json
#include <filesystem>
#include <qdk/chemistry.hpp>
Expand All @@ -12,8 +13,11 @@ using namespace qdk::chemistry::data;
int main() {
// Load structure from XYZ file (the file uses Angstrom, converted to Bohr
// internally)
Comment thread
eimrek marked this conversation as resolved.
Outdated
Structure structure_from_file =
Structure::from_xyz_file("../data/h2.structure.xyz");
Structure structure_from_file = Structure::from_xyz(R"(2
Comment thread
eimrek marked this conversation as resolved.
Outdated
Comment thread
eimrek marked this conversation as resolved.
H2 molecule
H 0.000000 0.000000 0.000000
H 0.000000 0.000000 0.740848
)");

// For demonstration: create a structure with custom masses and charges
// (requires explicit coordinates, here in Bohr)
Expand Down
12 changes: 8 additions & 4 deletions docs/source/_static/examples/python/active_space_selector.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,18 @@
################################################################################

################################################################################
# docs:xyz ../data/water.structure.xyz
# start-cell-run
from pathlib import Path
from qdk_chemistry.data import Structure

# Load a molecular structure (water molecule) from XYZ file
Comment thread
eimrek marked this conversation as resolved.
Outdated
structure = Structure.from_xyz_file(
Path(__file__).parent / "../data/water.structure.xyz"
)
structure = Structure.from_xyz("""\
Comment thread
eimrek marked this conversation as resolved.
Outdated
3
Water molecule
O 0.000000 0.000000 0.000000
H 0.758602 0.000000 0.504284
H -0.758602 0.000000 0.504284
""")
charge = 0

# First, run SCF to get molecular orbitals
Expand Down
9 changes: 7 additions & 2 deletions docs/source/_static/examples/python/ansatz.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,18 @@
# --------------------------------------------------------------------------------------------

################################################################################
# docs:xyz ../data/h2.structure.xyz
# start-cell-create
from pathlib import Path
from qdk_chemistry.data import Ansatz, Structure
from qdk_chemistry.algorithms import create

# Load H2 molecule structure from XYZ file
Comment thread
eimrek marked this conversation as resolved.
Outdated
structure = Structure.from_xyz_file(Path(__file__).parent / "../data/h2.structure.xyz")
structure = Structure.from_xyz("""\
Comment thread
eimrek marked this conversation as resolved.
Outdated
2
H2 molecule
H 0.000000 0.000000 0.000000
H 0.000000 0.000000 0.740848
""")

# SCF
scf_solver = create("scf_solver")
Expand Down
11 changes: 8 additions & 3 deletions docs/source/_static/examples/python/basis_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,20 @@
# --------------------------------------------------------------------------------------------

################################################################################
# docs:xyz ../data/water.structure.xyz
# start-cell-loading
import numpy as np
from pathlib import Path
from qdk_chemistry.data import AOType, BasisSet, OrbitalType, Shell, Structure

# Load a water molecule structure from XYZ file
Comment thread
eimrek marked this conversation as resolved.
Outdated
structure = Structure.from_xyz_file(
Path(__file__).parent / "../data/water.structure.xyz"
)
structure = Structure.from_xyz("""\
Comment thread
eimrek marked this conversation as resolved.
Outdated
3
Water molecule
O 0.000000 0.000000 0.000000
H 0.758602 0.000000 0.504284
H -0.758602 0.000000 0.504284
""")

# Create basis sets from the library using basis set name
basis_from_name = BasisSet.from_basis_name("sto-3g", structure)
Expand Down
9 changes: 7 additions & 2 deletions docs/source/_static/examples/python/design_principles.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

################################################################################
# start-cell-scf-create
from pathlib import Path

from qdk_chemistry.algorithms import create
from qdk_chemistry.data import Structure
Expand All @@ -24,9 +23,15 @@
################################################################################

################################################################################
# docs:xyz ../data/h2.structure.xyz
# start-cell-data-flow
# Load a Structure from file (data classes in QDK/Chemistry are immutable by design)
Comment thread
eimrek marked this conversation as resolved.
Outdated
structure = Structure.from_xyz_file(Path(__file__).parent / "../data/h2.structure.xyz")
structure = Structure.from_xyz("""\
Comment thread
eimrek marked this conversation as resolved.
Outdated
2
H2 molecule
H 0.000000 0.000000 0.000000
H 0.000000 0.000000 0.740848
""")

# Configure and run SCF calculation
scf_solver = create("scf_solver")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,18 @@
################################################################################

################################################################################
# docs:xyz ../data/h2.structure.xyz
# start-cell-run
from pathlib import Path

from qdk_chemistry.data import Ansatz, Structure

# Load H2 structure from XYZ file
Comment thread
eimrek marked this conversation as resolved.
Outdated
structure = Structure.from_xyz_file(Path(__file__).parent / "../data/h2.structure.xyz")
structure = Structure.from_xyz("""\
Comment thread
eimrek marked this conversation as resolved.
Outdated
2
H2 molecule
H 0.000000 0.000000 0.000000
H 0.000000 0.000000 0.740848
""")

# Run initial SCF to get reference wavefunction
scf_solver = create("scf_solver")
Expand Down
9 changes: 7 additions & 2 deletions docs/source/_static/examples/python/factory_pattern.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,18 @@
# --------------------------------------------------------------------------------------------

################################################################################
# docs:xyz ../data/h2.structure.xyz
# start-cell-scf-localizer
from pathlib import Path
from qdk_chemistry.algorithms import create
from qdk_chemistry.data import Structure

# Load H2 molecule from XYZ file
Comment thread
eimrek marked this conversation as resolved.
Outdated
structure = Structure.from_xyz_file(Path(__file__).parent / "../data/h2.structure.xyz")
structure = Structure.from_xyz("""\
Comment thread
eimrek marked this conversation as resolved.
Outdated
2
H2 molecule
H 0.000000 0.000000 0.000000
H 0.000000 0.000000 0.740848
""")

# Create a SCF solver using the default implementation
scf_solver = create("scf_solver")
Expand Down
12 changes: 8 additions & 4 deletions docs/source/_static/examples/python/hamiltonian.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,19 @@
# --------------------------------------------------------------------------------------------

################################################################################
# docs:xyz ../data/water.structure.xyz
# start-cell-hamiltonian-creation
from pathlib import Path
from qdk_chemistry.algorithms import create
from qdk_chemistry.data import Structure, SpinChannel

# Load a structure from XYZ file
Comment thread
eimrek marked this conversation as resolved.
Outdated
structure = Structure.from_xyz_file(
Path(__file__).parent / "../data/water.structure.xyz"
)
structure = Structure.from_xyz("""\
Comment thread
eimrek marked this conversation as resolved.
Outdated
3
Water molecule
O 0.000000 0.000000 0.000000
H 0.758602 0.000000 0.504284
H -0.758602 0.000000 0.504284
""")

# Run initial SCF to get orbitals
scf_solver = create("scf_solver")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See LICENSE.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
from pathlib import Path

from qdk_chemistry.algorithms import available, create
from qdk_chemistry.data import Structure
Expand All @@ -31,9 +30,15 @@
################################################################################

################################################################################
# docs:xyz ../data/h2.structure.xyz
# start-cell-construct
# Load a structure from XYZ file
Comment thread
eimrek marked this conversation as resolved.
Outdated
structure = Structure.from_xyz_file(Path(__file__).parent / "../data/h2.structure.xyz")
structure = Structure.from_xyz("""\
Comment thread
eimrek marked this conversation as resolved.
Outdated
2
H2 molecule
H 0.000000 0.000000 0.000000
H 0.000000 0.000000 0.740848
""")

# Run a SCF to get orbitals
scf_solver = create("scf_solver")
Expand Down
9 changes: 7 additions & 2 deletions docs/source/_static/examples/python/interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,18 @@
# --------------------------------------------------------------------------------------------

################################################################################
# docs:xyz ../data/h2.structure.xyz
# start-cell-scf
from pathlib import Path
from qdk_chemistry.algorithms import available, create
from qdk_chemistry.data import Structure

# Load H2 molecule from XYZ file
Comment thread
eimrek marked this conversation as resolved.
Outdated
structure = Structure.from_xyz_file(Path(__file__).parent / "../data/h2.structure.xyz")
structure = Structure.from_xyz("""\
Comment thread
eimrek marked this conversation as resolved.
Outdated
2
H2 molecule
H 0.000000 0.000000 0.000000
H 0.000000 0.000000 0.740848
""")

# Create a SCF solver using the factory
scf_solver = create("scf_solver", "pyscf")
Expand Down
Loading
Loading