diff --git a/gromos++/programs/0index.doxy b/gromos++/programs/0index.doxy index 1ad263ce..7193f1df 100644 --- a/gromos++/programs/0index.doxy +++ b/gromos++/programs/0index.doxy @@ -44,6 +44,7 @@ * - Drazen Petrov @anchor dp (dp) * - Anita de Ruiter @anchor adr (adr) * - Martina Setz @anchor ms (ms) + * - Stefan Bachmann @anchor sb (sb) *

* *

Available Programs:

@@ -60,6 +61,8 @@ * - @ref com_top combine molecular topology files into one * - @ref con_top convert topology to different force field version * - @ref copy_box repeats a simulation box in a given direction + * - @ref cos_dipole calculate molecular dipoles including COS charges + * - @ref cos_epsilon calculate relative permittivity and box dipole moment autocorrelations * - @ref cry perform symmetry operations on molecules * - @ref cry_rms perform RMSD and RMSF calculations based on crystallographic symmetry. * - @ref dfmult calculates multiple free energy differences diff --git a/gromos++/programs/Makefile.am b/gromos++/programs/Makefile.am index fd74cd02..18b9318f 100644 --- a/gromos++/programs/Makefile.am +++ b/gromos++/programs/Makefile.am @@ -105,7 +105,9 @@ bin_PROGRAMS = rmsd\ trs_ana\ dGslv_pbsolv\ dfgrid\ - contactnum + contactnum\ + cos_dipole\ + cos_epsilon nhoparam_SOURCES = nhoparam.cc frameout_SOURCES = frameout.cc @@ -207,6 +209,9 @@ trs_ana_SOURCES = trs_ana.cc dGslv_pbsolv_SOURCES = dGslv_pbsolv.cc dfgrid_SOURCES = dfgrid.cc contactnum_SOURCES = contactnum.cc +cos_dipole_SOURCES = cos_dipole.cc +cos_epsilon_SOURCES = cos_epsilon.cc + LDADD = $(top_builddir)/src/libgromos.la diff --git a/gromos++/programs/atominfo.cc b/gromos++/programs/atominfo.cc index 6bfe9673..8ee2ce3d 100644 --- a/gromos++/programs/atominfo.cc +++ b/gromos++/programs/atominfo.cc @@ -155,7 +155,7 @@ int main(int argc, char **argv){ << setw(12) << "Atom Code" << endl; - for(int i=0; i < as.size(); ++i){ + for(unsigned int i=0; i < as.size(); ++i){ if(as.atom()[i]->type()==utils::spec_virtual){ utils::AtomSpecifier conf=as.atom()[i]->conf(); cout << "----------------------------------------" @@ -202,7 +202,7 @@ int main(int argc, char **argv){ } - for(int j=0; j< conf.size(); ++j){ + for(unsigned int j=0; j< conf.size(); ++j){ cout << setw(13) << conf.toString(j) << setw(10) << conf.gromosAtom(j)+1 << setw(10) << conf.resnum(j)+1 diff --git a/gromos++/programs/bilayer_dist.cc b/gromos++/programs/bilayer_dist.cc index c52b7d14..1e133541 100644 --- a/gromos++/programs/bilayer_dist.cc +++ b/gromos++/programs/bilayer_dist.cc @@ -197,7 +197,7 @@ int main(int argc, char** argv) { min_d = -sys.box().M().abs()/2; // before was: cm[2]-sys.box()[2]/2; max_d = sys.box().M().abs()/2; - for(int i = 0; i < selection.size(); i++) { + for(unsigned int i = 0; i < selection.size(); i++) { Vec & vector1 = selection.pos(i); Vec dist = vector1 - pbc->nearestImage(vector1, cm, sys.box()); zcoord.push_back(dist[2]); diff --git a/gromos++/programs/check_box.cc b/gromos++/programs/check_box.cc index e105c762..a85fce96 100644 --- a/gromos++/programs/check_box.cc +++ b/gromos++/programs/check_box.cc @@ -149,7 +149,7 @@ int main(int argc, char **argv){ //init variables double overall_min_dist2=1e4; - int limit = 1; + unsigned int limit = 1; double cutoff = 1.4; double cutoff2 = cutoff*cutoff; bool no_cutoff=false; //do not report all distances @@ -359,12 +359,12 @@ int main(int argc, char **argv){ //if 2 neighbours have the same atoms (=there is only 1 cube total in this direction), only half of the distances must be calculated: bool skip=cubes.same_cube(c); - for(int i=0; i < cubes.cube_i_atomlist(c).size(); ++i ){ + for(unsigned int i=0; i < cubes.cube_i_atomlist(c).size(); ++i ){ int atom_i = cubes.cube_i_atomlist(c)[i]; Vec atom_i_pos = atoms.pos(atom_i); - int j=0; + unsigned int j=0; if(skip) j=i+1; @@ -438,7 +438,7 @@ int main(int argc, char **argv){ cout << "###" << endl; cout << "# Time Distance [nm] Atom A - Atom B Mol:Residue Atom A - Mol:Resiude Atom B" << endl; double itime=0; - for (int ii =0; ii < output.size(); ii++) { + for (unsigned int ii =0; ii < output.size(); ii++) { for(vec_it = output[ii].begin(); vec_it != output[ii].end(); ++vec_it){ if (read_time) itime=vec_it->time; diff --git a/gromos++/programs/close_pair.cc b/gromos++/programs/close_pair.cc index d4e76451..1e74c60a 100644 --- a/gromos++/programs/close_pair.cc +++ b/gromos++/programs/close_pair.cc @@ -148,10 +148,10 @@ int main(int argc, char **argv) { debug = atoi(args["debug"].c_str()); } if (debug == 1) { - for (int i = 0; i < groupA.size(); ++i) { + for (unsigned int i = 0; i < groupA.size(); ++i) { cout << "# groupA mol " << groupA.mol(i) << " size " << groupA.size() << endl; } - for (int j = 0; j < groupB.size(); ++j) { + for (unsigned int j = 0; j < groupB.size(); ++j) { cout << "# groupB mol " << groupB.mol(j) << " size " << groupB.size() << endl; } } @@ -224,7 +224,7 @@ int main(int argc, char **argv) { int pass = 1000; - for (int i = 0; i < groupA.size(); ++i) { + for (unsigned int i = 0; i < groupA.size(); ++i) { // skip hydrogen atoms int m = groupA.mol(i); @@ -236,7 +236,7 @@ int main(int argc, char **argv) { "atom name not specified properly."); if (m != pass && m > 0) if (groupA.mass(i) != 1.008) { - for (int j = 0; j < groupB.size(); ++j) { + for (unsigned int j = 0; j < groupB.size(); ++j) { if (debug >= 3) { cout << "# groupB size " << groupB.size() << endl; cout << "# molA " << groupA.mol(i) diff --git a/gromos++/programs/cog.cc b/gromos++/programs/cog.cc index 04785cef..7ff25a96 100644 --- a/gromos++/programs/cog.cc +++ b/gromos++/programs/cog.cc @@ -196,7 +196,7 @@ int main(int argc, char **argv){ } } - for(int a=0; a0) - debug=1; - if (args.count("pbc") <=0) { cout << "# WARNING: no @pbc argument found - no gathering will be done!"; } @@ -189,7 +185,7 @@ int main(int argc, char **argv){ // exclude atoms with given mass for (int i=atomgroup1.size()-1; i>=0 ; i--) { - for(int j=0; j=0 ; i--) { - for(int j=0; jnearestImage(atomgroup1.pos(i), atomgroup2.pos(j), sys.box()); double rdist=v.abs(); @@ -263,7 +259,7 @@ int main(int argc, char **argv){ ic.close(); } cout <<"# averages "; - for (int i=0; iarguments: + * + * + * + * + * + * + * + * + * + * + *
\@topo<molecular topology file>
\@pbc<boundary type> [<gather method>]
[\@time<@ref utils::Time "time and dt">]
[\@fac<conversion factor for the unit of the dipole, default: 1; use 48.032045 to convert from e*nm to Debye>]
[\@molecules<solute molecules to average over, e.g. 1-5,37,100-101>]
[\@solv<include solvent>]
[\@xyz<filename for writing out dipole x-,y-,z-components, Default: Mxyz.out>]
\@traj<trajectory files>
\@trs<special trajectory files with COS displacements>
+ * + * + * Example: + * @verbatim + cos_dipole + @topo ex.top + @pbc r + @fac 48.032045 + @molecules 1-5,8-10 + @solv + [@time 0 0.2] + @traj ex.trc + @trs ex.trs + @endverbatim + * + *
+ */ + +#include +#include +#include +#include +#include +#include + +#include "../src/args/Arguments.h" +#include "../src/args/BoundaryParser.h" +#include "../src/args/GatherParser.h" +#include "../src/fit/Reference.h" +#include "../src/gio/InG96.h" +#include "../src/gcore/System.h" +#include "../src/gcore/Molecule.h" +#include "../src/gcore/Box.h" +#include "../src/gio/InTopology.h" +#include "../src/bound/Boundary.h" +#include "../src/fit/PositionUtils.h" +#include "../src/gmath/Vec.h" +#include "../src/gmath/Correlation.h" +#include "../src/gmath/Physics.h" +#include "../src/utils/AtomSpecifier.h" +#include "../src/utils/groTime.h" +#include "../src/utils/parse.h" + +using namespace std; +using namespace fit; +using namespace gcore; +using namespace gio; +using namespace bound; +using namespace args; + +void get_atom_dipole(const AtomTopology ¤t_atom, Vec &atom_pos, + Vec &offsite_i, Vec &offsite_j, Vec &cosdispl, + int &pol_count, + Vec &mol_dip, Vec &fix_dip, Vec &ind_dip, + double &nchargepa) +{ + Vec pol_site_pos(0, 0, 0); + double pol_site_q = 0; + if (current_atom.isPolarisable()) + { + pol_count++; + if (current_atom.poloffsiteGamma() > 0.000001) + { + double off_set_gamma; + off_set_gamma = current_atom.poloffsiteGamma(); + + //position of the offset atom + pol_site_pos = atom_pos + off_set_gamma * + (offsite_i + offsite_j - 2 * atom_pos); + } + else + { + pol_site_pos = atom_pos; + } + pol_site_q = current_atom.charge() + (current_atom.cosCharge() * -1); + Vec cos_pos = pol_site_pos + cosdispl; + + // contribution of the cos charges with cos position + mol_dip += cos_pos * current_atom.cosCharge(); + ind_dip += cosdispl * current_atom.cosCharge(); + } + else + { + // case no polarisation nor offset + pol_site_pos = atom_pos; + pol_site_q = current_atom.charge(); + } + mol_dip += (pol_site_q - nchargepa) * pol_site_pos; + fix_dip += (current_atom.charge() - nchargepa) * pol_site_pos; +} + +int main(int argc, char **argv) +{ + + Argument_List knowns; + knowns << "topo" + << "pbc" + << "time" + << "molecules" + << "fac" + << "solv" + << "xyz" + << "traj" + << "trs"; + + string usage = "# " + string(argv[0]); + usage += "\n\t@topo \n"; + usage += "\t@pbc []\n"; + usage += "\t[@time