SSAGESproject / SSAGES

Software Suite for Advanced General Ensemble Simulations
GNU General Public License v3.0
85 stars 29 forks source link

Problem in running self-written method #15

Closed madhuragr closed 5 years ago

madhuragr commented 5 years ago

Dear developers/users,

I wrote a variation of NEB method (as a 4th flavor of String method). I try running it but I am getting an error that "the flavor for the new method is not a valid entry". I am sure I have followed the steps mentioned in the documentation correctly. I am following these steps first and then compiling SSAGES with GROMACS to test. I request you to help me figure out what is it that I am missing. I can attach the files as well later if required.

Thanks a lot, Madhur Aggarwal

mquevill commented 5 years ago

The current list of flavors for the methods based on String are defined in schema/Methods/string.method.json. Since the flavor is an enum type, you will need to add the name of your flavor to the list, shown below:

    "flavor" : {
        "type" : "string",
        "enum" : ["FTS", "SWARM", "ElasticBand", "YourMethod"]
    },

In src/Methods/StringMethod.cpp, you will want to make sure that you have the logic in for your method at the end of that file, such as:

...
else if(flavor == "YourMethod")
{
    reader->parse(JsonSchema::YourMethod.c_str(),
            JsonSchema::YourMethod.c_str() + JsonSchema::YourMethod.size(),
            &schema, NULL);
    validator.Parse(schema, path);

    //Validate input
    validator.Validate(json, path);
    if(validator.HasErrors())
        throw BuildException(validator.GetErrors());

    // Read in inputs necessary for your method
    // Create new instantiation of your method
    m = new YourMethod(world, comm, ...);
}

return m;
...
madhuragr commented 5 years ago

Oh, I didn't add my flavor to string.method.json file. Now it works well. I would like to give a suggestion; The new method works after we recompile SSAGES, so it would be good to mention this last step in the documentation. It may be obvious but for the sake of completeness, it's better to have it.
Thanks a lot for your help. :D