From a71f3dd23bc1fb7efb8a3fa2701cc02ccbb2c8d7 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Wed, 15 Apr 2020 15:06:16 -0400 Subject: [PATCH 01/39] Add charmm HIS residue names --- src/Residue.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Residue.cpp b/src/Residue.cpp index 5fdf91f0fa..e6aa8e66a1 100644 --- a/src/Residue.cpp +++ b/src/Residue.cpp @@ -24,6 +24,9 @@ char Residue::ConvertResName(std::string const& r) { if (r.compare(0,3,"HIE")==0) return 'H'; // NE-protonated (HIS) if (r.compare(0,3,"HID")==0) return 'H'; // ND-protonated if (r.compare(0,3,"HIP")==0) return 'H'; // NE/ND protonated + if (r.compare(0,3,"HSE")==0) return 'H'; // CHARMM NE-protonated + if (r.compare(0,3,"HSD")==0) return 'H'; // CHARMM ND-protonated + if (r.compare(0,3,"HSP")==0) return 'H'; // CHARMM NE/ND-protonated if (r.compare(0,3,"ILE")==0) return 'I'; if (r.compare(0,3,"LEU")==0) return 'L'; if (r.compare(0,3,"LYS")==0) return 'K'; From 208ed3ae8872fe0b557750729005c2e7ff2ef86a Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Wed, 15 Apr 2020 15:16:16 -0400 Subject: [PATCH 02/39] Add 'nointrares' keyword to 'bonds' command. --- src/Exec_Top.cpp | 7 +++++-- src/TopInfo.cpp | 10 ++++++++-- src/TopInfo.h | 2 ++ 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/Exec_Top.cpp b/src/Exec_Top.cpp index 374f6f5273..bf1d0a8070 100644 --- a/src/Exec_Top.cpp +++ b/src/Exec_Top.cpp @@ -51,15 +51,18 @@ static int CommonSetup(TopInfo& info, CpptrajState& State, ArgList& argIn, const mprintf("\tOutput to '%s'\n", outfile->Filename().full()); err = info.SetupTopInfo( outfile, parm, REF.RefPtr() ); } + if (argIn.hasKey("nointrares")) + info.SetNoIntraRes(true); return err; } // ----------------------------------------------------------------------------- void Exec_BondInfo::Help() const { - mprintf("\t[%s] [] [] [out ]\n", DataSetList::TopIdxArgs); + mprintf("\t[%s] [] [] [out ] [nointrares]\n", DataSetList::TopIdxArgs); mprintf(" For specified topology (first by default) either print bond info for all\n" " atoms in , or print info for bonds with first atom in and\n" - " second atom in .\n"); + " second atom in . If 'nointrares' is specified, only print bonds\n" + " that are between residues.\n"); } Exec::RetType Exec_BondInfo::Execute(CpptrajState& State, ArgList& argIn) { diff --git a/src/TopInfo.cpp b/src/TopInfo.cpp index e8dbfcb401..b68916c3ba 100644 --- a/src/TopInfo.cpp +++ b/src/TopInfo.cpp @@ -17,7 +17,8 @@ TopInfo::TopInfo() : Awidth_(0), amn_width_(0), max_aname_len_(0), - toStdout_(false) + toStdout_(false), + noIntraRes_(false) {} /// CONSTRUCTOR - To Stdout @@ -28,7 +29,8 @@ TopInfo::TopInfo(Topology const* pIn) : amn_width_(0), max_type_len_(0), max_aname_len_(0), - toStdout_(false) + toStdout_(false), + noIntraRes_(false) { SetupTopInfo( 0, pIn, 0 ); } @@ -397,6 +399,10 @@ void TopInfo::PrintBonds(BondArray const& barray, BondParmArray const& bondparm, printBond = (mask1.AtomInCharMask(atom1) && mask2.AtomInCharMask(atom2)); else printBond = (mask1.AtomInCharMask(atom1) || mask1.AtomInCharMask(atom2)); + if (noIntraRes_ && printBond) { + if ( (*parm_)[atom1].ResNum() == (*parm_)[atom2].ResNum() ) + printBond = false; + } if (printBond) { outfile_->Printf("%*i", nw, nb); int bidx = batom->Idx(); diff --git a/src/TopInfo.h b/src/TopInfo.h index c963586eb5..bb62d983cb 100644 --- a/src/TopInfo.h +++ b/src/TopInfo.h @@ -14,6 +14,7 @@ class TopInfo { /// CONSTRUCTOR - Take pointer to topology, output to STDOUT TopInfo(Topology const*); ~TopInfo(); + void SetNoIntraRes(bool b) { noIntraRes_ = b; } int SetupTopInfo(CpptrajFile*, Topology const*, DataSet_Coords*); int SetupTopInfo(Topology const* p, DataSet_Coords* c) { return SetupTopInfo(0, p, c); } @@ -54,5 +55,6 @@ class TopInfo { int max_type_len_; ///< Max width of atom type name in topology int max_aname_len_; ///< Max width of atom name in topology bool toStdout_; + bool noIntraRes_; ///< If true, ignore intra-residue bonds/angles/dihedrals etc }; #endif From d3b17a5131a6aca6d9a6d0a0e3b483632b80ff7f Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Wed, 15 Apr 2020 17:17:30 -0400 Subject: [PATCH 03/39] Start adding a remove bond function --- src/Topology.cpp | 47 +++++++++++++++++++++++++++++++++++++++++++++++ src/Topology.h | 1 + 2 files changed, 48 insertions(+) diff --git a/src/Topology.cpp b/src/Topology.cpp index e004e622b9..a81c7e2a09 100644 --- a/src/Topology.cpp +++ b/src/Topology.cpp @@ -599,6 +599,53 @@ static inline int WarnOutOfRange(int Natom, int atom, const char* type) { return 0; } +/** Remove a bond between atom 1 and atom2, update the atoms array. + * Does not modify bond parameters. + */ +void Topology::RemoveBond(int atom1, int atom2) +{ + // Check if atoms are out of range. + if (WarnOutOfRange(atoms_.size(), atom1, "bond")) return; + if (WarnOutOfRange(atoms_.size(), atom2, "bond")) return; + // Ensure the bond exists. + bool exists = false; + for (Atom::bond_iterator ba = atoms_[atom1].bondbegin(); + ba != atoms_[atom1].bondend(); ++ba) + if ( *ba == atom2 ) { + exists = true; + break; + } + if (!exists) { + mprintf("Warning: No bond exists between atoms %i and %i\n", atom1+1, atom2+1); + return; + } + bool a1H = (atoms_[atom1].Element() == Atom::HYDROGEN); + bool a2H = (atoms_[atom2].Element() == Atom::HYDROGEN); + BondArray* tgtArray; + if (a1H || a2H) + tgtArray = &bondsh_; + else + tgtArray = &bonds_; + // Search the array. + BondArray::iterator bnd = tgtArray->begin(); + for (; bnd != tgtArray->end(); ++bnd) { + if (atom1 == bnd->A1()) { + if (atom2 == bnd->A2()) break; + } + if (atom2 == bnd->A1()) { + if (atom1 == bnd->A2()) break; + } + } + // Sanity check + if (bnd == tgtArray->end()) { + mprinterr("Internal Error: Bond %i %i not found in internal bond array.\n", atom1+1, atom2+1); + return; + } + tgtArray->erase( bnd ); + +} + + // Topology::AddBond() /** Create a bond between atom1 and atom2, update the atoms array. * For bonds to H always insert the H second. diff --git a/src/Topology.h b/src/Topology.h index 777265ea6f..14e35db006 100644 --- a/src/Topology.h +++ b/src/Topology.h @@ -77,6 +77,7 @@ class Topology { void AddBond(int, int, int); void AddBond(BondType const&, bool); void AddBond(int, int, BondParmType const&); + void RemoveBond(int, int); void AssignBondParams(ParmHolder const&); // ----- Angle-specific routines ------------- size_t Nangles() const { return angles_.size()+anglesh_.size(); } From 40c2c37f02a433c4962bdc15c3772e6b9fdb376b Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Wed, 15 Apr 2020 18:57:24 -0400 Subject: [PATCH 04/39] Ensure erased bond indices are removed from atoms as well. --- src/Atom.cpp | 10 ++++++++++ src/Atom.h | 1 + src/Topology.cpp | 3 ++- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/Atom.cpp b/src/Atom.cpp index e886a2a709..06c7554136 100644 --- a/src/Atom.cpp +++ b/src/Atom.cpp @@ -196,6 +196,16 @@ Atom &Atom::operator=(Atom other) { return *this; } +/** Remove the specified bond to index if it exists. */ +void Atom::RemoveBondToIdx(int idx) { + std::vector newBonds_; + for (std::vector::const_iterator it = bonds_.begin(); it != bonds_.end(); ++it) + { + if (*it != idx) newBonds_.push_back( *it ); + } + bonds_ = newBonds_; +} + // Atom::SortBonds() void Atom::SortBonds() { sort( bonds_.begin(), bonds_.end() ); diff --git a/src/Atom.h b/src/Atom.h index 9f4d892bf1..f98c0958de 100644 --- a/src/Atom.h +++ b/src/Atom.h @@ -47,6 +47,7 @@ class Atom { /// Add atom index # to this atoms list of bonded atoms. void AddBondToIdx(int idxIn) { bonds_.push_back( idxIn ); } void ClearBonds() { bonds_.clear() ; } + void RemoveBondToIdx(int); void SortBonds(); // TODO: Use this routine in AtomMap etc /// \return true if this atom is bonded to given atom index diff --git a/src/Topology.cpp b/src/Topology.cpp index a81c7e2a09..14168f79cb 100644 --- a/src/Topology.cpp +++ b/src/Topology.cpp @@ -642,7 +642,8 @@ void Topology::RemoveBond(int atom1, int atom2) return; } tgtArray->erase( bnd ); - + atoms_[atom1].RemoveBondToIdx( atom2 ); + atoms_[atom2].RemoveBondToIdx( atom1 ); } From a7ff2457e4f4b754cc71d612392db4dcc7bddd1e Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 16 Apr 2020 13:27:39 -0400 Subject: [PATCH 05/39] Add new formatted name routine --- src/Topology.cpp | 16 ++++++++++++++++ src/Topology.h | 4 +++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/Topology.cpp b/src/Topology.cpp index 14168f79cb..495e7e81e5 100644 --- a/src/Topology.cpp +++ b/src/Topology.cpp @@ -169,6 +169,18 @@ std::string Topology::TruncResAtomNameNum(int atom) const { return TruncResAtomName(atom) + "_" + integerToString(atom+1); } +/** Given an atom number, return a string containing the corresponding + * residue name and number, and atom name and number, all separated + * by spaces: + * " + */ +std::string Topology::ResNameNumAtomNameNum(int atom) const { + if (atom < 0 || atom >= (int)atoms_.size()) return std::string(""); + int res = atoms_[atom].ResNum(); + return residues_[res].Name().Truncated() + " " + integerToString(res+1) + " " + + atoms_[atom].Name().Truncated() + " " + integerToString(atom+1); +} + // Topology::AtomMaskName() /** \return A string of format :r@a where r is atoms residue number and * a is atoms name. @@ -182,6 +194,10 @@ std::string Topology::AtomMaskName(int atom) const { return maskName; } +/** Given an atom number, return a string containing atom name and + * number with format: + * "_" + */ std::string Topology::TruncAtomNameNum(int atom) const { if (atom < 0 || atom >= (int)atoms_.size()) return std::string(""); std::string atom_name = atoms_[atom].Name().Truncated(); diff --git a/src/Topology.h b/src/Topology.h index 14e35db006..71715fbe32 100644 --- a/src/Topology.h +++ b/src/Topology.h @@ -130,8 +130,10 @@ class Topology { std::string TruncResAtomName(int) const; /// Format: @ std::string TruncResNameAtomName(int) const; - /// Format: _@_ + /// Format: _@_ std::string TruncResAtomNameNum(int) const; + /// Format: + std::string ResNameNumAtomNameNum(int) const; /// Format: :@ std::string AtomMaskName(int) const; /// Format: _ From c5dc53aac8696da6957b5caa58cb0e98ec4bae23 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 16 Apr 2020 13:42:04 -0400 Subject: [PATCH 06/39] Add a removebonds command --- src/Exec_Change.cpp | 61 +++++++++++++++++++++++++++++++++++++++++++-- src/Exec_Change.h | 1 + 2 files changed, 60 insertions(+), 2 deletions(-) diff --git a/src/Exec_Change.cpp b/src/Exec_Change.cpp index 2e40d90d01..f40da459a8 100644 --- a/src/Exec_Change.cpp +++ b/src/Exec_Change.cpp @@ -10,7 +10,8 @@ void Exec_Change::Help() const "\t{ resname from to |\n" "\t chainid of to |\n" "\t atomname from to |\n" - "\t addbond [req ] }\n" + "\t addbond [req ] |\n" + "\t removebonds [] }\n" " Change specified parts of topology or topology of a COORDS data set.\n", DataSetList::TopArgs); } @@ -19,7 +20,7 @@ void Exec_Change::Help() const Exec::RetType Exec_Change::Execute(CpptrajState& State, ArgList& argIn) { // Change type - enum ChangeType { UNKNOWN = 0, RESNAME, CHAINID, ATOMNAME, ADDBOND }; + enum ChangeType { UNKNOWN = 0, RESNAME, CHAINID, ATOMNAME, ADDBOND, REMOVEBONDS }; ChangeType type = UNKNOWN; if (argIn.hasKey("resname")) type = RESNAME; @@ -29,6 +30,8 @@ Exec::RetType Exec_Change::Execute(CpptrajState& State, ArgList& argIn) type = ATOMNAME; else if (argIn.hasKey("addbond")) type = ADDBOND; + else if (argIn.hasKey("removebonds")) + type = REMOVEBONDS; if (type == UNKNOWN) { mprinterr("Error: No change type specified.\n"); return CpptrajState::ERR; @@ -52,6 +55,7 @@ Exec::RetType Exec_Change::Execute(CpptrajState& State, ArgList& argIn) case CHAINID : err = ChangeChainID(*parm, argIn); break; case ATOMNAME : err = ChangeAtomName(*parm, argIn); break; case ADDBOND : err = AddBond(*parm, argIn); break; + case REMOVEBONDS : err = RemoveBonds(*parm, argIn); break; case UNKNOWN : err = 1; // sanity check } if (err != 0) return CpptrajState::ERR; @@ -194,6 +198,59 @@ int Exec_Change::FindBondTypeIdx(Topology const& topIn, BondArray const& bonds, return bidx; } +// Exec_Change::RemoveBonds() +int Exec_Change::RemoveBonds(Topology& topIn, ArgList& argIn) const { + AtomMask mask1, mask2; + std::string str1 = argIn.GetMaskNext(); + if (str1.empty()) { + mprinterr("Error: Must specify at least 1 atom mask.\n"); + return 1; + } + if (mask1.SetMaskString( str1 )) return 1; + if (topIn.SetupIntegerMask( mask1 )) return 1; + if (mask1.None()) { + mprinterr("Error: %s selects no atoms.\n", str1.c_str()); + return 1; + } + std::string str2 = argIn.GetMaskNext(); + if (!str2.empty()) { + if (mask2.SetMaskString( str2 )) return 1; + if (topIn.SetupIntegerMask( mask2 )) return 1; + if (mask2.None()) { + mprinterr("Error: %s selects no atoms.\n", str2.c_str()); + return 1; + } + } + + if (str2.empty()) { + mprintf("\tRemoving bonds to atoms selected by %s (%i atoms).\n", + str1.c_str(), mask1.Nselected()); + for (AtomMask::const_iterator atm = mask1.begin(); atm != mask1.end(); ++atm) { + std::string atmStr = topIn.ResNameNumAtomNameNum(*atm); + for (Atom::bond_iterator bnd = topIn[*atm].bondbegin(); + bnd != topIn[*atm].bondend(); ++bnd) + { + mprintf("\t\t%s to %s\n", atmStr.c_str(), topIn.ResNameNumAtomNameNum(*bnd).c_str()); + topIn.RemoveBond(*atm, *bnd); + } + } + } else { + mprintf("\tRemoving any bonds between atoms selected by %s (%i atoms)\n" + "\tand %s (%i atoms).\n", str1.c_str(), mask1.Nselected(), + str2.c_str(), mask2.Nselected()); + for (AtomMask::const_iterator atm1 = mask1.begin(); atm1 != mask1.end(); ++atm1) { + std::string atmStr = topIn.ResNameNumAtomNameNum(*atm1); + for (AtomMask::const_iterator atm2 = mask2.begin(); atm2 != mask2.end(); ++atm2) { + mprintf("\t\t%s to %s\n", atmStr.c_str(), topIn.ResNameNumAtomNameNum(*atm2).c_str()); + topIn.RemoveBond(*atm1, *atm2); + } + } + } + + return 0; +} + + // Exec_Change::AddBond() int Exec_Change::AddBond(Topology& topIn, ArgList& argIn) const { AtomMask mask1, mask2; diff --git a/src/Exec_Change.h b/src/Exec_Change.h index c53c1e3529..8b44675c9f 100644 --- a/src/Exec_Change.h +++ b/src/Exec_Change.h @@ -16,5 +16,6 @@ class Exec_Change : public Exec { static inline int Setup1atomMask(AtomMask&, Topology const&, std::string const&); static inline int FindBondTypeIdx(Topology const&, BondArray const&, TypeNameHolder const&); int AddBond(Topology&, ArgList&) const; + int RemoveBonds(Topology&, ArgList&) const; }; #endif From 24161e29b57d629023f27c2a694bd55f3457ff28 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 16 Apr 2020 13:51:38 -0400 Subject: [PATCH 07/39] Use a copy of the bonds array since it will be modified. Have RemoveBond return a status --- src/Atom.h | 1 + src/Exec_Change.cpp | 15 +++++++++------ src/Topology.cpp | 12 +++++++----- src/Topology.h | 2 +- 4 files changed, 18 insertions(+), 12 deletions(-) diff --git a/src/Atom.h b/src/Atom.h index f98c0958de..272a618f87 100644 --- a/src/Atom.h +++ b/src/Atom.h @@ -44,6 +44,7 @@ class Atom { inline bond_iterator bondbegin() const { return bonds_.begin(); } inline bond_iterator bondend() const { return bonds_.end(); } inline int Bond(int idx) const { return bonds_[idx]; } + std::vector const& BondIdxArray() const { return bonds_; } /// Add atom index # to this atoms list of bonded atoms. void AddBondToIdx(int idxIn) { bonds_.push_back( idxIn ); } void ClearBonds() { bonds_.clear() ; } diff --git a/src/Exec_Change.cpp b/src/Exec_Change.cpp index f40da459a8..31dc05b7ac 100644 --- a/src/Exec_Change.cpp +++ b/src/Exec_Change.cpp @@ -227,11 +227,13 @@ int Exec_Change::RemoveBonds(Topology& topIn, ArgList& argIn) const { str1.c_str(), mask1.Nselected()); for (AtomMask::const_iterator atm = mask1.begin(); atm != mask1.end(); ++atm) { std::string atmStr = topIn.ResNameNumAtomNameNum(*atm); - for (Atom::bond_iterator bnd = topIn[*atm].bondbegin(); - bnd != topIn[*atm].bondend(); ++bnd) + // Make a copy of the atoms bonds array because it will be modified. + std::vector atoms = topIn[*atm].BondIdxArray(); + for (std::vector::const_iterator bnd = atoms.begin(); bnd != atoms.end(); ++bnd) { - mprintf("\t\t%s to %s\n", atmStr.c_str(), topIn.ResNameNumAtomNameNum(*bnd).c_str()); - topIn.RemoveBond(*atm, *bnd); + int ret = topIn.RemoveBond(*atm, *bnd); + if (ret == 0) + mprintf("\t\t%s to %s\n", atmStr.c_str(), topIn.ResNameNumAtomNameNum(*bnd).c_str()); } } } else { @@ -241,8 +243,9 @@ int Exec_Change::RemoveBonds(Topology& topIn, ArgList& argIn) const { for (AtomMask::const_iterator atm1 = mask1.begin(); atm1 != mask1.end(); ++atm1) { std::string atmStr = topIn.ResNameNumAtomNameNum(*atm1); for (AtomMask::const_iterator atm2 = mask2.begin(); atm2 != mask2.end(); ++atm2) { - mprintf("\t\t%s to %s\n", atmStr.c_str(), topIn.ResNameNumAtomNameNum(*atm2).c_str()); - topIn.RemoveBond(*atm1, *atm2); + int ret = topIn.RemoveBond(*atm1, *atm2); + if (ret == 0) + mprintf("\t\t%s to %s\n", atmStr.c_str(), topIn.ResNameNumAtomNameNum(*atm2).c_str()); } } } diff --git a/src/Topology.cpp b/src/Topology.cpp index 495e7e81e5..424590b239 100644 --- a/src/Topology.cpp +++ b/src/Topology.cpp @@ -617,12 +617,13 @@ static inline int WarnOutOfRange(int Natom, int atom, const char* type) { /** Remove a bond between atom 1 and atom2, update the atoms array. * Does not modify bond parameters. + * \return 0 if a bond was successfully removed, -1 if no bond exists, and 1 if an error occurs. */ -void Topology::RemoveBond(int atom1, int atom2) +int Topology::RemoveBond(int atom1, int atom2) { // Check if atoms are out of range. - if (WarnOutOfRange(atoms_.size(), atom1, "bond")) return; - if (WarnOutOfRange(atoms_.size(), atom2, "bond")) return; + if (WarnOutOfRange(atoms_.size(), atom1, "bond")) return 1; + if (WarnOutOfRange(atoms_.size(), atom2, "bond")) return 1; // Ensure the bond exists. bool exists = false; for (Atom::bond_iterator ba = atoms_[atom1].bondbegin(); @@ -633,7 +634,7 @@ void Topology::RemoveBond(int atom1, int atom2) } if (!exists) { mprintf("Warning: No bond exists between atoms %i and %i\n", atom1+1, atom2+1); - return; + return -1; } bool a1H = (atoms_[atom1].Element() == Atom::HYDROGEN); bool a2H = (atoms_[atom2].Element() == Atom::HYDROGEN); @@ -655,11 +656,12 @@ void Topology::RemoveBond(int atom1, int atom2) // Sanity check if (bnd == tgtArray->end()) { mprinterr("Internal Error: Bond %i %i not found in internal bond array.\n", atom1+1, atom2+1); - return; + return 1; } tgtArray->erase( bnd ); atoms_[atom1].RemoveBondToIdx( atom2 ); atoms_[atom2].RemoveBondToIdx( atom1 ); + return 0; } diff --git a/src/Topology.h b/src/Topology.h index 71715fbe32..b254d343cc 100644 --- a/src/Topology.h +++ b/src/Topology.h @@ -77,7 +77,7 @@ class Topology { void AddBond(int, int, int); void AddBond(BondType const&, bool); void AddBond(int, int, BondParmType const&); - void RemoveBond(int, int); + int RemoveBond(int, int); void AssignBondParams(ParmHolder const&); // ----- Angle-specific routines ------------- size_t Nangles() const { return angles_.size()+anglesh_.size(); } From 0ec93fa7fa87e99515dbd77e8d08adf27c5eea02 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 16 Apr 2020 13:55:39 -0400 Subject: [PATCH 08/39] Ensure molecule info is redetermined. --- src/Exec_Change.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Exec_Change.cpp b/src/Exec_Change.cpp index 31dc05b7ac..87f2e10b80 100644 --- a/src/Exec_Change.cpp +++ b/src/Exec_Change.cpp @@ -249,6 +249,8 @@ int Exec_Change::RemoveBonds(Topology& topIn, ArgList& argIn) const { } } } + // Since molecule info has likely changed, re-determine + topIn.DetermineMolecules(); return 0; } From 7d6728e2b1fba1d70b65c6904f77d0e22050e61f Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 16 Apr 2020 14:07:47 -0400 Subject: [PATCH 09/39] Fix print of command line to the log --- src/Cpptraj.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Cpptraj.cpp b/src/Cpptraj.cpp index 8104450502..30185baf8f 100644 --- a/src/Cpptraj.cpp +++ b/src/Cpptraj.cpp @@ -634,7 +634,7 @@ int Cpptraj::Interactive() { // Write logfile header entry: date, cmd line opts, topologies logfile_.Printf("# %s\n", TimeString().c_str()); if (!commandLine_.empty()) - logfile_.Write(commandLine_.c_str(), commandLine_.size()*sizeof(char)); + logfile_.Printf("# Args: %s\n", commandLine_.c_str()); DataSetList tops = State_.DSL().GetSetsOfType("*", DataSet::TOPOLOGY); if (!tops.empty()) { logfile_.Printf("# Loaded topologies:\n"); From fab96fe59286a36521406a8908f80ffc9fc4a8e8 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 16 Apr 2020 14:17:52 -0400 Subject: [PATCH 10/39] Add outfile to removebonds --- src/Exec_Change.cpp | 19 +++++++++++++++---- src/Exec_Change.h | 2 +- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/Exec_Change.cpp b/src/Exec_Change.cpp index 87f2e10b80..e01cdfcdcd 100644 --- a/src/Exec_Change.cpp +++ b/src/Exec_Change.cpp @@ -55,7 +55,7 @@ Exec::RetType Exec_Change::Execute(CpptrajState& State, ArgList& argIn) case CHAINID : err = ChangeChainID(*parm, argIn); break; case ATOMNAME : err = ChangeAtomName(*parm, argIn); break; case ADDBOND : err = AddBond(*parm, argIn); break; - case REMOVEBONDS : err = RemoveBonds(*parm, argIn); break; + case REMOVEBONDS : err = RemoveBonds(State, *parm, argIn); break; case UNKNOWN : err = 1; // sanity check } if (err != 0) return CpptrajState::ERR; @@ -199,7 +199,7 @@ int Exec_Change::FindBondTypeIdx(Topology const& topIn, BondArray const& bonds, } // Exec_Change::RemoveBonds() -int Exec_Change::RemoveBonds(Topology& topIn, ArgList& argIn) const { +int Exec_Change::RemoveBonds(CpptrajState& State, Topology& topIn, ArgList& argIn) const { AtomMask mask1, mask2; std::string str1 = argIn.GetMaskNext(); if (str1.empty()) { @@ -221,6 +221,15 @@ int Exec_Change::RemoveBonds(Topology& topIn, ArgList& argIn) const { return 1; } } + CpptrajFile* outfile = State.DFL().AddCpptrajFile(argIn.GetStringKey("out"), "RemovedBonds", + DataFileList::TEXT, true); + if (outfile == 0) { + mprinterr("Internal Error: RemoveBonds could not get an output file.\n"); + return 1; + } + const char* prefix = ""; + if (outfile->IsStream()) + prefix = "\t\t"; if (str2.empty()) { mprintf("\tRemoving bonds to atoms selected by %s (%i atoms).\n", @@ -233,7 +242,8 @@ int Exec_Change::RemoveBonds(Topology& topIn, ArgList& argIn) const { { int ret = topIn.RemoveBond(*atm, *bnd); if (ret == 0) - mprintf("\t\t%s to %s\n", atmStr.c_str(), topIn.ResNameNumAtomNameNum(*bnd).c_str()); + outfile->Printf("%s%s to %s\n", prefix, atmStr.c_str(), + topIn.ResNameNumAtomNameNum(*bnd).c_str()); } } } else { @@ -245,7 +255,8 @@ int Exec_Change::RemoveBonds(Topology& topIn, ArgList& argIn) const { for (AtomMask::const_iterator atm2 = mask2.begin(); atm2 != mask2.end(); ++atm2) { int ret = topIn.RemoveBond(*atm1, *atm2); if (ret == 0) - mprintf("\t\t%s to %s\n", atmStr.c_str(), topIn.ResNameNumAtomNameNum(*atm2).c_str()); + outfile->Printf("%s%s to %s\n", prefix,atmStr.c_str(), + topIn.ResNameNumAtomNameNum(*atm2).c_str()); } } } diff --git a/src/Exec_Change.h b/src/Exec_Change.h index 8b44675c9f..8fec0e35df 100644 --- a/src/Exec_Change.h +++ b/src/Exec_Change.h @@ -16,6 +16,6 @@ class Exec_Change : public Exec { static inline int Setup1atomMask(AtomMask&, Topology const&, std::string const&); static inline int FindBondTypeIdx(Topology const&, BondArray const&, TypeNameHolder const&); int AddBond(Topology&, ArgList&) const; - int RemoveBonds(Topology&, ArgList&) const; + int RemoveBonds(CpptrajState&, Topology&, ArgList&) const; }; #endif From bab75a33aa19512dc548be7b38d16f4bfe2d7cd9 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 16 Apr 2020 15:37:34 -0400 Subject: [PATCH 11/39] Add a command that can be used to create leap input for a given set of COORDS. Currently only looks for disulfides. --- src/Command.cpp | 2 + src/Exec_PrepareForLeap.cpp | 79 +++++++++++++++++++++++++++++++++++++ src/Exec_PrepareForLeap.h | 12 ++++++ src/cpptrajdepend | 3 +- src/cpptrajfiles | 1 + 5 files changed, 96 insertions(+), 1 deletion(-) create mode 100644 src/Exec_PrepareForLeap.cpp create mode 100644 src/Exec_PrepareForLeap.h diff --git a/src/Command.cpp b/src/Command.cpp index 92eccfac76..842deae3b4 100644 --- a/src/Command.cpp +++ b/src/Command.cpp @@ -23,6 +23,7 @@ #include "Exec_Help.h" #include "Exec_ParallelAnalysis.h" #include "Exec_Precision.h" +#include "Exec_PrepareForLeap.h" #include "Exec_PrintData.h" #include "Exec_ReadData.h" #include "Exec_ReadEnsembleData.h" @@ -248,6 +249,7 @@ void Command::Init() { Command::AddCmd( new Exec_LoadCrd(), Cmd::EXE, 1, "loadcrd" ); Command::AddCmd( new Exec_LoadTraj(), Cmd::EXE, 1, "loadtraj" ); Command::AddCmd( new Exec_PermuteDihedrals(), Cmd::EXE, 1, "permutedihedrals" ); + Command::AddCmd( new Exec_PrepareForLeap(), Cmd::EXE, 1, "prepareforleap" ); Command::AddCmd( new Exec_RotateDihedral(), Cmd::EXE, 1, "rotatedihedral" ); Command::AddCmd( new Exec_SplitCoords(), Cmd::EXE, 1, "splitcoords" ); // TRAJECTORY diff --git a/src/Exec_PrepareForLeap.cpp b/src/Exec_PrepareForLeap.cpp new file mode 100644 index 0000000000..6356ca02a1 --- /dev/null +++ b/src/Exec_PrepareForLeap.cpp @@ -0,0 +1,79 @@ +#include "Exec_PrepareForLeap.h" +#include "CpptrajStdio.h" +#include "DistRoutines.h" + +// Exec_PrepareForLeap::Help() +void Exec_PrepareForLeap::Help() const +{ + mprintf("\tcrdset [frame <#>] out \n" + "\t[cysmask ] [disulfidecut ]\n" + "\t[leapunitname ]\n" + ); +} + +// Exec_PrepareForLeap::Execute() +Exec::RetType Exec_PrepareForLeap::Execute(CpptrajState& State, ArgList& argIn) +{ + std::string crdset = argIn.GetStringKey("crdset"); + if (crdset.empty()) { + mprinterr("Error: Must specify COORDS set with 'crdset'\n"); + return CpptrajState::ERR; + } + DataSet* ds = State.DSL().FindSetOfGroup( crdset, DataSet::COORDINATES ); + if (ds == 0) { + mprinterr("Error: No COORDS set found matching %s\n", crdset.c_str()); + return CpptrajState::ERR; + } + DataSet_Coords& coords = static_cast( *((DataSet_Coords*)ds) ); + int tgtframe = argIn.getKeyInt("frame", 1) - 1; + mprintf("\tUsing frame %i from COORDS set %s\n", tgtframe+1, coords.legend()); + if (tgtframe < 0 || tgtframe >= (int)coords.Size()) { + mprinterr("Error: Frame is out of range.\n"); + return CpptrajState::ERR; + } + Frame frameIn = coords.AllocateFrame(); + coords.GetFrame(tgtframe, frameIn); + + std::string leapunitname = argIn.GetStringKey("leapunitname", "m"); + mprintf("\tUsing leap unit name: %s\n", leapunitname.c_str()); + + CpptrajFile* outfile = State.DFL().AddCpptrajFile(argIn.GetStringKey("out"), + "LEaP Input", DataFileList::TEXT); + if (outfile == 0) return CpptrajState::ERR; + + // Disulfide search + double disulfidecut = argIn.getKeyDouble("disulfidecut", 2.1); + std::string cysmaskstr = argIn.GetStringKey("cysmask", ":CYS@SG"); + mprintf("\tSearching for disulfide bonds with a cutoff of %g Ang.\n", disulfidecut); + AtomMask cysmask; + if (cysmask.SetMaskString( cysmaskstr )) { + mprinterr("Error: Could not set up CYS mask string %s\n", cysmaskstr.c_str()); + return CpptrajState::ERR; + } + if (coords.Top().SetupIntegerMask( cysmask )) return CpptrajState::ERR; + cysmask.MaskInfo(); + if (cysmask.None()) + mprintf("Warning: No cysteine sulfur atoms selected by %s\n", cysmaskstr.c_str()); + else { + double cut2 = disulfidecut * disulfidecut; + // Try to find potential disulfide sites. + for (AtomMask::const_iterator at1 = cysmask.begin(); at1 != cysmask.end(); ++at1) { + for (AtomMask::const_iterator at2 = at1 + 1; at2 != cysmask.end(); ++at2) { + // TODO imaging? + double r2 = DIST2_NoImage(frameIn.XYZ(*at1), frameIn.XYZ(*at2)); + if (r2 < cut2) { + mprintf("\tPotential disulfide: %s to %s (%g Ang.)\n", + coords.Top().ResNameNumAtomNameNum(*at1).c_str(), + coords.Top().ResNameNumAtomNameNum(*at2).c_str(), sqrt(r2)); + outfile->Printf("bond %s.%i.%s %s.%i.%s\n", + leapunitname.c_str(), coords.Top()[*at1].ResNum()+1, *(coords.Top()[*at1].Name()), + leapunitname.c_str(), coords.Top()[*at2].ResNum()+1, *(coords.Top()[*at2].Name())); + + } + } + } + } + + + return CpptrajState::OK; +} diff --git a/src/Exec_PrepareForLeap.h b/src/Exec_PrepareForLeap.h new file mode 100644 index 0000000000..7bcba6e9f4 --- /dev/null +++ b/src/Exec_PrepareForLeap.h @@ -0,0 +1,12 @@ +#ifndef INC_EXEC_PREPAREFORLEAP_H +#define INC_EXEC_PREPAREFORLEAP_H +#include "Exec.h" +/// Do common tasks to prepare a structure to be loaded into tleap +class Exec_PrepareForLeap : public Exec { + public: + Exec_PrepareForLeap() : Exec(GENERAL) {} + void Help() const; + DispatchObject* Alloc() const { return (DispatchObject*)new Exec_PrepareForLeap(); } + RetType Execute(CpptrajState&, ArgList&); +}; +#endif diff --git a/src/cpptrajdepend b/src/cpptrajdepend index da9bcfc240..e311a93346 100644 --- a/src/cpptrajdepend +++ b/src/cpptrajdepend @@ -157,7 +157,7 @@ Cluster_ReadInfo.o : Cluster_ReadInfo.cpp ArgList.h ArrayIterator.h AssociatedDa Cmd.o : Cmd.cpp Cmd.h DispatchObject.h CmdInput.o : CmdInput.cpp CmdInput.h StringRoutines.h CmdList.o : CmdList.cpp Cmd.h CmdList.h DispatchObject.h -Command.o : Command.cpp Action.h ActionFrameCounter.h ActionList.h ActionState.h Action_Align.h Action_Angle.h Action_AreaPerMol.h Action_AtomMap.h Action_AtomicCorr.h Action_AtomicFluct.h Action_AutoImage.h Action_Average.h Action_Bounds.h Action_Box.h Action_Center.h Action_Channel.h Action_CheckChirality.h Action_CheckStructure.h Action_Closest.h Action_ClusterDihedral.h Action_Contacts.h Action_CreateCrd.h Action_CreateReservoir.h Action_DNAionTracker.h Action_DSSP.h Action_Density.h Action_Diffusion.h Action_Dihedral.h Action_DihedralRMS.h Action_Dipole.h Action_DistRmsd.h Action_Distance.h Action_Energy.h Action_Esander.h Action_FilterByData.h Action_FixAtomOrder.h Action_FixImagedBonds.h Action_GIST.h Action_Grid.h Action_GridFreeEnergy.h Action_HydrogenBond.h Action_Image.h Action_InfraredSpectrum.h Action_Jcoupling.h Action_LESsplit.h Action_LIE.h Action_LipidOrder.h Action_MakeStructure.h Action_Mask.h Action_Matrix.h Action_MinImage.h Action_Molsurf.h Action_MultiDihedral.h Action_MultiVector.h Action_NAstruct.h Action_NMRrst.h Action_NativeContacts.h Action_OrderParameter.h Action_Outtraj.h Action_PairDist.h Action_Pairwise.h Action_Principal.h Action_Projection.h Action_Pucker.h Action_Radgyr.h Action_Radial.h Action_RandomizeIons.h Action_Remap.h Action_ReplicateCell.h Action_Rmsd.h Action_Rotate.h Action_RunningAvg.h Action_STFC_Diffusion.h Action_Scale.h Action_SetVelocity.h Action_Spam.h Action_Strip.h Action_Surf.h Action_SymmetricRmsd.h Action_Temperature.h Action_Time.h Action_Translate.h Action_Unstrip.h Action_Unwrap.h Action_Vector.h Action_VelocityAutoCorr.h Action_Volmap.h Action_Volume.h Action_Watershell.h Action_XtalSymm.h Analysis.h AnalysisList.h AnalysisState.h Analysis_AmdBias.h Analysis_AutoCorr.h Analysis_Average.h Analysis_Clustering.h Analysis_ConstantPHStats.h Analysis_Corr.h Analysis_CrankShaft.h Analysis_CrdFluct.h Analysis_CrossCorr.h Analysis_CurveFit.h Analysis_Divergence.h Analysis_FFT.h Analysis_HausdorffDistance.h Analysis_Hist.h Analysis_IRED.h Analysis_Integrate.h Analysis_KDE.h Analysis_Lifetime.h Analysis_LowestCurve.h Analysis_Matrix.h Analysis_MeltCurve.h Analysis_Modes.h Analysis_MultiHist.h Analysis_Multicurve.h Analysis_Overlap.h Analysis_PhiPsi.h Analysis_Regression.h Analysis_RemLog.h Analysis_Rms2d.h Analysis_RmsAvgCorr.h Analysis_Rotdif.h Analysis_RunningAvg.h Analysis_Slope.h Analysis_Spline.h Analysis_State.h Analysis_Statistics.h Analysis_TI.h Analysis_Timecorr.h Analysis_VectorMath.h Analysis_Wavelet.h ArgList.h Array1D.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h AtomType.h AxisType.h BaseIOtype.h Box.h BufferedLine.h CharMask.h ClusterDist.h ClusterList.h ClusterMap.h ClusterNode.h ClusterSieve.h Cmd.h CmdInput.h CmdList.h Command.h ComplexArray.h Constants.h Constraints.h ControlBlock.h ControlBlock_For.h CoordinateInfo.h Corr.h Cph.h CpptrajFile.h CpptrajState.h CpptrajStdio.h DataFile.h DataFileList.h DataSet.h DataSetList.h DataSet_1D.h DataSet_2D.h DataSet_3D.h DataSet_Cmatrix.h DataSet_Coords.h DataSet_Coords_CRD.h DataSet_Coords_REF.h DataSet_GridFlt.h DataSet_Mat3x3.h DataSet_MatrixDbl.h DataSet_MatrixFlt.h DataSet_Mesh.h DataSet_Modes.h DataSet_RemLog.h DataSet_Vector.h DataSet_double.h DataSet_float.h DataSet_integer.h DataSet_integer_mem.h DataSet_pH.h DataSet_string.h Deprecated.h DihedralSearch.h Dimension.h DispatchObject.h DistRoutines.h Energy.h Energy_Sander.h EnsembleIn.h EnsembleOutList.h Exec.h Exec_Analyze.h Exec_Calc.h Exec_CatCrd.h Exec_Change.h Exec_ClusterMap.h Exec_CombineCoords.h Exec_Commands.h Exec_CompareTop.h Exec_CrdAction.h Exec_CrdOut.h Exec_CreateSet.h Exec_DataFile.h Exec_DataFilter.h Exec_DataSetCmd.h Exec_GenerateAmberRst.h Exec_Help.h Exec_LoadCrd.h Exec_LoadTraj.h Exec_ParallelAnalysis.h Exec_ParmBox.h Exec_ParmSolvent.h Exec_ParmStrip.h Exec_ParmWrite.h Exec_PermuteDihedrals.h Exec_Precision.h Exec_PrintData.h Exec_ReadData.h Exec_ReadEnsembleData.h Exec_ReadInput.h Exec_RotateDihedral.h Exec_RunAnalysis.h Exec_ScaleDihedralK.h Exec_SequenceAlign.h Exec_Set.h Exec_Show.h Exec_SortEnsembleData.h Exec_SplitCoords.h Exec_System.h Exec_Top.h Exec_Traj.h Exec_UpdateParameters.h Exec_ViewRst.h FileIO.h FileName.h FileTypes.h Frame.h FramePtrArray.h Grid.h GridAction.h GridBin.h HistBin.h Hungarian.h ImageTypes.h ImagedAction.h InputTrajCommon.h MapAtom.h MaskArray.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h NetcdfFile.h OnlineVarT.h OutputTrajCommon.h PDBfile.h PairList.h Parallel.h ParameterHolders.h ParameterSet.h ParameterTypes.h PubFFT.h RPNcalc.h Random.h Range.h ReferenceAction.h ReferenceFrame.h RemdReservoirNC.h ReplicaDimArray.h ReplicaInfo.h Residue.h Spline.h StructureCheck.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Timer.h Topology.h TrajFrameCounter.h TrajectoryFile.h Trajin.h TrajinList.h TrajoutList.h Trajout_Single.h TypeNameHolder.h Vec3.h cuda_kernels/GistCudaSetup.cuh molsurf.h +Command.o : Command.cpp Action.h ActionFrameCounter.h ActionList.h ActionState.h Action_Align.h Action_Angle.h Action_AreaPerMol.h Action_AtomMap.h Action_AtomicCorr.h Action_AtomicFluct.h Action_AutoImage.h Action_Average.h Action_Bounds.h Action_Box.h Action_Center.h Action_Channel.h Action_CheckChirality.h Action_CheckStructure.h Action_Closest.h Action_ClusterDihedral.h Action_Contacts.h Action_CreateCrd.h Action_CreateReservoir.h Action_DNAionTracker.h Action_DSSP.h Action_Density.h Action_Diffusion.h Action_Dihedral.h Action_DihedralRMS.h Action_Dipole.h Action_DistRmsd.h Action_Distance.h Action_Energy.h Action_Esander.h Action_FilterByData.h Action_FixAtomOrder.h Action_FixImagedBonds.h Action_GIST.h Action_Grid.h Action_GridFreeEnergy.h Action_HydrogenBond.h Action_Image.h Action_InfraredSpectrum.h Action_Jcoupling.h Action_LESsplit.h Action_LIE.h Action_LipidOrder.h Action_MakeStructure.h Action_Mask.h Action_Matrix.h Action_MinImage.h Action_Molsurf.h Action_MultiDihedral.h Action_MultiVector.h Action_NAstruct.h Action_NMRrst.h Action_NativeContacts.h Action_OrderParameter.h Action_Outtraj.h Action_PairDist.h Action_Pairwise.h Action_Principal.h Action_Projection.h Action_Pucker.h Action_Radgyr.h Action_Radial.h Action_RandomizeIons.h Action_Remap.h Action_ReplicateCell.h Action_Rmsd.h Action_Rotate.h Action_RunningAvg.h Action_STFC_Diffusion.h Action_Scale.h Action_SetVelocity.h Action_Spam.h Action_Strip.h Action_Surf.h Action_SymmetricRmsd.h Action_Temperature.h Action_Time.h Action_Translate.h Action_Unstrip.h Action_Unwrap.h Action_Vector.h Action_VelocityAutoCorr.h Action_Volmap.h Action_Volume.h Action_Watershell.h Action_XtalSymm.h Analysis.h AnalysisList.h AnalysisState.h Analysis_AmdBias.h Analysis_AutoCorr.h Analysis_Average.h Analysis_Clustering.h Analysis_ConstantPHStats.h Analysis_Corr.h Analysis_CrankShaft.h Analysis_CrdFluct.h Analysis_CrossCorr.h Analysis_CurveFit.h Analysis_Divergence.h Analysis_FFT.h Analysis_HausdorffDistance.h Analysis_Hist.h Analysis_IRED.h Analysis_Integrate.h Analysis_KDE.h Analysis_Lifetime.h Analysis_LowestCurve.h Analysis_Matrix.h Analysis_MeltCurve.h Analysis_Modes.h Analysis_MultiHist.h Analysis_Multicurve.h Analysis_Overlap.h Analysis_PhiPsi.h Analysis_Regression.h Analysis_RemLog.h Analysis_Rms2d.h Analysis_RmsAvgCorr.h Analysis_Rotdif.h Analysis_RunningAvg.h Analysis_Slope.h Analysis_Spline.h Analysis_State.h Analysis_Statistics.h Analysis_TI.h Analysis_Timecorr.h Analysis_VectorMath.h Analysis_Wavelet.h ArgList.h Array1D.h ArrayIterator.h AssociatedData.h Atom.h AtomExtra.h AtomMap.h AtomMask.h AtomType.h AxisType.h BaseIOtype.h Box.h BufferedLine.h CharMask.h ClusterDist.h ClusterList.h ClusterMap.h ClusterNode.h ClusterSieve.h Cmd.h CmdInput.h CmdList.h Command.h ComplexArray.h Constants.h Constraints.h ControlBlock.h ControlBlock_For.h CoordinateInfo.h Corr.h Cph.h CpptrajFile.h CpptrajState.h CpptrajStdio.h DataFile.h DataFileList.h DataSet.h DataSetList.h DataSet_1D.h DataSet_2D.h DataSet_3D.h DataSet_Cmatrix.h DataSet_Coords.h DataSet_Coords_CRD.h DataSet_Coords_REF.h DataSet_GridFlt.h DataSet_Mat3x3.h DataSet_MatrixDbl.h DataSet_MatrixFlt.h DataSet_Mesh.h DataSet_Modes.h DataSet_RemLog.h DataSet_Vector.h DataSet_double.h DataSet_float.h DataSet_integer.h DataSet_integer_mem.h DataSet_pH.h DataSet_string.h Deprecated.h DihedralSearch.h Dimension.h DispatchObject.h DistRoutines.h Energy.h Energy_Sander.h EnsembleIn.h EnsembleOutList.h Exec.h Exec_Analyze.h Exec_Calc.h Exec_CatCrd.h Exec_Change.h Exec_ClusterMap.h Exec_CombineCoords.h Exec_Commands.h Exec_CompareTop.h Exec_CrdAction.h Exec_CrdOut.h Exec_CreateSet.h Exec_DataFile.h Exec_DataFilter.h Exec_DataSetCmd.h Exec_GenerateAmberRst.h Exec_Help.h Exec_LoadCrd.h Exec_LoadTraj.h Exec_ParallelAnalysis.h Exec_ParmBox.h Exec_ParmSolvent.h Exec_ParmStrip.h Exec_ParmWrite.h Exec_PermuteDihedrals.h Exec_Precision.h Exec_PrepareForLeap.h Exec_PrintData.h Exec_ReadData.h Exec_ReadEnsembleData.h Exec_ReadInput.h Exec_RotateDihedral.h Exec_RunAnalysis.h Exec_ScaleDihedralK.h Exec_SequenceAlign.h Exec_Set.h Exec_Show.h Exec_SortEnsembleData.h Exec_SplitCoords.h Exec_System.h Exec_Top.h Exec_Traj.h Exec_UpdateParameters.h Exec_ViewRst.h FileIO.h FileName.h FileTypes.h Frame.h FramePtrArray.h Grid.h GridAction.h GridBin.h HistBin.h Hungarian.h ImageTypes.h ImagedAction.h InputTrajCommon.h MapAtom.h MaskArray.h MaskToken.h Matrix.h Matrix_3x3.h MetaData.h Molecule.h NameType.h NetcdfFile.h OnlineVarT.h OutputTrajCommon.h PDBfile.h PairList.h Parallel.h ParameterHolders.h ParameterSet.h ParameterTypes.h PubFFT.h RPNcalc.h Random.h Range.h ReferenceAction.h ReferenceFrame.h RemdReservoirNC.h ReplicaDimArray.h ReplicaInfo.h Residue.h Spline.h StructureCheck.h SymbolExporting.h SymmetricRmsdCalc.h TextFormat.h Timer.h Topology.h TrajFrameCounter.h TrajectoryFile.h Trajin.h TrajinList.h TrajoutList.h Trajout_Single.h TypeNameHolder.h Vec3.h cuda_kernels/GistCudaSetup.cuh molsurf.h ComplexArray.o : ComplexArray.cpp ArrayIterator.h ComplexArray.h Constraints.o : Constraints.cpp ArgList.h Atom.h AtomExtra.h AtomMask.h AtomType.h Box.h CharMask.h Constants.h Constraints.h CoordinateInfo.h CpptrajStdio.h FileName.h Frame.h MaskToken.h Matrix_3x3.h Molecule.h NameType.h Parallel.h ParameterHolders.h ParameterSet.h ParameterTypes.h Range.h ReplicaDimArray.h Residue.h SymbolExporting.h Topology.h TypeNameHolder.h Vec3.h ControlBlock_For.o : ControlBlock_For.cpp Action.h ActionList.h ActionState.h Analysis.h AnalysisList.h AnalysisState.h ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h AtomType.h BaseIOtype.h Box.h Constants.h ControlBlock.h ControlBlock_For.h CoordinateInfo.h CpptrajFile.h CpptrajState.h CpptrajStdio.h DataFile.h DataFileList.h DataSet.h DataSetList.h DataSet_Coords.h DataSet_Coords_REF.h Dimension.h DispatchObject.h EnsembleIn.h EnsembleOutList.h FileIO.h FileName.h FileTypes.h ForLoop.h ForLoop_dataSetBlocks.h ForLoop_integer.h ForLoop_list.h ForLoop_mask.h ForLoop_overSets.h Frame.h FramePtrArray.h InputTrajCommon.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterHolders.h ParameterSet.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h ReplicaInfo.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h TrajFrameCounter.h Trajin.h TrajinList.h TrajoutList.h TypeNameHolder.h Vec3.h @@ -264,6 +264,7 @@ Exec_ParmStrip.o : Exec_ParmStrip.cpp Action.h ActionList.h ActionState.h Analys Exec_ParmWrite.o : Exec_ParmWrite.cpp Action.h ActionList.h ActionState.h Analysis.h AnalysisList.h AnalysisState.h ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h AtomType.h BaseIOtype.h BondSearch.h Box.h Constants.h CoordinateInfo.h CpptrajFile.h CpptrajState.h CpptrajStdio.h DataFile.h DataFileList.h DataSet.h DataSetList.h DataSet_Coords.h DataSet_Coords_REF.h Dimension.h DispatchObject.h EnsembleIn.h EnsembleOutList.h Exec.h Exec_ParmWrite.h FileIO.h FileName.h FileTypes.h Frame.h FramePtrArray.h InputTrajCommon.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterHolders.h ParameterSet.h ParameterTypes.h ParmFile.h ParmIO.h Range.h ReferenceFrame.h ReplicaDimArray.h ReplicaInfo.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h TrajFrameCounter.h Trajin.h TrajinList.h TrajoutList.h TypeNameHolder.h Vec3.h Exec_PermuteDihedrals.o : Exec_PermuteDihedrals.cpp Action.h ActionFrameCounter.h ActionList.h ActionState.h Analysis.h AnalysisList.h AnalysisState.h ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h AtomType.h BaseIOtype.h Box.h CharMask.h Constants.h CoordinateInfo.h CpptrajFile.h CpptrajState.h CpptrajStdio.h DataFile.h DataFileList.h DataSet.h DataSetList.h DataSet_Coords.h DataSet_Coords_CRD.h DataSet_Coords_REF.h DihedralSearch.h Dimension.h DispatchObject.h DistRoutines.h EnsembleIn.h EnsembleOutList.h Exec.h Exec_PermuteDihedrals.h FileIO.h FileName.h FileTypes.h Frame.h FramePtrArray.h ImagedAction.h InputTrajCommon.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h OutputTrajCommon.h PairList.h Parallel.h ParameterHolders.h ParameterSet.h ParameterTypes.h Random.h Range.h ReferenceFrame.h ReplicaDimArray.h ReplicaInfo.h Residue.h StructureCheck.h SymbolExporting.h TextFormat.h Timer.h Topology.h TorsionRoutines.h TrajFrameCounter.h TrajectoryFile.h Trajin.h TrajinList.h TrajoutList.h Trajout_Single.h TypeNameHolder.h Vec3.h Exec_Precision.o : Exec_Precision.cpp Action.h ActionList.h ActionState.h Analysis.h AnalysisList.h AnalysisState.h ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h AtomType.h BaseIOtype.h Box.h Constants.h CoordinateInfo.h CpptrajFile.h CpptrajState.h CpptrajStdio.h DataFile.h DataFileList.h DataSet.h DataSetList.h DataSet_Coords.h DataSet_Coords_REF.h Dimension.h DispatchObject.h EnsembleIn.h EnsembleOutList.h Exec.h Exec_Precision.h FileIO.h FileName.h FileTypes.h Frame.h FramePtrArray.h InputTrajCommon.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterHolders.h ParameterSet.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h ReplicaInfo.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h TrajFrameCounter.h Trajin.h TrajinList.h TrajoutList.h TypeNameHolder.h Vec3.h +Exec_PrepareForLeap.o : Exec_PrepareForLeap.cpp Action.h ActionList.h ActionState.h Analysis.h AnalysisList.h AnalysisState.h ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h AtomType.h BaseIOtype.h Box.h Constants.h CoordinateInfo.h CpptrajFile.h CpptrajState.h CpptrajStdio.h DataFile.h DataFileList.h DataSet.h DataSetList.h DataSet_Coords.h DataSet_Coords_REF.h Dimension.h DispatchObject.h DistRoutines.h EnsembleIn.h EnsembleOutList.h Exec.h Exec_PrepareForLeap.h FileIO.h FileName.h FileTypes.h Frame.h FramePtrArray.h InputTrajCommon.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterHolders.h ParameterSet.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h ReplicaInfo.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h TrajFrameCounter.h Trajin.h TrajinList.h TrajoutList.h TypeNameHolder.h Vec3.h Exec_PrintData.o : Exec_PrintData.cpp Action.h ActionList.h ActionState.h Analysis.h AnalysisList.h AnalysisState.h ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h AtomType.h BaseIOtype.h Box.h Constants.h CoordinateInfo.h CpptrajFile.h CpptrajState.h CpptrajStdio.h DataFile.h DataFileList.h DataSet.h DataSetList.h DataSet_Coords.h DataSet_Coords_REF.h Dimension.h DispatchObject.h EnsembleIn.h EnsembleOutList.h Exec.h Exec_PrintData.h FileIO.h FileName.h FileTypes.h Frame.h FramePtrArray.h InputTrajCommon.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterHolders.h ParameterSet.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h ReplicaInfo.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h TrajFrameCounter.h Trajin.h TrajinList.h TrajoutList.h TypeNameHolder.h Vec3.h Exec_ReadData.o : Exec_ReadData.cpp Action.h ActionList.h ActionState.h Analysis.h AnalysisList.h AnalysisState.h ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h AtomType.h BaseIOtype.h Box.h Constants.h CoordinateInfo.h CpptrajFile.h CpptrajState.h CpptrajStdio.h DataFile.h DataFileList.h DataSet.h DataSetList.h DataSet_Coords.h DataSet_Coords_REF.h Dimension.h DispatchObject.h EnsembleIn.h EnsembleOutList.h Exec.h Exec_ReadData.h FileIO.h FileName.h FileTypes.h Frame.h FramePtrArray.h InputTrajCommon.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterHolders.h ParameterSet.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h ReplicaInfo.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h TrajFrameCounter.h Trajin.h TrajinList.h TrajoutList.h TypeNameHolder.h Vec3.h Exec_ReadEnsembleData.o : Exec_ReadEnsembleData.cpp Action.h ActionList.h ActionState.h Analysis.h AnalysisList.h AnalysisState.h ArgList.h AssociatedData.h Atom.h AtomExtra.h AtomMask.h AtomType.h BaseIOtype.h Box.h Constants.h CoordinateInfo.h CpptrajFile.h CpptrajState.h CpptrajStdio.h DataFile.h DataFileList.h DataSet.h DataSetList.h DataSet_Coords.h DataSet_Coords_REF.h Dimension.h DispatchObject.h EnsembleIn.h EnsembleOutList.h Exec.h Exec_ReadEnsembleData.h FileIO.h FileName.h FileTypes.h Frame.h FramePtrArray.h InputTrajCommon.h MaskToken.h Matrix_3x3.h MetaData.h Molecule.h NameType.h Parallel.h ParameterHolders.h ParameterSet.h ParameterTypes.h Range.h ReferenceFrame.h ReplicaDimArray.h ReplicaInfo.h Residue.h SymbolExporting.h TextFormat.h Timer.h Topology.h TrajFrameCounter.h Trajin.h TrajinList.h TrajoutList.h TypeNameHolder.h Vec3.h diff --git a/src/cpptrajfiles b/src/cpptrajfiles index d8593aa396..220c072077 100644 --- a/src/cpptrajfiles +++ b/src/cpptrajfiles @@ -264,6 +264,7 @@ COMMON_SOURCES= \ Exec_ParmWrite.cpp \ Exec_PermuteDihedrals.cpp \ Exec_Precision.cpp \ + Exec_PrepareForLeap.cpp \ Exec_PrintData.cpp \ Exec_ReadData.cpp \ Exec_ReadEnsembleData.cpp \ From cf645c5077bdbd2b15a9d86f22f0482b9b185e65 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Thu, 16 Apr 2020 16:05:25 -0400 Subject: [PATCH 12/39] Change name of cys residues involved in disulfide bonds --- src/Exec_PrepareForLeap.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/Exec_PrepareForLeap.cpp b/src/Exec_PrepareForLeap.cpp index 6356ca02a1..99fce08af3 100644 --- a/src/Exec_PrepareForLeap.cpp +++ b/src/Exec_PrepareForLeap.cpp @@ -6,11 +6,18 @@ void Exec_PrepareForLeap::Help() const { mprintf("\tcrdset [frame <#>] out \n" - "\t[cysmask ] [disulfidecut ]\n" + "\t[cysmask ] [disulfidecut ] [newcysname ]\n" "\t[leapunitname ]\n" ); } +static inline void ChangeResName(Residue& res, NameType const& nameIn) { + if (res.Name() != nameIn) { + mprintf("\tChanging residue %s to %s\n", *(res.Name()), *nameIn); + res.SetName( nameIn ); + } +} + // Exec_PrepareForLeap::Execute() Exec::RetType Exec_PrepareForLeap::Execute(CpptrajState& State, ArgList& argIn) { @@ -43,6 +50,9 @@ Exec::RetType Exec_PrepareForLeap::Execute(CpptrajState& State, ArgList& argIn) // Disulfide search double disulfidecut = argIn.getKeyDouble("disulfidecut", 2.1); + std::string newcysnamestr = argIn.GetStringKey("newcysname", "CYX"); + NameType newcysname(newcysnamestr); + mprintf("\tCysteine residues involved in disulfide bonds will be changed to: %s\n", *newcysname); std::string cysmaskstr = argIn.GetStringKey("cysmask", ":CYS@SG"); mprintf("\tSearching for disulfide bonds with a cutoff of %g Ang.\n", disulfidecut); AtomMask cysmask; @@ -68,7 +78,8 @@ Exec::RetType Exec_PrepareForLeap::Execute(CpptrajState& State, ArgList& argIn) outfile->Printf("bond %s.%i.%s %s.%i.%s\n", leapunitname.c_str(), coords.Top()[*at1].ResNum()+1, *(coords.Top()[*at1].Name()), leapunitname.c_str(), coords.Top()[*at2].ResNum()+1, *(coords.Top()[*at2].Name())); - + ChangeResName(coords.TopPtr()->SetRes(coords.Top()[*at1].ResNum()), newcysname); + ChangeResName(coords.TopPtr()->SetRes(coords.Top()[*at2].ResNum()), newcysname); } } } From 1e156aac64a92dc5ed3bcb24eecd09ebe87261e4 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Fri, 17 Apr 2020 14:15:27 -0400 Subject: [PATCH 13/39] Get rid of 'if' statement inside loop reading residue numbers --- src/Parm_Amber.cpp | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/Parm_Amber.cpp b/src/Parm_Amber.cpp index 6cc98cf5b3..f99dfa78b6 100644 --- a/src/Parm_Amber.cpp +++ b/src/Parm_Amber.cpp @@ -745,13 +745,22 @@ int Parm_Amber::ReadResidueNames(Topology& TopIn, FortranData const& FMT) { // Parm_Amber::ReadResidueAtomNums() int Parm_Amber::ReadResidueAtomNums(Topology& TopIn, FortranData const& FMT) { if (SetupBuffer(F_RESNUMS, values_[NRES], FMT)) return 1; - for (int idx = 0; idx != values_[NRES]; idx++) { - int atnum = atoi(file_.NextElement()) - 1; - TopIn.SetRes(idx).SetFirstAtom( atnum ); - if (idx > 0) TopIn.SetRes(idx-1).SetLastAtom( atnum ); - TopIn.SetRes(idx).SetOriginalNum( idx+1 ); + // Each entry in the array is the start atom (indexed from 1) for + // the corresponding residue. Do all but the final residue. + int numRes = values_[NRES]; + int firstAtom = atoi(file_.NextElement()) - 1; + for (int idx = 1; idx < numRes; idx++) { + Residue& currentRes = TopIn.SetRes(idx-1); + int lastAtom = atoi(file_.NextElement()) - 1; + currentRes.SetFirstAtom( firstAtom ); + currentRes.SetLastAtom( lastAtom ); + currentRes.SetOriginalNum( idx ); + firstAtom = lastAtom; } - TopIn.SetRes( values_[NRES]-1 ).SetLastAtom( values_[NATOM] ); + // Do the final residue + TopIn.SetRes(numRes-1).SetFirstAtom( firstAtom ); + TopIn.SetRes(numRes-1).SetLastAtom( values_[NATOM] ); + TopIn.SetRes(numRes-1).SetOriginalNum( numRes ); return 0; } From b063339387f893b13f57539200199098d73e1832 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Fri, 17 Apr 2020 14:55:41 -0400 Subject: [PATCH 14/39] The last atom of residues is already being set after the atom is added. --- src/Topology.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/Topology.cpp b/src/Topology.cpp index 424590b239..fc1cd93549 100644 --- a/src/Topology.cpp +++ b/src/Topology.cpp @@ -303,9 +303,6 @@ int Topology::AddTopAtom(Atom const& atomIn, Residue const& resIn) ( residues_.back().OriginalResNum() == resIn.OriginalResNum() && residues_.back().Name() != resIn.Name() ) ) { - // Last atom of old residue is == current # atoms. - if (!residues_.empty()) - residues_.back().SetLastAtom( atoms_.size() ); // First atom of new residue is == current # atoms. residues_.push_back( resIn ); residues_.back().SetFirstAtom( atoms_.size() ); From 2f87aa95cd6cbce1bc272d334741dde66fd03075 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Fri, 17 Apr 2020 15:48:45 -0400 Subject: [PATCH 15/39] Have atom/residue/molecule info print out the number or atoms/residues/molecules. --- src/TopInfo.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/TopInfo.cpp b/src/TopInfo.cpp index b68916c3ba..31a38af7b1 100644 --- a/src/TopInfo.cpp +++ b/src/TopInfo.cpp @@ -108,6 +108,7 @@ int TopInfo::PrintAtomInfo(std::string const& maskExpression) const { if ( mask.None() ) mprinterr("\tSelection is empty.\n"); else { + mprintf("%i atoms selected.\n", mask.Nselected()); int width = DigitWidth(parm_->Natom()); if (width < 5) width = 5; int nWidth = maxAtomNamesWidth(mask); @@ -161,6 +162,7 @@ int TopInfo::PrintResidueInfo(std::string const& maskExpression) const { mprinterr("\tSelection is empty.\n"); else { std::vector resNums = parm_->ResnumsSelectedBy(mask); + mprintf("%zu residues selected.\n", resNums.size()); int rn_width = maxResNameWidth( resNums ); int awidth = std::max(5, DigitWidth(parm_->Natom())); @@ -266,6 +268,7 @@ int TopInfo::PrintMoleculeInfo(std::string const& maskString) const { mprintf("\tSelection is empty.\n"); else { std::vector molNums = parm_->MolnumsSelectedBy( mask ); + mprintf("%zu molecules.\n", molNums.size()); int mn_width = maxMolNameWidth( molNums ); int awidth = std::max(5, DigitWidth(parm_->Natom())); int rwidth = std::max(5, DigitWidth(parm_->Nres())); From f4cc8c68f478e9f935bad2ce9a3fe53da996824d Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Sat, 18 Apr 2020 13:42:06 -0400 Subject: [PATCH 16/39] Add back the concept of "offset" when searching for dihedrals. In weird structures or structures where bond information has been incorrectly assigned (e.g. some PDBs) the old code was sometimes finding dihedrals it shouldnt have. --- src/DihedralSearch.cpp | 125 ++++++++++++++++++++++++++--------------- src/DihedralSearch.h | 3 +- 2 files changed, 82 insertions(+), 46 deletions(-) diff --git a/src/DihedralSearch.cpp b/src/DihedralSearch.cpp index d47038b701..5961ceaed7 100644 --- a/src/DihedralSearch.cpp +++ b/src/DihedralSearch.cpp @@ -10,6 +10,7 @@ const DihedralSearch::DihedralType DihedralSearch::D_END = MetaData::PUCKER; /// Token to store pre-defined dihedral types. struct DihedralSearch::DIH_TYPE { int cidx; ///< Index of the "central" atom (i.e. what res should it belong to) + int offset; ///< Res offset for atoms: -2 to 2 DihedralType type; ///< Dihedral MetaData type const char* an0; ///< First atom name const char* an1; ///< Second atom name @@ -19,44 +20,44 @@ struct DihedralSearch::DIH_TYPE { /** Recognized dihedral types go here. */ const DihedralSearch::DIH_TYPE DihedralSearch::DIH[] = { - { 2, MetaData::PHI, "C" , "N" , "CA" , "C" }, // PHI: C0-N1-CA1-C1 - { 2, MetaData::PSI, "N" , "CA" , "C" , "N" }, // PSI: N0-CA0-C0-N1 - { 2, MetaData::CHIP, "N" , "CA" , "CB" , "CG" }, // Protein CHI: R,N,D,Q,E,H,L,K,M,F,P,W,Y - { 2, MetaData::CHIP, "N" , "CA" , "CB" , "SG" }, // Protein CHI: C - { 2, MetaData::CHIP, "N" , "CA" , "CB" , "CG1" }, // Protein CHI: I,V - { 2, MetaData::CHIP, "N" , "CA" , "CB" , "OG" }, // Protein CHI: S - { 2, MetaData::CHIP, "N" , "CA" , "CB" , "OG1" }, // Protein CHI: T - { 2, MetaData::CHI2, "CA" , "CB" , "CG" , "CD" }, // Protein CHI2: R, Q, E, I, K, P - { 2, MetaData::CHI2, "CA" , "CB" , "CG" , "OD1" }, // Protein CHI2: N, D - { 2, MetaData::CHI2, "CA" , "CB" , "CG" , "ND1" }, // Protein CHI2: H - { 2, MetaData::CHI2, "CA" , "CB" , "CG" , "CD1" }, // Protein CHI2: L, F, W, Y - { 2, MetaData::CHI2, "CA" , "CB" , "CG" , "SD" }, // Protein CHI2: M - { 2, MetaData::CHI3, "CB" , "CG" , "CD" , "NE" }, // Protein CHI3: R - { 2, MetaData::CHI3, "CB" , "CG" , "CD" , "OE1" }, // Protein CHI3: Q, E - { 2, MetaData::CHI3, "CB" , "CG" , "CD" , "CE" }, // Protein CHI3: K - { 2, MetaData::CHI3, "CB" , "CG" , "SD" , "CE" }, // Protein CHI3: M - { 2, MetaData::CHI4, "CG" , "CD" , "NE" , "CZ" }, // Protein CHI4: R - { 2, MetaData::CHI4, "CG" , "CD" , "CE" , "NZ" }, // Protein CHI4: K - { 2, MetaData::CHI5, "CD" , "NE" , "CZ" , "NH1" }, // Protein CHI5: R - { 2, MetaData::OMEGA, "CA" , "C" , "N" , "CA" }, // OMEGA: CA0-C0-N1-CA1 - { 2, MetaData::ALPHA, "O3'", "P" , "O5'", "C5'" }, // ALPHA: - { 2, MetaData::BETA, "P" , "O5'", "C5'", "C4'" }, // BETA: - { 2, MetaData::GAMMA, "O5'", "C5'", "C4'", "C3'" }, // GAMMA: - { 2, MetaData::DELTA, "C5'", "C4'", "C3'", "O3'" }, // DELTA: - { 2, MetaData::EPSILON, "C4'", "C3'", "O3'", "P" }, // EPSILON: - { 1, MetaData::ZETA, "C3'", "O3'", "P" , "O5'" }, // ZETA: - { 2, MetaData::NU0, "C4'", "O4'", "C1'", "C2'" }, // NU0: Nucleic pucker - { 2, MetaData::NU1, "O4'", "C1'", "C2'", "C3'" }, // NU1: Nucleic pucker - { 2, MetaData::NU2, "C1'", "C2'", "C3'", "C4'" }, // NU2: Nucleic pucker - { 2, MetaData::NU3, "C2'", "C3'", "C4'", "O4'" }, // NU3: Nucleic pucker - { 2, MetaData::NU4, "C3'", "C4'", "O4'", "C1'" }, // NU4: Nucleic pucker - { 2, MetaData::CHIN, "O4'", "C1'", "N9", "C4" }, // Nucleic CHI: Purine (A, G) - { 2, MetaData::CHIN, "O4'", "C1'", "N1", "C2" }, // Nucleic CHI: Pyrimidine (U, T, C) - { 2, MetaData::H1P, "H1'", "C1'", "N9", "C4" }, // Nucleic H1' sugar pucker-base (purine) - { 2, MetaData::H1P, "H1'", "C1'", "N1", "C2" }, // Nucleic H1' sugar pucker-base (pyrim.) - { 2, MetaData::C2P, "C2'", "C1'", "N9", "C4" }, // Nucleic C2' sugar pucker-base (purine) - { 2, MetaData::C2P, "C2'", "C1'", "N1", "C2" }, // Nucleic C2' sugar pucker-base (pyrim.) - { 2, MetaData::UNDEFINED, 0, 0, 0, 0 } + { 2, -1, MetaData::PHI, "C" , "N" , "CA" , "C" }, // Protein PHI: C0-N1-CA1-C1 + { 2, 1, MetaData::PSI, "N" , "CA" , "C" , "N" }, // Protein PSI: N0-CA0-C0-N1 + { 2, 0, MetaData::CHIP, "N" , "CA" , "CB" , "CG" }, // Protein CHI: R,N,D,Q,E,H,L,K,M,F,P,W,Y + { 2, 0, MetaData::CHIP, "N" , "CA" , "CB" , "SG" }, // Protein CHI: C + { 2, 0, MetaData::CHIP, "N" , "CA" , "CB" , "CG1" }, // Protein CHI: I,V + { 2, 0, MetaData::CHIP, "N" , "CA" , "CB" , "OG" }, // Protein CHI: S + { 2, 0, MetaData::CHIP, "N" , "CA" , "CB" , "OG1" }, // Protein CHI: T + { 2, 0, MetaData::CHI2, "CA" , "CB" , "CG" , "CD" }, // Protein CHI2: R, Q, E, I, K, P + { 2, 0, MetaData::CHI2, "CA" , "CB" , "CG" , "OD1" }, // Protein CHI2: N, D + { 2, 0, MetaData::CHI2, "CA" , "CB" , "CG" , "ND1" }, // Protein CHI2: H + { 2, 0, MetaData::CHI2, "CA" , "CB" , "CG" , "CD1" }, // Protein CHI2: L, F, W, Y + { 2, 0, MetaData::CHI2, "CA" , "CB" , "CG" , "SD" }, // Protein CHI2: M + { 2, 0, MetaData::CHI3, "CB" , "CG" , "CD" , "NE" }, // Protein CHI3: R + { 2, 0, MetaData::CHI3, "CB" , "CG" , "CD" , "OE1" }, // Protein CHI3: Q, E + { 2, 0, MetaData::CHI3, "CB" , "CG" , "CD" , "CE" }, // Protein CHI3: K + { 2, 0, MetaData::CHI3, "CB" , "CG" , "SD" , "CE" }, // Protein CHI3: M + { 2, 0, MetaData::CHI4, "CG" , "CD" , "NE" , "CZ" }, // Protein CHI4: R + { 2, 0, MetaData::CHI4, "CG" , "CD" , "CE" , "NZ" }, // Protein CHI4: K + { 2, 0, MetaData::CHI5, "CD" , "NE" , "CZ" , "NH1" }, // Protein CHI5: R + { 2, -2, MetaData::OMEGA, "CA" , "C" , "N" , "CA" }, // Protein OMEGA: CA0-C0-N1-CA1 + { 2, -1, MetaData::ALPHA, "O3'", "P" , "O5'", "C5'" }, // Nucelic ALPHA: O3'0-P1-O5'1-C5'1 + { 2, 0, MetaData::BETA, "P" , "O5'", "C5'", "C4'" }, // Nucleic BETA: + { 2, 0, MetaData::GAMMA, "O5'", "C5'", "C4'", "C3'" }, // Nucelic GAMMA: + { 2, 0, MetaData::DELTA, "C5'", "C4'", "C3'", "O3'" }, // Nucleic DELTA: + { 2, 1, MetaData::EPSILON, "C4'", "C3'", "O3'", "P" }, // Nucleic EPSILON: C4'0-C3'0-O3'0-P1 + { 1, 2, MetaData::ZETA, "C3'", "O3'", "P" , "O5'" }, // Nucleic ZETA: C3'0-O3'0-P1-O5'1 + { 2, 0, MetaData::NU0, "C4'", "O4'", "C1'", "C2'" }, // NU0: Nucleic pucker + { 2, 0, MetaData::NU1, "O4'", "C1'", "C2'", "C3'" }, // NU1: Nucleic pucker + { 2, 0, MetaData::NU2, "C1'", "C2'", "C3'", "C4'" }, // NU2: Nucleic pucker + { 2, 0, MetaData::NU3, "C2'", "C3'", "C4'", "O4'" }, // NU3: Nucleic pucker + { 2, 0, MetaData::NU4, "C3'", "C4'", "O4'", "C1'" }, // NU4: Nucleic pucker + { 2, 0, MetaData::CHIN, "O4'", "C1'", "N9", "C4" }, // Nucleic CHI: Purine (A, G) + { 2, 0, MetaData::CHIN, "O4'", "C1'", "N1", "C2" }, // Nucleic CHI: Pyrimidine (U, T, C) + { 2, 0, MetaData::H1P, "H1'", "C1'", "N9", "C4" }, // Nucleic H1' sugar pucker-base (purine) + { 2, 0, MetaData::H1P, "H1'", "C1'", "N1", "C2" }, // Nucleic H1' sugar pucker-base (pyrim.) + { 2, 0, MetaData::C2P, "C2'", "C1'", "N9", "C4" }, // Nucleic C2' sugar pucker-base (purine) + { 2, 0, MetaData::C2P, "C2'", "C1'", "N1", "C2" }, // Nucleic C2' sugar pucker-base (pyrim.) + { 2, 0, MetaData::UNDEFINED, 0, 0, 0, 0 } }; // DihedralSearch::ListKnownTypes() @@ -99,6 +100,7 @@ DihedralSearch::DihedralToken::DihedralToken(int off, NameType const& an2, NameType const& an3, std::string const& name) : centerIdx_(2), + offset_(off), name_(name), type_(MetaData::UNDEFINED) { @@ -113,6 +115,7 @@ DihedralSearch::DihedralToken::DihedralToken(int off, // CONSTRUCTOR - Recognized type DihedralSearch::DihedralToken::DihedralToken(DIH_TYPE const& dih) : centerIdx_(dih.cidx), + offset_(dih.offset), name_(MetaData::TypeString(dih.type)), type_(dih.type) { @@ -123,15 +126,34 @@ DihedralSearch::DihedralToken::DihedralToken(DIH_TYPE const& dih) : } /// \return index of atom named aname bonded to atm in Topology top, or -1 if not found. -static inline int FindNameBondedTo(Atom const& atm, Topology const& top, NameType const& aname) +/** \param atm Current atom to search. + * \param top Current topology + * \param aname Bonded atom Name to search for + * \param resnum Residue number of the 'central' atom. + * \param numShouldBeDifferent Whether the bonded atom residue number should be different + */ +static inline int FindNameBondedTo(Atom const& atm, Topology const& top, NameType const& aname, + int resnum, bool numShouldBeDifferent) { int atomX = -1; for (Atom::bond_iterator bat = atm.bondbegin(); bat != atm.bondend(); ++bat) - if (top[*bat].Name() == aname) - { - atomX = *bat; - break; + { + if (top[*bat].Name() == aname) { + if ( numShouldBeDifferent ) { + // Bonded residue num should not match resnum + if ( top[*bat].ResNum() != resnum) { + atomX = *bat; + break; + } + } else { + //Bonded residue num should match resnum + if ( top[*bat].ResNum() == resnum) { + atomX = *bat; + break; + } + } } + } return atomX; } @@ -144,6 +166,19 @@ DihedralSearch::DihedralMask { Residue const& Res = topIn.Res(resIn); int atIdx[4]; + // Determine whether atoms should be in different residues. + bool isDifferentRes[4]; + if (offset_ == -2) { + isDifferentRes[0] = true; isDifferentRes[1] = true; isDifferentRes[2] = false; isDifferentRes[3] = false; + } else if (offset_ == -1) { + isDifferentRes[0] = true; isDifferentRes[1] = false; isDifferentRes[2] = false; isDifferentRes[3] = false; + } else if (offset_ == 1) { + isDifferentRes[0] = false; isDifferentRes[1] = false; isDifferentRes[2] = false; isDifferentRes[3] = true; + } else if (offset_ == 2) { + isDifferentRes[0] = false; isDifferentRes[1] = false; isDifferentRes[2] = true; isDifferentRes[3] = true; + } else { + isDifferentRes[0] = false; isDifferentRes[1] = false; isDifferentRes[2] = false; isDifferentRes[3] = false; + } // See if central atom exists. atIdx[centerIdx_] = -1; for (int at = Res.FirstAtom(); at != Res.LastAtom(); at++) @@ -157,14 +192,14 @@ DihedralSearch::DihedralMask // Find atoms in forward direction. for (int i = centerIdx_+1; i < 4; i++) { - int idx = FindNameBondedTo(topIn[atIdx[i-1]], topIn, aname_[i]); + int idx = FindNameBondedTo(topIn[atIdx[i-1]], topIn, aname_[i], resIn, isDifferentRes[i]); if (idx == -1) return DihedralMask(); atIdx[i] = idx; } // Find atoms in reverse direction. for (int i = centerIdx_-1; i > -1; i--) { - int idx = FindNameBondedTo(topIn[atIdx[i+1]], topIn, aname_[i]); + int idx = FindNameBondedTo(topIn[atIdx[i+1]], topIn, aname_[i], resIn, isDifferentRes[i]); if (idx == -1) return DihedralMask(); atIdx[i] = idx; } diff --git a/src/DihedralSearch.h b/src/DihedralSearch.h index 23384b7602..080bee6c66 100644 --- a/src/DihedralSearch.h +++ b/src/DihedralSearch.h @@ -64,7 +64,7 @@ class DihedralSearch { /// Hold dihedral type information used for searching. class DihedralSearch::DihedralToken { public: - DihedralToken() : centerIdx_(2), type_(MetaData::UNDEFINED) {} + DihedralToken() : centerIdx_(2), offset_(0), type_(MetaData::UNDEFINED) {} /// Constructor for custom dihedral type DihedralToken(int, NameType const&, NameType const&, NameType const&, NameType const&, std::string const&); @@ -77,6 +77,7 @@ class DihedralSearch::DihedralToken { void SetAtomName(int i, NameType const& n) { aname_[i] = n; } private: int centerIdx_; ///< Index of the "central" dihedral atom (determines res#). + int offset_; ///< Help determine which atoms are in which residues NameType aname_[4]; ///< Dihedral atom names. std::string name_; ///< Dihedral type name. DihedralType type_; ///< Dihedral type. From 7de0781649e0f7de570f70634e7a9233fe706c6c Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Sat, 18 Apr 2020 14:13:09 -0400 Subject: [PATCH 17/39] Add option to print reference values to a file --- src/Action_MakeStructure.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Action_MakeStructure.cpp b/src/Action_MakeStructure.cpp index 40b3111d8a..2ab73bd6db 100644 --- a/src/Action_MakeStructure.cpp +++ b/src/Action_MakeStructure.cpp @@ -55,7 +55,7 @@ void Action_MakeStructure::Help() const { "\t5) '::::::[:]'\n" "\t Apply to dihedral defined by atoms , , , and .\n"); DihedralSearch::OffsetHelp(); - mprintf("\t6) 'ref::[:[:]]'\n" + mprintf("\t6) 'ref::[:[:]] [refvalsout ]'\n" "\t Apply dihedrals from reference to residues in range .\n" "\t If is specified, use those residues from reference. The\n" "\t dihedral types to be used can be specified in a comma-separated list;\n" @@ -70,6 +70,9 @@ Action::RetType Action_MakeStructure::Init(ArgList& actionArgs, ActionInit& init { debug_ = debugIn; secstruct_.clear(); + CpptrajFile* refvalsout = init.DFL().AddCpptrajFile( actionArgs.GetStringKey("refvalsout"), + "Ref dihedral types/values", + DataFileList::TEXT ); // Get all arguments std::string ss_expr = actionArgs.GetStringNext(); while ( !ss_expr.empty() ) { @@ -152,6 +155,9 @@ Action::RetType Action_MakeStructure::Init(ArgList& actionArgs, ActionInit& init if (debug_ > 0) mprintf("\t Res %i %s = %g\n", dih->ResNum()+1, dih->Name().c_str(), torsion*Constants::RADDEG); + if (refvalsout != 0) + refvalsout->Printf("Res %i %s = %g\n", dih->ResNum()+1, dih->Name().c_str(), + torsion*Constants::RADDEG); } secstruct_.push_back( ss_holder ); From afdc39f0b1cb7793bfa3cc36d543c0dc9e3c19e5 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Sat, 18 Apr 2020 14:41:01 -0400 Subject: [PATCH 18/39] Add founddihout option; makes for easier debugging --- src/Action_MakeStructure.cpp | 22 ++++++++++++++++++---- src/Action_MakeStructure.h | 7 +++++-- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/src/Action_MakeStructure.cpp b/src/Action_MakeStructure.cpp index 2ab73bd6db..5b39e9405e 100644 --- a/src/Action_MakeStructure.cpp +++ b/src/Action_MakeStructure.cpp @@ -6,7 +6,11 @@ #include "StringRoutines.h" // convertToDouble, convertToInteger // CONSTRUCTOR -Action_MakeStructure::Action_MakeStructure() : debug_(0) { +Action_MakeStructure::Action_MakeStructure() : + CurrentParm_(0), + debug_(0), + foundDihOut_(0) +{ // Initially known structure types. SS.push_back(SS_TYPE( -57.8, -47.0, 0.0, 0.0, 0, "alpha" )); SS.push_back(SS_TYPE( 57.8, 47.0, 0.0, 0.0, 0, "left" )); @@ -34,6 +38,7 @@ int Action_MakeStructure::FindSStype(std::string const& typeIn) return SS_EMPTY; } +// Action_MakeStructure::Help() void Action_MakeStructure::Help() const { mprintf("\t\n" " Apply dihedrals to specified residues using arguments found in ,\n" @@ -55,7 +60,7 @@ void Action_MakeStructure::Help() const { "\t5) '::::::[:]'\n" "\t Apply to dihedral defined by atoms , , , and .\n"); DihedralSearch::OffsetHelp(); - mprintf("\t6) 'ref::[:[:]] [refvalsout ]'\n" + mprintf("\t6) 'ref::[:[:]] [refvalsout ] [founddihout ]'\n" "\t Apply dihedrals from reference to residues in range .\n" "\t If is specified, use those residues from reference. The\n" "\t dihedral types to be used can be specified in a comma-separated list;\n" @@ -73,7 +78,10 @@ Action::RetType Action_MakeStructure::Init(ArgList& actionArgs, ActionInit& init CpptrajFile* refvalsout = init.DFL().AddCpptrajFile( actionArgs.GetStringKey("refvalsout"), "Ref dihedral types/values", DataFileList::TEXT ); - // Get all arguments + foundDihOut_ = init.DFL().AddCpptrajFile( actionArgs.GetStringKey("founddihout"), + "Found dihedrals", + DataFileList::TEXT ); + // Get all makestructure arguments std::string ss_expr = actionArgs.GetStringNext(); while ( !ss_expr.empty() ) { ArgList ss_arg(ss_expr, ":"); @@ -383,7 +391,13 @@ Action::RetType Action_MakeStructure::Setup(ActionSetup& setup) { for (DihedralSearch::mask_it dih = ss->dihSearch_.begin(); dih != ss->dihSearch_.end(); ++dih) { - mprintf("\tDihedral in residue %i = %f\n", dih->ResNum()+1, *(theta++)*Constants::RADDEG); + if (foundDihOut_ != 0) { + mprintf("\tFound dihedrals being written to '%s'\n", foundDihOut_->Filename().full()); + foundDihOut_->Printf("\tDihedral %s in residue %i = %f\n", + dih->Name().c_str(), dih->ResNum()+1, *(theta++)*Constants::RADDEG); + } else + mprintf("\tDihedral %s in residue %i = %f\n", + dih->Name().c_str(), dih->ResNum()+1, *(theta++)*Constants::RADDEG); ss->Rmasks_.push_back( DihedralSearch::MovingAtoms(setup.Top(), dih->A1(), dih->A2()) ); } diff --git a/src/Action_MakeStructure.h b/src/Action_MakeStructure.h index c7eb2f9570..36f1891a44 100644 --- a/src/Action_MakeStructure.h +++ b/src/Action_MakeStructure.h @@ -12,8 +12,7 @@ class Action_MakeStructure : public Action { Action::RetType Setup(ActionSetup&); Action::RetType DoAction(int, ActionFrame&); void Print() {} - Topology* CurrentParm_; // DEBUG - int debug_; + /// Hold secondary structure/turn/single dihedral types. class SS_TYPE { public: @@ -41,5 +40,9 @@ class Action_MakeStructure : public Action { int sstype_idx; ///< Pointer to corresponding SS_TYPE. }; std::vector secstruct_; + + Topology* CurrentParm_; ///< Hold current topology for DoAction(). + int debug_; + CpptrajFile* foundDihOut_; ///< File to write dihedrals found by Setup() to. }; #endif From a34d4694156226216d80c805ab8e04401bba8c71 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Sun, 19 Apr 2020 13:45:33 -0400 Subject: [PATCH 19/39] More info --- src/Exec_Change.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Exec_Change.cpp b/src/Exec_Change.cpp index e01cdfcdcd..a6b206a2bc 100644 --- a/src/Exec_Change.cpp +++ b/src/Exec_Change.cpp @@ -46,8 +46,11 @@ Exec::RetType Exec_Change::Execute(CpptrajState& State, ArgList& argIn) return CpptrajState::ERR; } parm = cset->TopPtr(); - } else + mprintf("\tUsing topology from COORDS set '%s'\n", cset->legend()); + } else { parm = State.DSL().GetTopology( argIn ); + mprintf("\tUsing topology: %s\n", parm->c_str()); + } if (parm == 0) return CpptrajState::ERR; int err = 0; switch (type) { From 5dad3cecc3d18d9b1bdeae5e36c94f90d9156951 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Sun, 19 Apr 2020 13:57:03 -0400 Subject: [PATCH 20/39] Add crdset keyword to GetTopByIndex --- src/DataSetList.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/DataSetList.cpp b/src/DataSetList.cpp index d0f99e9c30..fb1b4507be 100644 --- a/src/DataSetList.cpp +++ b/src/DataSetList.cpp @@ -1049,7 +1049,7 @@ Topology* DataSetList::GetTopology(ArgList& argIn) const { return ((DataSet_Topology*)top)->TopPtr(); } -const char* DataSetList::TopIdxArgs = "parm | parmindex <#> | <#>"; +const char* DataSetList::TopIdxArgs = "parm | crdset | parmindex <#> | <#>"; // DataSetList::GetTopByIndex() /** \return Topology specfied by a keyword, or if no keywords specified @@ -1064,6 +1064,13 @@ Topology* DataSetList::GetTopByIndex(ArgList& argIn) const { int err; DataSet* top = GetTopByKeyword( argIn, err ); if (err) return 0; + // Check coords sets + std::string crdset = argIn.GetStringKey("crdset"); + if (!crdset.empty()) { + top = FindSetOfGroup(crdset, DataSet::COORDINATES); + if ( top == 0) return 0; + return ((DataSet_Coords*)top)->TopPtr(); + } if (top == 0) { // For backwards compat., check for single integer arg. int topindex = argIn.getNextInteger(-1); if (topindex > -1 && topindex < (int)TopList_.size()) From e525e4c4e364af8e22ad92bc7d5ba0c04d450806 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Sun, 19 Apr 2020 16:40:23 -0400 Subject: [PATCH 21/39] Add the PSI-O dihedral --- src/DihedralSearch.cpp | 1 + src/MetaData.cpp | 2 +- src/MetaData.h | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/DihedralSearch.cpp b/src/DihedralSearch.cpp index 5961ceaed7..d1c9596ee5 100644 --- a/src/DihedralSearch.cpp +++ b/src/DihedralSearch.cpp @@ -22,6 +22,7 @@ struct DihedralSearch::DIH_TYPE { const DihedralSearch::DIH_TYPE DihedralSearch::DIH[] = { { 2, -1, MetaData::PHI, "C" , "N" , "CA" , "C" }, // Protein PHI: C0-N1-CA1-C1 { 2, 1, MetaData::PSI, "N" , "CA" , "C" , "N" }, // Protein PSI: N0-CA0-C0-N1 + { 2, 0, MetaData::PSIO, "N" , "CA" , "C" , "O" }, // Protein PSI O: N-CA-C-O { 2, 0, MetaData::CHIP, "N" , "CA" , "CB" , "CG" }, // Protein CHI: R,N,D,Q,E,H,L,K,M,F,P,W,Y { 2, 0, MetaData::CHIP, "N" , "CA" , "CB" , "SG" }, // Protein CHI: C { 2, 0, MetaData::CHIP, "N" , "CA" , "CB" , "CG1" }, // Protein CHI: I,V diff --git a/src/MetaData.cpp b/src/MetaData.cpp index 1f334c953c..8226ac71c6 100644 --- a/src/MetaData.cpp +++ b/src/MetaData.cpp @@ -7,7 +7,7 @@ const char* MetaData::Stypes[] = { // Torsions "alpha", "beta", "gamma", "delta", "epsilon", "zeta", "nu0", "nu1", "nu2", "nu3", "nu4", - "h1p", "c2p", "chin", "phi", "psi", "chip", "omega", + "h1p", "c2p", "chin", "phi", "psi", "psio", "chip", "omega", "chi2", "chi3", "chi4", "chi5", // Pucker "pucker", diff --git a/src/MetaData.h b/src/MetaData.h index 818e66fba5..308dfbb672 100644 --- a/src/MetaData.h +++ b/src/MetaData.h @@ -21,7 +21,7 @@ class MetaData { // NOTE: DihedralSearch depends on Dihedrals being between ALPHA and PUCKER ALPHA=0, BETA, GAMMA, DELTA, EPSILON, ZETA, NU0, NU1, NU2, NU3, NU4, - H1P, C2P, CHIN, PHI, PSI, CHIP, OMEGA, + H1P, C2P, CHIN, PHI, PSI, PSIO, CHIP, OMEGA, CHI2, CHI3, CHI4, CHI5, PUCKER, NOE, From 0ee15b0f34661e128410f29cd09790b6b330e09e Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Mon, 20 Apr 2020 13:34:10 -0400 Subject: [PATCH 22/39] DRR - If an action was skipped, do not make it an error. --- src/Exec_CrdAction.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Exec_CrdAction.cpp b/src/Exec_CrdAction.cpp index 73e530a74f..84757e2314 100644 --- a/src/Exec_CrdAction.cpp +++ b/src/Exec_CrdAction.cpp @@ -29,8 +29,12 @@ Exec::RetType Exec_CrdAction::DoCrdAction(CpptrajState& State, ArgList& actionar Frame originalFrame = CRD->AllocateFrame(); // Set up for this topology Action::RetType setup_ret = act->Setup( originalSetup ); - if ( setup_ret == Action::ERR || setup_ret == Action::SKIP ) + if ( setup_ret == Action::ERR ) return CpptrajState::ERR; + else if ( setup_ret == Action::SKIP ) { + mprintf("Warning: Action was skipped.\n"); + return CpptrajState::OK; + } // If the topology was modified, we will need a new COORDS set. DataSet_Coords* crdOut = 0; if ( setup_ret == Action::MODIFY_TOPOLOGY ) { From d262474ad019b9a43bae9b9ccfac86df6cb572b5 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Mon, 20 Apr 2020 15:42:41 -0400 Subject: [PATCH 23/39] Allow multiple args for removedata --- src/CpptrajState.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/CpptrajState.cpp b/src/CpptrajState.cpp index 6e42a67a9a..fde3cac7ec 100644 --- a/src/CpptrajState.cpp +++ b/src/CpptrajState.cpp @@ -346,14 +346,17 @@ int CpptrajState::RemoveDataSet( ArgList& argIn ) { mprinterr("Error: No data set(s) specified for removal.\n"); return 1; } - DataSetList tempDSL = DSL_.GetMultipleSets( removeArg ); - if (!tempDSL.empty()) { - for (DataSetList::const_iterator ds = tempDSL.begin(); - ds != tempDSL.end(); ++ds) - { - mprintf("\tRemoving \"%s\"\n", (*ds)->legend()); - RemoveDataSet( *ds ); + while (!removeArg.empty()) { + DataSetList tempDSL = DSL_.GetMultipleSets( removeArg ); + if (!tempDSL.empty()) { + for (DataSetList::const_iterator ds = tempDSL.begin(); + ds != tempDSL.end(); ++ds) + { + mprintf("\tRemoving \"%s\"\n", (*ds)->legend()); + RemoveDataSet( *ds ); + } } + removeArg = argIn.GetStringNext(); } return 0; } From 26e0303fcdfcfa228a3c09301c0a3f80f8e49d91 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Mon, 20 Apr 2020 15:43:27 -0400 Subject: [PATCH 24/39] Go back to making a single skipped action an error for crdaction --- src/Exec_CrdAction.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/Exec_CrdAction.cpp b/src/Exec_CrdAction.cpp index 84757e2314..73e530a74f 100644 --- a/src/Exec_CrdAction.cpp +++ b/src/Exec_CrdAction.cpp @@ -29,12 +29,8 @@ Exec::RetType Exec_CrdAction::DoCrdAction(CpptrajState& State, ArgList& actionar Frame originalFrame = CRD->AllocateFrame(); // Set up for this topology Action::RetType setup_ret = act->Setup( originalSetup ); - if ( setup_ret == Action::ERR ) + if ( setup_ret == Action::ERR || setup_ret == Action::SKIP ) return CpptrajState::ERR; - else if ( setup_ret == Action::SKIP ) { - mprintf("Warning: Action was skipped.\n"); - return CpptrajState::OK; - } // If the topology was modified, we will need a new COORDS set. DataSet_Coords* crdOut = 0; if ( setup_ret == Action::MODIFY_TOPOLOGY ) { From 22a2675e73a5cf9074feebe0890e4b82295028dc Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Wed, 22 Apr 2020 14:41:22 -0400 Subject: [PATCH 25/39] Improve DSSP help. Add "SG" atom name so that disulfides are not followed when looking for previous/next residues. --- src/Action_DSSP.cpp | 23 +++++++++++++++++++++-- src/Action_DSSP.h | 1 + 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/Action_DSSP.cpp b/src/Action_DSSP.cpp index 9075abcc06..8158f238dd 100644 --- a/src/Action_DSSP.cpp +++ b/src/Action_DSSP.cpp @@ -274,6 +274,7 @@ Action_DSSP::Action_DSSP() : BB_C_("C"), BB_O_("O"), BB_CA_("CA"), + SG_("SG"), outfile_(0), dsspFile_(0), assignout_(0), @@ -288,8 +289,18 @@ void Action_DSSP::Help() const { "\t[betadetail]\n" "\t[namen ] [nameh ] [nameca ]\n" "\t[namec ] [nameo ]\n" - " Calculate secondary structure content for residues in .\n" - " If sumout not specified, the filename specified by out is used with .sum suffix.\n"); + " Calculate secondary structure (SS) content for residues in .\n" + " The 'out' file will contain SS vs frame.\n" + " The 'sumout' file will contain total SS content for each residue, by SS type.\n" + " If sumout not specified, the filename specified by out is used with .sum suffix.\n" + " The 'assignout' file will contain the SS assignment foe each residue based\n" + " on the majority SS type.\n" + " The 'totalout' file will contain overall SS content vs frame, by SS type.\n" + " The 'ptrajformat' keyword will use characters instead of #s in the 'out' file.\n" + " The 'betadetail' keyword will print parallel/anti-parallel beta instead of\n" + " extended/bridge.\n" + ); + } // Action_DSSP::Init() @@ -450,9 +461,17 @@ Action::RetType Action_DSSP::Setup(ActionSetup& setup) int nextresnum = -1; for (int at = thisRes.FirstAtom(); at != thisRes.LastAtom(); at++) { if ( setup.Top()[at].Element() != Atom::HYDROGEN ) { + bool isSGatom = (setup.Top()[at].Name() == SG_); for (Atom::bond_iterator ib = setup.Top()[at].bondbegin(); ib != setup.Top()[at].bondend(); ++ib) { + // Do not follow disulfide bonds. + if (isSGatom && setup.Top()[*ib].Name() == SG_) { + mprintf("\tSkipping disulfide bond between %s and %s\n", + setup.Top().TruncResNameNum(setup.Top()[at].ResNum()).c_str(), + setup.Top().TruncResNameNum(setup.Top()[*ib].ResNum()).c_str()); + continue; + } if ( setup.Top()[*ib].ResNum() < *ridx ) { if (prevresnum != -1) mprintf("Warning: Multiple previous residues for res %i\n", *ridx+1); diff --git a/src/Action_DSSP.h b/src/Action_DSSP.h index ca552d5c0d..b325cee490 100644 --- a/src/Action_DSSP.h +++ b/src/Action_DSSP.h @@ -85,6 +85,7 @@ class Action_DSSP : public Action { NameType BB_C_; ///< Protein C atom name ('C') NameType BB_O_; ///< Protein C-O atom name ('O') NameType BB_CA_; ///< Protein alpha C name ('CA') + NameType SG_; ///< Protein cysteine sulfur name for detecting disulfides CharMask Mask_; ///< Mask used to determine selected residues. DataFile* outfile_; ///< Output Data file DataFile* dsspFile_; ///< Sum output file From 560470c2c03ec82b016623fd21142fa95e07faad Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Wed, 22 Apr 2020 14:47:43 -0400 Subject: [PATCH 26/39] Add namesg keyword. --- src/Action_DSSP.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Action_DSSP.cpp b/src/Action_DSSP.cpp index 8158f238dd..98a2470022 100644 --- a/src/Action_DSSP.cpp +++ b/src/Action_DSSP.cpp @@ -288,7 +288,7 @@ void Action_DSSP::Help() const { "\t[assignout ] [totalout ] [ptrajformat]\n" "\t[betadetail]\n" "\t[namen ] [nameh ] [nameca ]\n" - "\t[namec ] [nameo ]\n" + "\t[namec ] [nameo ] [namesg ]\n" " Calculate secondary structure (SS) content for residues in .\n" " The 'out' file will contain SS vs frame.\n" " The 'sumout' file will contain total SS content for each residue, by SS type.\n" @@ -299,6 +299,8 @@ void Action_DSSP::Help() const { " The 'ptrajformat' keyword will use characters instead of #s in the 'out' file.\n" " The 'betadetail' keyword will print parallel/anti-parallel beta instead of\n" " extended/bridge.\n" + " The backbone N, H, CA, C, and O atom names can be specifed with 'nameX' keywords.\n" + " The disulfide sulfur atom name can be specified with the 'nameSG' keyword.\n" ); } @@ -328,6 +330,8 @@ Action::RetType Action_DSSP::Init(ArgList& actionArgs, ActionInit& init, int deb if (!temp.empty()) BB_O_ = temp; temp = actionArgs.GetStringKey("nameca"); if (!temp.empty()) BB_CA_ = temp; + temp = actionArgs.GetStringKey("namesg"); + if (!temp.empty()) SG_ = temp; // Get masks if (Mask_.SetMaskString( actionArgs.GetMaskNext() )) return Action::ERR; @@ -394,6 +398,7 @@ Action::RetType Action_DSSP::Init(ArgList& actionArgs, ActionInit& init, int deb mprintf("\tOverall assigned SS will be written to %s\n", assignout_->Filename().full()); mprintf("\tBackbone Atom Names: N=[%s] H=[%s] C=[%s] O=[%s] CA=[%s]\n", *BB_N_, *BB_H_, *BB_C_, *BB_O_, *BB_CA_ ); + mprintf("\tDisulfide sulfur atom name: %s\n", *SG_); mprintf("# Citation: Kabsch, W.; Sander, C.; \"Dictionary of Protein Secondary Structure:\n" "# Pattern Recognition of Hydrogen-Bonded and Geometrical Features.\"\n" "# Biopolymers (1983), V.22, pp.2577-2637.\n" ); From 257803927fbe2f95d9df06a280cce21baee907ec Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Wed, 22 Apr 2020 15:24:54 -0400 Subject: [PATCH 27/39] DRR - Skip residues for which no atoms are selected. --- src/Action_DSSP.cpp | 68 +++++++++++++++++++++++++++------------------ 1 file changed, 41 insertions(+), 27 deletions(-) diff --git a/src/Action_DSSP.cpp b/src/Action_DSSP.cpp index 98a2470022..d7d0906fa5 100644 --- a/src/Action_DSSP.cpp +++ b/src/Action_DSSP.cpp @@ -500,40 +500,54 @@ Action::RetType Action_DSSP::Setup(ActionSetup& setup) } // Determine if this residue is selected if (Mask_.AtomsInCharMask(thisRes.FirstAtom(), thisRes.LastAtom())) { - Res->SetSelected( true ); - ++nResSelected; // Determine atom indices + bool hasAtoms = false; for (int at = thisRes.FirstAtom(); at != thisRes.LastAtom(); at++) { - if ( setup.Top()[at].Name() == BB_C_ ) Res->SetC( at*3 ); - else if ( setup.Top()[at].Name() == BB_O_ ) Res->SetO( at*3 ); - else if ( setup.Top()[at].Name() == BB_N_ ) Res->SetN( at*3 ); - else if ( setup.Top()[at].Name() == BB_H_ ) Res->SetH( at*3 ); - else if ( setup.Top()[at].Name() == BB_CA_ ) Res->SetCA( at*3 ); + if ( setup.Top()[at].Name() == BB_C_ ) { Res->SetC( at*3 ); hasAtoms = true; } + else if ( setup.Top()[at].Name() == BB_O_ ) { Res->SetO( at*3 ); hasAtoms = true; } + else if ( setup.Top()[at].Name() == BB_N_ ) { Res->SetN( at*3 ); hasAtoms = true; } + else if ( setup.Top()[at].Name() == BB_H_ ) { Res->SetH( at*3 ); hasAtoms = true; } + else if ( setup.Top()[at].Name() == BB_CA_ ) { Res->SetCA( at*3 ); hasAtoms = true; } } - // Check if residue is missing atoms - if (Res->IsMissingAtoms()) { - mprintf("Warning: Res %s is missing atoms", setup.Top().TruncResNameNum( *ridx ).c_str()); - if (Res->C() == -1) mprintf(" %s", *BB_C_); - if (Res->O() == -1) mprintf(" %s", *BB_N_); - if (Res->N() == -1) mprintf(" %s", *BB_O_); - if (Res->H() == -1) mprintf(" %s", *BB_H_); - if (Res->CA() == -1) mprintf(" %s", *BB_CA_); - mprintf("\n"); - } - // Set up DataSet if necessary - if (Res->Dset() == 0) { - md.SetIdx( *ridx+1 ); - md.SetLegend( setup.Top().TruncResNameNum( *ridx ) ); - // Setup DataSet for this residue - Res->SetDset( Init_.DSL().AddSet( dt, md ) ); + if (!hasAtoms) { + mprintf("Warning: No atoms selected for res %s; skipping.\n", + setup.Top().TruncResNameNum( *ridx ).c_str()); + } else { + Res->SetSelected( true ); + ++nResSelected; + for (int at = thisRes.FirstAtom(); at != thisRes.LastAtom(); at++) + { + if ( setup.Top()[at].Name() == BB_C_ ) Res->SetC( at*3 ); + else if ( setup.Top()[at].Name() == BB_O_ ) Res->SetO( at*3 ); + else if ( setup.Top()[at].Name() == BB_N_ ) Res->SetN( at*3 ); + else if ( setup.Top()[at].Name() == BB_H_ ) Res->SetH( at*3 ); + else if ( setup.Top()[at].Name() == BB_CA_ ) Res->SetCA( at*3 ); + } + // Check if residue is missing atoms + if (Res->IsMissingAtoms()) { + mprintf("Warning: Res %s is missing atoms", setup.Top().TruncResNameNum( *ridx ).c_str()); + if (Res->C() == -1) mprintf(" %s", *BB_C_); + if (Res->O() == -1) mprintf(" %s", *BB_N_); + if (Res->N() == -1) mprintf(" %s", *BB_O_); + if (Res->H() == -1) mprintf(" %s", *BB_H_); + if (Res->CA() == -1) mprintf(" %s", *BB_CA_); + mprintf("\n"); + } + // Set up DataSet if necessary if (Res->Dset() == 0) { - mprinterr("Error: Could not allocate DSSP data set for residue %i\n", *ridx+1); - return Action::ERR; + md.SetIdx( *ridx+1 ); + md.SetLegend( setup.Top().TruncResNameNum( *ridx ) ); + // Setup DataSet for this residue + Res->SetDset( Init_.DSL().AddSet( dt, md ) ); + if (Res->Dset() == 0) { + mprinterr("Error: Could not allocate DSSP data set for residue %i\n", *ridx+1); + return Action::ERR; + } + if (outfile_ != 0) outfile_->AddDataSet( Res->Dset() ); } - if (outfile_ != 0) outfile_->AddDataSet( Res->Dset() ); } - } // END residue is selected + } // END residue is selected by Mask } mprintf("\t%u of %i solute residues selected.\n", nResSelected, soluteRes.Size()); From 48271415499f002fe78718416d106af33ec0d9e8 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Wed, 22 Apr 2020 15:25:33 -0400 Subject: [PATCH 28/39] DRR - Nonsense assignment no longer made. --- test/Test_DSSP/ftufabi.assign.dat.save | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/Test_DSSP/ftufabi.assign.dat.save b/test/Test_DSSP/ftufabi.assign.dat.save index 89babbfba4..9781175b64 100644 --- a/test/Test_DSSP/ftufabi.assign.dat.save +++ b/test/Test_DSSP/ftufabi.assign.dat.save @@ -13,6 +13,6 @@ 201 SNFKKMLDYN AMVSPLKKNV DIMEVGNTVA FLCSDMATGI TGEVVHVDAG SS TTHHHHH HHHSSS HHHHHHHHH HHTSTT S SEEE SS -251 YHCVSMGNVL LEHHHHHHnT - GGG S SSSS +251 YHCVSMGNVL LEHHHHHH + GGG S SSSS From ba2a8bdddb1181b006f813cfb6ee99e63a38826b Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Wed, 22 Apr 2020 15:31:20 -0400 Subject: [PATCH 29/39] DRR - Do not follow bonds to unselected atoms --- src/Action_DSSP.cpp | 45 ++++++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/src/Action_DSSP.cpp b/src/Action_DSSP.cpp index d7d0906fa5..b84d2c74a0 100644 --- a/src/Action_DSSP.cpp +++ b/src/Action_DSSP.cpp @@ -470,27 +470,30 @@ Action::RetType Action_DSSP::Setup(ActionSetup& setup) for (Atom::bond_iterator ib = setup.Top()[at].bondbegin(); ib != setup.Top()[at].bondend(); ++ib) { - // Do not follow disulfide bonds. - if (isSGatom && setup.Top()[*ib].Name() == SG_) { - mprintf("\tSkipping disulfide bond between %s and %s\n", - setup.Top().TruncResNameNum(setup.Top()[at].ResNum()).c_str(), - setup.Top().TruncResNameNum(setup.Top()[*ib].ResNum()).c_str()); - continue; - } - if ( setup.Top()[*ib].ResNum() < *ridx ) { - if (prevresnum != -1) - mprintf("Warning: Multiple previous residues for res %i\n", *ridx+1); - else - prevresnum = setup.Top()[*ib].ResNum(); - } else if ( setup.Top()[*ib].ResNum() > *ridx ) { - if (nextresnum != -1) - mprintf("Warning: Multiple next residues for res %i\n", *ridx+1); - else - nextresnum = setup.Top()[*ib].ResNum(); - } - } - } - } + // Skip the bonded atom if it is not in the mask + if (Mask_.AtomInCharMask(*ib)) { + // Do not follow disulfide bonds. + if (isSGatom && setup.Top()[*ib].Name() == SG_) { + mprintf("\tSkipping disulfide bond between %s and %s\n", + setup.Top().TruncResNameNum(setup.Top()[at].ResNum()).c_str(), + setup.Top().TruncResNameNum(setup.Top()[*ib].ResNum()).c_str()); + continue; + } + if ( setup.Top()[*ib].ResNum() < *ridx ) { + if (prevresnum != -1) + mprintf("Warning: Multiple previous residues for res %i\n", *ridx+1); + else + prevresnum = setup.Top()[*ib].ResNum(); + } else if ( setup.Top()[*ib].ResNum() > *ridx ) { + if (nextresnum != -1) + mprintf("Warning: Multiple next residues for res %i\n", *ridx+1); + else + nextresnum = setup.Top()[*ib].ResNum(); + } + } // END if atom in mask + } // END loop over bonded atoms + } // END atom is not hydrogen + } // END loop over residue atoms # ifdef DSSPDEBUG mprintf("\t %8i < %8i < %8i\n", prevresnum+1, *ridx+1, nextresnum+1); # endif From 9dad85a95ee79048f6876a4409f9526446e7d320 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Wed, 22 Apr 2020 15:39:42 -0400 Subject: [PATCH 30/39] Hide command for now --- src/Exec_PrepareForLeap.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Exec_PrepareForLeap.h b/src/Exec_PrepareForLeap.h index 7bcba6e9f4..1aa39cbb70 100644 --- a/src/Exec_PrepareForLeap.h +++ b/src/Exec_PrepareForLeap.h @@ -4,7 +4,7 @@ /// Do common tasks to prepare a structure to be loaded into tleap class Exec_PrepareForLeap : public Exec { public: - Exec_PrepareForLeap() : Exec(GENERAL) {} + Exec_PrepareForLeap() : Exec(HIDDEN) {} void Help() const; DispatchObject* Alloc() const { return (DispatchObject*)new Exec_PrepareForLeap(); } RetType Execute(CpptrajState&, ArgList&); From 16fd050bb055cfebdab72258ba76a943a7028b61 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Wed, 22 Apr 2020 15:49:39 -0400 Subject: [PATCH 31/39] Remove the "psi-o" dihedral --- src/DihedralSearch.cpp | 1 - src/MetaData.cpp | 2 +- src/MetaData.h | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/DihedralSearch.cpp b/src/DihedralSearch.cpp index d1c9596ee5..5961ceaed7 100644 --- a/src/DihedralSearch.cpp +++ b/src/DihedralSearch.cpp @@ -22,7 +22,6 @@ struct DihedralSearch::DIH_TYPE { const DihedralSearch::DIH_TYPE DihedralSearch::DIH[] = { { 2, -1, MetaData::PHI, "C" , "N" , "CA" , "C" }, // Protein PHI: C0-N1-CA1-C1 { 2, 1, MetaData::PSI, "N" , "CA" , "C" , "N" }, // Protein PSI: N0-CA0-C0-N1 - { 2, 0, MetaData::PSIO, "N" , "CA" , "C" , "O" }, // Protein PSI O: N-CA-C-O { 2, 0, MetaData::CHIP, "N" , "CA" , "CB" , "CG" }, // Protein CHI: R,N,D,Q,E,H,L,K,M,F,P,W,Y { 2, 0, MetaData::CHIP, "N" , "CA" , "CB" , "SG" }, // Protein CHI: C { 2, 0, MetaData::CHIP, "N" , "CA" , "CB" , "CG1" }, // Protein CHI: I,V diff --git a/src/MetaData.cpp b/src/MetaData.cpp index 8226ac71c6..1f334c953c 100644 --- a/src/MetaData.cpp +++ b/src/MetaData.cpp @@ -7,7 +7,7 @@ const char* MetaData::Stypes[] = { // Torsions "alpha", "beta", "gamma", "delta", "epsilon", "zeta", "nu0", "nu1", "nu2", "nu3", "nu4", - "h1p", "c2p", "chin", "phi", "psi", "psio", "chip", "omega", + "h1p", "c2p", "chin", "phi", "psi", "chip", "omega", "chi2", "chi3", "chi4", "chi5", // Pucker "pucker", diff --git a/src/MetaData.h b/src/MetaData.h index 308dfbb672..818e66fba5 100644 --- a/src/MetaData.h +++ b/src/MetaData.h @@ -21,7 +21,7 @@ class MetaData { // NOTE: DihedralSearch depends on Dihedrals being between ALPHA and PUCKER ALPHA=0, BETA, GAMMA, DELTA, EPSILON, ZETA, NU0, NU1, NU2, NU3, NU4, - H1P, C2P, CHIN, PHI, PSI, PSIO, CHIP, OMEGA, + H1P, C2P, CHIN, PHI, PSI, CHIP, OMEGA, CHI2, CHI3, CHI4, CHI5, PUCKER, NOE, From d48824760b65b35611e4f4d3170155ac9eefece8 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Wed, 22 Apr 2020 15:52:09 -0400 Subject: [PATCH 32/39] Update makestructure --- doc/cpptraj.lyx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/cpptraj.lyx b/doc/cpptraj.lyx index e4f2a92ea6..741b57f99c 100644 --- a/doc/cpptraj.lyx +++ b/doc/cpptraj.lyx @@ -26990,7 +26990,7 @@ ref::[:[:]] +range>[:]] [refvalsout ] [founddihout ] \end_layout \begin_layout Standard @@ -27003,6 +27003,8 @@ Apply dihedrals from residues in previously loaded reference \series default above) can be specified in a comma-separated list; default is phi/psi. Note that in order to specify , must be specified. + The 'refvalsout' and 'founddihout' keywords can be used to print dihedrals + found in the reference and target structures respectively to files. \end_layout \begin_layout Subsubsection* From f5d2705c0e7f38ab9212d76b008f4a57f90c180f Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Wed, 22 Apr 2020 15:56:40 -0400 Subject: [PATCH 33/39] Add namesg keyword to manual --- doc/cpptraj.lyx | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/doc/cpptraj.lyx b/doc/cpptraj.lyx index 741b57f99c..29b8229753 100644 --- a/doc/cpptraj.lyx +++ b/doc/cpptraj.lyx @@ -31836,7 +31836,7 @@ secstruct \end_layout \begin_layout LyX-Code - [namec ] [nameo ] + [namec ] [nameo ] [namesg ] \begin_inset Separator latexpar \end_inset @@ -31949,6 +31949,19 @@ name>] Backbone carbonyl carbon atom name (default 'C'). name>] Backbone carbonyl oxygen atom name (default 'O'). \end_layout +\begin_layout Description +[namesg +\begin_inset space ~ +\end_inset + +] Cysteine sulfur atom name, used to ignore disulfide connectivity + (default 'SG'). +\end_layout + \begin_layout Standard Data Sets Created: \end_layout @@ -32107,6 +32120,24 @@ nameX cpptraj \shape default will print an informational message but the calculation will proceed normally. + When determining residue connecivity, disulfide bonds will be ignored; + +\emph on +cpptraj +\emph default + identifies such bonds based on the +\series bold +namesg +\series default + atom name (default +\begin_inset Quotes eld +\end_inset + +SG +\begin_inset Quotes erd +\end_inset + +). \end_layout \begin_layout Standard From 48e39163749fb287ab6bdec922e6df921b196764 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Wed, 22 Apr 2020 15:57:07 -0400 Subject: [PATCH 34/39] Note that residues with no selected atoms in dssp are now skipped. --- doc/cpptraj.lyx | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/cpptraj.lyx b/doc/cpptraj.lyx index 29b8229753..cb3fb0d6d1 100644 --- a/doc/cpptraj.lyx +++ b/doc/cpptraj.lyx @@ -32120,6 +32120,7 @@ nameX cpptraj \shape default will print an informational message but the calculation will proceed normally. + If a residue has no atoms selected it will be skipped. When determining residue connecivity, disulfide bonds will be ignored; \emph on From 2fa035b4fb0a8ea6be79817b8c88a4b025b07d9d Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Wed, 22 Apr 2020 15:59:57 -0400 Subject: [PATCH 35/39] Add change removebonds to manual --- doc/cpptraj.lyx | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/doc/cpptraj.lyx b/doc/cpptraj.lyx index cb3fb0d6d1..79866d499b 100644 --- a/doc/cpptraj.lyx +++ b/doc/cpptraj.lyx @@ -11486,7 +11486,11 @@ change [parm | parmindex <#> | <#> | \end_layout \begin_layout LyX-Code - addbond [req ] } + addbond [req ] +\end_layout + +\begin_layout LyX-Code + removebonds [] } \end_layout \begin_deeper @@ -11629,6 +11633,20 @@ constant>] The bond force constant in kcal/mol*Angstrom. \end_layout \end_deeper +\begin_layout Description +removebonds +\begin_inset space ~ +\end_inset + + +\begin_inset space ~ +\end_inset + +[] Remove bonds from atoms in . + If also given, remove bonds between atoms in and atoms + in . +\end_layout + \end_deeper \begin_layout Standard Change specified parts of the specified topology. From 1db5aee1d9d9d52311aacafd8f963dd26490e280 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Wed, 22 Apr 2020 16:02:10 -0400 Subject: [PATCH 36/39] Add bonds nointrares to manual --- doc/cpptraj.lyx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/doc/cpptraj.lyx b/doc/cpptraj.lyx index 79866d499b..fce03c5958 100644 --- a/doc/cpptraj.lyx +++ b/doc/cpptraj.lyx @@ -11368,7 +11368,11 @@ bondinfo | bonds | printbonds \end_layout \begin_layout LyX-Code -bondinfo [parm | parmindex <#> | <#>] [] [] [out ] +bondinfo [parm | parmindex <#> | <#>] +\end_layout + +\begin_layout LyX-Code + [] [] [out ] [nointrares] \end_layout \begin_deeper @@ -11417,6 +11421,10 @@ parmindex ] File to print to (default STDOUT). \end_layout +\begin_layout Description +[nointrares] Do not print intra-residue bonds. +\end_layout + \end_deeper \begin_layout Standard Print bond information for atoms in for selected topology (first From afff29faf5d423d75113c07600a239779f3ccb35 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Wed, 22 Apr 2020 16:05:15 -0400 Subject: [PATCH 37/39] Add change removebonds out keyword to manual --- doc/cpptraj.lyx | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/doc/cpptraj.lyx b/doc/cpptraj.lyx index fce03c5958..3c1518735e 100644 --- a/doc/cpptraj.lyx +++ b/doc/cpptraj.lyx @@ -11498,7 +11498,7 @@ change [parm | parmindex <#> | <#> | \end_layout \begin_layout LyX-Code - removebonds [] } + removebonds [] [out ] } \end_layout \begin_deeper @@ -11655,6 +11655,17 @@ removebonds in . \end_layout +\begin_deeper +\begin_layout Description +[out +\begin_inset space ~ +\end_inset + +] If specified, write removed bonds to with format ' '. +\end_layout + +\end_deeper \end_deeper \begin_layout Standard Change specified parts of the specified topology. From e6abebcfdb9e8d0a65f97139a0e838c28287eca4 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Wed, 22 Apr 2020 16:07:01 -0400 Subject: [PATCH 38/39] Version change for makestructure additional keywords, change removebonds, dssp namesg, bonds nointrares. Minor version bump since dssp now skips residues that have no selected atoms. --- src/Version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Version.h b/src/Version.h index ad0bfc4585..1222020cf2 100644 --- a/src/Version.h +++ b/src/Version.h @@ -12,7 +12,7 @@ * Whenever a number that precedes is incremented, all subsequent * numbers should be reset to 0. */ -#define CPPTRAJ_INTERNAL_VERSION "V4.25.13" +#define CPPTRAJ_INTERNAL_VERSION "V4.26.0" /// PYTRAJ relies on this #define CPPTRAJ_VERSION_STRING CPPTRAJ_INTERNAL_VERSION #endif From c918572e19b1b91bad5c8ef79968d1401746914d Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Wed, 22 Apr 2020 16:13:36 -0400 Subject: [PATCH 39/39] Fix up change removebonds help --- src/Exec_Change.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Exec_Change.cpp b/src/Exec_Change.cpp index a6b206a2bc..fbe61e46e6 100644 --- a/src/Exec_Change.cpp +++ b/src/Exec_Change.cpp @@ -11,7 +11,7 @@ void Exec_Change::Help() const "\t chainid of to |\n" "\t atomname from to |\n" "\t addbond [req ] |\n" - "\t removebonds [] }\n" + "\t removebonds [] [out ]}\n" " Change specified parts of topology or topology of a COORDS data set.\n", DataSetList::TopArgs); }