Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copy hydrocarbon files to hydrocarbon module in GhostFragment #63

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all 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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ __pycache__
# These are directories used by IDEs for storing settings
.idea/
.vscode/
.cache/

# These are common Python virtual enviornment directory names
venv/
Expand All @@ -55,4 +56,6 @@ toolchain.cmake

install/
.DS_Store
.kdev4/
GhostFragment.kdev4

2 changes: 2 additions & 0 deletions src/ghostfragment/ghostfragment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "screening/screening.hpp"
#include "topology/topology.hpp"
#include <ghostfragment/load_modules.hpp>
#include "hydrocarbon/hydrocarbon.hpp"

namespace ghostfragment {

Expand All @@ -29,6 +30,7 @@ void load_modules(pluginplay::ModuleManager& mm) {
drivers::load_modules(mm);
fragmenting::load_modules(mm);
// screening::load_modules(mm);
hydrocarbon::load_modules(mm);

capping::set_defaults(mm);
topology::set_defaults(mm);
Expand Down
18 changes: 18 additions & 0 deletions src/ghostfragment/hydrocarbon/hydrocarbon.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#pragma once
#include <simde/simde.hpp>

namespace ghostfragment::hydrocarbon {

// chemist::Molecule hydrocarbon(int num_carbon);

DECLARE_MODULE(MakeHydrocarbon);

inline void load_modules(pluginplay::ModuleManager& mm) {
mm.add_module<MakeHydrocarbon>("Generate a straight chain alkane");
}

inline void set_defaults(pluginplay::ModuleManager& mm) {

}

} // namespace ghostfragment::hydrocarbon
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@
* limitations under the License.
*/

#include "hydrocarbon.hpp"
#include "position.hpp"
#include "hydrocarbon.hpp"
#include <simde/simde.hpp>
#include <string>

#define C_C_BOND 2.89
#define H_C_BOND 2.06
Expand All @@ -26,8 +28,8 @@
#define C_NPROTON 6
#define H_NPROTON 1

namespace testing {

namespace ghostfragment::hydrocarbon {
namespace {
chemist::Molecule hydrocarbon(int num_carbon) {
chemist::Molecule m;

Expand Down Expand Up @@ -90,5 +92,26 @@ chemist::Molecule hydrocarbon(int num_carbon) {

return m;
}
}

const auto mod_desc = R"(
Hydrocarbon Chain Generator
---------------------------
)";

MODULE_CTOR(MakeHydrocarbon) {
description(mod_desc);
satisfies_property_type<simde::MoleculeFromString>();
}

} // namespace testing
MODULE_RUN(MakeHydrocarbon) {
const std::string& num_carbon_string = std::get<0>(simde::MoleculeFromString::unwrap_inputs(inputs));

auto hc = hydrocarbon(std::stoi(num_carbon_string));

auto rv = results();

return simde::MoleculeFromString::wrap_results(rv, hc);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
*/

#include "position.hpp"
#include <cmath>

namespace testing {
namespace ghostfragment::hydrocarbon {

std::array<float, 3> position_carbon(const std::vector<float>& source_coords,
float carbon_bond, int num,
Expand Down Expand Up @@ -112,4 +113,4 @@ std::array<float, 3> position_hydrogen(const std::vector<float>& source_coords,
return coords;
}

} // namespace testing
} // namespace ghostfragment::hydrocarbon
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@

#pragma once
#include <array>
#include <cmath>
#include <vector>

namespace testing {
namespace ghostfragment::hydrocarbon {

std::array<float, 3> position_carbon(const std::vector<float>& source_coords,
float carbon_bond, int num,
Expand All @@ -28,4 +27,4 @@ std::array<float, 3> position_carbon(const std::vector<float>& source_coords,
std::array<float, 3> position_hydrogen(const std::vector<float>& source_coords,
int flag, int num, float hydrogen_bond,
float angle_deg);
} // namespace testing
} // namespace ghostfragment::hydrocarbon
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,12 @@
#include <chemist/chemical_system/molecule/molecule.hpp>
#include <chemist/fragmenting/fragmented_nuclei.hpp>
#include <chemist/topology/connectivity_table.hpp>
#include <ghostfragment/hydrocarbon/hydrocarbon.hpp>
#include <cstdlib>
#include <string>

namespace testing {

chemist::Molecule hydrocarbon(int num_carbon);

inline auto hydrocarbon_connectivity(std::size_t N) {
// Probably a better way, but this works
const auto n_atoms = hydrocarbon(N).size();
Expand Down
Loading