"devtools/packaging/scripts/source/build.sh" did not exist on "0abd720e69d7c93dd9bcd1eea0bf9da52488270c"
TestNormalModeLangevin.cpp 1.52 KB
Newer Older
1
2
3
#include "OpenMM.h"
#include <vector>
#include <string>
4
#include <iostream>
5
#include <cstdlib>
6
7
8
9

using namespace OpenMM;
using namespace std;

10
11
12
13
14
15
16
17
18
19
void mysetenv(const char* name, const char* value) {
#ifdef _MSC_VER
    char buffer[1000];
    sprintf(buffer, "%s=%s", name, value);
    putenv(buffer);
#else
    setenv(name, value, 1);
#endif
}

20
21
void testLoadNMLPlugin() 
{
22
23
24
    string pluginDir = Platform::getDefaultPluginsDirectory();
    cout << "Default plugins directory = " << pluginDir << endl;
    Platform::loadPluginsFromDirectory(pluginDir);
25
26
27
28
29
30
31

    // Create a context, just to initialize all plugins
    System system;
    VerletIntegrator integrator(0.01);
    Context context(system, integrator);

    // Was NormalModeLangevin plugin loaded?
32
    vector<string> kernelName;
33
    kernelName.push_back("IntegrateNMLStep");
34
    cout << "Searching for kernel IntegrateNMLStep" << endl;
35
    Platform& platform = Platform::findPlatform(kernelName); // throws if no platform with kernel
36
37
}

38
int main(int argc, const char* argv[]) 
39
{
40
41
    try 
    {
42
        // Set OPENMM_PLUGIN_DIR from first command line argument
43
44
45
46
47
48
        if (argc > 1) {
            const char* plugin_dir = argv[1];
            mysetenv("OPENMM_PLUGIN_DIR", plugin_dir);
            cout << plugin_dir << endl;
            cout << getenv("OPENMM_PLUGIN_DIR") << endl;
        }
49
50
51
52
        testLoadNMLPlugin();
        cout << "tests passed" << endl;
        return 0;
    } 
53
    catch (const std::exception& exc) 
54
    {
55
        cout << "FAILED: " << exc.what() << endl;
56
57
        return 1;
    }
58
}
59