ccsb-scripps / AutoDock-Vina

AutoDock Vina
http://vina.scripps.edu
Apache License 2.0
597 stars 210 forks source link

Problems compiling in MacBook Pro M2 with split #227

Open mixcoha opened 1 year ago

mixcoha commented 1 year ago

I finally compiled vina on my Mac with ARM64 and chip M2. I've just done three modifications in split.ccp file. I hope it will help you

/*

Copyright (c) 2006-2010, The Scripps Research Institute

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Author: Dr. Oleg Trott ot14@columbia.edu, The Olson Lab, The Scripps Research Institute

*/

include

include

include

include // ligand paths

include

include // getline?

include // for ceila

include <boost/program_options.hpp>

include <boost/filesystem/fstream.hpp>

include <boost/filesystem/exception.hpp>

include <boost/filesystem/convenience.hpp> // filesystem::basename

include "file.h"

include "parse_error.h"

using boost::filesystem::path;

boost::filesystem::path make_path(const std::string& str) { return boost::filesystem::path(str).make_preferred(); }

std::string default_prefix(const std::string& input_name, const std::string& add) { std::string tmp = input_name; if(tmp.size() >= 6 && tmp.substr(tmp.size()-6, 6) == ".pdbqt") tmp.resize(tmp.size() - 6); // FIXME? return tmp + add; }

struct usage_error : public std::runtime_error { usage_error(const std::string& message) : std::runtime_error(message) {} };

typedef std::list strl;

struct model { strl ligand; strl flex; };

typedef std::list models;

models parse_multimodel_pdbqt(const std::string& input) { const path p = make_path(input); ifile in(p); models tmp; unsigned count = 0; std::string str; bool parsing_model = false; bool parsing_ligand = true; while(std::getline(in, str)) { ++count; if(starts_with(str, "MODEL")) { if(parsing_model == true || parsing_ligand == false) throw parse_error(p, count, "Misplaced MODEL tag"); tmp.push_back(model()); parsing_model = true; } else if(starts_with(str, "ENDMDL")) { if(parsing_model == false || parsing_ligand == false) throw parse_error(p, count, "Misplaced ENDMDL tag"); parsing_model = false; } else if(starts_with(str, "BEGIN_RES")) { if(parsing_model == false || parsing_ligand == false) throw parse_error(p, count, "Misplaced BEGIN_RES tag"); parsing_ligand = false; tmp.back().flex.push_back(str); } else if(starts_with(str, "END_RES")) { if(parsing_model == false || parsing_ligand == true) throw parse_error(p, count, "Misplaced END_RES tag"); parsing_ligand = true; tmp.back().flex.push_back(str); } else { if(parsing_model == false) throw parse_error(p, count, "Input occurs outside MODEL"); if(parsing_ligand) { tmp.back().ligand.push_back(str); } else { tmp.back().flex.push_back(str); } } } if(parsing_model == true) throw parse_error(p, count+1, "Missing ENDMDL tag"); return tmp; }

void write_pdbqt(const strl& lines, const std::string& name) { if(lines.size() > 0) { ofile out(make_path(name)); for(strl::const_iterator it = lines.begin(); it != lines.end(); ++it) out << *it << '\n'; } }

void write_multimodel_pdbqt(const models& m, const std::string& ligand_prefix, const std::string& flex_prefix) { sz how_many = m.size(); std::streamsize w = static_cast(to_string(how_many).size()); sz counter = 0; for(models::const_iterator it = m.begin(); it != m.end(); ++it) { ++counter; const std::string add = to_string(counter, w, '0') + ".pdbqt"; write_pdbqt(it->ligand, ligand_prefix + add); write_pdbqt(it->flex, flex_prefix + add); } }

int main(int argc, char* argv[]) { using namespace boost::program_options; const bool advanced = false; const std::string version_string = "AutoDock Vina PDBQT Split 1.1.2 (May 11, 2011)";

const std::string error_message = "\n\n\

Please contact the author, Dr. Oleg Trott ot14@columbia.edu, so\n\ that this problem can be resolved. The reproducibility of the\n\ error may be vital, so please remember to include the following in\n\ your problem report:\n\