diff --git a/gromosXX/Makefile.am b/gromosXX/Makefile.am index 82433f12e..0abe4cd22 100644 --- a/gromosXX/Makefile.am +++ b/gromosXX/Makefile.am @@ -10,6 +10,7 @@ build: doc: doc/doxygen.conf.in sed "s//$(top_srcdir)/g" $(top_srcdir)/doc/doxygen.conf.in > doxygen.conf + python $(top_srcdir)/doc/generate_snippets.py $(top_srcdir)/src/io/parameter/in_parameter.cc $(top_srcdir)/src/io/topology/in_distanceres.cc > $(top_srcdir)/doc/snippets/snippets.cc mkdir -p doc doxygen doxygen.conf diff --git a/gromosXX/doc/generate_snippets.py b/gromosXX/doc/generate_snippets.py new file mode 100755 index 000000000..f8bdb2e6b --- /dev/null +++ b/gromosXX/doc/generate_snippets.py @@ -0,0 +1,25 @@ +#! /usr/bin/env python +# get lines containing the documentation example of a gromos block between 'INFO <<"' and '..\n";' +# and output them as snippets that can be referred to in doxygen comments using @snippet + +import sys, os + +if len(sys.argv) < 2: + sys.exit("USAGE: " + sys.argv[0] + " = 0) +# NPM NSM + 1 0 +END +//! [SYSTEM] + +//! [ENERGYMIN] +ENERGYMIN +# NTEM: 0..1 controls energy minimisation mode +# 0: do not do energy minimisation (default) +# 1: steepest-descent minimisation +# NCYC: >0 number of steps before resetting of conjugate-gradient search direction (not in use !!) +# DELE: >0.0 energy threshold for convergence +# DX0: > 0.0 initial step size +# DXM: > 0.0 maximum step size +# NMIN > 0 minimum number of minimisation steps +# FLIM >= 0.0 limit force to maximum value (FLIM > 0.0 is not recommended). +# NTEM NCYC DELE DX0 DXM NMIN FLIM + 1 0 0.1 0.01 0.05 1 0 +END +//! [ENERGYMIN] + +//! [STEP] +STEP +# NSTLIM >0 number of steps +# T >=0 initial time +# -1 read time from configuration file +# DT >0 time step +# +# NSTLIM T DT + 100 0.0 0.005 +END +//! [STEP] + +//! [CONSTRAINT] +CONSTRAINT +# NTC +# 1 solvent solvent only +# 2 hydrogen solvent and solute bonds containing hydrogens and +# constraints in the topology's CONSTRAINTS block +# 3 all solvent and solute all bonds +# 4 specified solvent and constraints in the topology's CONSTRAINTS block + 3 +# NTCP: solute algorithm +# 1 shake +# 2 lincs +# 3 flexshake +# NTCP + 1 +# NTCP0(1)..(3): algorithm options +# - shake: tolerance +# - lincs: order +# - flexshake: tolerance, readin, order +# NTCP0(1) NTCP0(2) NTCP0(3) + 0.0001 +# NTCS: solvent algorithm +# 1 shake +# 2 lincs +# 3 flexshake +# 4 settle +# 5 m_shake (only implemented for water and methanol!) +# 6 gpu_shake +# NTCS + 1 +# NTCS0(1): algorithm options +# - shake: tolerance +# - lincs: order +# - flexshake: tolerance, readin, order +# - settle: no arguments +# - m_shake: tolerance +# NTCS0(1) + 0.0001 +# NTCG: Number of GPUs +# NTCD: Device number of the GPU +# NTCG NTCD + 1 0 +END +//! [CONSTRAINT] + +//! [PRINTOUT] +PRINTOUT +# NTPR: print out energies, etc. every NTPR steps +# NTPP: =1 perform dihedral angle transition monitoring +# NTPR NTPP + 0 0 +END +//! [PRINTOUT] + +//! [WRITETRAJ] +WRITETRAJ +# NTWX controls writing of coordinate trajectory +# 0: no coordinate trajectory is written (default) +# >0: write solute and solvent coordinates every NTWX steps +# <0: write solute coordinates every |NTWX| steps +# NTWSE >= 0 selection criteria for coordinate trajectory writing +# 0: write normal coordinate trajectory +# >0: write minimum-energy coordinate and energy trajectory (based on the +# energy entry selected by NTWSE and as blocks of length NTWX) +# (see configuration/energy.cc or ene_ana library for indices) +# NTWV controls writing of velocity trajectory +# 0: no velocity trajectory is written (default) +# >0: write solute and solvent velocities every NTWV steps +# <0: write solute velocities every |NTWV| steps +# NTWF controls writing of force trajectory +# 0: no force trajectory is written (default) +# >0: write solute and solvent forces every NTWF steps +# <0: write solute forces every |NTWF| steps +# NTWE >= 0 controls writing of energy trajectory +# 0: no energy trajectory is written (default) +# >0: write energy trajectory every NTWE steps +# NTWG >= 0 controls writing of free energy trajectory +# 0: no free energy trajectory is written (default) +# >0: write free energy trajectory every NTWG steps +# NTWB >= 0 controls writing of block-averaged energy trajectory +# 0: no block averaged energy trajectory is written (default) +# >0: write block-averaged energy variables every |NTWB| steps +# (and free energies if NTWG > 0) trajectory +# +# NTWX NTWSE NTWV NTWF NTWE NTWG NTWB + 100 0 0 0 100 0 100 +END +//! [WRITETRAJ] + +//! [PRESSURESCALE] +PRESSURESCALE +# COUPLE: off(0), calc(1), scale(2) +# SCALE: off(0), iso(1), aniso(2), full(3), semianiso(4) +# VIRIAL: none(0), atomic(1), group(2) +# +# COUPLE SCALE COMP TAUP VIRIAL + calc iso 4.575E-4 0.5 atomic +# SEMI (semianisotropic couplings: X, Y, Z) +# e.g. 1 1 2: x and y jointly coupled and z separately coupled +# e.g. 0 0 1: constant area (xy-plane) and z coupled to a bath + 1 1 2 +# reference pressure + 0.06102 0.00000 0.00000 + 0.00000 0.06102 0.00000 + 0.00000 0.00000 0.06102 +END +//! [PRESSURESCALE] + +//! [BOUNDCOND] +BOUNDCOND +# NTB: boundary conditions +# -1 : truncated octahedral +# 0 : vacuum +# 1 : rectangular +# 2 : triclinic +# NDFMIN: number of degrees of freedom subtracted for temperature +# +# NTB NDFMIN + 1 0 +END +//! [BOUNDCOND] + +//! [PERTURBATION] +PERTURBATION +# NTG: 0..1 controls use of free-energy calculation. +# 0: no free-energy calculation (default) +# 1: calculate dH/dRLAM +# NRDGL: 0,1 controls reading of initial value for RLAM. +# 0: use initial RLAM parameter from PERTURBATION block +# 1: read from configuration +# RLAM: 0.0..1.0 initial value for lambda +# DLAMT: >= 0.0 rate of lambda increase in time. +# ALPHLJ: >= 0.0 Lennard-Jones soft-core parameter +# ALPHC: >= 0.0 Coulomb-RF soft-core parameter +# NLAM: > 0 power dependence of lambda coupling +# NSCALE: 0..2 controls use of interaction scaling +# 0: no interaction scaling +# 1: interaction scaling +# 2: perturbation for all atom pairs with scaled +# interactions. No perturbation for others. +# +# NTG NRDGL RLAM DLAMT + 0 0 0.0 0.0 +# ALPHLJ ALPHC NLAM NSCALE + 0.0 0.0 1 0 +END +//! [PERTURBATION] + +//! [FORCE] +FORCE +# NTF(1..6): 0,1 determines terms used in force calculation +# 0: do not include terms +# 1: include terms +# NEGR: ABS(NEGR): number of energy groups +# > 0: use energy groups +# < 0: use energy and force groups +# NRE(1..NEGR): >= 1 last atom in each energy group +# NTF(1) NTF(2) NTF(3) NTF(4) NTF(5) NTF(6) +# bonds angles improper dihedral electrostatic vdW + 0 1 1 1 1 1 +# NEGR NRE(1) NRE(2) ... NRE(NEGR) + 1 60 +END +//! [FORCE] + +//! [COVALENTFORM] +COVALENTFORM +# NTBBH: 0,1 controls bond-stretching potential +# 0: quartic form (default) +# 1: harmonic form +# NTBAH: 0,1 controls bond-angle bending potential +# 0: cosine-harmonic (default) +# 1: harmonic +# NTBDN: 0,1 controls torsional dihedral potential +# 0: arbitrary phase shifts (default) +# 1: phase shifts limited to 0 and 180 degrees. +# NTBBH NTBAH NTBDN + 0 0 0 +END +//! [COVALENTFORM] + +//! [INITIALISE] +INITIALISE +# NTIVEL: 0,1 controls generation of initial velocities. +# 0: read from configuration (default) +# 1: generate from Maxell distribution at temperature TEMPI +# NTISHK: 0..3 controls shaking of initial configuration +# 0: no intial SHAKE (default) +# 1: initial SHAKE on coordinates only +# 2: initial SHAKE on velocities only +# 3: initial SHAKE on coordinates and velocities +# NTINHT: 0,1 controls generation of initial Nose-Hoover chain variables +# 0: read from configuration (default) +# 1: reset variables to zero. +# NTINHB: 0,1 controls generation of initial Nose-Hoover (chain) barostat +# variables +# 0: read from strartup file (if applicable) (default) +# 1: reset variables to zero +# NTISHI: 0,1 controls initial setting for lattice shift vectors +# 0: read from configuration (default) +# 1: reset shifts to zero. +# NTIRTC: 0,1 controls initial setting of positions and orientations for +# roto-translational constraints +# 0: read from configuration (default) +# 1: reset based on initial configuraion of startup file +# NTICOM: 0,1 controls initial removal of COM motion +# 0: no initial system COM motion removal (default) +# 1: initial COM translation is removed +# 2: initial COM rotation is removed +# NTISTI: 0,1 controls generation of stochastic integrals +# 0: read stochastic integrals and IG from configuration (default) +# 1: set stochastic integrals to zero and use IG from here. +# IG: random number generator seed +# TEMPI: initial temperature +# +# NTIVEL NTISHK NTINHT NTINHB + 0 0 0 0 +# NTISHI NTIRTC NTICOM + 0 0 0 +# NTISTI + 0 +# IG TEMPI + 0 0.0 +END +//! [INITIALISE] + +//! [COMTRANSROT] +COMTRANSROT +# NSCM : controls system centre-of-mass (com) motion removal +# 0: no com motion removal (default) +# < 0: com translation and rotation are removed every abs(NSCM) +# steps. +# > 0: com translation is removed every NSCM steps. +# NSCM + 0 +END +//! [COMTRANSROT] + +//! [HOOMD] +HOOMD +# PROCESSOR: cpu gpus +# +# PROCESSOR + gpus +END +//! [HOOMD] + +//! [PAIRLIST] +PAIRLIST +# ALGORITHM standard(0) (gromos96 like pairlist) +# grid(1) (md++ grid pairlist) +# grid_cell(2) (creates a mask) +# NSNB >0 frequency (number of steps) a pairlist is constructed +# RCUTP >0.0 short-range cut-off in twin-range +# RCUTL >0.0 intermediate-range cut-off in twin-range +# SIZE >0 grid cell size (or auto = 0.5 * RCUTP) +# TYPE chargegoup(0) (chargegroup based cutoff) +# atomic(1) (atom based cutoff) +# +# ALGORITHM NSNB RCUTP RCUTL SIZE TYPE + grid 5 0.8 1.4 auto chargegroup +# +END +//! [PAIRLIST] + +//! [CGRAIN] +CGRAIN +# NTCGRAN 0..3 coarse grain selection +# 0: atomistic (off) +# 1: coarse-grained using MARTINI model (on) +# 2: coarse-grained using GROMOS model (on) +# 3: mixed-grained using GROMOS model (on) +# EPS >= 0.0 dielectric constant for coarse grained coulombic interaction +# EPSM >= 0.0 dielectric constant for mixed CG-FG coulombic interaction +# NTCGRAN EPS EPSM + 1 20 1 +END +//! [CGRAIN] + +//! [MULTIBATH] +MULTIBATH +# NTBTYP: temperature coupling algorithm +# weak-coupling(0) +# nose-hoover(1) +# nose-hoover-chains(2) num +# (where num is the number of chains to use) +# NTBTYP NUM + nose-hoover-chains 3 +# NBATHS: number of baths + 2 +# TEMP0 TAU + 300 0.10 + 300 0.10 +# DOFSET: number of different couplings + 1 +# LAST COM-BATH IR-BATH + 60 1 2 +# (this couples the first 60 atoms com motion to bath 1 and +# the internal / rotational motion to bath 2) +END +//! [MULTIBATH] + +//! [POSITIONRES] +POSITIONRES +# NTPOR 0..3 controls atom positions re(con)straining. +# 0: no position re(con)straints (default) +# 1: restraining with force constant CPOR +# 2: restraining with force constant CPOR weighted by +# atomic B-factors +# 3: constraining +# NTPORB 0,1 controls reading of reference positions and +# B-factors +# 0: read reference positions from startup file. +# 1: read reference positions and B-factors from +# special file +# NTPORS 0,1 controls scaling of reference positions upon +# pressure scaling +# 0: do not scale reference positions +# 1: scale reference positions +# CPOR >= 0 position restraining force constant +# +# NTPOR NTPORB NTPORS CPOR + 0 0 0 2.5E4 +END +//! [POSITIONRES] + +//! [XRAYRES] +XRAYRES +# NTXR -2: time-averaged electron density restraints +# -1: instantaneous electron density restraints +# 0: no xray restraints. +# 1: instantaneous structure factor restraints +# 2: time-averaged structure factor restraints +# 3: biquadratic/timeaveraged structure factor restraints +# NTXLE 0: do not perform local elevation +# 1: do perform local elevation +# CXR >= 0 xray restraining force constant +# NTWXR >= 0 write xray data to output file +# 0: don't write xray data +# > 0 write every NTPXRth step +# NTWDE 0..3 write density-maps +# 0: write nothing +# 1: write electron densitiy map +# 2: write asymmetric-unit-only electron densitiy map +# 3: write both +# NTWXM >= 0 write every NTWXMth step electron density map(s) to external file +# CXTAU >=0 xray time-average restraining memory-constant +# RDAVG 0/1 read sf-timeaverages (from job to job) +# +# NTXR NTXLE CXR NTWXR NTWDE NTWXM CXTAU RDAVG + 0 0 0.0 0 0 0 0.0 0 +END +//! [XRAYRES] + +//! [DISTANCERES] +DISTANCERES +# NTDIR -2..2 controls distance restraining +# 0: no distance restraining (default) +# 1: instantaneous, using force constant CDIR +# 2: instantaneous, using force constant CDIR x W0 +# -1: time-averaged, using force constant CDIR +# -2: time-averaged, using force constant CDIR x W0 +# NTDIRA 0,1 controls values for initial distance averages +# 0: generate initial averages +# 1: read from configuration +# CDIR >= 0.0 force constant for distance restraining +# DIR0 > 0.0 distance offset in restraining function +# TAUDIR >= 0.0 coupling time for time averaging +# FORCESCALE 0..2 controls approximation of force scaling +# 0: approximate d/dr = 1 +# 1: approximate d/dr = (1.0 - exp(-Dt/tau)) +# 2: use d/dr = (1.0 - exp(-Dt/tau))*(/r)^4 +# VDIR 0,1 controls contribution to virial +# 0: no contribution +# 1: distance restraints contribute to virial +# NTWDIR >= 0 write every NTWDIRth step dist. restr. information to external file +# NTDIR NTDIRA CDIR DIR0 TAUDIR FORCESCALE VDIR NTWDIR + 0 0 0.0 1.0 0.0 0 0 0 +END +//! [DISTANCERES] + +//! [DISTANCEFIELD] +DISTANCEFIELD +# NTDFR 0,1 controls distance field restraining +# 0: no distance field restraining (default) +# 1: apply distance field restraining +# GRID > 0.0 grid size for distance field +# PROTEINOFFSET >= 0 penalty for distances through the host +# PROTEINCUTOFF >= 0 distance to protein atoms to be considered inside +# PROTECT >= 0 protect grid points within this radius around the zero-distance +# point from being flagged as protein +# UPDATE > 0 update frequency for grid +# RL >= 0 linearize forces for distances larger than RL +# SMOOTH >= 0 smoothen the protein boundary after grid construction +# by SMOOTH layers +# NTWDF >= 0 write every NTWDF step disfield information to external file +# PRINTGRID = 0,1 write grid to final configuration file +# +# NTDFR + 1 +# GRID PROTEINOFFSET PROTEINCUTOFF PROTECT + 0.2 15 0.2 0 +# UPDATE SMOOTH RL NTWDF PRINTGRID + 100 1 1.0 50 0 +END +//! [DISTANCEFIELD] + +//! [DIHEDRALRES] +DIHEDRALRES +# NTDLR 0...3 controls dihedral-angle restraining and constraining +# 0: off [default] +# 1: dihedral restraining using CDLR +# 2: dihedral restraining using CDLR * WDLR +# 3: dihedral constraining +# +# CDLR >=0.0 force constant for dihedral restraining [kJ/mol/degree^2] +# PHILIN >0.0 deviation after which the potential energy function is linearized +# NTWDLR >=0 write every NTWDLR step dihedral information to external file +# +# NTDLR CDLR PHILIN NTWDLR + 1 100.0 180.0 100 +END +//! [DIHEDRALRES] + +//! [JVALUERES] +JVALUERES +# NTJVR -3..2 +# -3 biquadratic using CJVR * WJVR +# -2 time-averaged using CJVR * WJVR +# -1 time-avaraged using CJVR +# 0 no J-value restraints [default] +# 1 instantaneous using CJVR +# 2 instantaneous using CJVR * WJVR +# NTJVRA 0 controls reading of averages from startup file +# 0 start from initial values of J0 [default] +# 1 read time averages from startup file (for continuation time-averaged run) +# CJVR >= 0 J-value restraining force constant +# (weighted by individual WJVR) +# TAUJVR >= 0 coupling time for time-averaging +# NJVRTARS 0,1 omits or includes force scaling by memory decay factor in case of time-averaging +# 0 omit factor (set (1 - exp(-Dt/tau)) = 1) +# 1 scale force by (1 - exp(-Dt/tau)) +# NJVRBIQW 0..2 controls weights (X in Eq. 19 of MD98.17) of the two terms in biquadratic restraining +# 0 X = 1 +# 1 X = (1 - exp(-Dt/tau)) +# 2 X = 0 +# LE 0,1 local elevation restraining +# 0 local elevation off [default] +# 1 local elevation on +# NGRID > 1 number of grid points in local elevation restraining +# DELTA >= 0.0 no elevation of potential if J is within DELTA of J0 +# NTWJV >= 0 write J-value averages and LE grid to special trajectory +# 0 don't write [default] +# > 0 write every NTWJVth step +# +# NTJVR NTJVRA CJVR TAUJVR NJVRTARS NJVRBIQW LE NGRID DELTA NTWJV + -3 0 10.0 5.0 0 0 1 16 0.5 0 +END +//! [JVALUERES] + +//! [ORDERPARAMRES] +ORDERPARAMRES +# NTOPR -2..2 +# -2 time-averaged using COPR * WOPR +# -1 time-averaged using COPR +# 0 no order-parameter restraints [default] +# 1 window-averaged using COPR +# 2 window-averaged using COPR * WOPR +# NTOPRA 0 controls reading of averages from startup file +# 0 start from initial values of S0 [default] +# 1 read time averages from startup file (for continuation time-averaged run) +# COPR >= 0.0 order-parameter restraining force constant +# (weighted by individual WOPR) +# TAUOPR >= 0.0 coupling time for time-averaging +# UPDOPR > 0 update average every UPDOPRth step +# NTWOP >= 0 write order-parameter to special trajectory +# 0 don't write [default] +# > 0 write every NTWOP step +# +# NTOPR NTOPRA COPR TAUOPR UPDOPR NTWOP + -2 0 10.0 5.0 1 0 +END +//! [ORDERPARAMRES] + +//! [RDCRES] +RDCRES +# NTRDCR -4..2 RDC restraining +# -4: biquadratic using CRDCR * WRDCR +# -3: biquadratic using CRDCR +# -2: time averaged using CRDCR * WRDCR +# -1: time averaged using CRDCR +# 0: no RDC restraints [default] +# 1: instantaneous using CRDCR +# 2: instantaneous using CRDCR * WRDCR +# NTRDCRA 0,1 controls reading of average RDCs +# 0: take initial values RDC0 from the RDC restraint file +# 1: read time averages from initial coordinate file +# (for continuation run) +# +# NTRDCT 0..2 Type of alignment representation +# 0: cartesian magnetic field vectors +# 1: alignment tensor +# 2: spherical harmonics +# NTALR 0,1 controls reading of values in the chosen representation +# 0: start from values given in RDC restraint file +# 1: read values from initial coordinate file (for continuation run) +# +# METHOD 0..2 Method of updating the magnetic field vectors +# 0: Energy minimisation +# 1: Stochastic dynamics +# 2: Molecular dynamics +# EMGRAD > 0.0 (METHOD = 0, EM) stop minimisation if gradient is below EMGRAD +# EMDX0 > 0.0 (METHOD = 0, EM) initial step size +# EMNMAX > 0 (METHOD = 0, EM) maximum number of minimisation steps +# SDCFRIC >= 0.0 (METHOD = 1, SD) global friction coefficient gamma +# TEMP >= 0.0 temperature of stochastic bath (SD) and temperature used for initial velocities (MD, SD) +# DELTA >= 0 the flatbottom potential is 2 DELTA wide [ps^-1] +# CRDCR >= 0 RDC restraining force constant [kJ*ps^2] +# (weighted by individual WRDCR) +# TAU >= 0 coupling time for time averaging [ps] +# NRDCRTARS 0,1 omits or includes force scaling by memory decay factor in case of time-averaging +# 0 omit factor (set (1-exp(-dt/tau))=1 ) +# 1 scale force by (1-exp(-dt/tau)) +# NRDCRBIQW 0..2 controls weights of the two terms in biquadratic restraining +# 0 X = 1 +# 1 X = (1 - exp(-dt/tau)) +# 2 X = 0 +# NTWRDC >= 0 write output to special trajectory +# 0: don't write +# >0: write every NTWRDCth step. +# +# NTRDCR NTRDCRA NTRDCT NTALR METHOD + 2 0 0 0 0 +# EMGRAD EMDX0 EMNMAX SDCFRIC TEMP DELTA CRDCR TAU NRDCRTARS NRDCRBIQW NTWRDC NTWRDC + 0.001 0.01 1000 20 300 0 1 1 0 0 0 10000 +END +//! [RDCRES] + +//! [PERSCALE] +PERSCALE +# RESTYPE special energy term to which periodic scaling should +# be applied +# 0 don't apply periodic scaling +# 1 apply periodic scaling to J-value restraints +# +# parameters for periodic scaling of J-value restraints +# KDIH >= 0 maximum scaling factor for dihedral angle potential +# KJ >= 0 maximum scaling factor for J-Value restraint potential +# T >= 0 period of cosine scaling function +# DIFF >= 0 minimum deviation from target value at which to start +# scaling period +# RATIO >= 0 minimum fraction of T that needs to be passed before +# starting a new scaling period +# READ 0,1 controls reading of scaling parameters +# 0 reset scaling parameters +# 1 read from configuration +# +# RESTYPE + 0 +# KDIH KJ T DIFF RATIO READ + 0.1 0.1 0.2 0.7 1.0 0 +END +//! [PERSCALE] + +//! [ROTTRANS] +ROTTRANS +# roto-translational constraints +# use either centre of mass removal or roto-translational constraints +# not both! +# +# RTC: 0,1 controls roto-translational constraints +# 0 don't use roto-translational constraints (default) +# 1 use roto-translational constraints +# RTCLAST: last atom to be roto-translationally constrained +# RTC RTCLAST + 1 1155 +END +//! [ROTTRANS] + +//! [INNERLOOP] +INNERLOOP +# NTILM: 0..4, acceleration method used +# 0: use standard solvent loops [default] +# 1: use fast generic solvent loops +# 2: use solvent loops with hardcoded parameters +# 3: use solvent loops with tabulated forces and energies +# 4: use solvent loops with CUDA library +# NTILS: 0..1, solvent used +# 0: use topology [default] +# 1: use SPC +# NGPUS: number of GPUs to use +# NDEVG: Which GPU device number to use. If not given driver will determine. +# NTILM NTILS NGPUS NDEVG + 4 0 2 0 1 +END +//! [INNERLOOP] + +//! [REPLICA] +REPLICA +# NRET >= 1 number of replica exchange temperatures +# RET() >= 0.0 temperature for each replica +# LRESCALE 0,1 controls temperature scaling +# 0 don't scale temperatures after exchange trial +# 1 scale temperatures after exchange trial +# NRELAM >= 1 number of replica exchange lambda values +# RELAM() >= 0.0 lambda value for each lambda-replica +# RETS() >= 0.0 timestep of each lambda-replica +# NRETRIAL >= 0 number of overall exchange trials +# NREQUIL >= 0 number of exchange periods to equilibrate +# (disallow switches) +# CONT >= 0 continuation run +# 0 start from one configuration file +# 1 start from multiple configuration files +# +# NRET + 10 +# RET(1..NRET) + 300.0 320.0 340.0 360.0 380.0 + 400.0 420.0 440.0 460.0 480.0 +# LRESCALE + 1 +# NRELAM + 10 +# RELAM(1..NRELAM) + 0.0 0.1 0.2 0.3 0.4 + 0.5 0.6 0.7 0.8 0.9 +# RETS(1..NRELAM) + 0.002 0.001 0.001 0.001 0.002 + 0.003 0.002 0.001 0.001 0.002 +# NERTRIAL + 100 +# NREQUIL + 10 +# CONT + 0 +END +//! [REPLICA] + +//! [MULTICELL] +MULTICELL +# NTM: 0,1 switch for multiple-unit-cell simulation. +# 0 : single-unit-cell simulation [default] +# 1 : multiple-unit-cell simulation +# NTM + 0 +# number of subdivisions along axis +# NCELLA NCELLB NCELLC + 1 1 1 +# periodicity checks (relative tolerance) +# not available in md++ -> 0.0 +# TOLPX TOLPV TOLPF TOLPFW + 0.0 0.0 0.0 0.0 +END +//! [MULTICELL] + +//! [READTRAJ] +READTRAJ +# NTRD 0,1 controls trajectory-reevaluation mode +# 0: do not use trajectory-reevaluation mode (default) +# 1: use trajectory-reevaluation mode +# NTRN number of files (ignored) +# NTRB read box (must be 1) +# NTSHK 0,1 controls SHAKE on old coordinates +# 0 perform SHAKE with respect to previous coordinates +# 1 perform SHAKE with respect to current coordinates +# +# NTRD NTRN NTRB NTSHK + 0 0 1 0 +END +//! [READTRAJ] + +//! [INTEGRATE] +INTEGRATE +# NINT 0..1 selects integration method +# 0: no integration performed +# 1: leap-frog integration scheme performed (default) +# +# NINT + 1 +END +//! [INTEGRATE] + +//! [STOCHDYN] +STOCHDYN +# NTSD 0,1 controls stochastic dynamics mode +# 0: do not do stochastic dynamics (default) +# 1: do stochastic dynamics +# NTFR 0..3 defines atomic friction coefficients gamma +# 0: set gamma to 0.0 (default) +# 1: set gamma to CFRIC +# 2: set gamma to CFRIC*GAM0 +# 3: set gamma to CFRIC*w where w approximates the solvent-accessible +# surface area as described in the Stochastic Dynamics Chapter in Vol.2 of the manual +# NSFR > 0 recalculate gamma every NSFR steps +# NBREF > 0 threshold number of neighbour atoms for a buried atom +# RCUTF >= 0.0 interatomic distance considered when calculating gamma +# CFRIC >= 0.0 global weighting for gamma +# TEMPSD >= 0.0 temperature of stochastic bath +# +# NTSD NTFR NSFR NBREF RCUTF CFRIC TEMPSD + 0 1 0 6 0.3 91.0 300.0 +END +//! [STOCHDYN] + +//! [EWARN] +EWARN +# MAXENER issue a warning if total energy is larger than this value +# +# MAXENER + 100000 +END +//! [EWARN] + +//! [MULTISTEP] +MULTISTEP +# STEPS calculate non-bonded every STEPSth step. +# BOOST 0,1 +# 0: stored forces of STEPSth step are added every step +# 1: stored forces of STEPSth setp are multiplied by STEPS +# and added every STEPSth step (default) +# +# STEPS BOOST + 0 0 +END +//! [MULTISTEP] + +//! [CHEMICALMONTECARLO] +CHEMICALMONTECARLO +# +# MC MCSTEPS MCDLAM + 0 1 0.5 +END +//! [CHEMICALMONTECARLO] + +//! [POLARISE] +POLARISE +# COS 0,1,2 use polarisation +# 0: don't use polarisation (default) +# 1: use charge-on-spring model for dipolar polarisation +# 2: use charge-on-spring model for dipolar polarisation with off atom site +# EFIELD 0,1 controls evaluation site for electric field +# 0: evaluate at atom position +# 1: evaluate at cos position +# MINFIELD >0.0 convergence criterium +# DAMP 0,1 controls polarisability damping +# 0: don't damp polarisability +# 1: damp polarisability (with paramaters from topology) +# WRITE > 0 write COS positions to special trajectory +# 0: don't write +# >0: write COS positions every WRITEth step +# +# COS EFIELD MINFIELD DAMP WRITE + 0 0 2.5 0 0 +END +//! [POLARISE] + +//! [RANDOMNUMBERS] +RANDOMNUMBERS +# NTRNG 0,1 random number generator +# 0 use G96 algorithm (default) +# 1 use GSL library +# NTGSL -1.. GSL random number generation algorithm +# -1: use default algorithm (mt19937) +# >=0 : run contrib/rng_gsl for a list of possible arguments +# +# NTRNG NTGSL + 1 -1 +END +//! [RANDOMNUMBERS] + +//! [EDS] +EDS +# EDS 0,1 +# 0: no enveloping distribution sampling (EDS) [default] +# 1: enveloping distribution sampling +# ALPHLJ: >= 0.0 Lennard-Jones soft-core parameter +# ALPHC: >= 0.0 Coulomb-RF soft-core parameter +# FORM 1-3 +# 1: Single s Hamiltonian +# 2: Hamiltonian with NUMSTATES*(NUMSTATES-1)/2 (pairwise) S parameters +# 3: Hamiltonian with (NUMSTATES-1) S parameters +# NUMSTATES >1 : number of states +# if NUMSTATES != 3: +# S >0.0: smoothness parameter(s) +# if NUMSTATES == 3: +# i j S : state pair i j and associated s parameter +# EIR : energy offsets for states +# +# EDS + 1 +# ALPHLJ ALPHC FORM NUMSTATES + 0.0 0.0 2 3 +# S + 0.2 0.01 0.1 +# EIR + 0 20 40 +# +# ---- OR: example for FORM = 3: +# +# EDS + 1 +# ALPHLJ ALPHC FORM NUMSTATES + 0.0 0.0 3 3 +# i j S + 1 2 0.1 + 2 3 0.5 +# EIR + 0 20 40 +END +//! [EDS] + +//! [LAMBDAS] +LAMBDAS +# NTIL off(0), on(1) +# 0: no special treatment of interactions with individual lambda-values +# 1: interactions are treated with special individual lambda-values +# NTLI(1..) interaction type to treat with individual lambda: +# bond(1), angle(2), dihedral(3), improper(4), vdw(5), vdw_soft(6), +# crf(7), crf_soft(8), distanceres(9), distancefield(10), +# dihedralres(11), mass(12) +# NILG1, NILG2 energy groups of interactions that are treated with individual +# lambda values +# ALI, BLI, CLI, DLI, ELI polynomial coefficients linking the individual lambda- +# values to the overall lambda-value +# NTIL + 1 +# NTLI NILG1 NILG2 ALI BLI CLI DLI ELI + 7 1 3 0 0 1 0 0 +END +//! [LAMBDAS] + +//! [PRECALCLAM] +PRECALCLAM +# NRLAM 0 : off +# >1 : precalculating energies for NRLAM extra lambda values +# MINLAM between 0 and 1: minimum lambda value to precalculate energies +# MAXLAM between MINLAM and 1: maximum lambda value to precalculate energies +# NRLAM MINLAM MAXLAM + 100 0.0 1.0 +END +//! [PRECALCLAM] + +//! [NONBONDED] +NONBONDED +# NLRELE 1-3 method to handle electrostatic interactions +# -1 : reaction-field (LSERF compatibility mode) +# 0 : no electrostatic interactions +# 1 : reaction-field +# 2 : Ewald method +# 3 : P3M method +# APPAK >= 0.0 reaction-field inverse Debye screening length +# RCRF >= 0.0 reaction-field radius +# 0.0 : set to infinity +# EPSRF = 0.0 || > 1.0 reaction-field permittivity +# 0.0 : set to infinity +# NSLFEXCL 0,1 contribution of excluded atoms to reaction field +# 0 : contribution turned off +# 1 : contribution considered (default) +# NSHAPE -1..10 lattice sum charge-shaping function +# -1 : gaussian +# 0..10 : polynomial +# ASHAPE > 0.0 width of the lattice sum charge-shaping function +# NA2CALC 0..4 controls evaluation of lattice sum A2 term +# 0 : A2 = A2~ = 0 +# 1 : A2~ exact, A2 = A2~ +# 2 : A2 numerical, A2~ = A2 +# 3 : A2~ exact from Ewald or from mesh and atom coords, A2 numerical +# 4 : A2~ averaged from mesh only, A2 numerical +# TOLA2 > 0.0 tolerance for numerical A2 evaluation +# EPSLS = 0.0 || > 1.0 lattice sum permittivity (0.0 = tinfoil) +# NKX, NKY, NKZ > 0 maximum absolute Ewald k-vector components +# KCUT > 0.0 Ewald k-space cutoff +# NGX, NGY, NGZ > 0 P3M number of grid points +# NASORD 1..5 order of mesh charge assignment function +# NFDORD 0..5 order of the mesh finite difference operator +# 0 : ik - differentiation +# 1..5 : finite differentiation +# NALIAS > 0 number of mesh alias vectors considered +# NSPORD order of SPME B-spline functions (not available) +# NQEVAL >= 0 controls accuracy reevaluation +# 0 : do not reevaluate +# > 0 : evaluate every NQEVAL steps +# FACCUR > 0.0 rms force error threshold to recompute influence function +# NRDGRD 0,1 read influence function +# 0 : calculate influence function at simulation start up +# 1 : read influence function from file (not yet implemented) +# NWRGRD 0,1 write influence function +# 0 : do not write +# 1 : write at the end of the simulation (not yet implemented) +# NLRLJ 0,1 controls long-range Lennard-Jones corrections +# 0 : no corrections +# 1 : do corrections (not yet implemented) +# SLVDNS > 0.0 average solvent density for long-range LJ correction (ignored) +# +# NLRELE + 1 +# APPAK RCRF EPSRF NSLFEXCL + 0.0 1.4 61.0 1 +# NSHAPE ASHAPE NA2CLC TOLA2 EPSLS + -1 1.4 2 0.1E-9 0.0 +# NKX NKY NKZ KCUT + 10 10 10 100.0 +# NGX NGY NGZ NASORD NFDORD NALIAS NSPORD + 32 32 32 3 2 3 4 +# NQEVAL FACCUR NRDGRD NWRGDR + 100000 1.6 0 0 +# NLRLJ SLVDNS + 0 33.3 +END +//! [NONBONDED] + +//! [SASA] +SASA +# NTSASA +# 0 : not used (default) +# 1 : use SASA implicit solvent model +# NTVOL +# 0 : not used (default) +# 1 : use VOLUME correction to SASA implicit solvent model (requires NTSASA = 1) +# P_12 >= 0, <= 1 pair parameter for SASA reduction for first neighbours +# P_13 >= 0, <= 1 pair parameter for SASA reduction for second neighbours +# P_1X >= 0, <= 1 pair parameter for SASA reduction for third and higher neighbours +# SIGMAV >0 scaling parameter for volume energy term (kJ.mol^-1.nm^-3) +# RSOLV > 0 radius of solvent molecule for SASA calculation (nm) +# AS1 > 0 an atom with SASA below this contributes to the VOLUME correction (nm^2) +# AS2 > 0 an atom with SASA above this is not considered for the VOLUME correction (nm^2) +# atoms with AS1 < SASA < AS2 have a partial contribution determined by a switching function +# NTSASA NTVOL P_12 P_13 P_1X SIGMAV RSOlV AS1 AS2 + 1 1 0.8875 0.3516 0.3516 -100 0.14 0.01 0.02 +END +//! [SASA] + +//! [LOCALELEV] +LOCALELEV +# NTLES 0,1 controls the use of local elevation. +# 0 : not used [default] +# 1 : local elevation is applied +# NLEPOT >= 0 number of umbrella potentials applied +# NTLESA 1..2 controls the reading of the potential definition +# 1 : read from startup file +# 2 : read from special file (@lud) +# NTWLE >= 0 write umbrellas to trajectory every NTWLEth step +# NLEPID[1..NLEPOT] IDs of the umbrella potentials +# NTLEPFR[1..NLEPOT] 0,1 freeze the umbrella potential +# 0 : build up +# 1 : freeze +# NTLES NLEPOT NTLESA NTWLE + 1 2 1 0 +# NLEPID NLEPFR + 1 0 + 2 1 +END +//! [LOCALELEV] + +//! [BSLEUS] +BSLEUS +# +# The general settings for the B&S-LEUS algorithm +# BSLEUS: Dow we use B&S-LEUS? +# 0: Don'use it (default) +# 1: Use it +# BUILD: Are we building? +# 0: No +# 1: Yes +# WRITE: >= 0 Do we write the energies and forces of the Umbrella? +# == 0: No +# > 0: Every nth step +# +# BSLEUS BUILD WRITE + 1 1 0 +END +//! [BSLEUS] + +//! [ELECTRIC] +ELECTRIC +# FIELD 0,1 controls the use of applied electric field. +# 0 : not used [default] +# 1 : electric field is applied +# DIPOLE 0,1 controls the calculation of box dipole. +# 0 : not used [default] +# 1 : box dipole is calculated and written to special trajectory +# CURRENT 0,1 controls the calculation of electric currents. +# 0 : not used [default] +# 1 : electric current is calculated and written to special trajectory +# ELECTRIC FIELD COMPONENTS (EF_x, EF_y, EF_z) +# 0.0 0.0 0.0 +# DIPGRP 0..2 controls the groups considered for box dipole calculation +# 0 : solute only +# 1 : solvent only +# 2 : all +# NTWDIP >= 0 write dipole box every NTWDIPth step +# NTWCUR >= 0 write current every NTWDIPth step +# NCURGRP >=0 number of current groups +# CURGRP [1..NCURGRP] last atom of the group +# FIELD DIPOLE CURRENT + 1 1 1 +# EF_x EF_y EF_z + 0.0 0.0 0.0 +# DIPGRP NTWDIP + 0 1 +# NTWCUR NCURGRP CURGRP[1] CURGRP[2] + 1 2 100 1000 +END +//! [ELECTRIC] + +//! [NEMD] +NEMD +# NEMD 0,1 controls the use of non-equilibrium molecular dynamics. +# 0 : not used [default] +# 1 : nemd is used +# PROPERTY 0- select property to calculate +# 0 : viscosity +# METHOD 0- select method of NEMD. +# 0 : periodic perturbation method (PPM) +# 1 : internal reservoir method (IRM) +# SLABNUM >=1 number of slabs used in the discretization along z-direction. +# the effective number is 2xSLABNUM due to periodicity +# PERTFRQ >=1 perturbation frequency: apply perturbation every PERTFRQth timestep +# [this flag is ignored by the PPM method, but a value must be provided] +# AMPLI >=0 amplitude of applied field +# [this flag is ignored by the IRM method, but a value must be provided] +# STDYAFT >=0 first STDYAFTth steps do not contribute for accumulated averages +# WRITE >=1 write flux and average velocities to special trajectory every WRITEth timestep +# NEMD PROPERTY METHOD + 1 0 0 +# SLABNUM PERTFRQ AMPLI STDYAFT WRITE + 10 20 10 1000 200 +END +//! [NEMD] + +//! [MULTIGRADIENT] +MULTIGRADIENT +# NTMGRE 0,1 enable multiple gradients +# 0: disable gradients (default) +# 1: enable gradients +# NTMGRP 0..3 print of curves +# 0: don't print +# 1: plot the curves +# 2: print that values of the curves +# 3: plot and print the curves +# NTMGRN >= 0 number of gradients +# MGRVAR: variable name to affect, available are: + TEMP0, CPOR, CDIR, RESO, CXR, COPR +# MGRFRM: functional form of the curve +# 0: linear interpolation between control points +# 1: cubic spline interpolation between control points +# 2: Bezier curve +# 3: Oscillation: A sin[2Pi/T (t - dt)] + b +# Note: MGRNCP is 2. A = MGRCPT[1] T = MGRCPV[1] dt = MGRCPT[2] b = MGRCPV[2] +# MGRNCP >= 2: number of control points +# MGRCPT >= 0: time of the control point +# MGRCPV: value of the control point +# +# NTMGRE NTMGRP + 1 1 +# NTMGRN + 2 +# MGRVAR MGRFRM MGRNCP + TEMP0[0] 0 2 +# MGRCPT MGRCPV + 0.0 60.0 + 80.0 300.0 +# MGRVAR MGRFRM MGRNCP + CPOR 2 4 +# MGRCPT MGRCPV + 0.0 2.5E5 + 0.0 2.5E1 + 20.0 0.0 + 80.0 0.0 +END +//! [MULTIGRADIENT] + +//! [ADDECOUPLE] +ADDECOUPLE +# ADGR >= 0 number of adiabatic decoupling groups +# ADSTART first atom of the adiabatic decoupling group +# ADEND last atom of the adiabatic decoupling group +# SM scaling factor mass +# SV scaling factor potential energy function +# ST scaling factor temperature +# TIR which temperature bath to scale +# 1 translational +# 2 internal-rotatinal +# 3 both +# TMF tau for calculating mean field +# STAD printing average to special trajectory +# ADGR + 2 +# ADSTART ADEND SM SV ST TIR + 1 1500 10 1 0 1 + 1501 3000 1 10 1 3 +# TMF STAD + 0.1 1000 +END +//! [ADDECOUPLE] + +//! [QMMM] +QMMM +# NTQMMM 0,1 apply QM/MM +# 0: do not apply QM/MM (default) +# 1: apply QM/MM +# NTQMSW 0 QM software package to use +# 0: MNDO (default) +# 1: Turbomole +# RCUTQ >= 0.0 cutoff for inclusion of MM charge groups +# 0.0: include all atoms +# >0.0: include atoms of charge groups closer than RCUTQ +# to QM zone. +# NTWQMMM >= 0 write QM/MM related data to special trajectory +# 0: do not write +# >0: write every NTWQMMMth step +# +# NTQMMM NTQMSW RCUTQ NTWQMMM + 1 0 0.0 0 +END +//! [QMMM] + +//! [SYMRES] +SYMRES +# NTSYM 0..2 apply symmetry restraints +# 0: do not apply symmetry restraints (default) +# 1: apply symmetry restraints +# 2: apply symmetry constraints +# CSYM >= 0.0 force constants +# +# NTSYM CSYM + 1 0.0 +END +//! [SYMRES] + +//! [DISTANCERESSPEC] +DISTANCERESSPEC +# DISH, DISC carbon-hydrogen/carbon-carbon distance +# i,j,k,l atoms comprising the virtual atom (put 0 if less than four atoms in use) +# type virtual atom type +# r0, w0 target distance and force constant weighting factor +# rah form and dimension of the potential +# full harmonic: +# 0: x,y,z +# 10: x,y +# 20: x,z +# 30: y,z +# 40: x +# 50: y +# 60: z +# subtract or add 1 from these numbers to select a half harmonic +# repulsive or attractive potential +# DISH DISC + 0.1 0.153 +# i j k l type i j k l type r0 w0 rah + 1 0 0 0 0 10 12 11 13 3 0.2 1.0 0 +END +//! [DISTANCERESSPEC] + +//! [PERTDISRESSPEC] +PERTDISRESSPEC +# DISH DISC + 0.1 0.153 +# i j k l type i j k l type n m A_r0 A_w0 B_r0 B_w0 rah + 1 0 0 0 0 10 12 11 13 3 1 1 0.2 1.0 0.5 2.0 0 +END +//! [PERTDISRESSPEC] + +//! [DFRESSPEC] +DFRESSPEC +# DISH H-C bond length for virtual atoms +# DISC C-C bond length for virtual atoms +# PROTEINATOMS > 0 last atom of the host +# K >= 0.0 Force constant +# r0 >=0 zero energy distance +# TYPE_I Virtual atom type for interaction site I +# NUM_I Number of atoms defining interaction site I +# ATOM_I[0..NUM_I] Index numbers of atoms defining interaction site I +# TYPE_J Virtual atom type for interaction site J +# NUM_J Number of atoms defining interaction site J +# ATOM_J[0..NUM_J] Index numbers of atoms defining interaction site J +# DISH DISC + 0.1 0.153 +# PROTEINATOMS K r0 + 1190 500 0.0 +# TYPE_I NUM_I ATOM_I[0] .. ATOM_I[NUM_I] + -1 7 16 190 249 312 486 632 1208 +# TYPE_J NUM_J ATOM_J[0] .. ATOM_J[NUM_J] + -1 2 1194 1203 +END +//! [DFRESSPEC] + +//! [PERTDFRESSPEC] +PERTDFRESSPEC +# DISH H-C bond length for virtual atoms +# DISC C-C bond length for virtual atoms +# PROTEINATOMS > 0 last atom of the host +# A_r0 >=0 reference distance for state A +# B_r0 >=0 reference distance for state B +# K_A >= 0 force constant state A +# K_B >= 0 force constant state B +# n >= 0 hidden restraint parameter n +# m >= 0 hidden restraint parameter m +# TYPE_I Virtual atom type for interaction site I +# NUM_I Number of atoms defining interaction site I +# ATOM_I[0..NUM_I] Index numbers of atoms defining interaction site I +# TYPE_J Virtual atom type for interaction site J +# NUM_J Number of atoms defining interaction site J +# ATOM_J[0..NUM_J] Index numbers of atoms defining interaction site J +# DISH DISC + 0.1 0.153 +# PROTEINATOMS A_r0 K_A B_r0 K_B n m + 1190 4.5 500 0.0 500 0 0 +# TYPE_I NUM_I ATOM_I[0] .. ATOM_I[NUM_I] + -1 7 16 190 249 312 486 632 1208 +# TYPE_J NUM_J ATOM_J[0] .. ATOM_J[NUM_J] + -1 2 1194 1203 +END +//! [PERTDFRESSPEC] + +//! [MDISRESSPEC] +MDISRESSPEC +# DISH DISC + 0.1 0.153 +# N: number of eds states (3 in this example) +# i j k l type i j k l type r0[1 ... N] w0[1 ... N] rah + 1 0 0 0 0 10 12 11 13 3 0.2 0.2 0.2 1.0 0.0 0.0 0 + 5 0 0 0 0 10 12 11 13 3 0.2 0.2 0.2 0.0 1.0 0.0 0 + 8 0 0 0 0 10 12 11 13 3 0.2 0.2 0.2 0.0 0.0 1.0 0 +END +//! [MDISRESSPEC] + diff --git a/gromosXX/get-doxygen.py b/gromosXX/get-doxygen.py new file mode 100755 index 000000000..8d1a902b0 --- /dev/null +++ b/gromosXX/get-doxygen.py @@ -0,0 +1,37 @@ +#! /usr/bin/env python +''' convert old gromos doxygen block descriptions + to new ones (INFO<<"";) +''' +import sys, os, glob + +if len(sys.argv)<2: + sys.exit("USAGE: "+sys.argv[0] + " ") + +intro=''' + std::stringstream INFO; + // lines starting with 'INFO<<"' and ending with '\\n";' (spaces don't matter) + // will be used to generate snippets that can be included in the doxygen doc; + // the first line is the tag\n''' + +with open(sys.argv[1]) as f: + read=False + for line in f: + if line.find("@verbatim") != -1: + read=True + infotxt=(intro) + line=next(f) + blockname=line.strip() + print(" * @snippet snippets/snippets.cc "+blockname) + infotxt+=' INFO << "' +line.rstrip()+'\\n";\n' + elif line.find("@endverbatim")!= -1: + read=False + # elif line.find("DEBUG(8,") != -1 and line.find("reading") != -1: + elif line.find("DEBUG(10,") != -1 and line.find("block") != -1: + print(line.rstrip()) + print(infotxt) + elif read and not line.strip()=="": + infotxt+=' INFO << "' +line.rstrip()+'\\n";\n' + else: + print(line.rstrip()) + + diff --git a/gromosXX/program/eds_2box.cc b/gromosXX/program/eds_2box.cc index fa6c0eacf..c81ce7ad3 100644 --- a/gromosXX/program/eds_2box.cc +++ b/gromosXX/program/eds_2box.cc @@ -15,9 +15,9 @@ * * * - * + * * - * + * * * * diff --git a/gromosXX/program/repex_mpi.cc b/gromosXX/program/repex_mpi.cc index 57c42bd05..2ef83f01a 100644 --- a/gromosXX/program/repex_mpi.cc +++ b/gromosXX/program/repex_mpi.cc @@ -74,7 +74,7 @@ int main(int argc, char *argv[]) { knowns << "topo" << "conf" << "input" << "verb" << "pttopo" << "trc" << "fin" << "trv" << "trf" << "trs" << "tre" << "trg" << "bae" << "bag" << "posresspec" << "refpos" << "distrest" << "dihrest" - << "jval" << "rdc" << "xray" << "lud" << "led" << "anatrj" << "print" << "friction" + << "jval" << "rdc" << "xray" << "lud" << "led" << "print" << "friction" // << "anatrj" << "version" << "repdat" << "repout"; std::string usage; @@ -114,10 +114,11 @@ int main(int argc, char *argv[]) { simulation::Simulation sim; // read in parameters - io::read_parameter(args,sim,std::cout,true); - if (io::check_parameter(sim)){ - io::messages.display(std::cout); - std::cout << "\nErrors during feature checker!\n" << std::endl; + if (io::read_parameter(args,sim,std::cout,true) || io::check_parameter(sim)){ + if (rank == 0) { + io::messages.display(std::cout); + std::cout << "\nErrors in in_parameters!\n" << std::endl; + } return -1; } //if (io::check_parameter(sim) != 0) return -1; @@ -191,7 +192,7 @@ int main(int argc, char *argv[]) { // could be optimized by putting neighboring replicas on same node; less communication... for (int i = 0; i < ceil((float) numReplicas / (float) size); ++i) { for (int j = 0; j < size; ++j) { - int ID = j + i*size; + unsigned int ID = j + i*size; if (ID >= numReplicas) break; repMap.insert(std::pair(ID, j)); diff --git a/gromosXX/src/algorithm/constraints/create_constraints.cc b/gromosXX/src/algorithm/constraints/create_constraints.cc index 7f33c8f69..b3c3933f0 100644 --- a/gromosXX/src/algorithm/constraints/create_constraints.cc +++ b/gromosXX/src/algorithm/constraints/create_constraints.cc @@ -86,7 +86,6 @@ int algorithm::create_constraints(algorithm::Algorithm_Sequence &md_seq, algorithm::Shake * s = new algorithm::Shake (sim.param().constraint.solute.shake_tolerance); - it.read_harmonic_bonds(s->parameter()); md_seq.push_back(s); } else { @@ -94,7 +93,6 @@ int algorithm::create_constraints(algorithm::Algorithm_Sequence &md_seq, algorithm::Perturbed_Shake * ps = new algorithm::Perturbed_Shake (sim.param().constraint.solute.shake_tolerance); - it.read_harmonic_bonds(ps->parameter()); md_seq.push_back(ps); } @@ -104,7 +102,6 @@ int algorithm::create_constraints(algorithm::Algorithm_Sequence &md_seq, { algorithm::Lincs * s = new algorithm::Lincs; - it.read_harmonic_bonds(s->parameter()); md_seq.push_back(s); if (sim.param().perturbation.perturbation) { @@ -138,8 +135,6 @@ int algorithm::create_constraints(algorithm::Algorithm_Sequence &md_seq, new algorithm::Flexible_Constraint (sim.param().constraint.solute.shake_tolerance, 1000, ff); - it.read_harmonic_bonds(fs->parameter()); - md_seq.push_back(fs); } else { @@ -148,8 +143,6 @@ int algorithm::create_constraints(algorithm::Algorithm_Sequence &md_seq, new algorithm::Perturbed_Flexible_Constraint (sim.param().constraint.solute.shake_tolerance, 1000, ff); - it.read_harmonic_bonds(pfc->parameter()); - md_seq.push_back(pfc); } @@ -195,7 +188,6 @@ int algorithm::create_constraints(algorithm::Algorithm_Sequence &md_seq, algorithm::Shake * s = new algorithm::Shake (sim.param().constraint.solvent.shake_tolerance); - it.read_harmonic_bonds(s->parameter()); md_seq.push_back(s); break; @@ -204,7 +196,6 @@ int algorithm::create_constraints(algorithm::Algorithm_Sequence &md_seq, { algorithm::Lincs * s = new algorithm::Lincs; - it.read_harmonic_bonds(s->parameter()); md_seq.push_back(s); break; @@ -219,7 +210,6 @@ int algorithm::create_constraints(algorithm::Algorithm_Sequence &md_seq, { algorithm::Settle * s = new algorithm::Settle; - it.read_harmonic_bonds(s->parameter()); md_seq.push_back(s); break; @@ -234,7 +224,6 @@ int algorithm::create_constraints(algorithm::Algorithm_Sequence &md_seq, } algorithm::M_Shake * s = new algorithm::M_Shake(sim.param().constraint.solvent.shake_tolerance); - it.read_harmonic_bonds(s->parameter()); md_seq.push_back(s); break; @@ -242,7 +231,6 @@ int algorithm::create_constraints(algorithm::Algorithm_Sequence &md_seq, case simulation::constr_gpu_settle : { /*algorithm::GPU_Settle * s = new algorithm::GPU_Settle; - it.read_harmonic_bonds(s->parameter()); md_seq.push_back(s); */ break; @@ -257,7 +245,6 @@ int algorithm::create_constraints(algorithm::Algorithm_Sequence &md_seq, } algorithm::GPU_Shake * s = new algorithm::GPU_Shake(sim.param().constraint.solvent.shake_tolerance); - it.read_harmonic_bonds(s->parameter()); md_seq.push_back(s); break; @@ -281,4 +268,3 @@ int algorithm::create_constraints(algorithm::Algorithm_Sequence &md_seq, return 0; } - diff --git a/gromosXX/src/algorithm/constraints/dihedral_constraint.cc b/gromosXX/src/algorithm/constraints/dihedral_constraint.cc index 728cb77e1..fa3305ad7 100644 --- a/gromosXX/src/algorithm/constraints/dihedral_constraint.cc +++ b/gromosXX/src/algorithm/constraints/dihedral_constraint.cc @@ -153,8 +153,6 @@ int algorithm::Shake::dih_constr_iteration ); // Finally, eq 60 - const double dt = sim.time_step_size(); - const double dt2 = dt * dt; ////////////////////////////////////////////////// // reference phi! diff --git a/gromosXX/src/algorithm/constraints/flexible_constraint.h b/gromosXX/src/algorithm/constraints/flexible_constraint.h index 9740dda28..18e3a5672 100644 --- a/gromosXX/src/algorithm/constraints/flexible_constraint.h +++ b/gromosXX/src/algorithm/constraints/flexible_constraint.h @@ -62,20 +62,6 @@ namespace algorithm */ int const & max_iterations()const {return m_max_iterations;} - /** - * the const bond type parameter. - */ - std::vector const ¶meter()const - { - return m_parameter; - } - /** - * the bond type parameter. - */ - std::vector & parameter() - { - return m_parameter; - } /** * accessor to the constrained atoms */ @@ -118,10 +104,6 @@ namespace algorithm * max iterations. */ const int m_max_iterations; - /** - * bond parameter - */ - std::vector m_parameter; /** * the atoms that are involved in the contraints */ @@ -603,17 +585,17 @@ void algorithm::Flexible_Constraint::_calc_distance // flex_len: flexible constraint distance // ================================================= - // const double constr_length2 = m_parameter(it->type).r0 * m_parameter(it->type).r0; + // const double constr_length2 = topo.bond_types_harm()(it->type).r0 * topo.bond_types_harm()(it->type).r0; // calculate the flexible constraint distance DEBUG(10, "F(c) = " << force_on_constraint); - DEBUG(10, "it->type = " << it->type << " of " << m_parameter.size()); + DEBUG(10, "it->type = " << it->type << " of " << topo.bond_types_harm().size()); - assert(m_parameter.size() > it->type); - DEBUG(10, "K = " << m_parameter[it->type].K << " r0 = " << m_parameter[it->type].r0); + assert(topo.bond_types_harm().size() > it->type); + DEBUG(10, "K = " << topo.bond_types_harm()[it->type].K << " r0 = " << topo.bond_types_harm()[it->type].r0); - const double new_len = force_on_constraint / m_parameter[it->type].K + - m_parameter[it->type].r0; + const double new_len = force_on_constraint / topo.bond_types_harm()[it->type].K + + topo.bond_types_harm()[it->type].r0; // store for shake m_flex_len.push_back(new_len); @@ -636,8 +618,8 @@ void algorithm::Flexible_Constraint::_calc_distance // calculate Epot in the bond length constraints conf.old().energies.constraints_energy[topo.atom_energy_group()[it->i]] += - 0.5 * m_parameter[it->type].K * (m_parameter[it->type].r0 - new_len) * - (m_parameter[it->type].r0 - new_len); + 0.5 * topo.bond_types_harm()[it->type].K * (topo.bond_types_harm()[it->type].r0 - new_len) * + (topo.bond_types_harm()[it->type].r0 - new_len); DEBUG(5, "flex_constraint_distance: " << new_len); @@ -757,12 +739,12 @@ void algorithm::Flexible_Constraint::_calc_undetermined_forces } } - math::Vec f1 = r - math::product(u1, r_nc) * dk * mu / m_parameter[it->type].K; - math::Vec f2 = -r - math::product(u2, r_nc) * dk * mu / m_parameter[it->type].K; + math::Vec f1 = r - math::product(u1, r_nc) * dk * mu / topo.bond_types_harm()[it->type].K; + math::Vec f2 = -r - math::product(u2, r_nc) * dk * mu / topo.bond_types_harm()[it->type].K; // r_nc is normalized! - f1 += (r_nc - r / r_dist) * dk * mu / (m_parameter[it->type].K * dt2); - f2 -= (r_nc - r / r_dist) * dk * mu / (m_parameter[it->type].K * dt2); + f1 += (r_nc - r / r_dist) * dk * mu / (topo.bond_types_harm()[it->type].K * dt2); + f2 -= (r_nc - r / r_dist) * dk * mu / (topo.bond_types_harm()[it->type].K * dt2); assert(m_force.size() > k && m_force[k].size() > it->i && m_force[k].size() > it->j); @@ -802,7 +784,7 @@ void algorithm::Flexible_Constraint::_calc_undetermined_forces assert(m_force.size() > k && m_force[k].size() > a); // r_nc is normalized - m_force[k][a] = math::product(h1, r_nc) * (-dk) * mu / m_parameter[it->type].K; + m_force[k][a] = math::product(h1, r_nc) * (-dk) * mu / topo.bond_types_harm()[it->type].K; DEBUG(12, "f(" << a << ") = " << math::v2s(m_force[k][a])); } diff --git a/gromosXX/src/algorithm/constraints/gpu_settle.cc b/gromosXX/src/algorithm/constraints/gpu_settle.cc index 4097b9f77..f59395984 100644 --- a/gromosXX/src/algorithm/constraints/gpu_settle.cc +++ b/gromosXX/src/algorithm/constraints/gpu_settle.cc @@ -78,8 +78,8 @@ int algorithm::GPU_Settle::init(topology::Topology & topo, } // the molecule must have two equal bond lengths (constraints 1 and 2) - if (parameter()[topo.solvent(0).distance_constraint(0).type].r0 != - parameter()[topo.solvent(0).distance_constraint(1).type].r0) { + if (topo.bond_types_harm()[topo.solvent(0).distance_constraint(0).type].r0 != + topo.bond_types_harm()[topo.solvent(0).distance_constraint(1).type].r0) { io::messages.add("SETTLE does only work with water like molecules (distance constraints wrong).", "Settle", io::message::error); return 1; diff --git a/gromosXX/src/algorithm/constraints/gpu_settle.h b/gromosXX/src/algorithm/constraints/gpu_settle.h index 5f53a2d63..a23acda91 100644 --- a/gromosXX/src/algorithm/constraints/gpu_settle.h +++ b/gromosXX/src/algorithm/constraints/gpu_settle.h @@ -44,20 +44,6 @@ namespace algorithm { std::ostream & os = std::cout, bool quiet = false); - /** - * the const bond type parameter. - */ - std::vector const ¶meter()const { - return m_parameter; - } - - /** - * the bond type parameter. - */ - std::vector & parameter() { - return m_parameter; - } - /** * accessor to the constrained atoms */ @@ -89,10 +75,6 @@ namespace algorithm { simulation::Simulation & sim, int & error); - /** - * bond parameter - */ - std::vector m_parameter; /** * the atoms that are involved in the contraints */ diff --git a/gromosXX/src/algorithm/constraints/gpu_shake.cc b/gromosXX/src/algorithm/constraints/gpu_shake.cc index d62268b20..065ae2735 100644 --- a/gromosXX/src/algorithm/constraints/gpu_shake.cc +++ b/gromosXX/src/algorithm/constraints/gpu_shake.cc @@ -184,8 +184,8 @@ int algorithm::GPU_Shake::init(topology::Topology & topo, it_k = topo.solvent(0).distance_constraints().begin(), to_k = topo.solvent(0).distance_constraints().end(); it_k != to_k; ++it_k, ++k) { - assert(parameter().size() > it_k->type); - constr_length2(k) = parameter()[it_k->type].r0 * parameter()[it_k->type].r0; + assert(topo.bond_types_harm().size() > it_k->type); + constr_length2(k) = topo.bond_types_harm()[it_k->type].r0 * topo.bond_types_harm()[it_k->type].r0; unsigned int l = 0; for (std::vector::const_iterator it_l = topo.solvent(0).distance_constraints().begin(), diff --git a/gromosXX/src/algorithm/constraints/gpu_shake.h b/gromosXX/src/algorithm/constraints/gpu_shake.h index c6542c931..78f2f2fbe 100644 --- a/gromosXX/src/algorithm/constraints/gpu_shake.h +++ b/gromosXX/src/algorithm/constraints/gpu_shake.h @@ -57,20 +57,6 @@ namespace algorithm */ int const & max_iterations()const {return m_max_iterations;} - /** - * the const bond type parameter. - */ - std::vector const ¶meter()const - { - return m_parameter; - } - /** - * the bond type parameter. - */ - std::vector & parameter() - { - return m_parameter; - } /** * initialize startup positions and velocities * if required. @@ -91,10 +77,6 @@ namespace algorithm * max iterations */ const int m_max_iterations; - /** - * bond parameter - */ - std::vector m_parameter; /** * rank and size for parallelization */ diff --git a/gromosXX/src/algorithm/constraints/lincs.cc b/gromosXX/src/algorithm/constraints/lincs.cc index 5e61e6266..4c7e49fef 100644 --- a/gromosXX/src/algorithm/constraints/lincs.cc +++ b/gromosXX/src/algorithm/constraints/lincs.cc @@ -95,7 +95,6 @@ int _lincs(topology::Topology & topo, simulation::Simulation & sim, std::vector const & constr, topology::Compound::lincs_struct const & lincs, - std::vector const & param, int lincs_order, util::Algorithm_Timer & m_timer, unsigned int offset = 0) @@ -138,7 +137,7 @@ int _lincs(topology::Topology & topo, for(unsigned int n=0; n < ccon; ++n){ DEBUG(8, "A[" << i << "]: coupled: " << lincs.coupled_constr[i][n]); - DEBUG(8, "constraint length: " << param[constr[i].type].r0); + DEBUG(8, "constraint length: " << topo.bond_types_harm()[constr[i].type].r0); A[i].a.push_back(lincs.coef[i][n] * math::dot(B(i), B(lincs.coupled_constr[i][n]))); @@ -147,7 +146,7 @@ int _lincs(topology::Topology & topo, periodicity.nearest_image(pos(constr[i].i + offset), pos(constr[i].j + offset), r); rhs[0](i) = lincs.sdiag[i] * - (math::dot(B(i), r) - param[constr[i].type].r0); + (math::dot(B(i), r) - topo.bond_types_harm()[constr[i].type].r0); sol(i) = rhs[0](i); @@ -163,7 +162,7 @@ int _lincs(topology::Topology & topo, periodicity.nearest_image(pos(constr[i].i + offset), pos(constr[i].j + offset), r); - const double diff = 2 * param[constr[i].type].r0 * param[constr[i].type].r0 - + const double diff = 2 * topo.bond_types_harm()[constr[i].type].r0 * topo.bond_types_harm()[constr[i].type].r0 - math::abs2(r); if (diff > 0.0) p = sqrt(diff); @@ -172,7 +171,7 @@ int _lincs(topology::Topology & topo, ++count; } - rhs[0](i) = lincs.sdiag[i] * (param[constr[i].type].r0 - p); + rhs[0](i) = lincs.sdiag[i] * (topo.bond_types_harm()[constr[i].type].r0 - p); sol(i) = rhs[0](i); } @@ -189,7 +188,6 @@ template void _solvent(topology::Topology & topo, configuration::Configuration & conf, simulation::Simulation & sim, - std::vector const & param, util::Algorithm_Timer & m_timer, int & error) { m_timer.start("solvent"); @@ -205,7 +203,7 @@ void _solvent(topology::Topology & topo, _lincs(topo, conf, sim, topo.solvent(i).distance_constraints(), topo.solvent(i).lincs(), - param, sim.param().constraint.solvent.lincs_order, + sim.param().constraint.solvent.lincs_order, m_timer, first); } } @@ -232,7 +230,7 @@ int algorithm::Lincs::apply(topology::Topology & topo, DEBUG(8, "\twe need to lincs SOLUTE"); m_timer.start("solute"); SPLIT_BOUNDARY(_lincs, topo, conf, sim, topo.solute().distance_constraints(), - topo.solute().lincs(), parameter(), + topo.solute().lincs(), sim.param().constraint.solute.lincs_order, m_timer); m_timer.stop("solute"); @@ -245,7 +243,7 @@ int algorithm::Lincs::apply(topology::Topology & topo, DEBUG(8, "\twe need to lincs SOLVENT"); int error = 0; SPLIT_VIRIAL_BOUNDARY(_solvent, - topo, conf, sim, parameter(), m_timer, error); + topo, conf, sim, m_timer, error); } diff --git a/gromosXX/src/algorithm/constraints/lincs.h b/gromosXX/src/algorithm/constraints/lincs.h index 51339b7d3..a59325d01 100644 --- a/gromosXX/src/algorithm/constraints/lincs.h +++ b/gromosXX/src/algorithm/constraints/lincs.h @@ -28,19 +28,6 @@ namespace algorithm { configuration::Configuration & conf, simulation::Simulation & sim); - /** - * the const bond type parameter. - */ - std::vector const ¶meter()const { - return m_parameter; - } - - /** - * the bond type parameter. - */ - std::vector & parameter() { - return m_parameter; - } /** * accessor to the constrained atoms @@ -68,10 +55,6 @@ namespace algorithm { protected: - /** - * the constraint parameters (bond lengths) - */ - std::vector m_parameter; /** * the atoms that are involved in the contraints */ diff --git a/gromosXX/src/algorithm/constraints/m_shake.cc b/gromosXX/src/algorithm/constraints/m_shake.cc index b97b9701d..d8f875960 100644 --- a/gromosXX/src/algorithm/constraints/m_shake.cc +++ b/gromosXX/src/algorithm/constraints/m_shake.cc @@ -493,8 +493,8 @@ int algorithm::M_Shake::init(topology::Topology & topo, it_k = topo.solvent(0).distance_constraints().begin(), to_k = topo.solvent(0).distance_constraints().end(); it_k != to_k; ++it_k, ++k) { - assert(parameter().size() > it_k->type); - constr_length2(k) = parameter()[it_k->type].r0 * parameter()[it_k->type].r0; + assert(topo.bond_types_harm().size() > it_k->type); + constr_length2(k) = topo.bond_types_harm()[it_k->type].r0 * topo.bond_types_harm()[it_k->type].r0; unsigned int l = 0; for (std::vector::const_iterator it_l = topo.solvent(0).distance_constraints().begin(), diff --git a/gromosXX/src/algorithm/constraints/m_shake.h b/gromosXX/src/algorithm/constraints/m_shake.h index 39858e59b..41c238d83 100644 --- a/gromosXX/src/algorithm/constraints/m_shake.h +++ b/gromosXX/src/algorithm/constraints/m_shake.h @@ -51,21 +51,6 @@ namespace algorithm */ int const & max_iterations()const {return m_max_iterations;} - /** - * the const bond type parameter. - */ - std::vector const ¶meter()const - { - return m_parameter; - } - /** - * the bond type parameter. - */ - std::vector & parameter() - { - return m_parameter; - } - /** * initialize startup positions and velocities * if required. @@ -86,10 +71,6 @@ namespace algorithm * max iterations */ const int m_max_iterations; - /** - * bond parameter - */ - std::vector m_parameter; /** * rank and size for parallelization */ diff --git a/gromosXX/src/algorithm/constraints/perturbed_flexible_constraint.cc b/gromosXX/src/algorithm/constraints/perturbed_flexible_constraint.cc index ef736a24c..5f131d6e5 100644 --- a/gromosXX/src/algorithm/constraints/perturbed_flexible_constraint.cc +++ b/gromosXX/src/algorithm/constraints/perturbed_flexible_constraint.cc @@ -286,23 +286,23 @@ int algorithm::Perturbed_Flexible_Constraint::_iteration DEBUG(10, "m1=" << m1 << " m2=" << m2 << " mu=" << mu << " dm1=" << dm1 << " dm2=" << dm2); - const double mr0 = (1.0 - lam) * m_parameter[it->A_type].r0 + - lam * m_parameter[it->B_type].r0; - const double mK = (1.0 - lam) * m_parameter[it->A_type].K + - lam * m_parameter[it->B_type].K; + const double mr0 = (1.0 - lam) * topo.bond_types_harm()[it->A_type].r0 + + lam * topo.bond_types_harm()[it->B_type].r0; + const double mK = (1.0 - lam) * topo.bond_types_harm()[it->A_type].K + + lam * topo.bond_types_harm()[it->B_type].K; DEBUG(10, "mixed r0=" << mr0 << " mixed K=" << mK); conf.old().perturbed_energy_derivatives.constraints_energy [topo.atom_energy_group()[it->i]] += lam_derivative * (lambda / dt2 * m_perturbed_flex_len[k] * - (m_parameter[it->B_type].r0 - - m_parameter[it->A_type].r0 + + (topo.bond_types_harm()[it->B_type].r0 - + topo.bond_types_harm()[it->A_type].r0 + (m_perturbed_flex_len[k] - mr0) * ((dm1 + dm2) / (m1 * m2 * mu) - dm2 / m2 - dm1 / m1 - - (m_parameter[it->B_type].K - - m_parameter[it->A_type].K) / mK + (topo.bond_types_harm()[it->B_type].K - + topo.bond_types_harm()[it->A_type].K) / mK ))); // update positions @@ -433,16 +433,16 @@ void algorithm::Perturbed_Flexible_Constraint::_calc_distance // flex_len: flexible constraint distance // ================================================= - // const double constr_length2 = m_parameter(it->type).r0 * m_parameter(it->type).r0; + // const double constr_length2 = topo.bond_types_harm()(it->type).r0 * topo.bond_types_harm()(it->type).r0; // calculate the flexible constraint distance - assert(m_parameter.size() > it->A_type); - assert(m_parameter.size() > it->B_type); + assert(topo.bond_types_harm().size() > it->A_type); + assert(topo.bond_types_harm().size() > it->B_type); - const double K = (1.0 - lam) * m_parameter[it->A_type].K + - lam * m_parameter[it->B_type].K; - const double r0 = (1.0 - lam) * m_parameter[it->A_type].r0 + - lam * m_parameter[it->B_type].r0; + const double K = (1.0 - lam) * topo.bond_types_harm()[it->A_type].K + + lam * topo.bond_types_harm()[it->B_type].K; + const double r0 = (1.0 - lam) * topo.bond_types_harm()[it->A_type].r0 + + lam * topo.bond_types_harm()[it->B_type].r0; const double new_len = force_on_constraint / K + r0; diff --git a/gromosXX/src/algorithm/constraints/perturbed_shake.cc b/gromosXX/src/algorithm/constraints/perturbed_shake.cc index 9a3932daa..d3ce86643 100644 --- a/gromosXX/src/algorithm/constraints/perturbed_shake.cc +++ b/gromosXX/src/algorithm/constraints/perturbed_shake.cc @@ -109,12 +109,12 @@ ::perturbed_shake_iteration(topology::Topology const &topo, periodicity.nearest_image(pos_i, pos_j, r); double dist2 = math::abs2(r); - double r0 = (1.0 - lam) * this->parameter()[it->A_type].r0 + - lam * this->parameter()[it->B_type].r0; + double r0 = (1.0 - lam) * topo.bond_types_harm()[it->A_type].r0 + + lam * topo.bond_types_harm()[it->B_type].r0; DEBUG(10, "constraint length: " << r0); - DEBUG(10, "r0(A) = " << this->parameter()[it->A_type].r0); - DEBUG(10, "r0(B) = " << this->parameter()[it->B_type].r0); + DEBUG(10, "r0(A) = " << topo.bond_types_harm()[it->A_type].r0); + DEBUG(10, "r0(B) = " << topo.bond_types_harm()[it->B_type].r0); double constr_length2 = r0 * r0; double diff = constr_length2 - dist2; @@ -195,15 +195,15 @@ ::perturbed_shake_iteration(topology::Topology const &topo, conf.old().perturbed_energy_derivatives. constraints_energy[topo.atom_energy_group()[it->i]] += lam_derivative * lambda / dt2 * sqrt(constr_length2) * - (this->parameter()[it->B_type].r0 - this->parameter()[it->A_type].r0); + (topo.bond_types_harm()[it->B_type].r0 - topo.bond_types_harm()[it->A_type].r0); //ANITA if (((sim.steps() % sim.param().write.free_energy) == 0) && sim.param().precalclam.nr_lambdas ){ DEBUG(1, "AB_bond within if "); - double r0A = this->parameter()[it->A_type].r0; + double r0A = topo.bond_types_harm()[it->A_type].r0; DEBUG(1, "AB_bond r0A " << r0A); - double r0B = this->parameter()[it->B_type].r0; + double r0B = topo.bond_types_harm()[it->B_type].r0; DEBUG(1, "AB_bond r0B " << r0B); double r0_diff = r0B - r0A; DEBUG(1, "AB_bond r0_diff " << r0_diff); @@ -216,7 +216,7 @@ ::perturbed_shake_iteration(topology::Topology const &topo, (sim.param().precalclam.nr_lambdas-1); //loop over nr_lambdas - for (int lam_index = 0; lam_index < sim.param().precalclam.nr_lambdas; ++lam_index){ + for (unsigned int lam_index = 0; lam_index < sim.param().precalclam.nr_lambdas; ++lam_index){ // determine current lambda for this index double lam=(lam_index * lambda_step) + sim.param().precalclam.min_lam; @@ -226,8 +226,7 @@ ::perturbed_shake_iteration(topology::Topology const &topo, double difflam = r0lam*r0lam - dist2; DEBUG(1, "AB_bond difflam " << difflam); double value = (difflam / sp_2_m_dt2) * r0lam *r0_diff; - conf.old().perturbed_energy_derivatives.AB_bond[lam_index] += - (difflam / sp_2_m_dt2) * sqrt(r0lam*r0lam) *r0_diff; + conf.old().perturbed_energy_derivatives.AB_bond[lam_index] += value; } } // ANITA @@ -282,7 +281,6 @@ ::perturbed_solute(topology::Topology const & topo, int first = 0; error = 0; - const unsigned int group_id = m_rank; int num_iterations = 0; bool convergence = false; while(!convergence){ @@ -433,7 +431,6 @@ ::apply(topology::Topology & topo, // broadcast eventual errors from master to slaves #ifdef XXMPI if (sim.mpi) { - math::VArray & pos = conf.current().pos; MPI::COMM_WORLD.Bcast(&error, 1, MPI::INT, 0); } #endif diff --git a/gromosXX/src/algorithm/constraints/settle.cc b/gromosXX/src/algorithm/constraints/settle.cc index 48f6eaa34..3b7dab88e 100644 --- a/gromosXX/src/algorithm/constraints/settle.cc +++ b/gromosXX/src/algorithm/constraints/settle.cc @@ -72,8 +72,8 @@ int algorithm::Settle::init(topology::Topology & topo, } // the molecule must have two equal bond lengths (constraints 1 and 2) - if (parameter()[topo.solvent(0).distance_constraint(0).type].r0 != - parameter()[topo.solvent(0).distance_constraint(1).type].r0) { + if (topo.bond_types_harm()[topo.solvent(0).distance_constraint(0).type].r0 != + topo.bond_types_harm()[topo.solvent(0).distance_constraint(1).type].r0) { io::messages.add("SETTLE does only work with water like molecules (distance constraints wrong).", "Settle", io::message::error); return 1; @@ -173,10 +173,10 @@ ::solvent(topology::Topology const & topo, const double mass_H = topo.solvent(0).atom(1).mass; // distance constraints assert(topo.solvent(0).distance_constraints().size() == 3); - assert(parameter()[topo.solvent(0).distance_constraints()[0].type].r0 == - parameter()[topo.solvent(0).distance_constraints()[1].type].r0); - const double dist_OH = parameter()[topo.solvent(0).distance_constraints()[0].type].r0; - const double dist_HH = parameter()[topo.solvent(0).distance_constraints()[2].type].r0; + assert(topo.bond_types_harm()[topo.solvent(0).distance_constraints()[0].type].r0 == + topo.bond_types_harm()[topo.solvent(0).distance_constraints()[1].type].r0); + const double dist_OH = topo.bond_types_harm()[topo.solvent(0).distance_constraints()[0].type].r0; + const double dist_HH = topo.bond_types_harm()[topo.solvent(0).distance_constraints()[2].type].r0; // calculate the coordinates of the canonical triangle // see Figure 2 (a) diff --git a/gromosXX/src/algorithm/constraints/settle.h b/gromosXX/src/algorithm/constraints/settle.h index b4541a996..461a96bb0 100644 --- a/gromosXX/src/algorithm/constraints/settle.h +++ b/gromosXX/src/algorithm/constraints/settle.h @@ -59,20 +59,6 @@ namespace algorithm { std::ostream & os = std::cout, bool quiet = false); - /** - * the const bond type parameter. - */ - std::vector const ¶meter()const { - return m_parameter; - } - - /** - * the bond type parameter. - */ - std::vector & parameter() { - return m_parameter; - } - /** * accessor to the constrained atoms */ @@ -104,10 +90,6 @@ namespace algorithm { simulation::Simulation & sim, int & error); - /** - * bond parameter - */ - std::vector m_parameter; /** * the atoms that are involved in the contraints */ diff --git a/gromosXX/src/algorithm/constraints/shake.cc b/gromosXX/src/algorithm/constraints/shake.cc index f233f1630..98a617b4b 100644 --- a/gromosXX/src/algorithm/constraints/shake.cc +++ b/gromosXX/src/algorithm/constraints/shake.cc @@ -122,7 +122,9 @@ int algorithm::Shake::apply(topology::Topology & topo, } } +#ifdef XXMPI int transfer_size=topo.num_atoms(); +#endif if (!error && sim.param().system.nsm && sim.param().constraint.solvent.algorithm == simulation::constr_shake) { @@ -139,9 +141,11 @@ int algorithm::Shake::apply(topology::Topology & topo, return E_SHAKE_FAILURE_SOLVENT; } } else { +#ifdef XXMPI // sum up only solute positions in the next block, otherwise things will // go wrong, because all ranks still have all solvent positions transfer_size=topo.num_solute_atoms(); +#endif } #ifdef XXMPI if (sim.mpi) { @@ -319,7 +323,7 @@ if ((topo.solute().distance_constraints().size() && std::vector::iterator it_end = m_constraint_groups[0].unaffected_indices.end(); for (unsigned int i = 0; i < topo.num_solute_atoms(); ++i) { bool is_constrained = false; - for(unsigned int group_id = 1; group_id < m_size; ++group_id) { + for(int group_id = 1; group_id < m_size; ++group_id) { is_constrained |= affected_indices[group_id].find(i) != affected_indices[group_id].end(); } if(!is_constrained) { diff --git a/gromosXX/src/algorithm/constraints/shake.h b/gromosXX/src/algorithm/constraints/shake.h index 9c80923a6..0fe842088 100644 --- a/gromosXX/src/algorithm/constraints/shake.h +++ b/gromosXX/src/algorithm/constraints/shake.h @@ -63,20 +63,6 @@ namespace algorithm */ int const & max_iterations()const {return m_max_iterations;} - /** - * the const bond type parameter. - */ - std::vector const ¶meter()const - { - return m_parameter; - } - /** - * the bond type parameter. - */ - std::vector & parameter() - { - return m_parameter; - } /** * accessor to the constrained atoms */ @@ -110,10 +96,6 @@ namespace algorithm * max iterations */ const int m_max_iterations; - /** - * bond parameter - */ - std::vector m_parameter; /** * the atoms that are involved in the contraints */ @@ -275,8 +257,8 @@ int algorithm::Shake::shake_iteration double dist2 = abs2(r); - assert(parameter().size() > it->type); - double constr_length2 = parameter()[it->type].r0 * parameter()[it->type].r0; + assert(topo.bond_types_harm().size() > it->type); + double constr_length2 = topo.bond_types_harm()[it->type].r0 * topo.bond_types_harm()[it->type].r0; double diff = constr_length2 - dist2; DEBUG(13, "constr: " << constr_length2 << " dist2: " << dist2); diff --git a/gromosXX/src/algorithm/create_md_sequence.cc b/gromosXX/src/algorithm/create_md_sequence.cc index 430de4876..a9e3735ff 100644 --- a/gromosXX/src/algorithm/create_md_sequence.cc +++ b/gromosXX/src/algorithm/create_md_sequence.cc @@ -160,12 +160,12 @@ int algorithm::create_md_sequence(algorithm::Algorithm_Sequence &md_seq, io::message::warning); } - if (sim.param().multibath.nosehoover == 0){ + if (sim.param().multibath.algorithm == 0){ algorithm::Berendsen_Thermostat * tcoup = new algorithm::Berendsen_Thermostat; md_seq.push_back(tcoup); } - else if (sim.param().multibath.nosehoover >= 1){ + else if (sim.param().multibath.algorithm >= 1){ algorithm::NoseHoover_Thermostat *tcoup = new algorithm::NoseHoover_Thermostat; md_seq.push_back(tcoup); diff --git a/gromosXX/src/algorithm/integration/leap_frog.cc b/gromosXX/src/algorithm/integration/leap_frog.cc index d07f9c728..2503ca345 100644 --- a/gromosXX/src/algorithm/integration/leap_frog.cc +++ b/gromosXX/src/algorithm/integration/leap_frog.cc @@ -39,12 +39,15 @@ ::apply(topology::Topology & topo, conf.old().pos(i) + conf.current().vel(i) * sim.time_step_size(); if (sim.param().polarise.cos) { - DEBUG(8, "leap-frog: updating cos positions"); #ifdef OMP #pragma omp parallel for #endif - for(int i=0; i < num_atoms; ++i) - conf.current().posV(i) = conf.old().posV(i); + for(int i=0; i < num_atoms; ++i) { + // Verlet type prediction of cos displacement + // conf.current() contains the oldold posV + conf.current().posV(i) = 2*conf.old().posV(i) - conf.current().posV(i); + + } } m_timer.stop(); diff --git a/gromosXX/src/algorithm/temperature/nosehoover_thermostat.cc b/gromosXX/src/algorithm/temperature/nosehoover_thermostat.cc index 0a8baee6d..048518def 100644 --- a/gromosXX/src/algorithm/temperature/nosehoover_thermostat.cc +++ b/gromosXX/src/algorithm/temperature/nosehoover_thermostat.cc @@ -29,15 +29,15 @@ int algorithm::NoseHoover_Thermostat::init bool quiet ) { - if (sim.param().multibath.nosehoover > 0){ + if (sim.param().multibath.algorithm > 0){ if (!quiet){ - if (sim.param().multibath.nosehoover == 1){ + if (sim.param().multibath.algorithm == 1){ std::cout << "\tNose-Hoover temperature coupling\n"; } else{ std::cout << "\tNose-Hoover-Chain temperature coupling: using " - << sim.param().multibath.nosehoover << " instances\n"; + << sim.param().multibath.algorithm << " instances\n"; } } @@ -46,7 +46,7 @@ int algorithm::NoseHoover_Thermostat::init b_to = sim.multibath().end(); for( ; b_it != b_to; ++b_it){ - b_it->zeta.resize(sim.param().multibath.nosehoover, 0.0); + b_it->zeta.resize(sim.param().multibath.algorithm, 0.0); } } return 0; @@ -61,9 +61,9 @@ int algorithm::NoseHoover_Thermostat::apply { m_timer.start(); - assert(sim.param().multibath.nosehoover > 0); + assert(sim.param().multibath.algorithm > 0); - if (sim.param().multibath.nosehoover == 1) + if (sim.param().multibath.algorithm == 1) calc_scaling(topo, conf, sim); else calc_chain_scaling(topo, conf, sim); @@ -176,7 +176,7 @@ ::calc_chain_scaling // divide by zero measure... if (free_temp < math::epsilon) free_temp = b_it->temperature; - const int nhc = sim.param().multibath.nosehoover; + const int nhc = sim.param().multibath.algorithm; std::vector tau(nhc, b_it->tau * b_it->tau / b_it->dof); tau[0] = b_it->tau * b_it->tau; diff --git a/gromosXX/src/algorithm/temperature/temperature_calculation.cc b/gromosXX/src/algorithm/temperature/temperature_calculation.cc index 5811c2a6c..564404bfd 100644 --- a/gromosXX/src/algorithm/temperature/temperature_calculation.cc +++ b/gromosXX/src/algorithm/temperature/temperature_calculation.cc @@ -184,7 +184,7 @@ ::apply(topology::Topology & topo, (sim.param().precalclam.nr_lambdas-1); //loop over nr_lambdas - for (int lam_index = 0; lam_index < sim.param().precalclam.nr_lambdas; ++lam_index){ + for (unsigned int lam_index = 0; lam_index < sim.param().precalclam.nr_lambdas; ++lam_index){ // determine current lambda for this index double lam=(lam_index * lambda_step) + sim.param().precalclam.min_lam; diff --git a/gromosXX/src/check/Makefile.am b/gromosXX/src/check/Makefile.am index 069927d70..5d2a2cea1 100644 --- a/gromosXX/src/check/Makefile.am +++ b/gromosXX/src/check/Makefile.am @@ -64,7 +64,7 @@ lambdas_t_SOURCES = lambdas.t.cc\ check_state.cc lambdas_t_LDADD = ../libmdpp.la $(extra_lib) -TESTS = aladip.t aladip_unperturbed.t aladip_atomic.t aladip_ls.t aladip_special.t c16_cg.t lambdas.t +TESTS = aladip.t aladip_unperturbed.t aladip_atomic.t aladip_special.t c16_cg.t lambdas.t EXTRA_DIST = data/aladip.topo\ data/aladip.pttopo\ diff --git a/gromosXX/src/check/aladip.t.cc b/gromosXX/src/check/aladip.t.cc index ad8732b03..13368ea1e 100644 --- a/gromosXX/src/check/aladip.t.cc +++ b/gromosXX/src/check/aladip.t.cc @@ -25,6 +25,7 @@ #include "../util/parse_tcouple.h" #include "../io/blockinput.h" #include "../io/topology/in_topology.h" +#include "../io/message.h" #include "../algorithm/integration/leap_frog.h" #include "../algorithm/temperature/temperature_calculation.h" @@ -152,6 +153,8 @@ int main(int argc, char* argv[]) { std::cerr << "creating simulation failed!" << std::endl; return 1; } + io::messages.display(std::cout); + io::messages.clear(); if (true){ // create a forcefield @@ -167,6 +170,8 @@ int main(int argc, char* argv[]) { std::cerr << "creating forcefield failed!" << std::endl; return 1; } + io::messages.display(std::cout); + io::messages.clear(); ff->init(aladip_sim.topo, aladip_sim.conf, aladip_sim.sim, std::cout, quiet); @@ -228,5 +233,7 @@ int main(int argc, char* argv[]) { aladip_sim.md.print_timing(std::cout); } + io::messages.display(std::cout); + io::messages.clear(); return total; } diff --git a/gromosXX/src/check/aladip_atomic.t.cc b/gromosXX/src/check/aladip_atomic.t.cc index 83fdfdb5f..89552d772 100644 --- a/gromosXX/src/check/aladip_atomic.t.cc +++ b/gromosXX/src/check/aladip_atomic.t.cc @@ -25,6 +25,7 @@ #include "../util/parse_tcouple.h" #include "../io/blockinput.h" #include "../io/topology/in_topology.h" +#include "../io/message.h" #include "../algorithm/integration/leap_frog.h" #include "../algorithm/temperature/temperature_calculation.h" @@ -127,6 +128,8 @@ int main(int argc, char* argv[]) std::cerr << "creating simulation failed!" << std::endl; return 1; } + io::messages.display(std::cout); + io::messages.clear(); // create a forcefield interaction::Forcefield *ff = new interaction::Forcefield; @@ -141,10 +144,14 @@ int main(int argc, char* argv[]) std::cerr << "creating forcefield failed!" << std::endl; return 1; } + io::messages.display(std::cout); + io::messages.clear(); ff->init(aladip_sim.topo, aladip_sim.conf, aladip_sim.sim, std::cout, quiet); total += check::check_atomic_virial(aladip_sim.topo, aladip_sim.conf, aladip_sim.sim, *ff); + io::messages.display(std::cout); + io::messages.clear(); return total; } diff --git a/gromosXX/src/check/aladip_ls.t.cc b/gromosXX/src/check/aladip_ls.t.cc index 15a90fa7b..d547d03d3 100644 --- a/gromosXX/src/check/aladip_ls.t.cc +++ b/gromosXX/src/check/aladip_ls.t.cc @@ -25,6 +25,7 @@ #include "../util/parse_tcouple.h" #include "../io/blockinput.h" #include "../io/topology/in_topology.h" +#include "../io/message.h" #include "../algorithm/integration/leap_frog.h" #include "../algorithm/temperature/temperature_calculation.h" @@ -146,6 +147,8 @@ int main(int argc, char* argv[]) { std::cerr << "creating simulation failed!" << std::endl; return 1; } + io::messages.display(std::cout); + io::messages.clear(); if (true){ // create a forcefield @@ -161,6 +164,8 @@ int main(int argc, char* argv[]) { std::cerr << "creating forcefield failed!" << std::endl; return 1; } + io::messages.display(std::cout); + io::messages.clear(); // store backup value for width of the charge shaping function double ashape = aladip_sim.sim.param().nonbonded.ls_charge_shape_width; @@ -249,6 +254,8 @@ int main(int argc, char* argv[]) { } aladip_sim.md.print_timing(std::cout); } + io::messages.display(std::cout); + io::messages.clear(); return total; } diff --git a/gromosXX/src/check/aladip_special.t.cc b/gromosXX/src/check/aladip_special.t.cc index 99edea736..9ff10e6f0 100644 --- a/gromosXX/src/check/aladip_special.t.cc +++ b/gromosXX/src/check/aladip_special.t.cc @@ -25,6 +25,7 @@ #include "../util/parse_tcouple.h" #include "../io/blockinput.h" #include "../io/topology/in_topology.h" +#include "../io/message.h" #include "../algorithm/integration/leap_frog.h" #include "../algorithm/temperature/temperature_calculation.h" @@ -195,6 +196,8 @@ int main(int argc, char* argv[]) { std::cerr << "creating simulation failed!" << std::endl; return 1; } + io::messages.display(std::cout); + io::messages.clear(); #ifndef HAVE_CLIPPER aladip_sim.sim.param().xrayrest.xrayrest = simulation::xrayrest_off; @@ -214,12 +217,16 @@ int main(int argc, char* argv[]) { std::cerr << "creating forcefield failed!" << std::endl; return 1; } + io::messages.display(std::cout); + io::messages.clear(); ff->init(aladip_sim.topo, aladip_sim.conf, aladip_sim.sim, std::cout, quiet); // first check the forcefield total += check::check_forcefield(aladip_sim.topo, aladip_sim.conf, aladip_sim.sim, *ff, ref_values); + io::messages.display(std::cout); + io::messages.clear(); return total; } diff --git a/gromosXX/src/check/aladip_unperturbed.t.cc b/gromosXX/src/check/aladip_unperturbed.t.cc index e3a2228e2..6e5b7fd13 100644 --- a/gromosXX/src/check/aladip_unperturbed.t.cc +++ b/gromosXX/src/check/aladip_unperturbed.t.cc @@ -25,6 +25,7 @@ #include "../util/parse_tcouple.h" #include "../io/blockinput.h" #include "../io/topology/in_topology.h" +#include "../io/message.h" #include "../algorithm/integration/leap_frog.h" #include "../algorithm/temperature/temperature_calculation.h" @@ -143,6 +144,8 @@ int main(int argc, char* argv[]) { std::cerr << "creating simulation failed!" << std::endl; return 1; } + io::messages.display(std::cout); + io::messages.clear(); if (true){ // create a forcefield @@ -158,6 +161,8 @@ int main(int argc, char* argv[]) { std::cerr << "creating forcefield failed!" << std::endl; return 1; } + io::messages.display(std::cout); + io::messages.clear(); ff->init(aladip_sim.topo, aladip_sim.conf, aladip_sim.sim, std::cout, quiet); @@ -218,6 +223,8 @@ int main(int argc, char* argv[]) { } aladip_sim.md.print_timing(std::cout); } + io::messages.display(std::cout); + io::messages.clear(); return total; } diff --git a/gromosXX/src/check/c16_cg.t.cc b/gromosXX/src/check/c16_cg.t.cc index c6c099239..64b27e79e 100644 --- a/gromosXX/src/check/c16_cg.t.cc +++ b/gromosXX/src/check/c16_cg.t.cc @@ -25,6 +25,7 @@ #include "../util/parse_tcouple.h" #include "../io/blockinput.h" #include "../io/topology/in_topology.h" +#include "../io/message.h" #include "../algorithm/integration/leap_frog.h" #include "../algorithm/temperature/temperature_calculation.h" @@ -141,6 +142,8 @@ int main(int argc, char* argv[]) { std::cerr << "creating simulation failed!" << std::endl; return 1; } + io::messages.display(std::cout); + io::messages.clear(); // create a forcefield interaction::Forcefield *ff = new interaction::Forcefield; @@ -155,12 +158,16 @@ int main(int argc, char* argv[]) { std::cerr << "creating forcefield failed!" << std::endl; return 1; } + io::messages.display(std::cout); + io::messages.clear(); ff->init(c16_cg_sim.topo, c16_cg_sim.conf, c16_cg_sim.sim, std::cout, quiet); // first check the forcefield total += check::check_forcefield(c16_cg_sim.topo, c16_cg_sim.conf, c16_cg_sim.sim, *ff, ref_values); + io::messages.display(std::cout); + io::messages.clear(); return total; } diff --git a/gromosXX/src/check/check_state.cc b/gromosXX/src/check/check_state.cc index 76150091c..4f57faaf3 100644 --- a/gromosXX/src/check/check_state.cc +++ b/gromosXX/src/check/check_state.cc @@ -139,7 +139,6 @@ int check::check_state(topology::Topology & mytopo, // prepare rel_mol_com_pos util::prepare_virial(topo, conf, sim); - // calculate the virial (real) ff.apply(topo, conf, sim); diff --git a/gromosXX/src/check/data/aladip.in b/gromosXX/src/check/data/aladip.in index b9afde131..b65b3ed4d 100644 --- a/gromosXX/src/check/data/aladip.in +++ b/gromosXX/src/check/data/aladip.in @@ -145,7 +145,7 @@ FORCE # NTF array # bonds angles imp. dihe charge nonbonded # H H H H - 1 1 1 1 1 1 1 1 1 1 + 1 1 1 1 1 1 # NEGR NRE(1) NRE(2) ... NRE(NEGR) 2 12 72 END @@ -167,8 +167,8 @@ END NONBONDED # NLRELE 1 -# APPAK RCRF EPSRF - 0.0 1.4 62.0 +# APPAK RCRF EPSRF NSLFEXCL + 0.0 1.4 62.0 1 # NSHAPE ASHAPE NA2CLC TOLA2 EPSLS -1 1.4 2 0.1E-9 0.0 # NKX NKY NKZ NK2 @@ -256,21 +256,3 @@ END # NTPI # 0 #END - - -GROMOS96COMPAT -# NTNB96 0,1 controls use of g96-like nonbonded routines (ignored) -# 0 : not used [default] -# 1 : g96-like double-loop routines are used -# NTR96 0,1 controls use of reaction field formula -# 0 : new reaction field formula [default] -# 1 : g96 reaction field formula -# NTP96 0,1 controls use of g96 pressure calculation (ignored) -# 0 : new formula using ekin a t -# 1 : g96 formulat using ekin at t - dt / 2 -# NTG96 0,1 controls use of soft-core formula (ignored) -# 0 : new soft-core formula -# 1 : g96 soft-core formula [default] -# NTNB96 NTR96 NTP96 NTG96 - 1 1 1 1 -END diff --git a/gromosXX/src/check/data/aladip.topo b/gromosXX/src/check/data/aladip.topo index 9124f91cc..f8002602f 100644 --- a/gromosXX/src/check/data/aladip.topo +++ b/gromosXX/src/check/data/aladip.topo @@ -1,26 +1,24 @@ TITLE -Molecular topology in SPCE water. -Terminal blocked by CH3NH2 and COCH3, -Force field 45A3 (GROMOS96). From Thereza 18.11.2002. -Topology checked, Ric 16.12.2002. -REDTOP molecules: 1:4-15 -from: gmt_DIPEP_ALA.fmt +Reduced topology based on aladip_45a4.top +using atoms 1:5-16 END PHYSICALCONSTANTS # FPEPSI: 1.0/(4.0*PI*EPS0) (EPS0 is the permittivity of vacuum) -138.935 +138.9354 # HBAR: Planck's constant HBAR = H/(2* PI) 0.0635078 -# SPDL: Speed of light (in nm/ps) - 2.9979245800E05 -# BOLTZ: +# SPDL: Speed of light (nm/ps) +299792.458 +# BOLTZ: Boltzmann's constant kB 0.00831441 END TOPVERSION -1.7 +2.0 END ATOMTYPENAME +# NRATT: number of van der Waals atom types 45 +# TYPE: atom type names O OM OA @@ -72,268 +70,398 @@ CH2r CH0 END RESNAME +# NRAA2: number of residues in a solute molecule 3 +# AANM: residue names GLY ALA GLY END SOLUTEATOM +# NRP: number of solute atoms 12 +# ATNM: atom number +# MRES: residue number +# PANM: atom name of solute atom +# IAC: integer (van der Waals) atom type code +# MASS: mass of solute atom +# CG: charge of solute atom +# CGC: charge group code (0 or 1) +# INE: number of excluded atoms +# INE14: number of 1-4 interactions +# ATNM MRES PANM IAC MASS CG CGC INE +# INE14 1 1 CB 14 15.03500 0.00000 1 3 2 3 4 - 2 5 6 - 2 1 C 11 12.01100 0.38000 0 4 3 4 5 6 - 2 7 8 - 3 1 O 1 15.99940 -0.38000 1 1 4 - 2 5 6 - 4 2 N 5 14.00670 -0.28000 0 4 5 6 7 8 - 2 9 10 - 5 2 H 18 1.00800 0.28000 1 1 6 - 2 7 8 - 6 2 CA 12 13.01900 0.00000 0 4 7 8 9 10 - 2 11 12 - 7 2 CB 14 15.03500 0.00000 1 1 8 - 2 9 10 - 8 2 C 11 12.01100 0.38000 0 4 9 10 11 12 - 0 - 9 2 O 1 15.99940 -0.38000 1 1 10 - 2 11 12 - 10 3 N 5 14.00670 -0.28000 0 2 11 12 - 0 - 11 3 H 18 1.00800 0.28000 1 1 12 - 0 + 2 5 6 + 2 1 C 11 12.01100 0.38000 0 4 3 4 5 6 + 2 7 8 + 3 1 O 1 15.99940 -0.38000 1 1 4 + 2 5 6 + 4 2 N 5 14.00670 -0.28000 0 4 5 6 7 8 + 2 9 10 + 5 2 H 18 1.00800 0.28000 1 1 6 + 2 7 8 + 6 2 CA 12 13.01900 0.00000 0 4 7 8 9 10 + 2 11 12 + 7 2 CB 14 15.03500 0.00000 1 1 8 + 2 9 10 + 8 2 C 11 12.01100 0.38000 0 4 9 10 11 12 + 0 + 9 2 O 1 15.99940 -0.38000 1 1 10 + 2 11 12 + 10 3 N 5 14.00670 -0.28000 0 2 11 12 + 0 + 11 3 H 18 1.00800 0.28000 1 1 12 + 0 12 3 CB 14 15.03500 0.00000 1 0 - 0 + 0 END -BONDTYPE -47 - 1.57000e+07 1.00000e-01 - 1.87000e+07 1.00000e-01 - 1.23000e+07 1.09000e-01 - 1.66000e+07 1.23000e-01 - 1.34000e+07 1.25000e-01 - 1.20000e+07 1.32000e-01 - 8.87000e+06 1.33000e-01 - 1.06000e+07 1.33000e-01 - 1.18000e+07 1.33000e-01 - 1.05000e+07 1.34000e-01 - 1.17000e+07 1.34000e-01 - 1.02000e+07 1.36000e-01 - 1.10000e+07 1.38000e-01 - 8.66000e+06 1.39000e-01 - 1.08000e+07 1.39000e-01 - 8.54000e+06 1.40000e-01 - 8.18000e+06 1.43000e-01 - 9.21000e+06 1.43000e-01 - 6.10000e+06 1.43500e-01 - 8.71000e+06 1.47000e-01 - 5.73000e+06 1.48000e-01 - 7.64000e+06 1.48000e-01 - 8.60000e+06 1.48000e-01 - 8.37000e+06 1.50000e-01 - 5.43000e+06 1.52000e-01 - 7.15000e+06 1.53000e-01 - 4.84000e+06 1.61000e-01 - 4.72000e+06 1.63000e-01 - 5.94000e+06 1.78000e-01 - 5.62000e+06 1.83000e-01 - 3.59000e+06 1.87000e-01 - 6.40000e+05 1.98000e-01 - 5.03000e+06 2.04000e-01 - 6.28000e+05 2.00000e-01 - 2.32000e+07 1.00000e-01 - 1.21000e+07 1.10000e-01 - 8.12000e+06 1.75800e-01 - 8.04000e+06 1.53000e-01 - 4.95000e+06 1.95000e-01 - 8.10000e+06 1.76000e-01 - 8.71000e+06 1.63299e-01 - 2.68000e+06 2.33839e-01 - 2.98000e+06 2.90283e-01 - 2.39000e+06 2.80412e-01 - 2.19000e+06 2.92993e-01 - 3.97000e+06 1.98842e-01 - 3.04000e+06 2.87407e-01 +BONDSTRETCHTYPE +# NBTY: number of covalent bond types +50 +# CB: quartic force constant +# CHB: harmonic force constant +# B0: bond length at minimum energy +# CB CHB B0 + 1.57000e+07 3.14000e+05 1.00000e-01 + 1.87000e+07 3.74000e+05 1.00000e-01 + 1.23000e+07 2.92273e+05 1.09000e-01 + 1.66000e+07 5.02283e+05 1.23000e-01 + 1.34000e+07 4.18750e+05 1.25000e-01 + 1.20000e+07 4.18176e+05 1.32000e-01 + 8.87000e+06 3.13803e+05 1.33000e-01 + 1.06000e+07 3.75007e+05 1.33000e-01 + 1.18000e+07 4.17460e+05 1.33000e-01 + 1.05000e+07 3.77076e+05 1.34000e-01 +# 10 + 1.17000e+07 4.20170e+05 1.34000e-01 + 1.02000e+07 3.77318e+05 1.36000e-01 + 1.10000e+07 4.18968e+05 1.38000e-01 + 8.66000e+06 3.34640e+05 1.39000e-01 + 1.08000e+07 4.17334e+05 1.39000e-01 + 8.54000e+06 3.34768e+05 1.40000e-01 + 8.18000e+06 3.34546e+05 1.43000e-01 + 9.21000e+06 3.76671e+05 1.43000e-01 + 6.10000e+06 2.51225e+05 1.43500e-01 + 8.71000e+06 3.76429e+05 1.47000e-01 +# 20 + 5.73000e+06 2.51020e+05 1.48000e-01 + 7.64000e+06 3.34693e+05 1.48000e-01 + 8.60000e+06 3.76749e+05 1.48000e-01 + 8.37000e+06 3.76650e+05 1.50000e-01 + 5.43000e+06 2.50909e+05 1.52000e-01 + 7.15000e+06 3.34749e+05 1.53000e-01 + 4.84000e+06 2.50915e+05 1.61000e-01 + 4.72000e+06 2.50811e+05 1.63000e-01 + 5.94000e+06 3.76406e+05 1.78000e-01 + 5.62000e+06 3.76416e+05 1.83000e-01 +# 30 + 3.59000e+06 2.51077e+05 1.87000e-01 + 6.40000e+05 5.01811e+04 1.98000e-01 + 5.03000e+06 4.18657e+05 2.04000e-01 + 6.28000e+05 5.02400e+04 2.00000e-01 + 2.32000e+07 4.64000e+05 1.00000e-01 + 1.21000e+07 2.92820e+05 1.10000e-01 + 8.12000e+06 5.01908e+05 1.75800e-01 + 8.04000e+06 3.76417e+05 1.53000e-01 + 4.95000e+06 3.76448e+05 1.95000e-01 + 8.10000e+06 5.01811e+05 1.76000e-01 +# 40 + 8.71000e+06 4.64532e+05 1.63299e-01 + 2.68000e+06 2.93088e+05 2.33839e-01 + 2.98000e+06 5.02215e+05 2.90283e-01 + 2.39000e+06 3.75856e+05 2.80412e-01 + 2.19000e+06 3.76001e+05 2.92993e-01 + 3.97000e+06 3.13933e+05 1.98842e-01 + 3.04000e+06 5.02225e+05 2.87407e-01 + 5.40000e+05 5.27483e+04 2.21000e-01 + 2.72000e+06 1.72361e+05 1.78000e-01 + 3.70000e+07 9.28256e+05 1.12000e-01 END BONDH +# NBONH: number of bonds involving H atoms in solute 2 - 4 5 2 - 10 11 2 +# IBH, JBH: atom sequence numbers of atoms forming a bond +# ICBH: bond type code +# IBH JBH ICBH + 4 5 2 + 10 11 2 END BOND +# NBON: number of bonds NOT involving H atoms in solute 9 - 1 2 26 - 2 3 4 - 2 4 9 - 4 6 20 - 6 7 26 - 6 8 26 - 8 9 4 - 8 10 9 - 10 12 20 +# IB, JB: atom sequence numbers of atoms forming a bond +# ICB: bond type code +# IB JB ICB + 1 2 26 + 2 3 4 + 2 4 9 + 4 6 20 + 6 7 26 + 6 8 26 + 8 9 4 + 8 10 9 + 10 12 20 END -BONDANGLETYPE -46 - 4.20000e+02 9.00000e+01 - 4.05000e+02 9.60000e+01 - 4.75000e+02 1.00000e+02 - 4.20000e+02 1.03000e+02 - 4.90000e+02 1.04000e+02 - 4.65000e+02 1.08000e+02 - 2.85000e+02 1.09500e+02 - 3.20000e+02 1.09500e+02 - 3.80000e+02 1.09500e+02 - 4.25000e+02 1.09500e+02 - 4.50000e+02 1.09500e+02 - 5.20000e+02 1.09500e+02 - 4.50000e+02 1.09600e+02 - 5.30000e+02 1.11000e+02 - 5.45000e+02 1.13000e+02 - 5.00000e+01 1.15000e+02 - 4.60000e+02 1.15000e+02 - 6.10000e+02 1.15000e+02 - 4.65000e+02 1.16000e+02 - 6.20000e+02 1.16000e+02 - 6.35000e+02 1.17000e+02 - 3.90000e+02 1.20000e+02 - 4.45000e+02 1.20000e+02 - 5.05000e+02 1.20000e+02 - 5.30000e+02 1.20000e+02 - 5.60000e+02 1.20000e+02 - 6.70000e+02 1.20000e+02 - 7.80000e+02 1.20000e+02 - 6.85000e+02 1.21000e+02 - 7.00000e+02 1.22000e+02 - 4.15000e+02 1.23000e+02 - 7.30000e+02 1.24000e+02 - 3.75000e+02 1.25000e+02 - 7.50000e+02 1.25000e+02 - 5.75000e+02 1.26000e+02 - 6.40000e+02 1.26000e+02 - 7.70000e+02 1.26000e+02 - 7.60000e+02 1.32000e+02 - 2.21500e+03 1.55000e+02 - 4.34000e+02 1.09500e+02 - 4.84000e+02 1.07570e+02 - 6.32000e+02 1.11300e+02 - 4.69000e+02 9.74000e+01 - 5.03000e+02 1.06750e+02 - 4.43000e+02 1.08530e+02 - 6.18000e+02 1.09500e+02 +BONDANGLEBENDTYPE +# NTTY: number of bond angle types +48 +# CT: force constant (based on potential +# harmonic in the angle cosine) +# CHT: force constant (based on potential +# harmonic in the angle) +# T0: bond angle at minimum energy in degrees +# CT CHT T0 + 4.20000e+02 1.27686e-01 9.00000e+01 + 4.05000e+02 1.21771e-01 9.60000e+01 + 4.75000e+02 1.40083e-01 1.00000e+02 + 4.20000e+02 1.21222e-01 1.03000e+02 + 4.90000e+02 1.40285e-01 1.04000e+02 + 4.65000e+02 1.27888e-01 1.08000e+02 + 2.85000e+02 7.69125e-02 1.09500e+02 + 3.20000e+02 8.63861e-02 1.09500e+02 + 3.80000e+02 1.02627e-01 1.09500e+02 + 4.25000e+02 1.14807e-01 1.09500e+02 +# 10 + 4.50000e+02 1.21574e-01 1.09500e+02 + 5.20000e+02 1.40521e-01 1.09500e+02 + 4.50000e+02 1.21423e-01 1.09600e+02 + 5.30000e+02 1.40487e-01 1.11000e+02 + 5.45000e+02 1.40451e-01 1.13000e+02 + 5.00000e+01 1.22966e-02 1.15000e+02 + 4.60000e+02 1.14885e-01 1.15000e+02 + 6.10000e+02 1.52417e-01 1.15000e+02 + 4.65000e+02 1.14219e-01 1.16000e+02 + 6.20000e+02 1.52361e-01 1.16000e+02 +# 20 + 6.35000e+02 1.53360e-01 1.17000e+02 + 3.90000e+02 8.89104e-02 1.20000e+02 + 4.45000e+02 1.01476e-01 1.20000e+02 + 5.05000e+02 1.15184e-01 1.20000e+02 + 5.30000e+02 1.20895e-01 1.20000e+02 + 5.60000e+02 1.27749e-01 1.20000e+02 + 6.70000e+02 1.52880e-01 1.20000e+02 + 7.80000e+02 1.78011e-01 1.20000e+02 + 6.85000e+02 1.53127e-01 1.21000e+02 + 7.00000e+02 1.53174e-01 1.22000e+02 +# 30 + 4.15000e+02 8.87438e-02 1.23000e+02 + 7.30000e+02 1.52669e-01 1.24000e+02 + 3.75000e+02 7.64902e-02 1.25000e+02 + 7.50000e+02 1.53141e-01 1.25000e+02 + 5.75000e+02 1.14487e-01 1.26000e+02 + 6.40000e+02 1.27447e-01 1.26000e+02 + 7.70000e+02 1.53365e-01 1.26000e+02 + 7.60000e+02 1.27755e-01 1.32000e+02 + 2.21500e+03 1.21127e-01 1.55000e+02 + 4.34000e+02 1.17243e-01 1.09500e+02 +# 40 + 4.84000e+02 1.33765e-01 1.07570e+02 + 6.32000e+02 1.66891e-01 1.11300e+02 + 4.69000e+02 1.40245e-01 9.74000e+01 + 5.03000e+02 1.40260e-01 1.06750e+02 + 4.43000e+02 1.21084e-01 1.08530e+02 + 6.18000e+02 1.67047e-01 1.09500e+02 + 3.80000e+02 1.15501e-01 9.00000e+01 + 9.13500e+04 7.26402e-02 1.80000e+02 END BONDANGLEH +# NTHEH: number of bond angles involving H atoms in solute 4 - 2 4 5 31 - 5 4 6 17 - 8 10 11 31 - 11 10 12 17 +# ITH, JTH, KTH: atom sequence numbers +# of atoms forming a bond angle in solute +# ICTH: bond angle type code +# ITH JTH KTH ICTH + 2 4 5 31 + 5 4 6 17 + 8 10 11 31 + 11 10 12 17 END BONDANGLE +# NTHE: number of bond angles NOT +# involving H atoms in solute 11 - 1 2 3 29 - 1 2 4 18 - 3 2 4 32 - 2 4 6 30 - 4 6 7 12 - 4 6 8 12 - 7 6 8 12 - 6 8 9 29 - 6 8 10 18 - 9 8 10 32 - 8 10 12 30 +# IT, JT, KT: atom sequence numbers of atoms +# forming a bond angle +# ICT: bond angle type code +# IT JT KT ICT + 1 2 3 29 + 1 2 4 18 + 3 2 4 32 + 2 4 6 30 + 4 6 7 12 + 4 6 8 12 + 7 6 8 12 + 6 8 9 29 + 6 8 10 18 + 9 8 10 32 +# 10 + 8 10 12 30 END IMPDIHEDRALTYPE +# NQTY: number of improper dihedrals 3 - 5.10000e-02 0.00000e+00 - 1.02000e-01 3.52644e+01 - 2.04000e-01 0.00000e+00 +# CQ: force constant of improper dihedral per degrees square +# Q0: improper dihedral angle at minimum energy in degrees +# CQ Q0 + 5.10000e-02 0.00000e+00 + 1.02000e-01 3.52644e+01 + 2.04000e-01 0.00000e+00 END IMPDIHEDRALH +# NQHIH: number of improper dihedrals +# involving H atoms in the solute 2 - 4 2 6 5 1 - 10 8 12 11 1 +# IQH,JQH,KQH,LQH: atom sequence numbers +# of atoms forming an improper dihedral +# ICQH: improper dihedral type code +# IQH JQH KQH LQH ICQH + 4 2 6 5 1 + 10 8 12 11 1 END IMPDIHEDRAL +# NQHI: number of improper dihedrals NOT +# involving H atoms in solute 3 - 2 1 4 3 1 - 6 4 8 7 2 - 8 6 10 9 1 +# IQ,JQ,KQ,LQ: atom sequence numbers of atoms +# forming an improper dihedral +# ICQ: improper dihedral type code +# IQ JQ KQ LQ ICQ + 2 1 4 3 1 + 6 4 8 7 2 + 8 6 10 9 1 END -DIHEDRALTYPE -21 - 5.86000 -1.00000 2 - 7.11000 -1.00000 2 - 16.70000 -1.00000 2 - 33.50000 -1.00000 2 - 41.80000 -1.00000 2 - 0.00000 1.00000 2 - 0.41800 1.00000 2 - 2.09000 1.00000 2 - 3.14000 1.00000 2 - 16.70000 1.00000 2 - 1.05000 1.00000 3 - 1.26000 1.00000 3 - 2.93000 1.00000 3 - 3.77000 1.00000 3 - 4.18000 1.00000 3 - 5.44000 1.00000 3 - 5.92000 1.00000 3 - 0.00000 1.00000 4 - 1.00000 -1.00000 6 - 1.00000 1.00000 6 - 3.77000 1.00000 6 +TORSDIHEDRALTYPE +# NPTY: number of dihedral types +40 +# CP: force constant +# PD: phase-shift angle +# NP: multiplicity +# CP PD NP + 5.86000 180.00000 2 + 7.11000 180.00000 2 + 16.70000 180.00000 2 + 33.50000 180.00000 2 + 41.80000 180.00000 2 + 0.00000 0.00000 2 + 0.41800 0.00000 2 + 2.09000 0.00000 2 + 3.14000 0.00000 2 + 16.70000 0.00000 2 +# 10 + 1.05000 0.00000 3 + 1.26000 0.00000 3 + 2.93000 0.00000 3 + 3.77000 0.00000 3 + 4.18000 0.00000 3 + 5.44000 0.00000 3 + 5.92000 0.00000 3 + 0.00000 0.00000 4 + 1.00000 180.00000 6 + 1.00000 0.00000 6 +# 20 + 3.77000 0.00000 6 + 5.35000 0.00000 1 + 2.53000 0.00000 3 + 5.09000 0.00000 2 + 3.19000 0.00000 3 + 2.79000 0.00000 1 + 5.86000 180.00000 1 + 8.62000 0.00000 3 + 24.00000 180.00000 2 + 3.90000 0.00000 3 +# 30 + 9.35000 180.00000 1 + 9.50000 0.00000 3 + 9.45000 180.00000 1 + 3.41000 180.00000 1 + 4.69000 0.00000 3 + 3.65000 0.00000 3 + 6.66000 180.00000 1 + 7.69000 0.00000 3 + 2.67000 180.00000 1 + 1.53000 180.00000 2 END DIHEDRALH +# NPHIH: number of dihedrals involving H atoms in solute 0 +# IPH, JPH, KPH, LPH: atom sequence numbers +# of atoms forming a dihedral +# ICPH: dihedral type code +# IPH JPH KPH LPH ICPH END DIHEDRAL +# NPHI: number of dihedrals NOT involving H atoms in solute 4 - 1 2 4 6 4 - 2 4 6 8 19 - 4 6 8 10 20 - 6 8 10 12 4 -END -SOLUTEMOLECULES -# NSPM NSP(1.. NSPM) - 1 12 +# IP, JP, KP, LP: atom sequence numbers +# of atoms forming a dihedral +# ICP: dihedral type code +# IP JP KP LP ICP + 1 2 4 6 4 + 2 4 6 8 19 + 4 6 8 10 20 + 6 8 10 12 4 END -TEMPERATUREGROUPS -# NSPM NSP(1.. NSPM) - 1 12 +CROSSDIHEDRALH +# NPHIH: number of cross dihedrals involving H atoms in solute +0 +# APH, BPH, CPH, DPH, EPH, FPH, GPH, HPH: atom sequence numbers +# of atoms forming a dihedral +# ICCH: dihedral type code +# APH BPH CPH DPH EPH FPH GPH HPH ICCH END -PRESSUREGROUPS -# NSPM NSP(1.. NSPM) - 1 12 +CROSSDIHEDRAL +# NPPC: number of cross dihedrals NOT involving H atoms in solute +0 +# AP, BP, CP, DP, EP, FP, GP, HP: atom sequence numbers +# of atoms forming a dihedral +# ICC: dihedral type code +# AP BP CP DP EP FP GP HP ICC END LJPARAMETERS +# NRATT2: number of LJ interaction types = NRATT*(NRATT+1)/2 1035 +# IAC,JAC: integer (van der Waals) atom type code +# C12: r**(-12) term in nonbonded interactions +# C6: r**(-6) term in nonbonded interactions +# CS12: r**(-12) term in 1-4 nonbonded interactions +# CS6: r**(-6) term in 1-4 nonbonded interactions +# IAC JAC C12 C6 CS12 CS6 1 1 7.414932e-07 2.261954e-03 7.414932e-07 2.261954e-03 +# 1 2 7.414932e-07 2.261954e-03 7.414932e-07 2.261954e-03 2 2 7.414932e-07 2.261954e-03 7.414932e-07 2.261954e-03 +# 1 3 1.380375e-06 2.261954e-03 9.687375e-07 2.261954e-03 2 3 2.258907e-06 2.261954e-03 9.687375e-07 2.261954e-03 3 3 1.505529e-06 2.261954e-03 1.265625e-06 2.261954e-03 +# 1 4 1.825875e-06 2.433170e-03 1.397565e-06 2.433170e-03 2 4 2.987943e-06 2.433170e-03 1.397565e-06 2.433170e-03 3 4 1.991421e-06 2.433170e-03 1.825875e-06 2.433170e-03 4 4 2.634129e-06 2.617346e-03 2.634129e-06 2.617346e-03 +# 1 5 2.185875e-06 2.347562e-03 1.120291e-06 2.347562e-03 2 5 3.577063e-06 2.347562e-03 1.120291e-06 2.347562e-03 3 5 2.384061e-06 2.347562e-03 1.463625e-06 2.347562e-03 4 5 3.153489e-06 2.525258e-03 2.111523e-06 2.525258e-03 5 5 1.692601e-06 2.436410e-03 1.692601e-06 2.436410e-03 +# 1 6 2.531250e-06 2.347562e-03 1.120291e-06 2.347562e-03 2 6 4.142250e-06 2.347562e-03 1.120291e-06 2.347562e-03 3 6 2.760750e-06 2.347562e-03 1.463625e-06 2.347562e-03 4 6 3.651750e-06 2.525258e-03 2.111523e-06 2.525258e-03 - 5 6 1.692601e-06 2.436410e-03 1.692601e-06 2.436410e-03 - 6 6 1.692601e-06 2.436410e-03 1.692601e-06 2.436410e-03 + 5 6 4.371750e-06 2.436410e-03 1.692601e-06 2.436410e-03 + 6 6 5.062500e-06 2.436410e-03 1.692601e-06 2.436410e-03 +# 1 7 3.451500e-06 2.347562e-03 1.120291e-06 2.347562e-03 2 7 9.412624e-06 2.347562e-03 1.120291e-06 2.347562e-03 3 7 3.764436e-06 2.347562e-03 1.463625e-06 2.347562e-03 4 7 4.979364e-06 2.525258e-03 2.111523e-06 2.525258e-03 5 7 1.692601e-06 2.436410e-03 1.692601e-06 2.436410e-03 - 6 7 1.692601e-06 2.436410e-03 1.692601e-06 2.436410e-03 + 6 7 6.903000e-06 2.436410e-03 1.692601e-06 2.436410e-03 7 7 1.692601e-06 2.436410e-03 1.692601e-06 2.436410e-03 +# 1 8 2.071125e-06 2.347562e-03 1.120291e-06 2.347562e-03 2 8 3.389281e-06 2.347562e-03 1.120291e-06 2.347562e-03 3 8 2.258907e-06 2.347562e-03 1.463625e-06 2.347562e-03 @@ -342,25 +470,28 @@ LJPARAMETERS 6 8 4.142250e-06 2.436410e-03 1.692601e-06 2.436410e-03 7 8 5.648188e-06 2.436410e-03 1.692601e-06 2.436410e-03 8 8 3.389281e-06 2.436410e-03 1.692601e-06 2.436410e-03 +# 1 9 2.416500e-06 2.347562e-03 1.120291e-06 2.347562e-03 2 9 6.590064e-06 2.347562e-03 1.120291e-06 2.347562e-03 3 9 2.635596e-06 2.347562e-03 1.463625e-06 2.347562e-03 4 9 3.486204e-06 2.525258e-03 2.111523e-06 2.525258e-03 5 9 1.692601e-06 2.436410e-03 1.692601e-06 2.436410e-03 - 6 9 1.692601e-06 2.436410e-03 1.692601e-06 2.436410e-03 + 6 9 4.833000e-06 2.436410e-03 1.692601e-06 2.436410e-03 7 9 1.692601e-06 2.436410e-03 1.692601e-06 2.436410e-03 8 9 3.954468e-06 2.436410e-03 1.692601e-06 2.436410e-03 9 9 1.692601e-06 2.436410e-03 1.692601e-06 2.436410e-03 +# 1 10 2.232000e-06 2.347562e-03 1.120291e-06 2.347562e-03 2 10 6.086912e-06 2.347562e-03 1.120291e-06 2.347562e-03 3 10 2.434368e-06 2.347562e-03 1.463625e-06 2.347562e-03 4 10 3.220032e-06 2.525258e-03 2.111523e-06 2.525258e-03 5 10 1.692601e-06 2.436410e-03 1.692601e-06 2.436410e-03 - 6 10 1.692601e-06 2.436410e-03 1.692601e-06 2.436410e-03 + 6 10 4.464000e-06 2.436410e-03 1.692601e-06 2.436410e-03 7 10 1.692601e-06 2.436410e-03 1.692601e-06 2.436410e-03 8 10 3.652544e-06 2.436410e-03 1.692601e-06 2.436410e-03 9 10 1.692601e-06 2.436410e-03 1.692601e-06 2.436410e-03 10 10 1.692601e-06 2.436410e-03 1.692601e-06 2.436410e-03 +# 1 11 1.581841e-06 2.300953e-03 1.581841e-06 2.300953e-03 2 11 1.581841e-06 2.300953e-03 1.581841e-06 2.300953e-03 3 11 2.066625e-06 2.300953e-03 2.066625e-06 2.300953e-03 @@ -372,6 +503,7 @@ LJPARAMETERS 9 11 2.389937e-06 2.388037e-03 2.389937e-06 2.388037e-03 10 11 2.389937e-06 2.388037e-03 2.389937e-06 2.388037e-03 11 11 3.374569e-06 2.340624e-03 3.374569e-06 2.340624e-03 +# 1 12 8.481835e-06 3.704924e-03 1.664506e-06 2.566338e-03 2 12 8.481835e-06 3.704924e-03 1.664506e-06 2.566338e-03 3 12 1.108125e-05 3.704924e-03 2.174625e-06 2.566338e-03 @@ -384,6 +516,7 @@ LJPARAMETERS 10 12 1.281485e-05 3.845144e-03 2.514833e-06 2.663466e-03 11 12 1.809445e-05 3.768802e-03 3.550921e-06 2.610585e-03 12 12 9.702250e-05 6.068410e-03 3.736489e-06 2.911682e-03 +# 1 13 5.018491e-06 4.110135e-03 1.875128e-06 3.268799e-03 2 13 5.018491e-06 4.110135e-03 1.875128e-06 3.268799e-03 3 13 6.556500e-06 4.110135e-03 2.449796e-06 3.268799e-03 @@ -397,6 +530,7 @@ LJPARAMETERS 11 13 1.070604e-05 4.181000e-03 4.000245e-06 3.325157e-03 12 13 5.740580e-05 6.732118e-03 4.209294e-06 3.708671e-03 13 13 3.396558e-05 7.468416e-03 4.741926e-06 4.723813e-03 +# 1 14 4.444998e-06 4.663258e-03 2.114674e-06 3.937017e-03 2 14 4.444998e-06 4.663258e-03 2.114674e-06 3.937017e-03 3 14 5.807250e-06 4.663258e-03 2.762755e-06 3.937017e-03 @@ -411,6 +545,7 @@ LJPARAMETERS 12 14 5.084570e-05 7.638095e-03 4.747027e-06 4.466809e-03 13 14 3.008414e-05 8.473481e-03 5.347702e-06 5.689469e-03 14 14 2.664624e-05 9.613802e-03 6.030865e-06 6.852528e-03 +# 1 15 5.047768e-06 5.459888e-03 5.047768e-06 5.459888e-03 2 15 5.047768e-06 5.459888e-03 5.047768e-06 5.459888e-03 3 15 6.594750e-06 5.459888e-03 6.594750e-06 5.459888e-03 @@ -426,6 +561,7 @@ LJPARAMETERS 13 15 3.416374e-05 9.921016e-03 1.276507e-05 7.890204e-03 14 15 3.025964e-05 1.125614e-02 1.439579e-05 9.503144e-03 15 15 3.436304e-05 1.317904e-02 3.436304e-05 1.317904e-02 +# 1 16 3.347957e-06 3.531330e-03 2.485135e-06 3.536086e-03 2 16 3.347957e-06 3.531330e-03 2.485135e-06 3.536086e-03 3 16 4.374000e-06 3.531330e-03 3.246750e-06 3.536086e-03 @@ -438,10 +574,11 @@ LJPARAMETERS 10 16 5.058288e-06 3.664980e-03 3.754686e-06 3.669916e-03 11 16 7.142256e-06 3.592215e-03 5.301582e-06 3.597053e-03 12 16 3.829680e-05 5.784075e-03 5.578638e-06 4.011926e-03 - 13 16 2.265926e-05 6.416685e-03 6.284543e-06 5.110075e-03 + 13 16 2.265926e-05 6.416685e-03 6.284543e-06 5.110076e-03 14 16 2.006986e-05 7.280212e-03 7.087387e-06 6.154693e-03 15 16 2.279146e-05 8.523900e-03 1.691773e-05 8.535380e-03 - 16 16 1.511654e-05 5.513063e-03 8.328996e-06 5.527922e-03 + 16 16 1.511654e-05 5.513062e-03 8.328996e-06 5.527922e-03 +# 1 17 1.059153e-07 4.375520e-04 1.059153e-07 4.375520e-04 2 17 1.059153e-07 4.375520e-04 1.059153e-07 4.375520e-04 3 17 1.383750e-07 4.375520e-04 1.383750e-07 4.375520e-04 @@ -459,6 +596,7 @@ LJPARAMETERS 15 17 7.210260e-07 1.056160e-03 7.210260e-07 1.056160e-03 16 17 4.782240e-07 6.831000e-04 3.549780e-07 6.840200e-04 17 17 1.512900e-08 8.464000e-05 1.512900e-08 8.464000e-05 +# 1 18 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 2 18 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 3 18 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 @@ -477,6 +615,7 @@ LJPARAMETERS 16 18 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 17 18 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 18 18 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 +# 1 19 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 2 19 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 3 19 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 @@ -496,6 +635,7 @@ LJPARAMETERS 17 19 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 18 19 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 19 19 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 +# 1 20 3.113738e-06 4.752195e-03 3.113738e-06 4.752195e-03 2 20 3.113738e-06 4.752195e-03 3.113738e-06 4.752195e-03 3 20 4.068000e-06 4.752195e-03 4.068000e-06 4.752195e-03 @@ -516,6 +656,7 @@ LJPARAMETERS 18 20 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 19 20 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 20 20 1.307546e-05 9.984006e-03 1.307546e-05 9.984006e-03 +# 1 21 2.531250e-07 9.726020e-04 6.164615e-08 9.726020e-04 2 21 6.903000e-07 9.726020e-04 6.164615e-08 9.726020e-04 3 21 2.760750e-07 9.726020e-04 8.053875e-08 9.726020e-04 @@ -529,14 +670,15 @@ LJPARAMETERS 11 21 1.315108e-07 9.893710e-04 1.315108e-07 9.893710e-04 12 21 7.051615e-07 1.593055e-03 1.383835e-07 1.103482e-03 13 21 4.172265e-07 1.767289e-03 1.558941e-07 1.405529e-03 - 14 21 3.695476e-07 2.005123e-03 1.758094e-07 1.692851e-03 + 14 21 3.695476e-07 2.005122e-03 1.758094e-07 1.692851e-03 15 21 4.196606e-07 2.347660e-03 4.196606e-07 2.347660e-03 - 16 21 2.783419e-07 1.518412e-03 2.066087e-07 1.520458e-03 + 16 21 2.783419e-07 1.518412e-03 2.066087e-07 1.520457e-03 17 21 8.805570e-09 1.881400e-04 8.805570e-09 1.881400e-04 18 21 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 19 21 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 20 21 2.588694e-07 2.043364e-03 2.588694e-07 2.043364e-03 21 21 5.125128e-09 4.182025e-04 5.125128e-09 4.182025e-04 +# 1 22 4.602375e-07 9.726020e-04 6.164615e-08 9.726020e-04 2 22 1.255119e-06 9.726020e-04 6.164615e-08 9.726020e-04 3 22 5.019657e-07 9.726020e-04 8.053875e-08 9.726020e-04 @@ -550,15 +692,16 @@ LJPARAMETERS 11 22 1.315108e-07 9.893710e-04 1.315108e-07 9.893710e-04 12 22 7.051615e-07 1.593055e-03 1.383835e-07 1.103482e-03 13 22 4.172265e-07 1.767289e-03 1.558941e-07 1.405529e-03 - 14 22 3.695476e-07 2.005123e-03 1.758094e-07 1.692851e-03 + 14 22 3.695476e-07 2.005122e-03 1.758094e-07 1.692851e-03 15 22 4.196606e-07 2.347660e-03 4.196606e-07 2.347660e-03 - 16 22 2.783419e-07 1.518412e-03 2.066087e-07 1.520458e-03 + 16 22 2.783419e-07 1.518412e-03 2.066087e-07 1.520457e-03 17 22 8.805570e-09 1.881400e-04 8.805570e-09 1.881400e-04 18 22 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 19 22 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 20 22 2.588694e-07 2.043364e-03 2.588694e-07 2.043364e-03 21 22 5.125128e-09 4.182025e-04 5.125128e-09 4.182025e-04 22 22 5.125128e-09 4.182025e-04 5.125128e-09 4.182025e-04 +# 1 23 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 2 23 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 3 23 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 @@ -582,6 +725,7 @@ LJPARAMETERS 21 23 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 22 23 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 23 23 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 +# 1 24 1.093050e-07 9.726020e-04 8.366448e-08 9.726020e-04 2 24 2.980869e-07 9.726020e-04 8.366448e-08 9.726020e-04 3 24 1.192153e-07 9.726020e-04 1.093050e-07 9.726020e-04 @@ -595,9 +739,9 @@ LJPARAMETERS 11 24 1.784829e-07 9.893710e-04 1.784829e-07 9.893710e-04 12 24 9.570260e-07 1.593055e-03 1.878103e-07 1.103482e-03 13 24 5.662485e-07 1.767289e-03 2.115753e-07 1.405529e-03 - 14 24 5.015399e-07 2.005123e-03 2.386038e-07 1.692851e-03 + 14 24 5.015399e-07 2.005122e-03 2.386038e-07 1.692851e-03 15 24 5.695519e-07 2.347660e-03 5.695519e-07 2.347660e-03 - 16 24 3.777581e-07 1.518412e-03 2.804038e-07 1.520458e-03 + 16 24 3.777581e-07 1.518412e-03 2.804038e-07 1.520457e-03 17 24 1.195068e-08 1.881400e-04 1.195068e-08 1.881400e-04 18 24 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 19 24 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 @@ -606,6 +750,7 @@ LJPARAMETERS 22 24 6.955684e-09 4.182025e-04 6.955684e-09 4.182025e-04 23 24 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 24 24 9.440066e-09 4.182025e-04 9.440066e-09 4.182025e-04 +# 1 25 6.567750e-08 3.842848e-04 5.027102e-08 3.842848e-04 2 25 1.791098e-07 3.842848e-04 5.027102e-08 3.842848e-04 3 25 7.163226e-08 3.842848e-04 6.567750e-08 3.842848e-04 @@ -631,6 +776,7 @@ LJPARAMETERS 23 25 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 24 25 5.672201e-09 1.652360e-04 5.672201e-09 1.652360e-04 25 25 3.408224e-09 6.528640e-05 3.408224e-09 6.528640e-05 +# 1 26 7.939125e-07 1.507652e-03 6.076783e-07 1.507652e-03 2 26 2.165088e-06 1.507652e-03 6.076783e-07 1.507652e-03 3 26 8.658939e-07 1.507652e-03 7.939125e-07 1.507652e-03 @@ -657,6 +803,7 @@ LJPARAMETERS 24 26 6.856581e-08 6.482650e-04 6.856581e-08 6.482650e-04 25 26 4.119877e-08 2.561360e-04 4.119877e-08 2.561360e-04 26 26 4.980125e-07 1.004890e-03 4.980125e-07 1.004890e-03 +# 1 27 5.299875e-06 5.773784e-03 4.056642e-06 5.773784e-03 2 27 1.445335e-05 5.773784e-03 4.056642e-06 5.773784e-03 3 27 5.780397e-06 5.773784e-03 5.299875e-06 5.773784e-03 @@ -684,6 +831,7 @@ LJPARAMETERS 25 27 2.750282e-07 9.809120e-04 2.750282e-07 9.809120e-04 26 27 3.324553e-06 3.848380e-03 3.324553e-06 3.848380e-03 27 27 2.219352e-05 1.473796e-02 2.219352e-05 1.473796e-02 +# 1 28 2.702132e-06 3.764374e-03 2.702132e-06 3.764374e-03 2 28 2.702132e-06 3.764374e-03 2.702132e-06 3.764374e-03 3 28 3.530250e-06 3.764374e-03 3.530250e-06 3.764374e-03 @@ -696,7 +844,7 @@ LJPARAMETERS 10 28 4.082538e-06 3.906844e-03 4.082538e-06 3.906844e-03 11 28 5.764506e-06 3.829277e-03 5.764506e-06 3.829277e-03 12 28 3.090930e-05 6.165785e-03 6.065754e-06 4.270934e-03 - 13 28 1.828826e-05 6.840143e-03 6.833298e-06 5.439980e-03 + 13 28 1.828826e-05 6.840143e-03 6.833298e-06 5.439979e-03 14 28 1.619836e-05 7.760657e-03 7.706244e-06 6.552037e-03 15 28 1.839496e-05 9.086420e-03 1.839496e-05 9.086420e-03 16 28 1.220054e-05 5.876887e-03 9.056268e-06 5.884802e-03 @@ -711,7 +859,8 @@ LJPARAMETERS 25 28 1.831964e-07 6.395320e-04 1.831964e-07 6.395320e-04 26 28 2.214487e-06 2.509055e-03 2.214487e-06 2.509055e-03 27 28 1.478312e-05 9.608810e-03 1.478312e-05 9.608810e-03 - 28 28 9.847044e-06 6.264722e-03 9.847044e-06 6.264722e-03 + 28 28 9.847044e-06 6.264723e-03 9.847044e-06 6.264723e-03 +# 1 29 7.510514e-07 1.632259e-03 7.510514e-07 1.632259e-03 2 29 7.510514e-07 1.632259e-03 7.510514e-07 1.632259e-03 3 29 1.505529e-06 1.632259e-03 9.812250e-07 1.632259e-03 @@ -741,6 +890,7 @@ LJPARAMETERS 27 29 5.780397e-06 4.166448e-03 4.108934e-06 4.166448e-03 28 29 2.736964e-06 2.716428e-03 2.736964e-06 2.716428e-03 29 29 7.607328e-07 1.177862e-03 7.607328e-07 1.177862e-03 +# 1 30 3.367762e-06 4.452567e-03 3.367762e-06 4.452567e-03 2 30 3.367762e-06 4.452567e-03 3.367762e-06 4.452567e-03 3 30 4.798797e-06 4.452567e-03 4.399875e-06 4.452567e-03 @@ -771,69 +921,72 @@ LJPARAMETERS 28 30 1.227272e-05 7.410023e-03 1.227272e-05 7.410023e-03 29 30 3.411174e-06 3.213038e-03 3.411174e-06 3.213038e-03 30 30 1.529592e-05 8.764704e-03 1.529592e-05 8.764704e-03 - 1 31 6.968021e-06 1.633210e-03 6.968021e-06 1.633210e-03 - 2 31 6.968021e-06 1.633210e-03 6.968021e-06 1.633210e-03 - 3 31 9.928884e-06 1.633210e-03 9.103500e-06 1.633210e-03 - 4 31 1.313332e-05 1.756834e-03 1.313332e-05 1.756834e-03 - 5 31 1.572276e-05 1.695022e-03 1.052769e-05 1.695022e-03 - 6 31 1.820700e-05 1.695022e-03 1.052769e-05 1.695022e-03 - 7 31 2.482626e-05 1.695022e-03 1.052769e-05 1.695022e-03 - 8 31 1.489737e-05 1.695022e-03 1.052769e-05 1.695022e-03 - 9 31 1.738162e-05 1.695022e-03 1.052769e-05 1.695022e-03 - 10 31 1.605453e-05 1.695022e-03 1.052769e-05 1.695022e-03 - 11 31 1.486500e-05 1.661369e-03 1.486500e-05 1.661369e-03 - 12 31 7.970620e-05 2.675086e-03 1.564184e-05 1.852986e-03 - 13 31 4.716018e-05 2.967663e-03 1.762111e-05 2.360188e-03 - 14 31 4.177090e-05 3.367037e-03 1.987219e-05 2.842665e-03 - 15 31 4.743530e-05 3.942232e-03 4.743530e-05 3.942232e-03 - 16 31 3.146170e-05 2.549745e-03 2.335351e-05 2.553179e-03 - 17 31 9.953160e-07 3.159280e-04 9.953160e-07 3.159280e-04 +# + 1 31 6.968021e-06 7.909228e-03 6.968021e-06 7.909228e-03 + 2 31 6.968021e-06 7.909228e-03 6.968021e-06 7.909228e-03 + 3 31 9.928884e-06 7.909228e-03 9.103500e-06 7.909228e-03 + 4 31 1.313332e-05 8.507908e-03 1.313332e-05 8.507908e-03 + 5 31 1.572276e-05 8.208568e-03 1.052769e-05 8.208568e-03 + 6 31 1.820700e-05 8.208568e-03 1.052769e-05 8.208568e-03 + 7 31 2.482626e-05 8.208568e-03 1.052769e-05 8.208568e-03 + 8 31 1.489737e-05 8.208568e-03 1.052769e-05 8.208568e-03 + 9 31 1.738162e-05 8.208568e-03 1.052769e-05 8.208568e-03 + 10 31 1.605453e-05 8.208568e-03 1.052769e-05 8.208568e-03 + 11 31 1.486500e-05 8.045594e-03 1.486500e-05 8.045594e-03 + 12 31 7.970620e-05 1.295477e-02 1.564184e-05 8.973548e-03 + 13 31 4.716018e-05 1.437165e-02 1.762111e-05 1.142980e-02 + 14 31 4.177090e-05 1.630571e-02 1.987219e-05 1.376631e-02 + 15 31 4.743530e-05 1.909124e-02 4.743530e-05 1.909124e-02 + 16 31 3.146170e-05 1.234778e-02 2.335351e-05 1.236441e-02 + 17 31 9.953160e-07 1.529960e-03 9.953160e-07 1.529960e-03 18 31 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 19 31 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 - 20 31 2.926067e-05 3.431253e-03 2.926067e-05 3.431253e-03 - 21 31 1.820700e-06 7.022530e-04 5.793063e-07 7.022530e-04 - 22 31 3.310437e-06 7.022530e-04 5.793063e-07 7.022530e-04 + 20 31 2.926067e-05 1.661670e-02 2.926067e-05 1.661670e-02 + 21 31 1.820700e-06 3.400835e-03 5.793063e-07 3.400835e-03 + 22 31 3.310437e-06 3.400835e-03 5.793063e-07 3.400835e-03 23 31 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 - 24 31 7.862187e-07 7.022530e-04 7.862187e-07 7.022530e-04 - 25 31 4.724110e-07 2.774672e-04 4.724110e-07 2.774672e-04 - 26 31 5.710524e-06 1.088578e-03 5.710524e-06 1.088578e-03 - 27 31 3.812141e-05 4.168876e-03 3.812141e-05 4.168876e-03 - 28 31 2.539270e-05 2.718011e-03 2.539270e-05 2.718011e-03 - 29 31 7.057842e-06 1.178549e-03 7.057842e-06 1.178549e-03 - 30 31 3.164781e-05 3.214911e-03 3.164781e-05 3.214911e-03 - 31 31 6.548046e-05 1.179236e-03 6.548046e-05 1.179236e-03 + 24 31 7.862187e-07 3.400835e-03 7.862187e-07 3.400835e-03 + 25 31 4.724110e-07 1.343704e-03 4.724110e-07 1.343704e-03 + 26 31 5.710524e-06 5.271710e-03 5.710524e-06 5.271710e-03 + 27 31 3.812141e-05 2.018882e-02 3.812141e-05 2.018882e-02 + 28 31 2.539270e-05 1.316265e-02 2.539270e-05 1.316265e-02 + 29 31 7.057842e-06 5.707416e-03 7.057842e-06 5.707416e-03 + 30 31 3.164781e-05 1.556901e-02 3.164781e-05 1.556901e-02 + 31 31 6.548046e-05 2.765569e-02 6.548046e-05 2.765569e-02 +# 1 32 3.932213e-06 4.480628e-03 3.932213e-06 4.480628e-03 2 32 3.932213e-06 4.480628e-03 3.932213e-06 4.480628e-03 - 3 32 5.137313e-06 4.480628e-03 5.137313e-06 4.480628e-03 - 4 32 7.411429e-06 4.819784e-03 7.411429e-06 4.819784e-03 - 5 32 5.941016e-06 4.650206e-03 5.941016e-06 4.650206e-03 - 6 32 5.941016e-06 4.650206e-03 5.941016e-06 4.650206e-03 - 7 32 5.941016e-06 4.650206e-03 5.941016e-06 4.650206e-03 - 8 32 5.941016e-06 4.650206e-03 5.941016e-06 4.650206e-03 - 9 32 5.941016e-06 4.650206e-03 5.941016e-06 4.650206e-03 - 10 32 5.941016e-06 4.650206e-03 5.941016e-06 4.650206e-03 - 11 32 8.388660e-06 4.557880e-03 8.388660e-06 4.557880e-03 + 3 32 5.137312e-06 4.480628e-03 5.137312e-06 4.480628e-03 + 4 32 7.411430e-06 4.819784e-03 7.411430e-06 4.819784e-03 + 5 32 5.941017e-06 4.650206e-03 5.941017e-06 4.650206e-03 + 6 32 5.941017e-06 4.650206e-03 5.941017e-06 4.650206e-03 + 7 32 5.941017e-06 4.650206e-03 5.941017e-06 4.650206e-03 + 8 32 5.941017e-06 4.650206e-03 5.941017e-06 4.650206e-03 + 9 32 5.941017e-06 4.650206e-03 5.941017e-06 4.650206e-03 + 10 32 5.941017e-06 4.650206e-03 5.941017e-06 4.650206e-03 + 11 32 8.388661e-06 4.557880e-03 8.388661e-06 4.557880e-03 12 32 4.498003e-05 7.338959e-03 8.827045e-06 5.083572e-03 13 32 2.661356e-05 8.141628e-03 9.943994e-06 6.475053e-03 14 32 2.357227e-05 9.237291e-03 1.121433e-05 7.798704e-03 15 32 2.676882e-05 1.081531e-02 2.676882e-05 1.081531e-02 - 16 32 1.775455e-05 6.995093e-03 1.317892e-05 7.004513e-03 + 16 32 1.775455e-05 6.995093e-03 1.317892e-05 7.004514e-03 17 32 5.616795e-07 8.667320e-04 5.616795e-07 8.667320e-04 18 32 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 19 32 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 20 32 1.651246e-05 9.413463e-03 1.651246e-05 9.413463e-03 - 21 32 3.269157e-07 1.926595e-03 3.269157e-07 1.926595e-03 - 22 32 3.269157e-07 1.926595e-03 3.269157e-07 1.926595e-03 + 21 32 3.269157e-07 1.926594e-03 3.269157e-07 1.926594e-03 + 22 32 3.269157e-07 1.926594e-03 3.269157e-07 1.926594e-03 23 32 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 - 24 32 4.436811e-07 1.926595e-03 4.436811e-07 1.926595e-03 + 24 32 4.436811e-07 1.926594e-03 4.436811e-07 1.926594e-03 25 32 2.665923e-07 7.612168e-04 2.665923e-07 7.612168e-04 26 32 3.222579e-06 2.986457e-03 3.222579e-06 2.986457e-03 27 32 2.151278e-05 1.143709e-02 2.151278e-05 1.143709e-02 28 32 1.432968e-05 7.456722e-03 1.432968e-05 7.456722e-03 29 32 3.982901e-06 3.233287e-03 3.982901e-06 3.233287e-03 30 32 1.785958e-05 8.819940e-03 1.785958e-05 8.819940e-03 - 31 32 3.695212e-05 3.235171e-03 3.695212e-05 3.235171e-03 + 31 32 3.695212e-05 1.566712e-02 3.695212e-05 1.566712e-02 32 32 2.085292e-05 8.875524e-03 2.085292e-05 8.875524e-03 +# 1 33 1.380375e-06 2.261954e-03 9.687375e-07 2.261954e-03 2 33 2.258907e-06 2.261954e-03 9.687375e-07 2.261954e-03 3 33 1.505529e-06 2.261954e-03 1.265625e-06 2.261954e-03 @@ -864,9 +1017,10 @@ LJPARAMETERS 28 33 3.530250e-06 3.764374e-03 3.530250e-06 3.764374e-03 29 33 1.505529e-06 1.632259e-03 9.812250e-07 1.632259e-03 30 33 4.798797e-06 4.452567e-03 4.399875e-06 4.452567e-03 - 31 33 9.928884e-06 1.633210e-03 9.103500e-06 1.633210e-03 - 32 33 5.137313e-06 4.480628e-03 5.137313e-06 4.480628e-03 + 31 33 9.928884e-06 7.909228e-03 9.103500e-06 7.909228e-03 + 32 33 5.137312e-06 4.480628e-03 5.137312e-06 4.480628e-03 33 33 1.505529e-06 2.261954e-03 1.265625e-06 2.261954e-03 +# 1 34 1.631250e-07 4.037368e-04 1.248595e-07 4.037368e-04 2 34 4.448600e-07 4.037368e-04 1.248595e-07 4.037368e-04 3 34 1.779150e-07 4.037368e-04 1.631250e-07 4.037368e-04 @@ -882,7 +1036,7 @@ LJPARAMETERS 13 34 8.450600e-07 7.336194e-04 3.157515e-07 5.834490e-04 14 34 7.484900e-07 8.323465e-04 3.560884e-07 7.027194e-04 15 34 8.499900e-07 9.745372e-04 8.499900e-07 9.745372e-04 - 16 34 5.637600e-07 6.303083e-04 4.184700e-07 6.311572e-04 + 16 34 5.637600e-07 6.303082e-04 4.184700e-07 6.311571e-04 17 34 1.783500e-08 7.809880e-05 1.783500e-08 7.809880e-05 18 34 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 19 34 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 @@ -897,10 +1051,11 @@ LJPARAMETERS 28 34 4.550100e-07 6.719043e-04 4.550100e-07 6.719043e-04 29 34 1.779150e-07 2.913425e-04 1.264690e-07 2.913425e-04 30 34 5.670950e-07 7.947402e-04 5.670950e-07 7.947402e-04 - 31 34 1.173340e-06 2.915123e-04 1.173340e-06 2.915123e-04 + 31 34 1.173340e-06 1.411721e-03 1.173340e-06 1.411721e-03 32 34 6.621425e-07 7.997487e-04 6.621425e-07 7.997487e-04 33 34 1.779150e-07 4.037368e-04 1.631250e-07 4.037368e-04 34 34 2.102500e-08 7.206312e-05 2.102500e-08 7.206312e-05 +# 1 35 8.903774e-06 5.588300e-03 8.903774e-06 5.588300e-03 2 35 8.903774e-06 5.588300e-03 8.903774e-06 5.588300e-03 3 35 1.268718e-05 5.588300e-03 1.163250e-05 5.588300e-03 @@ -931,11 +1086,12 @@ LJPARAMETERS 28 35 3.244692e-05 9.300125e-03 3.244692e-05 9.300125e-03 29 35 9.018548e-06 4.032600e-03 9.018548e-06 4.032600e-03 30 35 4.043974e-05 1.100035e-02 4.043974e-05 1.100035e-02 - 31 35 8.367128e-05 4.034950e-03 8.367128e-05 4.034950e-03 + 31 35 8.367128e-05 1.954025e-02 8.367128e-05 1.954025e-02 32 35 4.721761e-05 1.106967e-02 4.721761e-05 1.106967e-02 33 35 1.268718e-05 5.588300e-03 1.163250e-05 5.588300e-03 34 35 1.499300e-06 9.974575e-04 1.499300e-06 9.974575e-04 35 35 1.069156e-04 1.380625e-02 1.069156e-04 1.380625e-02 +# 1 36 1.735978e-06 2.439448e-03 1.735978e-06 2.439448e-03 2 36 1.735978e-06 2.439448e-03 1.735978e-06 2.439448e-03 3 36 2.268000e-06 2.439448e-03 2.268000e-06 2.439448e-03 @@ -966,12 +1122,13 @@ LJPARAMETERS 28 36 6.326208e-06 4.059762e-03 6.326208e-06 4.059762e-03 29 36 1.758355e-06 1.760341e-03 1.758355e-06 1.760341e-03 30 36 7.884576e-06 4.801957e-03 7.884576e-06 4.801957e-03 - 31 36 1.631347e-05 1.761367e-03 1.631347e-05 1.761367e-03 + 31 36 1.631347e-05 8.529860e-03 1.631347e-05 8.529860e-03 32 36 9.206064e-06 4.832219e-03 9.206064e-06 4.832219e-03 33 36 2.268000e-06 2.439448e-03 2.268000e-06 2.439448e-03 34 36 2.923200e-07 4.354178e-04 2.923200e-07 4.354178e-04 35 36 2.084544e-05 6.026810e-03 2.084544e-05 6.026810e-03 36 36 4.064256e-06 2.630869e-03 4.064256e-06 2.630869e-03 +# 1 37 3.194767e-06 4.334666e-03 3.194767e-06 4.334666e-03 2 37 3.194767e-06 4.334666e-03 3.194767e-06 4.334666e-03 3 37 4.173862e-06 4.334666e-03 4.173862e-06 4.334666e-03 @@ -1002,13 +1159,14 @@ LJPARAMETERS 28 37 1.164229e-05 7.213810e-03 1.164229e-05 7.213810e-03 29 37 3.235949e-06 3.127959e-03 3.235949e-06 3.127959e-03 30 37 1.451020e-05 8.532620e-03 1.451020e-05 8.532620e-03 - 31 37 3.002213e-05 3.129782e-03 3.002213e-05 3.129782e-03 + 31 37 3.002213e-05 1.515675e-02 3.002213e-05 1.515675e-02 32 37 1.694217e-05 8.586394e-03 1.694217e-05 8.586394e-03 33 37 4.173862e-06 4.334666e-03 4.173862e-06 4.334666e-03 34 37 5.379645e-07 7.736959e-04 5.379645e-07 7.736959e-04 35 37 3.836243e-05 1.070907e-02 3.836243e-05 1.070907e-02 36 37 7.481300e-06 4.675400e-03 7.481300e-06 4.675400e-03 37 37 1.376484e-05 8.306682e-03 1.376484e-05 8.306682e-03 +# 1 38 5.646577e-08 2.920184e-04 5.646577e-08 2.920184e-04 2 38 5.646577e-08 2.920184e-04 5.646577e-08 2.920184e-04 3 38 7.377075e-08 2.920184e-04 7.377075e-08 2.920184e-04 @@ -1039,7 +1197,7 @@ LJPARAMETERS 28 38 2.057712e-07 4.859810e-04 2.057712e-07 4.859810e-04 29 38 5.719364e-08 2.107248e-04 5.719364e-08 2.107248e-04 30 38 2.564599e-07 5.748268e-04 2.564599e-07 5.748268e-04 - 31 38 5.306248e-07 2.108476e-04 5.306248e-07 2.108476e-04 + 31 38 5.306248e-07 1.021082e-03 5.306248e-07 1.021082e-03 32 38 2.994437e-07 5.784494e-04 2.994437e-07 5.784494e-04 33 38 7.377075e-08 2.920184e-04 7.377075e-08 2.920184e-04 34 38 9.508230e-09 5.212246e-05 9.508230e-09 5.212246e-05 @@ -1047,6 +1205,7 @@ LJPARAMETERS 36 38 1.745000e-07 3.622000e-04 1.745000e-07 3.622000e-04 37 38 3.266000e-07 6.493000e-04 3.266000e-07 6.493000e-04 38 38 4.299949e-09 3.769960e-05 4.299949e-09 3.769960e-05 +# 1 39 3.992576e-06 4.887741e-03 3.992576e-06 4.887741e-03 2 39 3.992576e-06 4.887741e-03 3.992576e-06 4.887741e-03 3 39 5.216175e-06 4.887741e-03 5.216175e-06 4.887741e-03 @@ -1077,15 +1236,16 @@ LJPARAMETERS 28 39 1.454965e-05 8.134245e-03 1.454965e-05 8.134245e-03 29 39 4.044043e-06 3.527066e-03 4.044043e-06 3.527066e-03 30 39 1.813374e-05 9.621327e-03 1.813374e-05 9.621327e-03 - 31 39 3.751937e-05 3.529122e-03 3.751937e-05 3.529122e-03 + 31 39 3.751937e-05 1.709065e-02 3.751937e-05 1.709065e-02 32 39 2.117303e-05 9.681962e-03 2.117303e-05 9.681962e-03 33 39 5.216175e-06 4.887741e-03 5.216175e-06 4.887741e-03 34 39 6.723070e-07 8.724145e-04 6.723070e-07 8.724145e-04 - 35 39 4.794244e-05 1.207548e-02 4.794244e-05 1.207548e-02 + 35 39 4.794244e-05 1.207547e-02 4.794244e-05 1.207547e-02 36 39 9.347386e-06 5.271279e-03 9.347386e-06 5.271279e-03 37 39 1.720225e-05 9.366561e-03 1.720225e-05 9.366561e-03 38 39 3.040404e-07 6.310078e-04 3.040404e-07 6.310078e-04 39 39 2.149806e-05 1.056167e-02 2.149806e-05 1.056167e-02 +# 1 40 4.016601e-06 4.524811e-03 4.016601e-06 4.524811e-03 2 40 4.016601e-06 4.524811e-03 4.016601e-06 4.524811e-03 3 40 5.247563e-06 4.524811e-03 5.247563e-06 4.524811e-03 @@ -1116,7 +1276,7 @@ LJPARAMETERS 28 40 1.463720e-05 7.530252e-03 1.463720e-05 7.530252e-03 29 40 4.068377e-06 3.265170e-03 4.068377e-06 3.265170e-03 30 40 1.824286e-05 8.906913e-03 1.824286e-05 8.906913e-03 - 31 40 3.774513e-05 3.267073e-03 3.774513e-05 3.267073e-03 + 31 40 3.774513e-05 1.582162e-02 3.774513e-05 1.582162e-02 32 40 2.130044e-05 8.963045e-03 2.130044e-05 8.963045e-03 33 40 5.247563e-06 4.524811e-03 5.247563e-06 4.524811e-03 34 40 6.763525e-07 8.076350e-04 6.763525e-07 8.076350e-04 @@ -1126,6 +1286,7 @@ LJPARAMETERS 38 40 3.058699e-07 5.841535e-04 3.058699e-07 5.841535e-04 39 40 2.165230e-05 9.782700e-03 2.165230e-05 9.782700e-03 40 40 2.175756e-05 9.051429e-03 2.175756e-05 9.051429e-03 +# 1 41 7.464531e-07 2.266329e-03 7.464531e-07 2.266329e-03 2 41 7.464531e-07 2.266329e-03 7.464531e-07 2.266329e-03 3 41 1.380375e-06 2.266329e-03 9.752175e-07 2.266329e-03 @@ -1156,7 +1317,7 @@ LJPARAMETERS 28 41 2.720207e-06 3.771656e-03 2.720207e-06 3.771656e-03 29 41 7.560753e-07 1.635417e-03 7.560753e-07 1.635417e-03 30 41 3.390289e-06 4.461180e-03 3.390289e-06 4.461180e-03 - 31 41 7.014631e-06 1.636370e-03 7.014631e-06 1.636370e-03 + 31 41 7.014631e-06 7.924528e-03 7.014631e-06 7.924528e-03 32 41 3.958516e-06 4.489295e-03 3.958516e-06 4.489295e-03 33 41 1.380375e-06 2.266329e-03 9.752175e-07 2.266329e-03 34 41 1.631250e-07 4.045178e-04 1.256947e-07 4.045178e-04 @@ -1167,6 +1328,7 @@ LJPARAMETERS 39 41 4.609400e-06 5.244200e-03 4.609400e-06 5.244200e-03 40 41 4.759700e-06 4.918700e-03 4.759700e-06 4.918700e-03 41 41 7.514463e-07 2.270713e-03 7.514463e-07 2.270713e-03 +# 1 42 2.373880e-06 2.439448e-03 2.373880e-06 2.439448e-03 2 42 2.373880e-06 2.439448e-03 2.373880e-06 2.439448e-03 3 42 3.101400e-06 2.439448e-03 3.101400e-06 2.439448e-03 @@ -1197,7 +1359,7 @@ LJPARAMETERS 28 42 8.650838e-06 4.059762e-03 8.650838e-06 4.059762e-03 29 42 2.404481e-06 1.760341e-03 2.404481e-06 1.760341e-03 30 42 1.078184e-05 4.801957e-03 1.078184e-05 4.801957e-03 - 31 42 2.230803e-05 1.761367e-03 2.230803e-05 1.761367e-03 + 31 42 2.230803e-05 8.529860e-03 2.230803e-05 8.529860e-03 32 42 1.258893e-05 4.832219e-03 1.258893e-05 4.832219e-03 33 42 3.101400e-06 2.439448e-03 3.101400e-06 2.439448e-03 34 42 3.997360e-07 4.354178e-04 3.997360e-07 4.354178e-04 @@ -1209,6 +1371,7 @@ LJPARAMETERS 40 42 1.285909e-05 4.879870e-03 1.285909e-05 4.879870e-03 41 42 2.389760e-06 2.444166e-03 2.389760e-06 2.444166e-03 42 42 7.599946e-06 2.630869e-03 7.599946e-06 2.630869e-03 +# 1 43 3.076883e-06 4.147280e-03 3.076883e-06 4.147280e-03 2 43 3.076883e-06 4.147280e-03 3.076883e-06 4.147280e-03 3 43 4.019850e-06 4.147280e-03 4.019850e-06 4.147280e-03 @@ -1239,7 +1402,7 @@ LJPARAMETERS 28 43 1.121270e-05 6.901959e-03 1.121270e-05 6.901959e-03 29 43 3.116545e-06 2.992738e-03 3.116545e-06 2.992738e-03 30 43 1.397479e-05 8.163758e-03 1.397479e-05 8.163758e-03 - 31 43 2.891433e-05 2.994482e-03 2.891433e-05 2.994482e-03 + 31 43 2.891433e-05 1.450153e-02 2.891433e-05 1.450153e-02 32 43 1.631702e-05 8.215206e-03 1.631702e-05 8.215206e-03 33 43 4.019850e-06 4.147280e-03 4.019850e-06 4.147280e-03 34 43 5.181140e-07 7.402493e-04 5.181140e-07 7.402493e-04 @@ -1252,6 +1415,7 @@ LJPARAMETERS 41 43 3.097464e-06 4.155302e-03 3.097464e-06 4.155302e-03 42 43 9.850598e-06 4.472714e-03 9.850598e-06 4.472714e-03 43 43 1.276776e-05 7.604014e-03 1.276776e-05 7.604014e-03 +# 1 44 4.561247e-06 4.073038e-03 1.875128e-06 3.268799e-03 2 44 4.561247e-06 4.073038e-03 1.875128e-06 3.268799e-03 3 44 5.959125e-06 4.073038e-03 2.449796e-06 3.268799e-03 @@ -1267,7 +1431,7 @@ LJPARAMETERS 13 44 3.087092e-05 7.401009e-03 4.741926e-06 4.723813e-03 14 44 2.734311e-05 8.397002e-03 5.347702e-06 5.689469e-03 15 44 3.105101e-05 9.831472e-03 1.276507e-05 7.890204e-03 - 16 44 2.059474e-05 6.358770e-03 6.284543e-06 5.110075e-03 + 16 44 2.059474e-05 6.358770e-03 6.284543e-06 5.110076e-03 17 44 6.515310e-07 7.878880e-04 2.678444e-07 6.323160e-04 18 44 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 19 44 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 @@ -1279,10 +1443,10 @@ LJPARAMETERS 25 44 3.092389e-07 6.919712e-04 1.271281e-07 5.553384e-04 26 44 3.738093e-06 2.714788e-03 1.536730e-06 2.178741e-03 27 44 2.495417e-05 1.039670e-02 1.025866e-05 8.343822e-03 - 28 44 1.662199e-05 6.778406e-03 6.833298e-06 5.439980e-03 + 28 44 1.662199e-05 6.778406e-03 6.833298e-06 5.439979e-03 29 44 4.620043e-06 2.939165e-03 1.899300e-06 2.358814e-03 30 44 2.071657e-05 8.017617e-03 8.516580e-06 6.434503e-03 - 31 44 4.286332e-05 2.940878e-03 1.762111e-05 2.360188e-03 + 31 44 4.286332e-05 1.424193e-02 1.762111e-05 1.142980e-02 32 44 2.418875e-05 8.068144e-03 9.943994e-06 6.475053e-03 33 44 5.959125e-06 4.073038e-03 2.449796e-06 3.268799e-03 34 44 7.680650e-07 7.269980e-04 3.157515e-07 5.834490e-04 @@ -1296,6 +1460,7 @@ LJPARAMETERS 42 44 1.460277e-05 4.392647e-03 6.003198e-06 3.525299e-03 43 44 1.892724e-05 7.467894e-03 7.780987e-06 5.993325e-03 44 44 2.805821e-05 7.334210e-03 4.741926e-06 4.723813e-03 +# 1 45 1.233956e-05 2.328538e-03 1.581841e-06 2.300953e-03 2 45 1.233956e-05 2.328538e-03 1.581841e-06 2.300953e-03 3 45 1.612125e-05 2.328538e-03 2.066625e-06 2.300953e-03 @@ -1326,8 +1491,8 @@ LJPARAMETERS 28 45 4.496754e-05 3.875184e-03 5.764506e-06 3.829277e-03 29 45 1.249863e-05 1.680307e-03 1.602231e-06 1.660402e-03 30 45 5.604463e-05 4.583635e-03 7.184507e-06 4.529336e-03 - 31 45 1.159584e-04 1.681286e-03 1.486500e-05 1.661369e-03 - 32 45 6.543795e-05 4.612522e-03 8.388660e-06 4.557880e-03 + 31 45 1.159584e-04 8.142048e-03 1.486500e-05 8.045594e-03 + 32 45 6.543795e-05 4.612522e-03 8.388661e-06 4.557880e-03 33 45 1.612125e-05 2.328538e-03 2.066625e-06 2.300953e-03 34 45 2.077850e-06 4.156214e-04 2.663650e-07 4.106978e-04 35 45 1.481722e-04 5.752800e-03 1.899458e-05 5.684650e-03 @@ -1341,16 +1506,60 @@ LJPARAMETERS 43 45 5.120396e-05 4.269361e-03 6.563968e-06 4.218784e-03 44 45 7.590601e-05 4.192934e-03 4.000245e-06 3.325157e-03 45 45 2.053489e-04 2.397082e-03 3.374569e-06 2.340624e-03 +# +END +SOLUTEMOLECULES +# NSPM: number of separate molecules in solute block +# NSP[1...NSPM]: atom sequence number of last atom +# of the successive submolecules +# NSPM NSP[1...NSPM] + 1 + 12 +END +TEMPERATUREGROUPS +# NSTM: number of temperature atom groups +# NST[1...NSTM]: atom sequence number of last atom +# of the successive temperature atom groups +# NSTM NST[1...NSTM] + 1 + 12 +END +PRESSUREGROUPS +# NSVM: number of pressure atom groups +# NSV[1...NSVM]: atom sequence number of last atom +# of the successive pressure atom groups +# NSVM NSV[1...NSVM] + 1 + 12 +END +LJEXCEPTIONS +# This block defines special LJ-interactions based on atom numbers +# This overrules the normal LJ-parameters (including 1-4 interactions) +# NEX: number of exceptions +0 +# AT1 AT2 C12 C6 END SOLVENTATOM +# NRAM: number of atoms per solvent molecule 3 - 1 OW 4 15.99940 -0.82000 - 2 HW1 18 1.00800 0.41000 - 3 HW2 18 1.00800 0.41000 +# I: solvent atom sequence number +# IACS: integer (van der Waals) atom type code +# ANMS: atom name of solvent atom +# MASS: mass of solvent atom +# CGS: charge of solvent atom +# I ANMS IACS MASS CGS + 1 OW 4 15.99940 -0.82000 + 2 HW1 18 1.00800 0.41000 + 3 HW2 18 1.00800 0.41000 END SOLVENTCONSTR +# NCONS: number of constraints 3 +# ICONS, JCONS: atom sequence numbers forming constraint +# CONS constraint length +#ICONS JCONS CONS 1 2 0.1000000 1 3 0.1000000 2 3 0.1632990 END +# end of topology file diff --git a/gromosXX/src/check/data/aladip_atomic.in b/gromosXX/src/check/data/aladip_atomic.in index 1d790ddd4..527493ac8 100644 --- a/gromosXX/src/check/data/aladip_atomic.in +++ b/gromosXX/src/check/data/aladip_atomic.in @@ -156,7 +156,7 @@ FORCE # NTF array # bonds angles imp. dihe charge nonbonded # H H H H - 1 1 1 1 1 1 1 1 1 1 + 1 1 1 1 1 1 # NEGR NRE(1) NRE(2) ... NRE(NEGR) 2 12 72 END @@ -178,8 +178,8 @@ END NONBONDED # NLRELE 1 -# APPAK RCRF EPSRF - 0.0 1.4 62.0 +# APPAK RCRF EPSRF NSLFEXCL + 0.0 1.4 62.0 1 # NSHAPE ASHAPE NA2CLC TOLA2 EPSLS -1 1.4 2 0.1E-9 0.0 # NKX NKY NKZ NK2 @@ -251,22 +251,3 @@ END # NTPI # 0 #END - - -GROMOS96COMPAT -# NTNB96 0,1 controls use of g96-like nonbonded routines (ignored) -# 0 : not used [default] -# 1 : g96-like double-loop routines are used -# NTR96 0,1 controls use of reaction field formula -# 0 : new reaction field formula [default] -# 1 : g96 reaction field formula -# NTP96 0,1 controls use of g96 pressure calculation (ignored) -# 0 : new formula using ekin a t -# 1 : g96 formulat using ekin at t - dt / 2 -# NTG96 0,1 controls use of soft-core formula (ignored) -# 0 : new soft-core formula -# 1 : g96 soft-core formula [default] -# NTNB96 NTR96 NTP96 NTG96 - 1 1 1 1 -END - diff --git a/gromosXX/src/check/data/aladip_ewald.in b/gromosXX/src/check/data/aladip_ewald.in index e5d0c58d0..25c01b592 100644 --- a/gromosXX/src/check/data/aladip_ewald.in +++ b/gromosXX/src/check/data/aladip_ewald.in @@ -145,7 +145,7 @@ FORCE # NTF array # bonds angles imp. dihe charge nonbonded # H H H H - 1 1 1 1 1 1 1 1 1 1 + 1 1 1 1 1 1 # NEGR NRE(1) NRE(2) ... NRE(NEGR) 1 72 END @@ -167,8 +167,8 @@ END NONBONDED # NLRELE 2 -# APPAK RCRF EPSRF NEXCL - 0.0 1.4 1.0 1 +# APPAK RCRF EPSRF NSLFEXCL + 0.0 1.4 1.0 1 # NSHAPE ASHAPE NA2CLC TOLA2 EPSLS -1 1.4 2 0.1E-9 0.0 # NKX NKY NKZ NK2 @@ -256,6 +256,3 @@ END # NTPI # 0 #END -GROMOS96COMPAT -1 1 1 1 -END diff --git a/gromosXX/src/check/data/aladip_ls.in b/gromosXX/src/check/data/aladip_ls.in index 9b3157472..d5353fef8 100644 --- a/gromosXX/src/check/data/aladip_ls.in +++ b/gromosXX/src/check/data/aladip_ls.in @@ -145,7 +145,7 @@ FORCE # NTF array # bonds angles imp. dihe charge nonbonded # H H H H - 1 1 1 1 1 1 1 1 1 1 + 1 1 1 1 1 1 # NEGR NRE(1) NRE(2) ... NRE(NEGR) 1 72 END @@ -158,7 +158,7 @@ PAIRLIST # atomic (atom based cutoff) # # ALGORITHM NSNB RCUTP RCUTL SIZE TYPE - standard 1 1.4 1.4 auto molecular + standard 1 1.4 1.4 auto chargegroup END #LONGRANGE # EPSRF APPAK RCRF @@ -256,6 +256,3 @@ END # NTPI # 0 #END -GROMOS96COMPAT -1 1 1 1 -END diff --git a/gromosXX/src/check/data/aladip_special.in b/gromosXX/src/check/data/aladip_special.in index e1d7d15ff..ff16c1891 100644 --- a/gromosXX/src/check/data/aladip_special.in +++ b/gromosXX/src/check/data/aladip_special.in @@ -153,7 +153,7 @@ FORCE # NTF array # bonds angles imp. dihe charge nonbonded # H H H H - 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 # NEGR NRE(1) NRE(2) ... NRE(NEGR) 2 12 72 END @@ -176,8 +176,8 @@ END NONBONDED # NLRELE 1 -# APPAK RCRF EPSRF - 0.0 1.4 62.0 +# APPAK RCRF EPSRF NSLFEXCL + 0.0 1.4 62.0 1 # NSHAPE ASHAPE NA2CLC TOLA2 EPSLS -1 1.4 2 0.1E-9 0.0 # NKX NKY NKZ NK2 @@ -223,9 +223,16 @@ DISTANCERES # DIR0 >= 0.0 distance offset in restraining function # TAUDIR >= 0.0 coupling time for time averaging # != 0: not implemented +# FORCESCALE 0..2 controls approximation of force scaling +# 0: approximate d/dr = 1 +# 1: approximate d/dr = (1.0 - exp(-Dt/tau)) +# 2: use d/dr = (1.0 - exp(-Dt/tau))*(/r)^4 +# VDIR 0,1 controls contribution to virial +# 0: no contribution +# 1: distance restraints contribute to virial # -# NTDIR NTDIRA CDIR DIR0 TAUDIR NTWDIR - 2 0 1000.0 0.3 0.0 0 +# NTDIR NTDIRA CDIR DIR0 TAUDIR FORCESCALE VDIR NTWDIR + 2 0 1000.0 0.3 0.1 0 0 0 END DIHEDRALRES # NTDLR 0...3 controls dihedral-angle restraining and constraining @@ -235,10 +242,11 @@ DIHEDRALRES # 3: dihedral constraining # # CDLR >=0.0 force constant for dihedral restraining -# PHILIN deviation after which the potential energy function is linearized +# PHILIN deviation after which the potential energy function is linearizedi +# NTWDLR >= 0 write every NTWDLR step dihedral information to external file # -# NTDLR CDLR PHILIN - 2 100.0 1000.0 +# NTDLR CDLR PHILIN NTWDLR + 2 0.03046 1000.0 0 END PERTURBATION # NTG: 0..1 controls use of free-energy calculation. @@ -280,23 +288,6 @@ END # 0 #END - -GROMOS96COMPAT -# NTNB96 0,1 controls use of g96-like nonbonded routines (ignored) -# 0 : not used [default] -# 1 : g96-like double-loop routines are used -# NTR96 0,1 controls use of reaction field formula -# 0 : new reaction field formula [default] -# 1 : g96 reaction field formula -# NTP96 0,1 controls use of g96 pressure calculation (ignored) -# 0 : new formula using ekin a t -# 1 : g96 formulat using ekin at t - dt / 2 -# NTG96 0,1 controls use of soft-core formula (ignored) -# 0 : new soft-core formula -# 1 : g96 soft-core formula [default] -# NTNB96 NTR96 NTP96 NTG96 - 1 1 1 1 1 -END XRAYRES # NTXR -2: time-averaged electron density restraints # -1: instantaneous electron density restraints diff --git a/gromosXX/src/check/data/aladip_unperturbed.in b/gromosXX/src/check/data/aladip_unperturbed.in index 3c48481b9..e05ba95b3 100644 --- a/gromosXX/src/check/data/aladip_unperturbed.in +++ b/gromosXX/src/check/data/aladip_unperturbed.in @@ -145,7 +145,7 @@ FORCE # NTF array # bonds angles imp. dihe charge nonbonded # H H H H - 1 1 1 1 1 1 1 1 1 1 + 1 1 1 1 1 1 # NEGR NRE(1) NRE(2) ... NRE(NEGR) 2 12 72 END @@ -167,8 +167,8 @@ END NONBONDED # NLRELE 1 -# APPAK RCRF EPSRF - 0.0 1.4 62.0 +# APPAK RCRF EPSRF NSLFEXCL + 0.0 1.4 62.0 1 # NSHAPE ASHAPE NA2CLC TOLA2 EPSLS -1 1.4 2 0.1E-9 0.0 # NKX NKY NKZ NK2 @@ -256,20 +256,3 @@ END # NTPI # 0 #END - -GROMOS96COMPAT -# NTNB96 0,1 controls use of g96-like nonbonded routines (ignored) -# 0 : not used [default] -# 1 : g96-like double-loop routines are used -# NTR96 0,1 controls use of reaction field formula -# 0 : new reaction field formula [default] -# 1 : g96 reaction field formula -# NTP96 0,1 controls use of g96 pressure calculation (ignored) -# 0 : new formula using ekin a t -# 1 : g96 formulat using ekin at t - dt / 2 -# NTG96 0,1 controls use of soft-core formula (ignored) -# 0 : new soft-core formula -# 1 : g96 soft-core formula [default] -# NTNB96 NTR96 NTP96 NTG96 - 1 1 1 1 -END diff --git a/gromosXX/src/check/data/cg16.in b/gromosXX/src/check/data/cg16.in index 737686e72..72bbbf90b 100644 --- a/gromosXX/src/check/data/cg16.in +++ b/gromosXX/src/check/data/cg16.in @@ -143,7 +143,7 @@ FORCE # NTF array # bonds angles imp. dihe charge nonbonded # H H H H - 1 1 1 1 1 1 1 1 1 1 + 1 1 1 1 1 1 # NEGR NRE(1) NRE(2) ... NRE(NEGR) 1 4 END @@ -165,8 +165,8 @@ END NONBONDED # NLRELE 1 -# APPAK RCRF EPSRF - 0.0 1.4 62.0 +# APPAK RCRF EPSRF NSLFEXCL + 0.0 1.4 62.0 1 # NSHAPE ASHAPE NA2CLC TOLA2 EPSLS -1 1.4 2 0.1E-9 0.0 # NKX NKY NKZ NK2 @@ -256,28 +256,13 @@ END #END CGRAIN -# NTCGRAN: coarse grain selection -# # 0: no coarse graining -# # 1: coarse grain simulation -# # 2: multigrain simulation -# # EPS : dielectric constant for coarse grained coulombic interactions -# # NTCGRAN EPS - 1 20.0 -END - -GROMOS96COMPAT -# NTNB96 0,1 controls use of g96-like nonbonded routines (ignored) -# # 0 : not used [default] -# # 1 : g96-like double-loop routines are used -# # NTR96 0,1 controls use of reaction field formula -# # 0 : new reaction field formula [default] -# # 1 : g96 reaction field formula -# # NTP96 0,1 controls use of g96 pressure calculation (ignored) -# # 0 : new formula using ekin a t -# # 1 : g96 formulat using ekin at t - dt / 2 -# # NTG96 0,1 controls use of soft-core formula (ignored) -# # 0 : new soft-core formula -# # 1 : g96 soft-core formula [default] -# # NTNB96 NTR96 NTP96 NTG96 - 1 1 1 1 -END +# NTCGRAN 0..3 coarse grain selection +# 0: atomistic (off) +# 1: coarse-grained using MARTINI model (on) +# 2: coarse-grained using GROMOS model (on) +# 3: mixed-grained using GROMOS model (on) +# EPS >= 0.0 dielectric constant for coarse grained coulombic interaction +# EPSM >= 0.0 dielectric constant for mixed CG-FG coulombic interaction +# NTCGRAN EPS EPSM + 1 20.0 1 +END \ No newline at end of file diff --git a/gromosXX/src/check/data/cg16.topo b/gromosXX/src/check/data/cg16.topo index ee4278d93..beeeb122b 100644 --- a/gromosXX/src/check/data/cg16.topo +++ b/gromosXX/src/check/data/cg16.topo @@ -141,7 +141,7 @@ IMPDIHEDRAL # ICQ: improper dihedral type code # IQ JQ KQ LQ ICQ END -DIHEDRALTYPE +TORSDIHEDRALTYPE # NPTY: number of dihedral types 1 # CP: force constant diff --git a/gromosXX/src/check/data/lambdas.off.in b/gromosXX/src/check/data/lambdas.off.in index b12791e9e..6846db920 100644 --- a/gromosXX/src/check/data/lambdas.off.in +++ b/gromosXX/src/check/data/lambdas.off.in @@ -145,7 +145,7 @@ FORCE # NTF array # bonds angles imp. dihe charge nonbonded # H H H H - 1 1 1 1 1 1 1 1 1 1 + 1 1 1 1 1 1 # NEGR NRE(1) NRE(2) ... NRE(NEGR) 2 12 72 END @@ -160,16 +160,11 @@ PAIRLIST # ALGORITHM NSNB RCUTP RCUTL SIZE TYPE standard 5 0.8 1.4 auto chargegroup END -#LONGRANGE -# EPSRF APPAK RCRF -# 62.0 0.0 1.4 -#END -# NONBONDED # NLRELE 1 -# APPAK RCRF EPSRF - 0.0 1.4 62.0 +# APPAK RCRF EPSRF NSLFEXCL + 0.0 1.4 62.0 1 # NSHAPE ASHAPE NA2CLC TOLA2 EPSLS -1 1.4 2 0.1E-9 0.0 # NKX NKY NKZ NK2 @@ -202,7 +197,6 @@ POSITIONRES # NTPOR NTPORB NTPORS CPOR 0 0 0 1.0E1 END -# PERTURBATION # NTG: 0..3 controls use of free-energy calculation. # 0: no free-energy calculation (default) @@ -256,8 +250,6 @@ crf_soft 1 1 1.0 0.0 0.0 0.0 0.0 crf_soft 1 2 1.0 1.0 -1.0 0.0 0.0 crf_soft 2 2 0.0 0.0 0.5 0.5 0.0 END - -#------- #PATHINT # restrictions for PI # topology must contain bead information @@ -273,22 +265,3 @@ END # NTPI # 0 #END - - -GROMOS96COMPAT -# NTNB96 0,1 controls use of g96-like nonbonded routines (ignored) -# 0 : not used [default] -# 1 : g96-like double-loop routines are used -# NTR96 0,1 controls use of reaction field formula -# 0 : new reaction field formula [default] -# 1 : g96 reaction field formula -# NTP96 0,1 controls use of g96 pressure calculation (ignored) -# 0 : new formula using ekin a t -# 1 : g96 formulat using ekin at t - dt / 2 -# NTG96 0,1 controls use of soft-core formula (ignored) -# 0 : new soft-core formula -# 1 : g96 soft-core formula [default] -# NTNB96 NTR96 NTP96 NTG96 - 1 1 1 1 -END - diff --git a/gromosXX/src/check/data/lambdas.on.in b/gromosXX/src/check/data/lambdas.on.in index 4ee5d11f7..82519fc34 100644 --- a/gromosXX/src/check/data/lambdas.on.in +++ b/gromosXX/src/check/data/lambdas.on.in @@ -145,7 +145,7 @@ FORCE # NTF array # bonds angles imp. dihe charge nonbonded # H H H H - 1 1 1 1 1 1 1 1 1 1 + 1 1 1 1 1 1 # NEGR NRE(1) NRE(2) ... NRE(NEGR) 2 12 72 END @@ -160,16 +160,11 @@ PAIRLIST # ALGORITHM NSNB RCUTP RCUTL SIZE TYPE standard 5 0.8 1.4 auto chargegroup END -#LONGRANGE -# EPSRF APPAK RCRF -# 62.0 0.0 1.4 -#END -# NONBONDED # NLRELE 1 -# APPAK RCRF EPSRF - 0.0 1.4 62.0 +# APPAK RCRF EPSRF NSLFEXCL + 0.0 1.4 62.0 1 # NSHAPE ASHAPE NA2CLC TOLA2 EPSLS -1 1.4 2 0.1E-9 0.0 # NKX NKY NKZ NK2 @@ -202,7 +197,6 @@ POSITIONRES # NTPOR NTPORB NTPORS CPOR 0 0 0 1.0E1 END -# PERTURBATION # NTG: 0..3 controls use of free-energy calculation. # 0: no free-energy calculation (default) @@ -256,8 +250,6 @@ crf_soft 1 1 1.0 0.0 0.0 0.0 0.0 crf_soft 1 2 1.0 1.0 -1.0 0.0 0.0 crf_soft 2 2 0.0 0.0 0.5 0.5 0.0 END - -#------- #PATHINT # restrictions for PI # topology must contain bead information @@ -273,22 +265,3 @@ END # NTPI # 0 #END - - -GROMOS96COMPAT -# NTNB96 0,1 controls use of g96-like nonbonded routines (ignored) -# 0 : not used [default] -# 1 : g96-like double-loop routines are used -# NTR96 0,1 controls use of reaction field formula -# 0 : new reaction field formula [default] -# 1 : g96 reaction field formula -# NTP96 0,1 controls use of g96 pressure calculation (ignored) -# 0 : new formula using ekin a t -# 1 : g96 formulat using ekin at t - dt / 2 -# NTG96 0,1 controls use of soft-core formula (ignored) -# 0 : new soft-core formula -# 1 : g96 soft-core formula [default] -# NTNB96 NTR96 NTP96 NTG96 - 1 1 1 1 -END - diff --git a/gromosXX/src/check/data/scaling.in b/gromosXX/src/check/data/scaling.in index 93235e701..f6a701e79 100644 --- a/gromosXX/src/check/data/scaling.in +++ b/gromosXX/src/check/data/scaling.in @@ -139,7 +139,7 @@ FORCE # NTF array # bonds angles imp. dihe charge nonbonded # H H H H - 1 1 1 1 1 1 1 1 1 1 + 1 1 1 1 1 1 # NEGR NRE(1) NRE(2) ... NRE(NEGR) 3 4 12 72 END @@ -162,8 +162,8 @@ END NONBONDED # NLRELE 1 -# APPAK RCRF EPSRF - 0.0 1.4 62.0 +# APPAK RCRF EPSRF NSLFEXCL + 0.0 1.4 62.0 1 # NSHAPE ASHAPE NA2CLC TOLA2 EPSLS -1 1.4 2 0.1E-9 0.0 # NKX NKY NKZ NK2 @@ -218,22 +218,4 @@ PERTURBATION 1 0 0.125 0.0 # ALPHLJ ALPHC NLAM NSCALE 1.0 1.0 1 0 -END - -GROMOS96COMPAT -# NTNB96 0,1 controls use of g96-like nonbonded routines (ignored) -# 0 : not used [default] -# 1 : g96-like double-loop routines are used -# NTR96 0,1 controls use of reaction field formula -# 0 : new reaction field formula [default] -# 1 : g96 reaction field formula -# NTP96 0,1 controls use of g96 pressure calculation (ignored) -# 0 : new formula using ekin a t -# 1 : g96 formulat using ekin at t - dt / 2 -# NTG96 0,1 controls use of soft-core formula (ignored) -# 0 : new soft-core formula -# 1 : g96 soft-core formula [default] -# NTNB96 NTR96 NTP96 NTG96 - 1 1 1 1 -END - +END \ No newline at end of file diff --git a/gromosXX/src/check/data/scaling.lambdadep.in b/gromosXX/src/check/data/scaling.lambdadep.in index 458da3105..90c4017cd 100644 --- a/gromosXX/src/check/data/scaling.lambdadep.in +++ b/gromosXX/src/check/data/scaling.lambdadep.in @@ -140,7 +140,7 @@ FORCE # NTF array # bonds angles imp. dihe charge nonbonded # H H H H - 1 1 1 1 1 1 1 1 1 1 + 1 1 1 1 1 1 # NEGR NRE(1) NRE(2) ... NRE(NEGR) 3 4 12 72 END @@ -164,7 +164,7 @@ NONBONDED # NLRELE 1 # APPAK RCRF EPSRF - 0.0 1.4 62.0 + 0.0 1.4 62.0 1 # NSHAPE ASHAPE NA2CLC TOLA2 EPSLS -1 1.4 2 0.1E-9 0.0 # NKX NKY NKZ NK2 @@ -219,22 +219,4 @@ PERTURBATION 1 0 0.125 0.0 # ALPHLJ ALPHC NLAM NSCALE 1.0 1.0 1 0 -END - -GROMOS96COMPAT -# NTNB96 0,1 controls use of g96-like nonbonded routines (ignored) -# 0 : not used [default] -# 1 : g96-like double-loop routines are used -# NTR96 0,1 controls use of reaction field formula -# 0 : new reaction field formula [default] -# 1 : g96 reaction field formula -# NTP96 0,1 controls use of g96 pressure calculation (ignored) -# 0 : new formula using ekin a t -# 1 : g96 formulat using ekin at t - dt / 2 -# NTG96 0,1 controls use of soft-core formula (ignored) -# 0 : new soft-core formula -# 1 : g96 soft-core formula [default] -# NTNB96 NTR96 NTP96 NTG96 - 1 1 1 1 -END - +END \ No newline at end of file diff --git a/gromosXX/src/check/lambdas.t.cc b/gromosXX/src/check/lambdas.t.cc index 260d81877..56aa3e0d2 100644 --- a/gromosXX/src/check/lambdas.t.cc +++ b/gromosXX/src/check/lambdas.t.cc @@ -25,6 +25,7 @@ #include "../util/parse_tcouple.h" #include "../io/blockinput.h" #include "../io/topology/in_topology.h" +#include "../io/message.h" #include "../algorithm/integration/leap_frog.h" #include "../algorithm/temperature/temperature_calculation.h" @@ -142,16 +143,17 @@ int main(int argc, char* argv[]) { util::simulation_struct aladip_sim_on; util::simulation_struct aladip_sim_off; - io::In_Topology in_topo; + io::In_Topology in_topo_on, in_topo_off; - in_topo.quiet = quiet; + in_topo_on.quiet = quiet; + in_topo_off.quiet = quiet; if (util::create_simulation(stopo, spttopo, sconf, sinputon, aladip_sim_on, - in_topo, + in_topo_on, "", "", "", "", "", "", quiet ) @@ -159,12 +161,15 @@ int main(int argc, char* argv[]) { std::cerr << "creating simulation (on) failed!" << std::endl; return 1; } + io::messages.display(std::cout); + io::messages.clear(); + if (util::create_simulation(stopo, spttopo, sconf, sinputoff, aladip_sim_off, - in_topo, + in_topo_off, "", "", "", "", "", "", quiet ) @@ -172,6 +177,8 @@ int main(int argc, char* argv[]) { std::cerr << "creating simulation (off) failed!" << std::endl; return 1; } + io::messages.display(std::cout); + io::messages.clear(); // create a forcefield interaction::Forcefield *ff_on = new interaction::Forcefield; @@ -179,7 +186,7 @@ int main(int argc, char* argv[]) { if (interaction::create_g96_forcefield(*ff_on, aladip_sim_on.topo, aladip_sim_on.sim, - in_topo, + in_topo_on, std::cout, quiet) != 0){ @@ -204,7 +211,7 @@ int main(int argc, char* argv[]) { if (interaction::create_g96_forcefield(*ff_off, aladip_sim_off.topo, aladip_sim_off.sim, - in_topo, + in_topo_off, std::cout, quiet) != 0){ @@ -331,7 +338,7 @@ int main(int argc, char* argv[]) { // let's not claim we checked something that was zero to begin with if(dE_on !=0){ - CHECKING("indivual lambdas ("+nm+")", res); + CHECKING("individual lambdas ("+nm+")", res); CHECK_APPROX_EQUAL(E_on, E_off, 0.0000001, res); CHECK_APPROX_EQUAL(dE_on, dE_off*dLint, 0.0000001, res); RESULT(res, total); @@ -384,6 +391,8 @@ int main(int argc, char* argv[]) { RESULT(res, total); } } + io::messages.display(std::cout); + io::messages.clear(); return total; } diff --git a/gromosXX/src/check/scaling.t.cc b/gromosXX/src/check/scaling.t.cc index 871d4611b..bcb36873c 100644 --- a/gromosXX/src/check/scaling.t.cc +++ b/gromosXX/src/check/scaling.t.cc @@ -116,6 +116,8 @@ int main(int argc, char* argv[]) { std::cerr << "creating simulation failed!" << std::endl; return 1; } + io::messages.display(std::cout); + io::messages.clear(); // std::cout << "aladip sim" << std::endl; // io::messages.display(std::cout); @@ -134,6 +136,8 @@ int main(int argc, char* argv[]) { std::cerr << "creating lambda dependent simulation failed!" << std::endl; return 1; } + io::messages.display(std::cout); + io::messages.clear(); // std::cout << "aladip lambdadep sim" << std::endl; // io::messages.display(std::cout); @@ -287,6 +291,8 @@ int main(int argc, char* argv[]) { } */ RESULT(res, total); + io::messages.display(std::cout); + io::messages.clear(); return total; } diff --git a/gromosXX/src/configuration/configuration.cc b/gromosXX/src/configuration/configuration.cc index abb96e389..d37b95baf 100644 --- a/gromosXX/src/configuration/configuration.cc +++ b/gromosXX/src/configuration/configuration.cc @@ -680,7 +680,7 @@ void configuration::Configuration::check_excluded_positions(topology::Topology c } // loop over the solute charge groups - int idx_cg1, idx_cg2; + unsigned int idx_cg1, idx_cg2; for (idx_cg1 = 0; idx_cg1 < num_cg; idx_cg1++) { for (idx_cg2 = idx_cg1 + 1; idx_cg2 < num_cg; idx_cg2++) { // check if they are outside of inner cut off diff --git a/gromosXX/src/configuration/energy.cc b/gromosXX/src/configuration/energy.cc index 42dac1d9d..1b8732fa9 100644 --- a/gromosXX/src/configuration/energy.cc +++ b/gromosXX/src/configuration/energy.cc @@ -36,8 +36,10 @@ ls_pair_total(0.0), ls_realspace_total(0.0), ls_kspace_total(0.0), ls_self_total(0.0), +ls_self_total_nvt(0.0), ls_surface_total(0.0), ls_a_term_total(0.0), +ls_a_term_total_nvt(0.0), special_total(0.0), posrest_total(0.0), distanceres_total(0.0), @@ -57,9 +59,7 @@ sasa_volume_total(0.0), qm_total(0.0), eds_vr(0.0), entropy_term(0.0), -m_ewarn(1E99), -ls_self_total_nvt(0.0), -ls_a_term_total_nvt(0.0){ +m_ewarn(1E99){ } void configuration::Energy::zero(bool potential, bool kinetic) @@ -282,7 +282,7 @@ int configuration::Energy::calculate_totals() { DEBUG(10, "energy: calculate totals"); - int num_groups = unsigned(bond_energy.size()); + unsigned int num_groups = unsigned(bond_energy.size()); kinetic_total = 0.0; @@ -308,10 +308,10 @@ int configuration::Energy::calculate_totals() sasa_volume_total = 0.0; // ANITA - DEBUG(8, "ANITA setting totals to zero"); - DEBUG(8, "ANITA A_lj_total.size() " << A_lj_total.size()); + DEBUG(10, "ANITA setting totals to zero"); + DEBUG(10, "ANITA A_lj_total.size() " << A_lj_total.size()); - int nr_lambdas = unsigned(A_lj_total.size()); + unsigned int nr_lambdas = unsigned(A_lj_total.size()); for(unsigned int i=0; i(), mesh_left(NULL), mesh_right(NULL), mesh_tmp(NULL), - num_threads(size), rank(arank), cache_size(cache_size), slice_width(0), + num_threads(size), rank(arank), cache_size(acache_size), slice_width(0), slice_start(0), slice_end(0) { resize(x,y,z); } diff --git a/gromosXX/src/interaction/bonded/angle_interaction.cc b/gromosXX/src/interaction/bonded/angle_interaction.cc index 82ca22332..f55d5fe03 100644 --- a/gromosXX/src/interaction/bonded/angle_interaction.cc +++ b/gromosXX/src/interaction/bonded/angle_interaction.cc @@ -31,9 +31,9 @@ template static int _calculate_angle_interactions(topology::Topology & topo, configuration::Configuration & conf, - simulation::Simulation & sim, - std::vector const & param) + simulation::Simulation & sim) { + std::vector const & param = topo.angle_types_cosharm(); // loop over the bonds std::vector::const_iterator a_it = topo.solute().angles().begin(), @@ -136,7 +136,7 @@ ::calculate_interactions(topology::Topology &topo, m_timer.start(); SPLIT_VIRIAL_BOUNDARY(_calculate_angle_interactions, - topo, conf, sim, m_parameter); + topo, conf, sim); m_timer.stop(); diff --git a/gromosXX/src/interaction/bonded/angle_interaction.h b/gromosXX/src/interaction/bonded/angle_interaction.h index f4d2ce8c3..9e5fe6550 100644 --- a/gromosXX/src/interaction/bonded/angle_interaction.h +++ b/gromosXX/src/interaction/bonded/angle_interaction.h @@ -53,17 +53,6 @@ namespace interaction configuration::Configuration & conf, simulation::Simulation & sim); - /** - * angle interaction parameter. - */ - std::vector const & parameter()const { return m_parameter; } - /** - * angle interaction parameter. - */ - std::vector & parameter() { return m_parameter; } - - protected: - std::vector m_parameter; }; diff --git a/gromosXX/src/interaction/bonded/cg_bond_interaction.cc b/gromosXX/src/interaction/bonded/cg_bond_interaction.cc index ddc2405cf..23d413a46 100644 --- a/gromosXX/src/interaction/bonded/cg_bond_interaction.cc +++ b/gromosXX/src/interaction/bonded/cg_bond_interaction.cc @@ -32,9 +32,9 @@ template static int _calculate_dp_bond_interactions (topology::Topology & topo, configuration::Configuration & conf, - simulation::Simulation & sim, - std::vector const & param) + simulation::Simulation & sim) { + std::vector const & bondtypes=topo.bond_types_harm(); // loop over the bonds std::vector::const_iterator b_it = topo.solute().cgbonds().begin(), @@ -47,7 +47,7 @@ static int _calculate_dp_bond_interactions //double energy, sigma2, diff2i, sigma4, diff4i, diffi; //double limitr = 0.3; - double energy, diff, diff2, diff4; + double energy, diff, diff2; math::Periodicity periodicity(conf.current().box); @@ -56,22 +56,21 @@ static int _calculate_dp_bond_interactions double dist = abs(v); - if (dist > param[b_it->type].r0) { + if (dist > bondtypes[b_it->type].r0) { - assert(unsigned(b_it->type) < param.size()); + assert(unsigned(b_it->type) < bondtypes.size()); DEBUG(7, "bond " << b_it->i << "-" << b_it->j << " type " << b_it->type); - DEBUG(10, "K " << param[b_it->type].K << " r0 " - << param[b_it->type].r0); + DEBUG(10, "K " << bondtypes[b_it->type].K << " r0 " + << bondtypes[b_it->type].r0); DEBUG(10, "pos i " << math::v2s(pos(b_it->i))); DEBUG(10, "pos j " << math::v2s(pos(b_it->j))); DEBUG(10, "dist " << dist); - diff = dist - param[b_it->type].r0; + diff = dist - bondtypes[b_it->type].r0; diff2 = diff * diff; - diff4 = diff2 * diff2; - f = (v / dist) * -0.5 * 4 * param[b_it->type].K * diff * diff2; + f = (v / dist) * -0.5 * 4 * bondtypes[b_it->type].K * diff * diff2; force(b_it->i) += f; force(b_it->j) -= f; @@ -85,7 +84,7 @@ static int _calculate_dp_bond_interactions DEBUG(7, "\tatomic virial done"); // } - energy = 0.5 * param[b_it->type].K * diff2 * diff2; + energy = 0.5 * bondtypes[b_it->type].K * diff2 * diff2; conf.current().energies.bond_energy[topo.atom_energy_group() [b_it->i]] += energy; @@ -108,7 +107,7 @@ ::calculate_interactions(topology::Topology &topo, m_timer.start(); SPLIT_VIRIAL_BOUNDARY(_calculate_dp_bond_interactions, - topo, conf, sim, m_parameter); + topo, conf, sim); m_timer.stop(); diff --git a/gromosXX/src/interaction/bonded/cg_bond_interaction.h b/gromosXX/src/interaction/bonded/cg_bond_interaction.h index edec0ab73..4b1e64e36 100644 --- a/gromosXX/src/interaction/bonded/cg_bond_interaction.h +++ b/gromosXX/src/interaction/bonded/cg_bond_interaction.h @@ -55,18 +55,7 @@ namespace interaction configuration::Configuration & conf, simulation::Simulation & sim); - /** - * the bond parameter. - */ - std::vector const & parameter()const { return m_parameter;} - /** - * the bond parameter. - */ - std::vector & parameter() { return m_parameter; } - - protected: - std::vector m_parameter; - + }; } // interaction diff --git a/gromosXX/src/interaction/bonded/create_bonded.cc b/gromosXX/src/interaction/bonded/create_bonded.cc index 5b2d69f67..b7cdce73d 100644 --- a/gromosXX/src/interaction/bonded/create_bonded.cc +++ b/gromosXX/src/interaction/bonded/create_bonded.cc @@ -54,7 +54,6 @@ int interaction::create_g96_bonded(interaction::Forcefield & ff, bool quiet) { DEBUG(8, "creating g96 bonded"); - if (param.force.bond == 1){ if (!quiet) os << "\tquartic bond interaction\n"; @@ -62,7 +61,6 @@ int interaction::create_g96_bonded(interaction::Forcefield & ff, interaction::Quartic_Bond_Interaction *b = new interaction::Quartic_Bond_Interaction(); - it.read_g96_bonds(b->parameter()); ff.push_back(b); if (param.perturbation.perturbation) { @@ -80,7 +78,6 @@ int interaction::create_g96_bonded(interaction::Forcefield & ff, interaction::Harmonic_Bond_Interaction *b = new interaction::Harmonic_Bond_Interaction(); - it.read_harmonic_bonds(b->parameter()); ff.push_back(b); io::messages.add("using harmonic bond potential", @@ -99,21 +96,27 @@ int interaction::create_g96_bonded(interaction::Forcefield & ff, // do the perturbed soft bonds regardless of constraints // the affected bonds will have been removed from bonds and constraints if (param.perturbation.perturbation) { + if (param.force.bond) { if (!quiet) os << "\tperturbed soft harmonic bond interaction\n"; interaction::Perturbed_Soft_Bond_Interaction * sb = - new interaction::Perturbed_Soft_Bond_Interaction(it); + new interaction::Perturbed_Soft_Bond_Interaction(); ff.push_back(sb); + } + if (param.force.angle) { if (!quiet) os << "\tperturbed soft harmonic angle interaction\n"; interaction::Perturbed_Soft_Angle_Interaction * sa = - new interaction::Perturbed_Soft_Angle_Interaction(it); + new interaction::Perturbed_Soft_Angle_Interaction(); ff.push_back(sa); + } + if (param.force.improper) { if (!quiet) os << "\tperturbed soft improper dihedral interaction\n"; interaction::Perturbed_Soft_Improper_Interaction * si = - new interaction::Perturbed_Soft_Improper_Interaction(it); + new interaction::Perturbed_Soft_Improper_Interaction(); ff.push_back(si); + } } if (param.cgrain.level > 1) { @@ -123,7 +126,6 @@ int interaction::create_g96_bonded(interaction::Forcefield & ff, interaction::DP_Bond_Interaction * bcg = new interaction::DP_Bond_Interaction(); - it.read_g96_bonds(bcg->parameter()); ff.push_back(bcg); if (param.perturbation.perturbation) { @@ -136,14 +138,13 @@ int interaction::create_g96_bonded(interaction::Forcefield & ff, } } - + if (param.force.angle == 1){ if (!quiet) os <<"\tbond angle (cosine) interaction\n"; interaction::Angle_Interaction *a = new interaction::Angle_Interaction(); - - it.read_angles(a->parameter()); + ff.push_back(a); if (param.perturbation.perturbation){ @@ -160,8 +161,7 @@ int interaction::create_g96_bonded(interaction::Forcefield & ff, os <<"\tharmonic bond angle interaction\n"; interaction::Harm_Angle_Interaction *a = new interaction::Harm_Angle_Interaction(); - - it.read_harm_angles(a->parameter()); + ff.push_back(a); if (param.perturbation.perturbation){ @@ -176,14 +176,13 @@ int interaction::create_g96_bonded(interaction::Forcefield & ff, */ } } - + if (param.force.improper == 1){ if (!quiet) os << "\timproper dihedral interaction\n"; - + interaction::Improper_Dihedral_Interaction * i = new interaction::Improper_Dihedral_Interaction(); - it.read_improper_dihedrals(i->parameter()); ff.push_back(i); if (param.perturbation.perturbation){ @@ -199,10 +198,9 @@ int interaction::create_g96_bonded(interaction::Forcefield & ff, if (param.force.dihedral == 1){ if (!quiet) os <<"\tdihedral interaction\n"; - + interaction::Dihedral_new_Interaction * d = new interaction::Dihedral_new_Interaction(); - it.read_dihedrals(d->parameter()); ff.push_back(d); if (param.perturbation.perturbation){ @@ -216,10 +214,9 @@ int interaction::create_g96_bonded(interaction::Forcefield & ff, if (param.force.dihedral == 2){ if (!quiet) os <<"\tdihedral interaction\n"; - + interaction::Dihedral_Interaction * d = new interaction::Dihedral_Interaction(); - it.read_dihedrals(d->parameter()); ff.push_back(d); if (param.perturbation.perturbation){ @@ -236,7 +233,6 @@ int interaction::create_g96_bonded(interaction::Forcefield & ff, interaction::Crossdihedral_Interaction * c = new interaction::Crossdihedral_Interaction(); - it.read_dihedrals(c->parameter()); ff.push_back(c); /*if (param.perturbation.perturbation){ @@ -247,8 +243,7 @@ int interaction::create_g96_bonded(interaction::Forcefield & ff, ff.push_back(pc); }*/ } - + return 0; } - diff --git a/gromosXX/src/interaction/bonded/crossdihedral_interaction.cc b/gromosXX/src/interaction/bonded/crossdihedral_interaction.cc index 855fbdd98..ec20ed774 100644 --- a/gromosXX/src/interaction/bonded/crossdihedral_interaction.cc +++ b/gromosXX/src/interaction/bonded/crossdihedral_interaction.cc @@ -36,10 +36,9 @@ template static int _calculate_crossdihedral_interactions(topology::Topology & topo, configuration::Configuration & conf, - simulation::Simulation & sim, - std::vector - const & param) + simulation::Simulation & sim) { + std::vector const & param = topo.dihedral_types(); // loop over the crossdihedrals std::vector::iterator d_it = topo.solute().crossdihedrals().begin(), @@ -222,7 +221,7 @@ ::calculate_interactions(topology::Topology &topo, m_timer.start(); SPLIT_VIRIAL_BOUNDARY(_calculate_crossdihedral_interactions, - topo, conf, sim, m_parameter); + topo, conf, sim); m_timer.stop(); diff --git a/gromosXX/src/interaction/bonded/crossdihedral_interaction.h b/gromosXX/src/interaction/bonded/crossdihedral_interaction.h index 1c2f5a7ae..12e9eb752 100644 --- a/gromosXX/src/interaction/bonded/crossdihedral_interaction.h +++ b/gromosXX/src/interaction/bonded/crossdihedral_interaction.h @@ -53,18 +53,8 @@ namespace interaction virtual int calculate_interactions(topology::Topology & topo, configuration::Configuration & conf, simulation::Simulation & sim); - - /** - * the angle type parameters. - */ - std::vector const & parameter()const { return m_parameter; } - /** - * the angle type parameters. - */ - std::vector & parameter() { return m_parameter; } protected: - std::vector m_parameter; /** * calculate nearest minimum diff --git a/gromosXX/src/interaction/bonded/dihedral_interaction.cc b/gromosXX/src/interaction/bonded/dihedral_interaction.cc index 4d81dcaa9..6d5325a94 100644 --- a/gromosXX/src/interaction/bonded/dihedral_interaction.cc +++ b/gromosXX/src/interaction/bonded/dihedral_interaction.cc @@ -36,9 +36,8 @@ static double _calculate_nearest_minimum(double phi, int m, double cospd); template static int _calculate_dihedral_interactions(topology::Topology & topo, configuration::Configuration & conf, - simulation::Simulation & sim, - std::vector - const & param) { + simulation::Simulation & sim) { + std::vector const & param = topo.dihedral_types(); // loop over the dihedrals std::vector::iterator d_it = topo.solute().dihedrals().begin(), @@ -216,7 +215,7 @@ ::calculate_interactions(topology::Topology &topo, m_timer.start(); SPLIT_VIRIAL_BOUNDARY(_calculate_dihedral_interactions, - topo, conf, sim, m_parameter); + topo, conf, sim); m_timer.stop(); @@ -242,9 +241,7 @@ int interaction::Dihedral_Interaction::init(topology::Topology &topo, std::ostream &os, bool quiet) { - //std::vector m_parameter; - //std::vector const & param =m_parameter; - std::vector const & param = Dihedral_Interaction::parameter(); + std::vector const & param = topo.dihedral_types(); std::vector::iterator d_it = topo.solute().dihedrals().begin(), d_to = topo.solute().dihedrals().end(); diff --git a/gromosXX/src/interaction/bonded/dihedral_interaction.h b/gromosXX/src/interaction/bonded/dihedral_interaction.h index 56e529c7a..5b117f481 100644 --- a/gromosXX/src/interaction/bonded/dihedral_interaction.h +++ b/gromosXX/src/interaction/bonded/dihedral_interaction.h @@ -49,18 +49,8 @@ namespace interaction virtual int calculate_interactions(topology::Topology & topo, configuration::Configuration & conf, simulation::Simulation & sim); - - /** - * the angle type parameters. - */ - std::vector const & parameter()const { return m_parameter; } - /** - * the angle type parameters. - */ - std::vector & parameter() { return m_parameter; } protected: - std::vector m_parameter; /** * calculate nearest minimum diff --git a/gromosXX/src/interaction/bonded/dihedral_new_interaction.cc b/gromosXX/src/interaction/bonded/dihedral_new_interaction.cc index 93543cc8e..907a7d652 100644 --- a/gromosXX/src/interaction/bonded/dihedral_new_interaction.cc +++ b/gromosXX/src/interaction/bonded/dihedral_new_interaction.cc @@ -35,9 +35,8 @@ static double _calculate_nearest_minimum(double phi, int m, double cospd); template static int _calculate_dihedral_new_interactions(topology::Topology & topo, configuration::Configuration & conf, - simulation::Simulation & sim, - std::vector - const & param) { + simulation::Simulation & sim) { + std::vector const & param = topo.dihedral_types(); // loop over the dihedrals std::vector::iterator d_it = topo.solute().dihedrals().begin(), @@ -195,7 +194,7 @@ ::calculate_interactions(topology::Topology &topo, m_timer.start(); SPLIT_VIRIAL_BOUNDARY(_calculate_dihedral_new_interactions, - topo, conf, sim, m_parameter); + topo, conf, sim); m_timer.stop(); diff --git a/gromosXX/src/interaction/bonded/dihedral_new_interaction.h b/gromosXX/src/interaction/bonded/dihedral_new_interaction.h index badf65079..17d293595 100644 --- a/gromosXX/src/interaction/bonded/dihedral_new_interaction.h +++ b/gromosXX/src/interaction/bonded/dihedral_new_interaction.h @@ -54,17 +54,8 @@ namespace interaction configuration::Configuration & conf, simulation::Simulation & sim); - /** - * the angle type parameters. - */ - std::vector const & parameter()const { return m_parameter; } - /** - * the angle type parameters. - */ - std::vector & parameter() { return m_parameter; } protected: - std::vector m_parameter; /** * calculate nearest minimum diff --git a/gromosXX/src/interaction/bonded/harm_angle_interaction.cc b/gromosXX/src/interaction/bonded/harm_angle_interaction.cc index 9353ebd80..af06ed5d8 100644 --- a/gromosXX/src/interaction/bonded/harm_angle_interaction.cc +++ b/gromosXX/src/interaction/bonded/harm_angle_interaction.cc @@ -31,9 +31,9 @@ template static int _calculate_harm_angle_interactions(topology::Topology & topo, configuration::Configuration & conf, - simulation::Simulation & sim, - std::vector const & param) + simulation::Simulation & sim) { + std::vector const & param = topo.angle_types_harm(); // loop over the bonds std::vector::const_iterator a_it = topo.solute().angles().begin(), @@ -82,7 +82,7 @@ static int _calculate_harm_angle_interactions(topology::Topology & topo, double K = param[a_it->type].K; double theta0 = param[a_it->type].cos0; //here theta0 is actually cos0, as the parameter cosO is read differently depending on harmonicity - //see io::In_Topology::read_harm_angles + //see io::In_Topology::read_bondangle_types DEBUG(10, "\tK=" << K << " theta0=" << theta0 << " dij=" << dij << " dkj=" << dkj); @@ -155,7 +155,7 @@ ::calculate_interactions(topology::Topology &topo, m_timer.start(); SPLIT_VIRIAL_BOUNDARY(_calculate_harm_angle_interactions, - topo, conf, sim, m_parameter); + topo, conf, sim); m_timer.stop(); diff --git a/gromosXX/src/interaction/bonded/harm_angle_interaction.h b/gromosXX/src/interaction/bonded/harm_angle_interaction.h index a2c406706..9f87634fe 100644 --- a/gromosXX/src/interaction/bonded/harm_angle_interaction.h +++ b/gromosXX/src/interaction/bonded/harm_angle_interaction.h @@ -52,18 +52,6 @@ namespace interaction virtual int calculate_interactions(topology::Topology & topo, configuration::Configuration & conf, simulation::Simulation & sim); - - /** - * angle interaction parameter. - */ - std::vector const & parameter()const { return m_parameter; } - /** - * angle interaction parameter. - */ - std::vector & parameter() { return m_parameter; } - - protected: - std::vector m_parameter; }; diff --git a/gromosXX/src/interaction/bonded/harmonic_bond_interaction.cc b/gromosXX/src/interaction/bonded/harmonic_bond_interaction.cc index de2017026..483a3836e 100644 --- a/gromosXX/src/interaction/bonded/harmonic_bond_interaction.cc +++ b/gromosXX/src/interaction/bonded/harmonic_bond_interaction.cc @@ -32,9 +32,9 @@ template static int _calculate_harmonic_bond_interactions (topology::Topology & topo, configuration::Configuration & conf, - simulation::Simulation & sim, - std::vector const & param) + simulation::Simulation & sim) { + std::vector const & bondtypes=topo.bond_types_harm(); // loop over the bonds std::vector::const_iterator b_it = topo.solute().bonds().begin(), @@ -54,21 +54,21 @@ static int _calculate_harmonic_bond_interactions double dist = sqrt(abs2(v)); assert(dist != 0.0); - assert(unsigned(b_it->type) < param.size()); + assert(unsigned(b_it->type) < bondtypes.size()); DEBUG(7, "bond " << b_it->i << "-" << b_it->j << " type " << b_it->type); - DEBUG(10, "K " << param[b_it->type].K << " r0 " - << param[b_it->type].r0); + DEBUG(10, "K " << bondtypes[b_it->type].K << " r0 " + << bondtypes[b_it->type].r0); DEBUG(10, "pos i " << math::v2s(pos(b_it->i))); DEBUG(10, "pos j " << math::v2s(pos(b_it->j))); DEBUG(10, "dist " << dist); - DEBUG(10, "DF " << (-param[b_it->type].K * - (dist - param[b_it->type].r0) / dist) + DEBUG(10, "DF " << (-bondtypes[b_it->type].K * + (dist - bondtypes[b_it->type].r0) / dist) << "\nr(ij) " << math::v2s(v)); - diff = dist - param[b_it->type].r0; + diff = dist - bondtypes[b_it->type].r0; - f = v * (-param[b_it->type].K * + f = v * (-bondtypes[b_it->type].K * (diff) / dist); force(b_it->i) += f; @@ -83,7 +83,7 @@ static int _calculate_harmonic_bond_interactions DEBUG(7, "\tatomic virial done"); // } - energy = 0.5 * param[b_it->type].K * diff * diff; + energy = 0.5 * bondtypes[b_it->type].K * diff * diff; conf.current().energies.bond_energy[topo.atom_energy_group() [b_it->i]] += energy; @@ -105,7 +105,7 @@ ::calculate_interactions(topology::Topology &topo, m_timer.start(); SPLIT_VIRIAL_BOUNDARY(_calculate_harmonic_bond_interactions, - topo, conf, sim, m_parameter); + topo, conf, sim); m_timer.stop(); diff --git a/gromosXX/src/interaction/bonded/harmonic_bond_interaction.h b/gromosXX/src/interaction/bonded/harmonic_bond_interaction.h index b28f292ae..891f87188 100644 --- a/gromosXX/src/interaction/bonded/harmonic_bond_interaction.h +++ b/gromosXX/src/interaction/bonded/harmonic_bond_interaction.h @@ -55,17 +55,6 @@ namespace interaction configuration::Configuration & conf, simulation::Simulation & sim); - /** - * the bond parameter. - */ - std::vector const & parameter()const { return m_parameter;} - /** - * the bond parameter. - */ - std::vector & parameter() { return m_parameter; } - - protected: - std::vector m_parameter; }; diff --git a/gromosXX/src/interaction/bonded/improper_dihedral_interaction.cc b/gromosXX/src/interaction/bonded/improper_dihedral_interaction.cc index 419f9dc04..4b7377b74 100644 --- a/gromosXX/src/interaction/bonded/improper_dihedral_interaction.cc +++ b/gromosXX/src/interaction/bonded/improper_dihedral_interaction.cc @@ -31,10 +31,9 @@ template static int _calculate_improper_interactions(topology::Topology & topo, configuration::Configuration & conf, - simulation::Simulation & sim, - std::vector - const & param) + simulation::Simulation & sim) { + std::vector const & param = topo.impdihedral_types(); // loop over the improper dihedrals std::vector::const_iterator i_it = topo.solute().improper_dihedrals().begin(), @@ -153,7 +152,7 @@ ::calculate_interactions(topology::Topology &topo, m_timer.start(); SPLIT_VIRIAL_BOUNDARY(_calculate_improper_interactions, - topo, conf, sim, m_parameter); + topo, conf, sim); m_timer.stop(); diff --git a/gromosXX/src/interaction/bonded/improper_dihedral_interaction.h b/gromosXX/src/interaction/bonded/improper_dihedral_interaction.h index 78cb1f5ed..e9ea0b9f2 100644 --- a/gromosXX/src/interaction/bonded/improper_dihedral_interaction.h +++ b/gromosXX/src/interaction/bonded/improper_dihedral_interaction.h @@ -53,19 +53,6 @@ namespace interaction configuration::Configuration & conf, simulation::Simulation & sim); - /** - * the angle type parameters. - */ - std::vector const & parameter()const { return m_parameter; } - - /** - * the angle type parameters. - */ - std::vector & parameter() { return m_parameter; } - - protected: - std::vector m_parameter; - }; } // interaction diff --git a/gromosXX/src/interaction/bonded/perturbed_angle_interaction.cc b/gromosXX/src/interaction/bonded/perturbed_angle_interaction.cc index cd5a4b509..294714a31 100644 --- a/gromosXX/src/interaction/bonded/perturbed_angle_interaction.cc +++ b/gromosXX/src/interaction/bonded/perturbed_angle_interaction.cc @@ -84,22 +84,22 @@ static int _calculate_perturbed_angle_interactions double ip = dot(rij, rkj); double cost = ip / (dij * dkj); - assert(unsigned(a_it->A_type) < m_interaction.parameter().size()); - assert(unsigned(a_it->B_type) < m_interaction.parameter().size()); + assert(unsigned(a_it->A_type) < topo.angle_types_cosharm().size()); + assert(unsigned(a_it->B_type) < topo.angle_types_cosharm().size()); double K = (1 - lambda) * - m_interaction.parameter()[a_it->A_type].K + + topo.angle_types_cosharm()[a_it->A_type].K + lambda * - m_interaction.parameter()[a_it->B_type].K; + topo.angle_types_cosharm()[a_it->B_type].K; double cos0 = (1 - lambda) * - m_interaction.parameter()[a_it->A_type].cos0 + + topo.angle_types_cosharm()[a_it->A_type].cos0 + lambda * - m_interaction.parameter()[a_it->B_type].cos0; + topo.angle_types_cosharm()[a_it->B_type].cos0; - const double K_diff = m_interaction.parameter()[a_it->B_type].K - - m_interaction.parameter()[a_it->A_type].K; - const double cos_diff=m_interaction.parameter()[a_it->B_type].cos0- - m_interaction.parameter()[a_it->A_type].cos0; + const double K_diff = topo.angle_types_cosharm()[a_it->B_type].K - + topo.angle_types_cosharm()[a_it->A_type].K; + const double cos_diff=topo.angle_types_cosharm()[a_it->B_type].cos0- + topo.angle_types_cosharm()[a_it->A_type].cos0; DEBUG(10, "K=" << K << " cos0=" << cos0 << " dij=" << dij << " dkj=" << dkj) ; @@ -158,17 +158,17 @@ static int _calculate_perturbed_angle_interactions // ANITA if (sim.param().precalclam.nr_lambdas && ((sim.steps() % sim.param().write.free_energy) == 0)){ - double KA = m_interaction.parameter()[a_it->A_type].K; - double KB = m_interaction.parameter()[a_it->B_type].K; - double cos0A = m_interaction.parameter()[a_it->A_type].cos0; - double cos0B = m_interaction.parameter()[a_it->B_type].cos0; + double KA = topo.angle_types_cosharm()[a_it->A_type].K; + double KB = topo.angle_types_cosharm()[a_it->B_type].K; + double cos0A = topo.angle_types_cosharm()[a_it->A_type].cos0; + double cos0B = topo.angle_types_cosharm()[a_it->B_type].cos0; double lambda_step = (sim.param().precalclam.max_lam - sim.param().precalclam.min_lam) / (sim.param().precalclam.nr_lambdas-1); //loop over nr_lambdas - for (int lam_index = 0; lam_index < sim.param().precalclam.nr_lambdas; ++lam_index){ + for (unsigned int lam_index = 0; lam_index < sim.param().precalclam.nr_lambdas; ++lam_index){ // determine current lambda for this index double lam=(lam_index * lambda_step) + sim.param().precalclam.min_lam; diff --git a/gromosXX/src/interaction/bonded/perturbed_cg_bond_interaction.cc b/gromosXX/src/interaction/bonded/perturbed_cg_bond_interaction.cc index 44606cd9d..e9197f93f 100644 --- a/gromosXX/src/interaction/bonded/perturbed_cg_bond_interaction.cc +++ b/gromosXX/src/interaction/bonded/perturbed_cg_bond_interaction.cc @@ -41,6 +41,8 @@ static int _calculate_perturbed_bond_interactions DEBUG(9, "using the bond interaction: " << m_interaction.name); DEBUG(9, std::setprecision(5)); + std::vector const & bondtypes=topo.bond_types_harm(); + // loop over the bonds std::vector::const_iterator b_it = topo.perturbed_solute().cgbonds().begin(), @@ -78,18 +80,18 @@ static int _calculate_perturbed_bond_interactions DEBUG(7, "dist: " << dist); assert(dist != 0.0); - assert(unsigned(b_it->A_type) < m_interaction.parameter().size()); - assert(unsigned(b_it->B_type) < m_interaction.parameter().size()); + assert(unsigned(b_it->A_type) < bondtypes.size()); + assert(unsigned(b_it->B_type) < bondtypes.size()); - const double K = (1 - lambda) * m_interaction.parameter()[b_it->A_type].K + - lambda * m_interaction.parameter()[b_it->B_type].K; + const double K = (1 - lambda) * bondtypes[b_it->A_type].K + + lambda * bondtypes[b_it->B_type].K; DEBUG(7, "K: " << K); const double r0 = ((1 - lambda) * - m_interaction.parameter()[b_it->A_type].r0 + + bondtypes[b_it->A_type].r0 + lambda * - m_interaction.parameter()[b_it->B_type].r0); + bondtypes[b_it->B_type].r0); diff = dist - r0; diff2 = diff * diff; @@ -117,12 +119,12 @@ static int _calculate_perturbed_bond_interactions DEBUG(9, "energy: " << e); - const double K_diff = m_interaction.parameter()[b_it->B_type].K - - m_interaction.parameter()[b_it->A_type].K; + const double K_diff = bondtypes[b_it->B_type].K - + bondtypes[b_it->A_type].K; DEBUG(9, "K_diff: " << K_diff); - const double b_diff = m_interaction.parameter()[b_it->B_type].r0 - - m_interaction.parameter()[b_it->A_type].r0; + const double b_diff = bondtypes[b_it->B_type].r0 - + bondtypes[b_it->A_type].r0; DEBUG(9, "b_diff: " << b_diff); e_lambda = lambda_derivative * (0.5 * K_diff * diff2 * diff2 diff --git a/gromosXX/src/interaction/bonded/perturbed_dihedral_interaction.cc b/gromosXX/src/interaction/bonded/perturbed_dihedral_interaction.cc index bb9ba4dff..99b0fb935 100644 --- a/gromosXX/src/interaction/bonded/perturbed_dihedral_interaction.cc +++ b/gromosXX/src/interaction/bonded/perturbed_dihedral_interaction.cc @@ -105,13 +105,13 @@ static int _calculate_perturbed_dihedral_interactions double cosphi3 = cosphi2 * cosphi; double cosphi4 = cosphi3 * cosphi; - assert(unsigned(d_it->A_type) < m_interaction.parameter().size()); + assert(unsigned(d_it->A_type) < topo.dihedral_types().size()); double dcosmphi = 0; double cosmphi = 0; // first state A - switch(m_interaction.parameter()[d_it->A_type].m){ + switch(topo.dihedral_types()[d_it->A_type].m){ case 0: cosmphi = 0.0; dcosmphi = 0.0; @@ -142,8 +142,8 @@ static int _calculate_perturbed_dihedral_interactions break; } - double K = m_interaction.parameter()[d_it->A_type].K; - double cosdelta = m_interaction.parameter()[d_it->A_type].cospd; + double K = topo.dihedral_types()[d_it->A_type].K; + double cosdelta = topo.dihedral_types()[d_it->A_type].cospd; DEBUG(10, "dihedral K=" << K << "cos delta=" << cosdelta << " dcos=" << dcosmphi); @@ -161,7 +161,7 @@ static int _calculate_perturbed_dihedral_interactions A_energy = K * (1 + cosdelta * cosmphi); // then state B - switch(m_interaction.parameter()[d_it->B_type].m){ + switch(topo.dihedral_types()[d_it->B_type].m){ case 0: cosmphi = 0.0; dcosmphi = 0.0; @@ -191,8 +191,8 @@ static int _calculate_perturbed_dihedral_interactions dcosmphi = 192*cosphi4*cosphi-192*cosphi3+36*cosphi; break; } - K = m_interaction.parameter()[d_it->B_type].K; - cosdelta = m_interaction.parameter()[d_it->B_type].cospd; + K = topo.dihedral_types()[d_it->B_type].K; + cosdelta = topo.dihedral_types()[d_it->B_type].cospd; DEBUG(10, "dihedral K=" << K << "cos delta=" << cosdelta << " dcos=" << dcosmphi); @@ -298,10 +298,7 @@ int interaction::Perturbed_Dihedral_Interaction::init(topology::Topology &topo, std::ostream &os, bool quiet) { - //std::vector m_parameter; - //std::vector const & param =m_parameter; - //Dihedral_Interaction & m_interaction; - std::vector const & param = m_interaction.parameter(); + std::vector const & param = topo.dihedral_types(); std::vector::iterator d_it = topo.solute().dihedrals().begin(), d_to = topo.solute().dihedrals().end(); diff --git a/gromosXX/src/interaction/bonded/perturbed_dihedral_new_interaction.cc b/gromosXX/src/interaction/bonded/perturbed_dihedral_new_interaction.cc index 2263c3cc9..78fe57baf 100644 --- a/gromosXX/src/interaction/bonded/perturbed_dihedral_new_interaction.cc +++ b/gromosXX/src/interaction/bonded/perturbed_dihedral_new_interaction.cc @@ -110,14 +110,14 @@ static int _calculate_perturbed_dihedral_new_interactions double sign = dot(rij, rnk); if(sign < 0) phi*=-1.0; - assert(unsigned(d_it->A_type) < m_interaction.parameter().size()); + assert(unsigned(d_it->A_type) < topo.dihedral_types().size()); // first state A - double K = m_interaction.parameter()[d_it->A_type].K; - double cosdelta = m_interaction.parameter()[d_it->A_type].cospd; - double delta = m_interaction.parameter()[d_it->A_type].pd; - double m = m_interaction.parameter()[d_it->A_type].m; + double K = topo.dihedral_types()[d_it->A_type].K; + double cosdelta = topo.dihedral_types()[d_it->A_type].cospd; + double delta = topo.dihedral_types()[d_it->A_type].pd; + double m = topo.dihedral_types()[d_it->A_type].m; DEBUG(10, "dihedral K=" << K << "cos delta=" << cosdelta); @@ -134,10 +134,10 @@ static int _calculate_perturbed_dihedral_new_interactions A_energy = K * (1 + cos (m*phi - delta)); // then state B - K = m_interaction.parameter()[d_it->B_type].K; - delta = m_interaction.parameter()[d_it->B_type].pd; - cosdelta = m_interaction.parameter()[d_it->B_type].cospd; - m = m_interaction.parameter()[d_it->B_type].m; + K = topo.dihedral_types()[d_it->B_type].K; + delta = topo.dihedral_types()[d_it->B_type].pd; + cosdelta = topo.dihedral_types()[d_it->B_type].cospd; + m = topo.dihedral_types()[d_it->B_type].m; DEBUG(10, "dihedral K=" << K << "cos delta=" << cosdelta); diff --git a/gromosXX/src/interaction/bonded/perturbed_harmonic_bond_interaction.cc b/gromosXX/src/interaction/bonded/perturbed_harmonic_bond_interaction.cc index 3be84df18..a03cdb0e7 100644 --- a/gromosXX/src/interaction/bonded/perturbed_harmonic_bond_interaction.cc +++ b/gromosXX/src/interaction/bonded/perturbed_harmonic_bond_interaction.cc @@ -37,6 +37,7 @@ static int _calculate_perturbed_hbond_interactions interaction::Harmonic_Bond_Interaction const & m_interaction) { + std::vector const & bondtypes=topo.bond_types_harm(); DEBUG(7, "perturbed harmonic bond interaction"); DEBUG(9, "using the bond interaction: " << m_interaction.name); DEBUG(9, std::setprecision(5)); @@ -78,18 +79,18 @@ static int _calculate_perturbed_hbond_interactions DEBUG(7, "dist: " << dist); assert(dist != 0.0); - assert(unsigned(b_it->A_type) < m_interaction.parameter().size()); - assert(unsigned(b_it->B_type) < m_interaction.parameter().size()); + assert(unsigned(b_it->A_type) < bondtypes.size()); + assert(unsigned(b_it->B_type) < bondtypes.size()); - const double K = (1 - lambda) * m_interaction.parameter()[b_it->A_type].K + - lambda * m_interaction.parameter()[b_it->B_type].K; + const double K = (1 - lambda) * bondtypes[b_it->A_type].K + + lambda * bondtypes[b_it->B_type].K; DEBUG(7, "K: " << K); const double r0 = ((1 - lambda) * - m_interaction.parameter()[b_it->A_type].r0 + + bondtypes[b_it->A_type].r0 + lambda * - m_interaction.parameter()[b_it->B_type].r0); + bondtypes[b_it->B_type].r0); diff = dist - r0; DEBUG(9, "r0: " << r0); @@ -116,12 +117,12 @@ static int _calculate_perturbed_hbond_interactions DEBUG(9, "energy: " << e); - const double K_diff = m_interaction.parameter()[b_it->B_type].K - - m_interaction.parameter()[b_it->A_type].K; + const double K_diff = bondtypes[b_it->B_type].K - + bondtypes[b_it->A_type].K; DEBUG(9, "K_diff: " << K_diff); - const double b_diff = m_interaction.parameter()[b_it->B_type].r0 - - m_interaction.parameter()[b_it->A_type].r0; + const double b_diff = bondtypes[b_it->B_type].r0 - + bondtypes[b_it->A_type].r0; DEBUG(9, "b_diff: " << b_diff); e_lambda = lambda_derivative * (0.5 * K_diff*diff*diff - K*diff*b_diff) ; @@ -145,17 +146,17 @@ static int _calculate_perturbed_hbond_interactions // ANITA if (sim.param().precalclam.nr_lambdas && ((sim.steps() % sim.param().write.free_energy) == 0)){ - double KA = m_interaction.parameter()[b_it->A_type].K; - double KB = m_interaction.parameter()[b_it->B_type].K; - double b0A = m_interaction.parameter()[b_it->A_type].r0; - double b0B = m_interaction.parameter()[b_it->B_type].r0; + double KA = bondtypes[b_it->A_type].K; + double KB = bondtypes[b_it->B_type].K; + double b0A = bondtypes[b_it->A_type].r0; + double b0B = bondtypes[b_it->B_type].r0; double lambda_step = (sim.param().precalclam.max_lam - sim.param().precalclam.min_lam) / (sim.param().precalclam.nr_lambdas-1); //loop over nr_lambdas - for (int lam_index = 0; lam_index < sim.param().precalclam.nr_lambdas; ++lam_index){ + for (unsigned int lam_index = 0; lam_index < sim.param().precalclam.nr_lambdas; ++lam_index){ // determine current lambda for this index double lam=(lam_index * lambda_step) + sim.param().precalclam.min_lam; diff --git a/gromosXX/src/interaction/bonded/perturbed_improper_dihedral_interaction.cc b/gromosXX/src/interaction/bonded/perturbed_improper_dihedral_interaction.cc index 889c73557..715121a81 100644 --- a/gromosXX/src/interaction/bonded/perturbed_improper_dihedral_interaction.cc +++ b/gromosXX/src/interaction/bonded/perturbed_improper_dihedral_interaction.cc @@ -104,23 +104,23 @@ static int _calculate_perturbed_improper_interactions ip = dot(rij, rnk); if(ip < 0) q *= -1.0; - assert(unsigned(i_it->A_type) < m_interaction.parameter().size()); + assert(unsigned(i_it->A_type) < topo.impdihedral_types().size()); double K = (1 - lambda) * - m_interaction.parameter()[i_it->A_type].K + + topo.impdihedral_types()[i_it->A_type].K + lambda * - m_interaction.parameter()[i_it->B_type].K; + topo.impdihedral_types()[i_it->B_type].K; double q0 = (1 - lambda) * - m_interaction.parameter()[i_it->A_type].q0 + + topo.impdihedral_types()[i_it->A_type].q0 + lambda * - m_interaction.parameter()[i_it->B_type].q0; + topo.impdihedral_types()[i_it->B_type].q0; const double K_diff = - m_interaction.parameter()[i_it->B_type].K - - m_interaction.parameter()[i_it->A_type].K; + topo.impdihedral_types()[i_it->B_type].K - + topo.impdihedral_types()[i_it->A_type].K; const double q_diff = - m_interaction.parameter()[i_it->B_type].q0- - m_interaction.parameter()[i_it->A_type].q0; + topo.impdihedral_types()[i_it->B_type].q0- + topo.impdihedral_types()[i_it->A_type].q0; DEBUG(10, "K=" << K << " q0=" << q0 ); @@ -173,17 +173,17 @@ static int _calculate_perturbed_improper_interactions // ANITA if (sim.param().precalclam.nr_lambdas && ((sim.steps() % sim.param().write.free_energy) == 0)){ - double KA = m_interaction.parameter()[i_it->A_type].K; - double KB = m_interaction.parameter()[i_it->B_type].K; - double q0A = m_interaction.parameter()[i_it->A_type].q0; - double q0B = m_interaction.parameter()[i_it->B_type].q0; + double KA = topo.impdihedral_types()[i_it->A_type].K; + double KB = topo.impdihedral_types()[i_it->B_type].K; + double q0A = topo.impdihedral_types()[i_it->A_type].q0; + double q0B = topo.impdihedral_types()[i_it->B_type].q0; double lambda_step = (sim.param().precalclam.max_lam - sim.param().precalclam.min_lam) / (sim.param().precalclam.nr_lambdas-1); //loop over nr_lambdas - for (int lam_index = 0; lam_index < sim.param().precalclam.nr_lambdas; ++lam_index){ + for (unsigned int lam_index = 0; lam_index < sim.param().precalclam.nr_lambdas; ++lam_index){ // determine current lambda for this index double lam=(lam_index * lambda_step) + sim.param().precalclam.min_lam; diff --git a/gromosXX/src/interaction/bonded/perturbed_quartic_bond_interaction.cc b/gromosXX/src/interaction/bonded/perturbed_quartic_bond_interaction.cc index 04c20f31f..27442ff6e 100644 --- a/gromosXX/src/interaction/bonded/perturbed_quartic_bond_interaction.cc +++ b/gromosXX/src/interaction/bonded/perturbed_quartic_bond_interaction.cc @@ -36,7 +36,7 @@ int _calculate_perturbed_qbond_interactions simulation::Simulation & sim, interaction::Quartic_Bond_Interaction const & m_interaction) { - + std::vector const & bondtypes=topo.bond_types_quart(); DEBUG(7, "perturbed quartic bond interaction"); DEBUG(8, "using the bond interaction: " << m_interaction.name); DEBUG(8, std::setprecision(5)); @@ -76,18 +76,18 @@ int _calculate_perturbed_qbond_interactions DEBUG(7, "dist2: " << dist2); - assert(unsigned(b_it->A_type) < m_interaction.parameter().size()); - assert(unsigned(b_it->B_type) < m_interaction.parameter().size()); + assert(unsigned(b_it->A_type) < bondtypes.size()); + assert(unsigned(b_it->B_type) < bondtypes.size()); - const double K = (1 - lambda) * m_interaction.parameter()[b_it->A_type].K + - lambda * m_interaction.parameter()[b_it->B_type].K; + const double K = (1 - lambda) * bondtypes[b_it->A_type].K + + lambda * bondtypes[b_it->B_type].K; DEBUG(7, "K: " << K); const double r0 = ((1 - lambda) * - m_interaction.parameter()[b_it->A_type].r0 + + bondtypes[b_it->A_type].r0 + lambda * - m_interaction.parameter()[b_it->B_type].r0); + bondtypes[b_it->B_type].r0); const double r02 = r0 * r0; @@ -115,21 +115,21 @@ int _calculate_perturbed_qbond_interactions DEBUG(7, "energy: " << e); - const double K_diff = m_interaction.parameter()[b_it->B_type].K - - m_interaction.parameter()[b_it->A_type].K; + const double K_diff = bondtypes[b_it->B_type].K - + bondtypes[b_it->A_type].K; DEBUG(7, "K_diff: " << K_diff); - const double b_diff = m_interaction.parameter()[b_it->B_type].r0 - - m_interaction.parameter()[b_it->A_type].r0; + const double b_diff = bondtypes[b_it->B_type].r0 - + bondtypes[b_it->A_type].r0; DEBUG(7, "b_diff: " << b_diff); - const double b_mix = m_interaction.parameter()[b_it->A_type].r0 + + const double b_mix = bondtypes[b_it->A_type].r0 + lambda * b_diff; DEBUG(7, "b_mix: " << b_mix); e_lambda = 0.25 * lambda_derivative * - ( -4 * (m_interaction.parameter()[b_it->A_type].K + + ( -4 * (bondtypes[b_it->A_type].K + lambda * K_diff) * b_diff * b_mix * (dist2 - b_mix * b_mix) + @@ -152,17 +152,17 @@ int _calculate_perturbed_qbond_interactions // ANITA if (sim.param().precalclam.nr_lambdas && ((sim.steps() % sim.param().write.free_energy) == 0)){ - double KA = m_interaction.parameter()[b_it->A_type].K; - double KB = m_interaction.parameter()[b_it->B_type].K; - double b0A = m_interaction.parameter()[b_it->A_type].r0; - double b0B = m_interaction.parameter()[b_it->B_type].r0; + double KA = bondtypes[b_it->A_type].K; + double KB = bondtypes[b_it->B_type].K; + double b0A = bondtypes[b_it->A_type].r0; + double b0B = bondtypes[b_it->B_type].r0; double lambda_step = (sim.param().precalclam.max_lam - sim.param().precalclam.min_lam) / (sim.param().precalclam.nr_lambdas-1); //loop over nr_lambdas - for (int lam_index = 0; lam_index < sim.param().precalclam.nr_lambdas; ++lam_index){ + for (unsigned int lam_index = 0; lam_index < sim.param().precalclam.nr_lambdas; ++lam_index){ // determine current lambda for this index double lam=(lam_index * lambda_step) + sim.param().precalclam.min_lam; diff --git a/gromosXX/src/interaction/bonded/perturbed_soft_angle_interaction.cc b/gromosXX/src/interaction/bonded/perturbed_soft_angle_interaction.cc index 126f97684..7bba80fbf 100644 --- a/gromosXX/src/interaction/bonded/perturbed_soft_angle_interaction.cc +++ b/gromosXX/src/interaction/bonded/perturbed_soft_angle_interaction.cc @@ -17,7 +17,6 @@ // interactions #include "../../interaction/interaction_types.h" #include "perturbed_soft_angle_interaction.h" -#include "../../io/ifp.h" #include "../../util/template_split.h" #include "../../util/debug.h" @@ -28,12 +27,6 @@ #define SUBMODULE bonded -interaction::Perturbed_Soft_Angle_Interaction::Perturbed_Soft_Angle_Interaction(io::IFP &it) - : Interaction("PerturbedSoftAngle") -{ - it.read_angles(m_parameter); -} - /** * calculate angle forces and energies and lambda derivatives. */ @@ -41,10 +34,10 @@ template static int _calculate_perturbed_soft_angle_interactions ( topology::Topology & topo, configuration::Configuration & conf, - simulation::Simulation & sim, - std::vector &angletypes) + simulation::Simulation & sim) { // this is repeated code from Angle_Interaction !!! + std::vector &angletypes = topo.angle_types_cosharm(); DEBUG(5, "perturbed soft angle interaction"); DEBUG(7, std::setprecision(5)); @@ -185,7 +178,7 @@ static int _calculate_perturbed_soft_angle_interactions (sim.param().precalclam.nr_lambdas-1); //loop over nr_lambdas - for (int lam_index = 0; lam_index < sim.param().precalclam.nr_lambdas; ++lam_index){ + for (unsigned int lam_index = 0; lam_index < sim.param().precalclam.nr_lambdas; ++lam_index){ // determine current lambda for this index double lam=(lam_index * lambda_step) + sim.param().precalclam.min_lam; @@ -226,7 +219,7 @@ ::calculate_interactions(topology::Topology &topo, m_timer.start(); SPLIT_VIRIAL_BOUNDARY(_calculate_perturbed_soft_angle_interactions, - topo, conf, sim, m_parameter); + topo, conf, sim); m_timer.stop(); @@ -249,15 +242,15 @@ ::init(topology::Topology &topo, bt_to = topo.perturbed_solute().softangles().end(); for( ; bt_it != bt_to; ++bt_it){ if (bt_it->A_type==INT_MAX-1) { - bt_it->A_type=m_parameter.size(); - double cost = m_parameter[bt_it->B_type].cos0; - m_parameter.push_back(interaction::angle_type_struct(0, cost)); + bt_it->A_type=topo.angle_types_cosharm().size(); + double cost = topo.angle_types_cosharm()[bt_it->B_type].cos0; + topo.angle_types_cosharm().push_back(interaction::angle_type_struct(0, cost)); DEBUG(10, "adding new angle type for soft angle perturbation: " << bt_it->A_type << " K=" << 0 << " cost=" << cost); } else if (bt_it->B_type==INT_MAX-1) { - bt_it->B_type=m_parameter.size(); - double cost = m_parameter[bt_it->A_type].cos0; - m_parameter.push_back(interaction::angle_type_struct(0, cost)); + bt_it->B_type=topo.angle_types_cosharm().size(); + double cost = topo.angle_types_cosharm()[bt_it->A_type].cos0; + topo.angle_types_cosharm().push_back(interaction::angle_type_struct(0, cost)); DEBUG(10, "adding new angle type for soft angle perturbation: " << bt_it->B_type << " K=" << 0 << " cost=" << cost); } diff --git a/gromosXX/src/interaction/bonded/perturbed_soft_angle_interaction.h b/gromosXX/src/interaction/bonded/perturbed_soft_angle_interaction.h index 5e180893b..4d0cf266c 100644 --- a/gromosXX/src/interaction/bonded/perturbed_soft_angle_interaction.h +++ b/gromosXX/src/interaction/bonded/perturbed_soft_angle_interaction.h @@ -16,10 +16,6 @@ namespace simulation{ class Simulation; } -namespace io{ - class IFP; -} - namespace interaction { /** @@ -32,7 +28,8 @@ namespace interaction /** * Constructor. */ - Perturbed_Soft_Angle_Interaction(io::IFP &it); + Perturbed_Soft_Angle_Interaction() + : Interaction("PerturbedSoftAngle") {} /** * Destructor. @@ -54,8 +51,6 @@ namespace interaction configuration::Configuration & conf, simulation::Simulation & sim); - protected: - std::vector m_parameter; }; } // interaction diff --git a/gromosXX/src/interaction/bonded/perturbed_soft_bond_interaction.cc b/gromosXX/src/interaction/bonded/perturbed_soft_bond_interaction.cc index 44e8c28c0..5f50c1625 100644 --- a/gromosXX/src/interaction/bonded/perturbed_soft_bond_interaction.cc +++ b/gromosXX/src/interaction/bonded/perturbed_soft_bond_interaction.cc @@ -17,7 +17,6 @@ // interactions #include "../../interaction/interaction_types.h" #include "perturbed_soft_bond_interaction.h" -#include "../../io/ifp.h" #include "../../util/template_split.h" #include "../../util/debug.h" @@ -27,16 +26,6 @@ #define MODULE interaction #define SUBMODULE interaction - - - -interaction::Perturbed_Soft_Bond_Interaction::Perturbed_Soft_Bond_Interaction(io::IFP &it) - : Interaction("PerturbedSoftBond") -{ - it.read_harmonic_bonds(m_parameter); -} - - /** * calculate bond forces and energies and lambda derivatives. */ @@ -44,10 +33,10 @@ template static int _calculate_perturbed_soft_interactions ( topology::Topology & topo, configuration::Configuration & conf, - simulation::Simulation & sim, - std::vector &bondtypes) + simulation::Simulation & sim) { + std::vector const & bondtypes=topo.bond_types_harm(); DEBUG(7, "perturbed soft bond interaction"); DEBUG(9, std::setprecision(5)); @@ -179,7 +168,7 @@ static int _calculate_perturbed_soft_interactions (sim.param().precalclam.nr_lambdas-1); //loop over nr_lambdas - for (int lam_index = 0; lam_index < sim.param().precalclam.nr_lambdas; ++lam_index){ + for (unsigned int lam_index = 0; lam_index < sim.param().precalclam.nr_lambdas; ++lam_index){ // determine current lambda for this index double lam=(lam_index * lambda_step) + sim.param().precalclam.min_lam; @@ -220,7 +209,7 @@ ::calculate_interactions(topology::Topology &topo, m_timer.start(); SPLIT_VIRIAL_BOUNDARY(_calculate_perturbed_soft_interactions, - topo, conf, sim, m_parameter); + topo, conf, sim); m_timer.stop(); return 0; @@ -242,15 +231,15 @@ ::init(topology::Topology &topo, bt_to = topo.perturbed_solute().softbonds().end(); for( ; bt_it != bt_to; ++bt_it){ if (bt_it->A_type==INT_MAX-1) { - bt_it->A_type=m_parameter.size(); - double r = m_parameter[bt_it->B_type].r0; - m_parameter.push_back(interaction::bond_type_struct(0, r)); + bt_it->A_type=topo.bond_types_harm().size(); + double r = topo.bond_types_harm()[bt_it->B_type].r0; + topo.bond_types_harm().push_back(interaction::bond_type_struct(0, r)); DEBUG(10, "adding new angle type for soft angle perturbation: " << bt_it->A_type << " K=" << 0 << " r=" << r); } else if (bt_it->B_type==INT_MAX-1) { - bt_it->B_type=m_parameter.size(); - double r = m_parameter[bt_it->A_type].r0; - m_parameter.push_back(interaction::bond_type_struct(0, r)); + bt_it->B_type=topo.bond_types_harm().size(); + double r = topo.bond_types_harm()[bt_it->A_type].r0; + topo.bond_types_harm().push_back(interaction::bond_type_struct(0, r)); DEBUG(10, "adding new angle type for soft angle perturbation: " << bt_it->B_type << " K=" << 0 << " r=" << r); } diff --git a/gromosXX/src/interaction/bonded/perturbed_soft_bond_interaction.h b/gromosXX/src/interaction/bonded/perturbed_soft_bond_interaction.h index 80421683f..7da94ad72 100644 --- a/gromosXX/src/interaction/bonded/perturbed_soft_bond_interaction.h +++ b/gromosXX/src/interaction/bonded/perturbed_soft_bond_interaction.h @@ -16,10 +16,6 @@ namespace simulation{ class Simulation; } -namespace io{ - class IFP; -} - namespace interaction { /** @@ -33,7 +29,9 @@ namespace interaction /** * Constructor. */ - Perturbed_Soft_Bond_Interaction(io::IFP &it); + Perturbed_Soft_Bond_Interaction() + : Interaction("PerturbedSoftBond") {} + /** @@ -57,18 +55,6 @@ namespace interaction configuration::Configuration & conf, simulation::Simulation & sim); - /** - * the bond parameter. - */ - std::vector const & parameter()const { return m_parameter;} - /** - * the bond parameter. - */ - std::vector & parameter() { return m_parameter; } - - protected: - std::vector m_parameter; - }; } // interaction diff --git a/gromosXX/src/interaction/bonded/perturbed_soft_improper_interaction.cc b/gromosXX/src/interaction/bonded/perturbed_soft_improper_interaction.cc index aff89c3ba..1902708fb 100644 --- a/gromosXX/src/interaction/bonded/perturbed_soft_improper_interaction.cc +++ b/gromosXX/src/interaction/bonded/perturbed_soft_improper_interaction.cc @@ -17,7 +17,6 @@ // interactions #include "../../interaction/interaction_types.h" #include "perturbed_soft_improper_interaction.h" -#include "../../io/ifp.h" #include "../../util/template_split.h" #include "../../util/debug.h" @@ -28,12 +27,6 @@ #define SUBMODULE bonded -interaction::Perturbed_Soft_Improper_Interaction::Perturbed_Soft_Improper_Interaction(io::IFP &it) - : Interaction("PerturbedSoftImproper") -{ - it.read_improper_dihedrals(m_parameter); -} - /** * calculate improper dihedral forces and energies and lambda derivatives. */ @@ -41,10 +34,10 @@ template static int _calculate_perturbed_soft_improper_interactions ( topology::Topology & topo, configuration::Configuration & conf, - simulation::Simulation & sim, - std::vector &impropertypes) + simulation::Simulation & sim) { // this is repeated code from Improper_Dihedral_Interaction !!! + std::vector &impropertypes = topo.impdihedral_types(); DEBUG(5, "perturbed soft improper dihedral interaction"); DEBUG(7, std::setprecision(5)); @@ -125,7 +118,6 @@ static int _calculate_perturbed_soft_improper_interactions double diff = q - q0; double diff2 = diff * diff; - const double K_diff = K_B - K_A; const double q_diff = impropertypes[i_it->B_type].q0- impropertypes[i_it->A_type].q0; @@ -196,7 +188,7 @@ static int _calculate_perturbed_soft_improper_interactions (sim.param().precalclam.nr_lambdas-1); //loop over nr_lambdas - for (int lam_index = 0; lam_index < sim.param().precalclam.nr_lambdas; ++lam_index){ + for (unsigned int lam_index = 0; lam_index < sim.param().precalclam.nr_lambdas; ++lam_index){ // determine current lambda for this index double lam=(lam_index * lambda_step) + sim.param().precalclam.min_lam; @@ -237,7 +229,7 @@ ::calculate_interactions(topology::Topology &topo, m_timer.start(); SPLIT_VIRIAL_BOUNDARY(_calculate_perturbed_soft_improper_interactions, - topo, conf, sim, m_parameter); + topo, conf, sim); m_timer.stop(); @@ -262,15 +254,15 @@ ::init(topology::Topology &topo, bt_to = topo.perturbed_solute().softimpropers().end(); for( ; bt_it != bt_to; ++bt_it){ if (bt_it->A_type==INT_MAX-1) { - bt_it->A_type=m_parameter.size(); - double qt = m_parameter[bt_it->B_type].q0; - m_parameter.push_back(interaction::improper_dihedral_type_struct(0, qt)); + bt_it->A_type=topo.impdihedral_types().size(); + double qt = topo.impdihedral_types()[bt_it->B_type].q0; + topo.impdihedral_types().push_back(interaction::improper_dihedral_type_struct(0, qt)); DEBUG(10, "adding new improper dihedral type for soft improper perturbation: " << bt_it->A_type << " K=" << 0 << " qt=" << qt); } else if (bt_it->B_type==INT_MAX-1) { - bt_it->B_type=m_parameter.size(); - double qt = m_parameter[bt_it->A_type].q0; - m_parameter.push_back(interaction::improper_dihedral_type_struct(0, qt)); + bt_it->B_type=topo.impdihedral_types().size(); + double qt = topo.impdihedral_types()[bt_it->A_type].q0; + topo.impdihedral_types().push_back(interaction::improper_dihedral_type_struct(0, qt)); DEBUG(10, "adding new improper dihedral type for soft improper perturbation: " << bt_it->B_type << " K=" << 0 << " qt=" << qt); } diff --git a/gromosXX/src/interaction/bonded/perturbed_soft_improper_interaction.h b/gromosXX/src/interaction/bonded/perturbed_soft_improper_interaction.h index 2d5a2a7d4..9f5111f7c 100644 --- a/gromosXX/src/interaction/bonded/perturbed_soft_improper_interaction.h +++ b/gromosXX/src/interaction/bonded/perturbed_soft_improper_interaction.h @@ -16,11 +16,6 @@ namespace simulation{ class Simulation; } -namespace io{ - class IFP; -} - - namespace interaction { /** @@ -33,7 +28,8 @@ namespace interaction /** * Constructor. */ - Perturbed_Soft_Improper_Interaction(io::IFP &it); + Perturbed_Soft_Improper_Interaction() + : Interaction("PerturbedSoftImproper"){} /** * Destructor. @@ -55,8 +51,6 @@ namespace interaction configuration::Configuration & conf, simulation::Simulation & sim); - protected: - std::vector m_parameter; }; diff --git a/gromosXX/src/interaction/bonded/quartic_bond_interaction.cc b/gromosXX/src/interaction/bonded/quartic_bond_interaction.cc index e8b152145..43ac2c2d4 100644 --- a/gromosXX/src/interaction/bonded/quartic_bond_interaction.cc +++ b/gromosXX/src/interaction/bonded/quartic_bond_interaction.cc @@ -31,10 +31,10 @@ template static int _calculate_quartic_bond_interactions(topology::Topology &topo, configuration::Configuration &conf, - simulation::Simulation &sim, - std::vector const & param) + simulation::Simulation &sim) { - + + std::vector const & bondtypes=topo.bond_types_quart(); math::Periodicity periodicity(conf.current().box); // loop over the bonds @@ -53,18 +53,18 @@ static int _calculate_quartic_bond_interactions(topology::Topology &topo, double dist2 = abs2(v); - assert(unsigned(b_it->type) < param.size()); - const double r02 = param[b_it->type].r0 * - param[b_it->type].r0; + assert(unsigned(b_it->type) < bondtypes.size()); + const double r02 = bondtypes[b_it->type].r0 * + bondtypes[b_it->type].r0; DEBUG(7, "bond " << b_it->i << "-" << b_it->j << " type " << b_it->type); - DEBUG(10, "K " << param[b_it->type].K + DEBUG(10, "K " << bondtypes[b_it->type].K << " r02 " << r02); - DEBUG(10, "DF " << (-param[b_it->type].K * + DEBUG(10, "DF " << (-bondtypes[b_it->type].K * (dist2 - r02)) << "\n" << math::v2s(v)); - f = v * (-param[b_it->type].K * + f = v * (-bondtypes[b_it->type].K * (dist2 - r02)); force(b_it->i) += f; @@ -79,7 +79,7 @@ static int _calculate_quartic_bond_interactions(topology::Topology &topo, DEBUG(7, "\tatomic virial done"); // } - e = 0.25 * param[b_it->type].K * + e = 0.25 * bondtypes[b_it->type].K * (dist2 -r02) * (dist2 - r02); DEBUG(10, "energy: " << e); @@ -104,7 +104,7 @@ ::calculate_interactions(topology::Topology &topo, { m_timer.start(); - SPLIT_VIRIAL_BOUNDARY(_calculate_quartic_bond_interactions, topo, conf, sim, m_parameter); + SPLIT_VIRIAL_BOUNDARY(_calculate_quartic_bond_interactions, topo, conf, sim); m_timer.stop(); diff --git a/gromosXX/src/interaction/bonded/quartic_bond_interaction.h b/gromosXX/src/interaction/bonded/quartic_bond_interaction.h index 1ff45ca46..944fb9459 100644 --- a/gromosXX/src/interaction/bonded/quartic_bond_interaction.h +++ b/gromosXX/src/interaction/bonded/quartic_bond_interaction.h @@ -53,18 +53,7 @@ namespace interaction virtual int calculate_interactions(topology::Topology &topo, configuration::Configuration &conf, simulation::Simulation &sim); - /* - * the bond type parameter. - */ - std::vector const & parameter()const {return m_parameter; } - - /** - * the bond type parameter. - */ - std::vector & parameter() { return m_parameter; } - - protected: - std::vector m_parameter; + }; diff --git a/gromosXX/src/interaction/nonbonded/create_nonbonded.cc b/gromosXX/src/interaction/nonbonded/create_nonbonded.cc index 47d15033d..4e65b02dd 100644 --- a/gromosXX/src/interaction/nonbonded/create_nonbonded.cc +++ b/gromosXX/src/interaction/nonbonded/create_nonbonded.cc @@ -96,7 +96,7 @@ int interaction::create_g96_nonbonded if (sim.param().polarise.cos) { os << "\t" << setw(20) << left << "Polarisation enabled" << right << "\n"; - os << "\t" << setw(20) << left << "Eletric Field"; + os << "\t" << setw(20) << left << "Electric Field"; switch(sim.param().polarise.efield_site) { case simulation::ef_atom : os << setw(30) << left << "calculated at atom position" << right << "\n"; diff --git a/gromosXX/src/interaction/nonbonded/interaction/latticesum.cc b/gromosXX/src/interaction/nonbonded/interaction/latticesum.cc index 57eacdcb7..87d4ec693 100644 --- a/gromosXX/src/interaction/nonbonded/interaction/latticesum.cc +++ b/gromosXX/src/interaction/nonbonded/interaction/latticesum.cc @@ -507,7 +507,7 @@ void interaction::Lattice_Sum::calculate_electric_field(const topology::Topology const double H_y = math::abs(box(1) / Ny); const double H_z = math::abs(box(2) / Nz); DEBUG(15,"H_x = " << H_x << ", H_y = " << H_y << ", H_z = " << H_z); - math::Matrix H_trans = math::transpose(H); + //math::Matrix H_trans = math::transpose(H); // the volume of a grid cell (Vg) MD05.32 eq. 61 //const double cell_volume = math::det(H_trans); const double sqrt_grid_volume = sqrt(double(grid_volume)); diff --git a/gromosXX/src/interaction/nonbonded/interaction/nonbonded_innerloop.cc b/gromosXX/src/interaction/nonbonded/interaction/nonbonded_innerloop.cc index c84087f43..b5df2e4d1 100644 --- a/gromosXX/src/interaction/nonbonded/interaction/nonbonded_innerloop.cc +++ b/gromosXX/src/interaction/nonbonded/interaction/nonbonded_innerloop.cc @@ -1417,7 +1417,7 @@ interaction::Nonbonded_Innerloop::RF_excluded_interaction_inne f_pol = 0.0; DEBUG(8, "\tself-term " << i); - rp1 = -conf.current().posV(*it); + rp1 = -conf.current().posV(i); rp2 = conf.current().posV(i); rpp = 0.0; @@ -1464,7 +1464,7 @@ interaction::Nonbonded_Innerloop::RF_excluded_interaction_inne f_pol = 0.0; DEBUG(8, "\tself-term " << i ); - rp1 = -conf.current().posV(*it); + rp1 = -conf.current().posV(i); //rp1 = 0.0; rp2 = conf.current().posV(i); rpp = 0.0; @@ -1773,7 +1773,7 @@ interaction::Nonbonded_Innerloop::electric_field_innerloop DEBUG(10, "\tni r " << r(0) << " / " << r(1) << " / " << r(2)); math::Vec rm = r; DEBUG(10, "\t topo.gamma(i) " << topo.gamma(i)); - if (topo.gamma(i) != 0.0 && simulation::pol_off_lj_crf_func) { + if (topo.gamma(i) != 0.0 && simulation::pol_off_lj_crf_func != 0) { math::Vec rij, rik, rim; periodicity.nearest_image(conf.current().pos(i), conf.current().pos(topo.gamma_j(i)), rij); @@ -1783,7 +1783,7 @@ interaction::Nonbonded_Innerloop::electric_field_innerloop rm -= rim; } DEBUG(10, "\t topo.gamma(j) " << topo.gamma(j)); - if (topo.gamma(j) != 0.0 && simulation::pol_off_lj_crf_func) { + if (topo.gamma(j) != 0.0 && simulation::pol_off_lj_crf_func != 0) { math::Vec rjj, rjk, rjm; periodicity.nearest_image(conf.current().pos(j), conf.current().pos(topo.gamma_j(j)), rjj); diff --git a/gromosXX/src/interaction/nonbonded/interaction/nonbonded_outerloop.cc b/gromosXX/src/interaction/nonbonded/interaction/nonbonded_outerloop.cc index e1b30995b..3f23b2f85 100644 --- a/gromosXX/src/interaction/nonbonded/interaction/nonbonded_outerloop.cc +++ b/gromosXX/src/interaction/nonbonded/interaction/nonbonded_outerloop.cc @@ -94,10 +94,10 @@ ::_lj_crf_outerloop(topology::Topology & topo, util::Algorithm_Timer & timer, bool master) { DEBUG(7, "\tcalculate interactions"); - // WORKAROUND! See definition of _lj_crf_outerloop_2 + // WORKAROUND! See definition of _lj_crf_outerloop_fast if (t_interaction_spec::boundary_type == math::rectangular && t_interaction_spec::interaction_func == simulation::lj_crf_func) { - _lj_crf_outerloop_2(topo, conf, sim, pairlist_solute, pairlist_solvent, + _lj_crf_outerloop_fast(topo, conf, sim, pairlist_solute, pairlist_solvent, storage, longrange, timer, master); return; } @@ -113,7 +113,7 @@ ::_lj_crf_outerloop(topology::Topology & topo, std::vector::const_iterator j_it, j_to; unsigned int size_i = unsigned(pairlist_solute.size()); - DEBUG(10, "outerloop pairlist size " << size_i); + DEBUG(10, "lj_crf_outerloop pairlist size " << size_i); const unsigned int end = topo.num_solute_atoms(); @@ -265,7 +265,7 @@ unsigned int i_deb; */ // WORKAROUND - see definition! void interaction::Nonbonded_Outerloop -::_lj_crf_outerloop_2(topology::Topology & topo, +::_lj_crf_outerloop_fast(topology::Topology & topo, configuration::Configuration & conf, simulation::Simulation & sim, Pairlist const & pairlist_solute, @@ -286,7 +286,7 @@ ::_lj_crf_outerloop_2(topology::Topology & topo, std::vector::const_iterator j_it, j_to; unsigned int size_i = unsigned(pairlist_solute.size()); - DEBUG(10, "outerloop pairlist size " << size_i); + DEBUG(10, "lj_crf2 outerloop pairlist size " << size_i); const unsigned int end = topo.num_solute_atoms(); @@ -298,9 +298,7 @@ ::_lj_crf_outerloop_2(topology::Topology & topo, int k = 0; - DEBUG(10, "\tnonbonded_interaction: i " << i << " j " << *j_it); - - // shortrange, therefore store in simulation.system() + // shortrange, therefore store in simulation.system() for (j_it = pairlist_solute[i].begin(), j_to = pairlist_solute[i].end(); j_it != j_to; @@ -1479,7 +1477,7 @@ ::_electric_field_outerloop(topology::Topology & topo, unsigned int i; unsigned int size_i = unsigned(pairlist.size()); unsigned int size_lr = size_i; - DEBUG(11, "outerloop pairlist size " << size_i); + DEBUG(11, "el_field outerloop pairlist size " << size_i); unsigned int end = size_i; unsigned int end_lr = size_lr; @@ -1665,15 +1663,16 @@ ::_electric_field_outerloop(topology::Topology & topo, // calculation of convergence criterium for (int j = 0; j < 3; ++j) { - double delta_e = fabs(storage.electric_field(i)(j) - e_el_new(i)(j))* 7.911492226513023 * 0.1; - if (delta_e > maxfield) { - maxfield = delta_e; + double delta_field = fabs(storage.electric_field(i)(j) - e_el_new(i)(j)); + if (delta_field > maxfield) { + maxfield = delta_field; } } } + storage.electric_field(i) = e_el_new(i); } - } + } // end if rank==0 turni++; minfield = maxfield; @@ -1687,6 +1686,7 @@ ::_electric_field_outerloop(topology::Topology & topo, #endif DEBUG(11, "\trank: " << rank << " minfield: " << minfield << " iteration round: " << turni); } + DEBUG(5, "electric field iterations: " << turni); } void interaction::Nonbonded_Outerloop @@ -1723,7 +1723,7 @@ ::_ls_real_outerloop(topology::Topology & topo, topology::excl_cont_t::value_type::const_iterator ex_it, ex_to; unsigned int size_i = unsigned(pairlist_solute.size()); - DEBUG(10, "outerloop pairlist size " << size_i); + DEBUG(10, "ls_real outerloop pairlist size " << size_i); unsigned int end = topo.num_solute_atoms(); diff --git a/gromosXX/src/interaction/nonbonded/interaction/nonbonded_outerloop.h b/gromosXX/src/interaction/nonbonded/interaction/nonbonded_outerloop.h index 954e71c76..f6f578e35 100644 --- a/gromosXX/src/interaction/nonbonded/interaction/nonbonded_outerloop.h +++ b/gromosXX/src/interaction/nonbonded/interaction/nonbonded_outerloop.h @@ -331,7 +331,7 @@ namespace interaction * Might be a g++ bug ( https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56480 ) or * an error in the implementation. For now, this is a workaround... */ - void _lj_crf_outerloop_2(topology::Topology & topo, + void _lj_crf_outerloop_fast(topology::Topology & topo, configuration::Configuration & conf, simulation::Simulation & sim, Pairlist const & pairlist_solute, diff --git a/gromosXX/src/interaction/nonbonded/interaction/nonbonded_set.cc b/gromosXX/src/interaction/nonbonded/interaction/nonbonded_set.cc index 101de5ae7..dd00ec243 100644 --- a/gromosXX/src/interaction/nonbonded/interaction/nonbonded_set.cc +++ b/gromosXX/src/interaction/nonbonded/interaction/nonbonded_set.cc @@ -338,7 +338,7 @@ int interaction::Nonbonded_Set::update_configuration // ANITA const unsigned int nr_lambdas = unsigned(m_storage.energies.A_lj_total.size()); - for(int i=0; i < nr_lambdas; ++i) { + for(unsigned int i=0; i < nr_lambdas; ++i) { for(int j=0; j < ljs; ++j) { for(int k=0; k < ljs; ++k) { e.A_lj_energy[i][j][k] += diff --git a/gromosXX/src/interaction/nonbonded/interaction/perturbed_nonbonded_innerloop.cc b/gromosXX/src/interaction/nonbonded/interaction/perturbed_nonbonded_innerloop.cc index daed25b1b..218715464 100644 --- a/gromosXX/src/interaction/nonbonded/interaction/perturbed_nonbonded_innerloop.cc +++ b/gromosXX/src/interaction/nonbonded/interaction/perturbed_nonbonded_innerloop.cc @@ -202,7 +202,7 @@ ::perturbed_lj_crf_innerloop // interactions have been calculated //-------------------------------------------------- - DEBUG(8, "\tcalculated interaction state A:\n\t\tf: " + DEBUG(8, "\tdoscaling: calculated interaction state A:\n\t\tf: " << f1 << " f6: " << f6 << " f12: " << f12 << "\n\t\te_lj: " << e_lj << " e_crf: " << e_crf @@ -244,7 +244,7 @@ ::perturbed_lj_crf_innerloop // interactions have been calculated //-------------------------------------------------- - DEBUG(8, "\tcalculated interaction state A:\n\t\tf: " + DEBUG(8, "\tnoscaling: calculated interaction state A:\n\t\tf: " << f1 << " f6: " << f6 << " f12: " << f12 << "\n\t\te_lj: " << e_lj << " e_crf: " << e_crf @@ -274,8 +274,8 @@ ::perturbed_lj_crf_innerloop // TODO: could add another parameter, to only calculate every x steps // if nr_lambdas > 1, we apply extended TI - if (((sim.steps() % sim.param().write.free_energy) == 0) && - sim.param().precalclam.nr_lambdas ){ + if (sim.param().precalclam.nr_lambdas && ((sim.steps() % sim.param().write.free_energy) == 0)){ + DEBUG(8, "precalculate lj_crf_soft"); // if ( sim.param().precalclam.nr_lambdas ) { double A_e_lj,B_e_lj, A_e_crf, B_e_crf, A_de_lj, B_de_lj, A_de_crf, B_de_crf; @@ -286,7 +286,7 @@ ::perturbed_lj_crf_innerloop (sim.param().precalclam.nr_lambdas-1); //loop over nr_lambdas - for (int lam_index = 0; lam_index < sim.param().precalclam.nr_lambdas; ++lam_index){ + for (unsigned int lam_index = 0; lam_index < sim.param().precalclam.nr_lambdas; ++lam_index){ // determine current lambda for this index double lam=(lam_index * lambda_step) + sim.param().precalclam.min_lam; @@ -335,11 +335,13 @@ ::perturbed_lj_crf_innerloop DEBUG(8, "\ndone with storing energies "); } //all 101 lambda points done } // done with extended TI + DEBUG(8, "\ndone with lj_crf_func "); break; } case simulation::cgrain_func: { + DEBUG(7, "\tcgrain_func"); math::Vec f; double f1, f6, f12; @@ -378,6 +380,7 @@ ::perturbed_lj_crf_innerloop } case simulation::cggromos_func: { + DEBUG(7, "\tcggromos_func"); math::Vec f; double f1, f6, f12; @@ -409,7 +412,7 @@ ::perturbed_lj_crf_innerloop // interactions have been calculated //-------------------------------------------------- - DEBUG(8, "\tcalculated interaction state A:\n\t\tf: " + DEBUG(8, "\tcg: calculated interaction state A:\n\t\tf: " << f1 << " f6: " << f6 << " f12: " << f12 << "\n\t\te_lj: " << e_lj << " e_crf: " << e_crf @@ -434,6 +437,7 @@ ::perturbed_lj_crf_innerloop } case simulation::pol_lj_crf_func: { + DEBUG(7, "\tpol_lj_crf_func"); math::Vec rp1, rp2, rpp; double f1[4]; math::VArray f(4); @@ -479,6 +483,7 @@ ::perturbed_lj_crf_innerloop } case simulation::pol_off_lj_crf_func: { + DEBUG(7, "\tpol_off_lj_crf_func"); math::Vec rm = r; if (topo.gamma(i)!=0.0) { math::Vec rij, rik; @@ -556,7 +561,7 @@ ::perturbed_lj_crf_innerloop io::message::critical); } } - +DEBUG(8, "\tenergies perturbed lj_crf_innerloop;"); // energy assert(storage.energies.lj_energy.size() > topo.atom_energy_group(i)); @@ -770,8 +775,7 @@ ::perturbed_one_four_interaction_innerloop // TODO: could add another parameter, to only calculate every x steps // if nr_lambdas > 1, we apply extended TI - if (((sim.steps() % sim.param().write.free_energy) == 0) && - sim.param().precalclam.nr_lambdas ){ + if (sim.param().precalclam.nr_lambdas && ((sim.steps() % sim.param().write.free_energy) == 0)){ double A_e_lj,B_e_lj, A_e_crf, B_e_crf, A_de_lj, B_de_lj, A_de_crf, B_de_crf; @@ -782,7 +786,7 @@ ::perturbed_one_four_interaction_innerloop (sim.param().precalclam.nr_lambdas-1); //loop over nr_lambdas - for (int lam_index = 0; lam_index < sim.param().precalclam.nr_lambdas; ++lam_index){ + for (unsigned int lam_index = 0; lam_index < sim.param().precalclam.nr_lambdas; ++lam_index){ // determine current lambda for this index double lam=(lam_index * lambda_step) + sim.param().precalclam.min_lam; @@ -1111,8 +1115,7 @@ ::perturbed_RF_excluded_interaction_innerloop f_rf, e_rf, de_rf, true); // ANITA - if (((sim.steps() % sim.param().write.free_energy) == 0) && - sim.param().precalclam.nr_lambdas ){ + if (sim.param().precalclam.nr_lambdas && ((sim.steps() % sim.param().write.free_energy) == 0)){ double A_e_rf, B_e_rf, A_de_rf, B_de_rf; // determine lambda stepsize from min,max and nr of lambdas @@ -1121,7 +1124,7 @@ ::perturbed_RF_excluded_interaction_innerloop (sim.param().precalclam.nr_lambdas-1); //loop over nr_lambdas - for (int lam_index = 0; lam_index < sim.param().precalclam.nr_lambdas; ++lam_index){ + for (unsigned int lam_index = 0; lam_index < sim.param().precalclam.nr_lambdas; ++lam_index){ // determine current lambda for this index double lam=(lam_index * lambda_step) + sim.param().precalclam.min_lam; @@ -1260,8 +1263,7 @@ ::perturbed_RF_excluded_interaction_innerloop force(*it) -= f_rf; // ANITA - if (((sim.steps() % sim.param().write.free_energy) == 0) && - sim.param().precalclam.nr_lambdas ){ + if (sim.param().precalclam.nr_lambdas && ((sim.steps() % sim.param().write.free_energy) == 0)){ // if ( sim.param().precalclam.nr_lambdas ) { double A_e_rf, B_e_rf, A_de_rf, B_de_rf; @@ -1271,7 +1273,7 @@ ::perturbed_RF_excluded_interaction_innerloop (sim.param().precalclam.nr_lambdas-1); //loop over nr_lambdas - for (int lam_index = 0; lam_index < sim.param().precalclam.nr_lambdas; ++lam_index){ + for (unsigned int lam_index = 0; lam_index < sim.param().precalclam.nr_lambdas; ++lam_index){ // determine current lambda for this index double lam=(lam_index * lambda_step) + sim.param().precalclam.min_lam; @@ -1487,7 +1489,7 @@ t_interaction_spec, t_perturbation_details>::perturbed_electric_field_innerloop topo.individual_lambda_derivative(simulation::crf_softness_lambda)[n1][n2], topo.lambda_exp()); - if (topo.gamma(i) != 0.0 && simulation::pol_off_lj_crf_func) + if (topo.gamma(i) != 0.0 && simulation::pol_off_lj_crf_func != 0) { math::Vec rij, rik, rim; periodicity.nearest_image(conf.current().pos(i), @@ -1497,7 +1499,7 @@ t_interaction_spec, t_perturbation_details>::perturbed_electric_field_innerloop rim = topo.gamma(i)*(rij + rik) / 2; r -= rim; } - if (topo.gamma(j) != 0.0 && simulation::pol_off_lj_crf_func) + if (topo.gamma(j) != 0.0 && simulation::pol_off_lj_crf_func != 0) { math::Vec rjj, rjk, rjm; periodicity.nearest_image(conf.current().pos(j), diff --git a/gromosXX/src/interaction/nonbonded/interaction/perturbed_nonbonded_outerloop.cc b/gromosXX/src/interaction/nonbonded/interaction/perturbed_nonbonded_outerloop.cc index d72febc70..c8b98af1f 100644 --- a/gromosXX/src/interaction/nonbonded/interaction/perturbed_nonbonded_outerloop.cc +++ b/gromosXX/src/interaction/nonbonded/interaction/perturbed_nonbonded_outerloop.cc @@ -2,6 +2,7 @@ * @file perturbed_nonbonded_outerloop.cc * (template) methods of Perturbed_Nonbonded_Outerloop. */ + #ifdef XXMPI #include #endif @@ -168,8 +169,7 @@ ::_perturbed_one_four_outerloop(topology::Topology & topo, } // loop over 1,4 pairs } // loop over solute atoms -} - +} /** * helper function to calculate the forces and energies from the @@ -261,10 +261,10 @@ ::_perturbed_electric_field_outerloop(topology::Topology & topo, unsigned int size_i = unsigned(pairlist.size()); unsigned int size_lr = size_i; DEBUG(11, "outerloop pairlist size " << size_i); - + unsigned int end = size_i; unsigned int end_lr = size_lr; - + if (rank == 0) { // compute the QM part, gather etc... if (sim.param().qmmm.qmmm != simulation::qmmm_off) { @@ -290,8 +290,8 @@ ::_perturbed_electric_field_outerloop(topology::Topology & topo, if (sim.mpi && sim.steps() == 0) { MPI::COMM_WORLD.Bcast(&conf.current().posV(0)(0), conf.current().posV.size() * 3, MPI::DOUBLE, 0); } -#endif - +#endif + // longrange ? if(!(sim.steps() % sim.param().pairlist.skip_step)){ @@ -318,10 +318,10 @@ ::_perturbed_electric_field_outerloop(topology::Topology & topo, j_it != j_to; ++j_it){ math::Vec e_eli_lr, e_elj_lr; - + innerloop.electric_field_innerloop(topo, conf, i, *j_it, e_eli_lr, e_elj_lr, periodicity); - + storage_lr.electric_field[i] += e_eli_lr; storage_lr.electric_field[*j_it] += e_elj_lr; } @@ -332,16 +332,15 @@ ::_perturbed_electric_field_outerloop(topology::Topology & topo, j_it != j_to; ++j_it){ math::Vec e_eli_lr, e_elj_lr; - + innerloop.electric_field_innerloop(topo, conf, i, *j_it, e_eli_lr, e_elj_lr, periodicity); - + storage_lr.electric_field[i] += e_eli_lr; storage_lr.electric_field[*j_it] += e_elj_lr; } } - - #ifdef XXMPI +#ifdef XXMPI if (sim.mpi) { // reduce the longrange electric field to some temp. variable and then set this // variable to the longrange electric field on the master. The lr e field @@ -416,7 +415,7 @@ ::_perturbed_electric_field_outerloop(topology::Topology & topo, e_el_new(*j_it) += e_elj; } } - + #ifdef XXMPI // also reduce the shortrange electric field the same way as the longrange // electric field @@ -428,8 +427,8 @@ ::_perturbed_electric_field_outerloop(topology::Topology & topo, e_el_new = e_el_master; } } -#endif - +#endif + if (rank == 0) { // get the contributions from the QM part. if (sim.param().qmmm.qmmm != simulation::qmmm_off) { @@ -461,11 +460,11 @@ ::_perturbed_electric_field_outerloop(topology::Topology & topo, //delta r math::Vec delta_r; - + ////////////////////////////////////////////////// // implementation of polarisability damping ///////////////////////////////////////////////// - + if (sim.param().polarise.damp) { // damp the polarisability const double e_i = sqrt(math::abs2(e_el_new(i))), e_0 = damp_lev; @@ -482,10 +481,10 @@ ::_perturbed_electric_field_outerloop(topology::Topology & topo, } // store the new position conf.current().posV(i) = delta_r; - + // calculation of convergence criterium for(int j=0; j<3; ++j) { - double delta_e = fabs(storage.electric_field(i)(j)-e_el_new(i)(j))* 7.911492226513023 * 0.1; + double delta_e = fabs(storage.electric_field(i)(j)-e_el_new(i)(j)); if (delta_e > maxfield) { maxfield = delta_e; } @@ -497,7 +496,7 @@ ::_perturbed_electric_field_outerloop(topology::Topology & topo, turni++; minfield = maxfield; - + #ifdef XXMPI // broadcast the new posV and also the convergence criterium (minfield) // to the slaves. Otherwise they don't know when to stop. diff --git a/gromosXX/src/interaction/nonbonded/interaction/perturbed_nonbonded_pair.cc b/gromosXX/src/interaction/nonbonded/interaction/perturbed_nonbonded_pair.cc index 86a4916f7..9adab2a2c 100644 --- a/gromosXX/src/interaction/nonbonded/interaction/perturbed_nonbonded_pair.cc +++ b/gromosXX/src/interaction/nonbonded/interaction/perturbed_nonbonded_pair.cc @@ -320,8 +320,7 @@ ::perturbed_pair_interaction_innerloop A_f, A_e_crf, A_de_crf); // ANITA - if (((sim.steps() % sim.param().write.free_energy) == 0) && - sim.param().precalclam.nr_lambdas ){ + if (sim.param().precalclam.nr_lambdas && ((sim.steps() % sim.param().write.free_energy) == 0)){ double A_e_rf, B_e_rf, A_de_rf, B_de_rf; // determine lambda stepsize from min,max and nr of lambdas @@ -330,7 +329,7 @@ ::perturbed_pair_interaction_innerloop (sim.param().precalclam.nr_lambdas-1); //loop over nr_lambdas - for (int lam_index = 0; lam_index < sim.param().precalclam.nr_lambdas; ++lam_index){ + for (unsigned int lam_index = 0; lam_index < sim.param().precalclam.nr_lambdas; ++lam_index){ // determine current lambda for this index double lam=(lam_index * lambda_step) + sim.param().precalclam.min_lam; @@ -388,8 +387,7 @@ ::perturbed_pair_interaction_innerloop A_de_crf = - topo.lambda_exp() * m_perturbed_nonbonded_term.A_crf_lambda_n_1() * A_e_crf; //define before multiplication of A_e_crf with lambda! // ANITA - if (((sim.steps() % sim.param().write.free_energy) == 0) && - sim.param().precalclam.nr_lambdas ){ + if (sim.param().precalclam.nr_lambdas && ((sim.steps() % sim.param().write.free_energy) == 0)){ // determine lambda stepsize from min,max and nr of lambdas double lambda_step = (sim.param().precalclam.max_lam - @@ -397,7 +395,7 @@ ::perturbed_pair_interaction_innerloop (sim.param().precalclam.nr_lambdas-1); //loop over nr_lambdas - for (int lam_index = 0; lam_index < sim.param().precalclam.nr_lambdas; ++lam_index){ + for (unsigned int lam_index = 0; lam_index < sim.param().precalclam.nr_lambdas; ++lam_index){ // determine current lambda for this index double lam=(lam_index * lambda_step) + sim.param().precalclam.min_lam; @@ -468,8 +466,7 @@ ::perturbed_pair_interaction_innerloop A_f = (A_f1 + A_f6 + A_f12) * r; // ANITA - if (((sim.steps() % sim.param().write.free_energy) == 0) && - sim.param().precalclam.nr_lambdas ){ + if (sim.param().precalclam.nr_lambdas && ((sim.steps() % sim.param().write.free_energy) == 0)){ // if ( sim.param().precalclam.nr_lambdas ) { double A_e_lj_l, B_e_lj_l, A_e_crf_l, B_e_crf_l, A_de_lj_l, B_de_lj_l, A_de_crf_l, B_de_crf_l; @@ -480,7 +477,7 @@ ::perturbed_pair_interaction_innerloop (sim.param().precalclam.nr_lambdas-1); //loop over nr_lambdas - for (int lam_index = 0; lam_index < sim.param().precalclam.nr_lambdas; ++lam_index){ + for (unsigned int lam_index = 0; lam_index < sim.param().precalclam.nr_lambdas; ++lam_index){ // determine current lambda for this index double lam=(lam_index * lambda_step) + sim.param().precalclam.min_lam; @@ -590,8 +587,7 @@ ::perturbed_pair_interaction_innerloop // ANITA - if (((sim.steps() % sim.param().write.free_energy) == 0) && - sim.param().precalclam.nr_lambdas ){ + if (sim.param().precalclam.nr_lambdas && ((sim.steps() % sim.param().write.free_energy) == 0)){ // determine lambda stepsize from min,max and nr of lambdas double lambda_step = (sim.param().precalclam.max_lam - @@ -599,7 +595,7 @@ ::perturbed_pair_interaction_innerloop (sim.param().precalclam.nr_lambdas-1); //loop over nr_lambdas - for (int lam_index = 0; lam_index < sim.param().precalclam.nr_lambdas; ++lam_index){ + for (unsigned int lam_index = 0; lam_index < sim.param().precalclam.nr_lambdas; ++lam_index){ // determine current lambda for this index double lam=(lam_index * lambda_step) + sim.param().precalclam.min_lam; @@ -688,8 +684,7 @@ ::perturbed_pair_interaction_innerloop A_f = (A_f1 + A_f6 + A_f12) * r; // ANITA - if (((sim.steps() % sim.param().write.free_energy) == 0) && - sim.param().precalclam.nr_lambdas ){ + if (sim.param().precalclam.nr_lambdas && ((sim.steps() % sim.param().write.free_energy) == 0)){ // if ( sim.param().precalclam.nr_lambdas ) { double A_e_lj_l, B_e_lj_l, A_e_crf_l, B_e_crf_l, A_de_lj_l, B_de_lj_l, A_de_crf_l, B_de_crf_l; @@ -700,7 +695,7 @@ ::perturbed_pair_interaction_innerloop (sim.param().precalclam.nr_lambdas-1); //loop over nr_lambdas - for (int lam_index = 0; lam_index < sim.param().precalclam.nr_lambdas; ++lam_index){ + for (unsigned int lam_index = 0; lam_index < sim.param().precalclam.nr_lambdas; ++lam_index){ // determine current lambda for this index double lam=(lam_index * lambda_step) + sim.param().precalclam.min_lam; @@ -807,8 +802,7 @@ ::perturbed_pair_interaction_innerloop A_de_lj = - topo.lambda_exp() * m_perturbed_nonbonded_term.A_lj_lambda_n_1() * A_e_lj; A_de_crf = - topo.lambda_exp() * m_perturbed_nonbonded_term.A_crf_lambda_n_1() * A_e_crf; // ANITA - if (((sim.steps() % sim.param().write.free_energy) == 0) && - sim.param().precalclam.nr_lambdas ){ + if (sim.param().precalclam.nr_lambdas && ((sim.steps() % sim.param().write.free_energy) == 0)){ // determine lambda stepsize from min,max and nr of lambdas double lambda_step = (sim.param().precalclam.max_lam - @@ -816,7 +810,7 @@ ::perturbed_pair_interaction_innerloop (sim.param().precalclam.nr_lambdas-1); //loop over nr_lambdas - for (int lam_index = 0; lam_index < sim.param().precalclam.nr_lambdas; ++lam_index){ + for (unsigned int lam_index = 0; lam_index < sim.param().precalclam.nr_lambdas; ++lam_index){ // determine current lambda for this index double lam=(lam_index * lambda_step) + sim.param().precalclam.min_lam; @@ -905,8 +899,7 @@ ::perturbed_pair_interaction_innerloop rf_soft_interaction(r, 0, B_q, alpha_crf, B_f, B_e_crf, B_de_crf); // ANITA - if (((sim.steps() % sim.param().write.free_energy) == 0) && - sim.param().precalclam.nr_lambdas ){ + if (sim.param().precalclam.nr_lambdas && ((sim.steps() % sim.param().write.free_energy) == 0)){ double A_e_rf, B_e_rf, A_de_rf, B_de_rf; // determine lambda stepsize from min,max and nr of lambdas @@ -915,7 +908,7 @@ ::perturbed_pair_interaction_innerloop (sim.param().precalclam.nr_lambdas-1); //loop over nr_lambdas - for (int lam_index = 0; lam_index < sim.param().precalclam.nr_lambdas; ++lam_index){ + for (unsigned int lam_index = 0; lam_index < sim.param().precalclam.nr_lambdas; ++lam_index){ // determine current lambda for this index double lam=(lam_index * lambda_step) + sim.param().precalclam.min_lam; @@ -960,8 +953,7 @@ ::perturbed_pair_interaction_innerloop B_de_crf = topo.lambda_exp() * m_perturbed_nonbonded_term.B_crf_lambda_n_1() * B_e_crf; // ANITA - if (((sim.steps() % sim.param().write.free_energy) == 0) && - sim.param().precalclam.nr_lambdas ){ + if (sim.param().precalclam.nr_lambdas && ((sim.steps() % sim.param().write.free_energy) == 0)){ // determine lambda stepsize from min,max and nr of lambdas double lambda_step = (sim.param().precalclam.max_lam - @@ -969,7 +961,7 @@ ::perturbed_pair_interaction_innerloop (sim.param().precalclam.nr_lambdas-1); //loop over nr_lambdas - for (int lam_index = 0; lam_index < sim.param().precalclam.nr_lambdas; ++lam_index){ + for (unsigned int lam_index = 0; lam_index < sim.param().precalclam.nr_lambdas; ++lam_index){ // determine current lambda for this index double lam=(lam_index * lambda_step) + sim.param().precalclam.min_lam; @@ -1031,8 +1023,7 @@ ::perturbed_pair_interaction_innerloop B_f = (B_f1 + B_f6 + B_f12) * r; // ANITA - if (((sim.steps() % sim.param().write.free_energy) == 0) && - sim.param().precalclam.nr_lambdas ){ + if (sim.param().precalclam.nr_lambdas && ((sim.steps() % sim.param().write.free_energy) == 0)){ // if ( sim.param().precalclam.nr_lambdas ) { double A_e_lj_l, B_e_lj_l, A_e_crf_l, B_e_crf_l, A_de_lj_l, B_de_lj_l, A_de_crf_l, B_de_crf_l; @@ -1043,7 +1034,7 @@ ::perturbed_pair_interaction_innerloop (sim.param().precalclam.nr_lambdas-1); //loop over nr_lambdas - for (int lam_index = 0; lam_index < sim.param().precalclam.nr_lambdas; ++lam_index){ + for (unsigned int lam_index = 0; lam_index < sim.param().precalclam.nr_lambdas; ++lam_index){ // determine current lambda for this index double lam=(lam_index * lambda_step) + sim.param().precalclam.min_lam; @@ -1152,8 +1143,7 @@ ::perturbed_pair_interaction_innerloop B_de_crf = topo.lambda_exp() * m_perturbed_nonbonded_term.B_crf_lambda_n_1() * B_e_crf; // ANITA - if (((sim.steps() % sim.param().write.free_energy) == 0) && - sim.param().precalclam.nr_lambdas ){ + if (sim.param().precalclam.nr_lambdas && ((sim.steps() % sim.param().write.free_energy) == 0)){ // determine lambda stepsize from min,max and nr of lambdas double lambda_step = (sim.param().precalclam.max_lam - @@ -1161,7 +1151,7 @@ ::perturbed_pair_interaction_innerloop (sim.param().precalclam.nr_lambdas-1); //loop over nr_lambdas - for (int lam_index = 0; lam_index < sim.param().precalclam.nr_lambdas; ++lam_index){ + for (unsigned int lam_index = 0; lam_index < sim.param().precalclam.nr_lambdas; ++lam_index){ // determine current lambda for this index double lam=(lam_index * lambda_step) + sim.param().precalclam.min_lam; @@ -1251,8 +1241,7 @@ ::perturbed_pair_interaction_innerloop B_f = (B_f1 + B_f6 + B_f12) * r; // ANITA - if (((sim.steps() % sim.param().write.free_energy) == 0) && - sim.param().precalclam.nr_lambdas ){ + if (sim.param().precalclam.nr_lambdas && ((sim.steps() % sim.param().write.free_energy) == 0)){ double A_e_lj_l, B_e_lj_l, A_e_crf_l, B_e_crf_l, A_de_lj_l, B_de_lj_l, A_de_crf_l, B_de_crf_l; @@ -1262,7 +1251,7 @@ ::perturbed_pair_interaction_innerloop (sim.param().precalclam.nr_lambdas-1); //loop over nr_lambdas - for (int lam_index = 0; lam_index < sim.param().precalclam.nr_lambdas; ++lam_index){ + for (unsigned int lam_index = 0; lam_index < sim.param().precalclam.nr_lambdas; ++lam_index){ // determine current lambda for this index double lam=(lam_index * lambda_step) + sim.param().precalclam.min_lam; @@ -1378,8 +1367,7 @@ ::perturbed_pair_interaction_innerloop B_de_lj = topo.lambda_exp() * m_perturbed_nonbonded_term.B_lj_lambda_n_1() * B_e_lj; B_de_crf = topo.lambda_exp() * m_perturbed_nonbonded_term.B_crf_lambda_n_1() * B_e_crf; // ANITA - if (((sim.steps() % sim.param().write.free_energy) == 0) && - sim.param().precalclam.nr_lambdas ){ + if (sim.param().precalclam.nr_lambdas && ((sim.steps() % sim.param().write.free_energy) == 0)){ // determine lambda stepsize from min,max and nr of lambdas double lambda_step = (sim.param().precalclam.max_lam - @@ -1387,7 +1375,7 @@ ::perturbed_pair_interaction_innerloop (sim.param().precalclam.nr_lambdas-1); //loop over nr_lambdas - for (int lam_index = 0; lam_index < sim.param().precalclam.nr_lambdas; ++lam_index){ + for (unsigned int lam_index = 0; lam_index < sim.param().precalclam.nr_lambdas; ++lam_index){ // determine current lambda for this index double lam=(lam_index * lambda_step) + sim.param().precalclam.min_lam; diff --git a/gromosXX/src/interaction/nonbonded/interaction/perturbed_nonbonded_set.cc b/gromosXX/src/interaction/nonbonded/interaction/perturbed_nonbonded_set.cc index 19953dc7c..8d8e64130 100644 --- a/gromosXX/src/interaction/nonbonded/interaction/perturbed_nonbonded_set.cc +++ b/gromosXX/src/interaction/nonbonded/interaction/perturbed_nonbonded_set.cc @@ -363,7 +363,7 @@ int interaction::Perturbed_Nonbonded_Set::update_configuration // ANITA const unsigned int nr_lambdas = unsigned(m_storage.energies.A_lj_total.size()); - for(int i=0; i < nr_lambdas; ++i) { + for(unsigned int i=0; i < nr_lambdas; ++i) { for(int j=0; j < ljs; ++j) { for(int k=0; k < ljs; ++k) { pe.A_lj_energy[i][j][k] += diff --git a/gromosXX/src/interaction/special/adde_reweighting.cc b/gromosXX/src/interaction/special/adde_reweighting.cc index 48609ff80..c45f1c25a 100644 --- a/gromosXX/src/interaction/special/adde_reweighting.cc +++ b/gromosXX/src/interaction/special/adde_reweighting.cc @@ -33,13 +33,13 @@ int interaction::Adde_Reweighting::calculate_interactions { unsigned int eg=sim.param().addecouple.adc_index()[0].eg; double vhl=0, evhl; - int not_adde; + //int not_adde; conf.special().adde.vhh=conf.current().energies.lj_energy[eg][eg]+ conf.current().energies.crf_energy[eg][eg]; - for(unsigned int i=0; iw0; + DEBUG(10, "K=" << K); if (fabs(delta_phi) > phi_lin){ // LINEAR diff --git a/gromosXX/src/interaction/special/distance_field_interaction.cc b/gromosXX/src/interaction/special/distance_field_interaction.cc index d27c1506e..46a746174 100644 --- a/gromosXX/src/interaction/special/distance_field_interaction.cc +++ b/gromosXX/src/interaction/special/distance_field_interaction.cc @@ -313,7 +313,7 @@ static void _update_grid // if protection radius is 0, check if the start pos is in the protein if (sim.param().distancefield.protect==0) { - for(int a =0; a <= topo.disfield_restraints().proteinatoms; a++){ + for(unsigned int a =0; a <= topo.disfield_restraints().proteinatoms; a++){ math::Vec ppos = conf.current().pos(a); periodicity.put_into_box(ppos); math::Vec d = startpos - ppos; @@ -350,7 +350,7 @@ static void _update_grid std::set protein; DEBUG(10, "DF UPDATE, proteinatoms" << topo.disfield_restraints().proteinatoms); - for(int a =0; a <= topo.disfield_restraints().proteinatoms; a++){ + for(unsigned int a =0; a <= topo.disfield_restraints().proteinatoms; a++){ math::Vec ppos = conf.current().pos(a); periodicity.put_into_box(ppos); int nx_min=int(-( sim.param().distancefield.proteincutoff - ppos(0) - box(0,0)/2)/grid); diff --git a/gromosXX/src/interaction/special/electric_field_interaction.cc b/gromosXX/src/interaction/special/electric_field_interaction.cc index 7f92b9fee..4f3442ea8 100644 --- a/gromosXX/src/interaction/special/electric_field_interaction.cc +++ b/gromosXX/src/interaction/special/electric_field_interaction.cc @@ -59,7 +59,7 @@ calculate_interactions(topology::Topology& topo, break; } - if (simulation::pol_off_lj_crf_func) + if (simulation::pol_off_lj_crf_func != 0) for (unsigned int i = 0; i < topo.num_atoms(); ++i){ // math::four_pi_eps_i contains already epsilon of cutoff-sphere (param().nonbonded.epsilon) math::Vec force = (math::four_pi_eps_i*sim.param().nonbonded.epsilon) * topo.charge(i) * E; diff --git a/gromosXX/src/interaction/special/jvalue_restraint_interaction.cc b/gromosXX/src/interaction/special/jvalue_restraint_interaction.cc index 7d85756f7..75338282b 100644 --- a/gromosXX/src/interaction/special/jvalue_restraint_interaction.cc +++ b/gromosXX/src/interaction/special/jvalue_restraint_interaction.cc @@ -424,9 +424,9 @@ double _calculate_derivative(topology::Topology & topo, if (param.jvalue.mode == simulation::jvalue_restr_av || param.jvalue.mode == simulation::jvalue_restr_av_weighted){ if(param.jvalue.tarfscale == simulation::jvalue_restr_tar_no_scaling) // omit memory decay factor - tar_fscale == 1.0; + tar_fscale = 1.0; else if(param.jvalue.tarfscale == simulation::jvalue_restr_tar_scaling) // use memory decay factor - tar_fscale == (1.0-exp(-param.step.dt / param.jvalue.tau)); + tar_fscale = (1.0-exp(-param.step.dt / param.jvalue.tau)); } const double dJ_dphi = - (2 * it->a * cos_phi_delta * sin_phi_delta + it->b * sin_phi_delta)*tar_fscale; diff --git a/gromosXX/src/interaction/special/perturbed_distance_field_interaction.cc b/gromosXX/src/interaction/special/perturbed_distance_field_interaction.cc index 7118d0368..8682f96b8 100644 --- a/gromosXX/src/interaction/special/perturbed_distance_field_interaction.cc +++ b/gromosXX/src/interaction/special/perturbed_distance_field_interaction.cc @@ -306,7 +306,7 @@ static void _update_grid // if protection radius is 0, check if the start pos is in the protein if (sim.param().distancefield.protect==0) { - for(int a =0; a <= topo.perturbed_disfield_restraints().proteinatoms; a++){ + for(unsigned int a =0; a <= topo.perturbed_disfield_restraints().proteinatoms; a++){ math::Vec ppos = conf.current().pos(a); periodicity.put_into_box(ppos); math::Vec d = startpos - ppos; @@ -347,7 +347,7 @@ static void _update_grid distance[j] = 4*(box(0,0)+box(1,1)+box(2,2)); std::set protein; - for(int a =0; a <= topo.perturbed_disfield_restraints().proteinatoms; a++){ + for(unsigned int a =0; a <= topo.perturbed_disfield_restraints().proteinatoms; a++){ math::Vec ppos = conf.current().pos(a); periodicity.put_into_box(ppos); int nx_min=int(-( sim.param().distancefield.proteincutoff - ppos(0) - box(0,0)/2)/grid); diff --git a/gromosXX/src/interaction/special/pscale.cc b/gromosXX/src/interaction/special/pscale.cc index 511558993..07cb3b6e1 100644 --- a/gromosXX/src/interaction/special/pscale.cc +++ b/gromosXX/src/interaction/special/pscale.cc @@ -32,28 +32,7 @@ */ interaction::Periodic_Scaling ::Periodic_Scaling(interaction::Forcefield & ff, simulation::Parameter const & param) - : Interaction("Periodic_Scaling"), - m_DI(NULL) -{ - - if (param.pscale.jrest){ - // try to get the DihedralAngle interaction from the forcefield - std::vector::iterator - i_it = ff.begin(), - i_to = ff.end(); - - for( ; i_it != i_to; ++i_it){ - - if ((m_DI = dynamic_cast(*i_it))) - break; - } - if (i_it == i_to){ - io::messages.add("Could not access a dihedral interaction. Use NTBDN=1 in COVALENTFORM block.", - "Periodic Scaling", - io::message::error); - } - } // JREST periodic scaling -} + : Interaction("Periodic_Scaling") {} /** @@ -105,7 +84,7 @@ ::calculate_interactions(topology::Topology & topo, // reset force constants it->K = conf.special().pscale.KJ[n]; if (conf.special().pscale.JtoDihedral[n] != -1){ - m_DI->parameter()[conf.special().pscale.JtoDihedral[n]].K = + m_dihedral_types[conf.special().pscale.JtoDihedral[n]].K = conf.special().pscale.KDIH[n]; } @@ -125,7 +104,7 @@ ::calculate_interactions(topology::Topology & topo, // do we have a dihedral potential as well? if (conf.special().pscale.JtoDihedral[n] != -1){ - m_DI->parameter()[conf.special().pscale.JtoDihedral[n]].K = + m_dihedral_types[conf.special().pscale.JtoDihedral[n]].K = scale(conf.special().pscale.t[n], sim.param().pscale.T, sim.param().pscale.KDIH) @@ -156,6 +135,20 @@ ::init(topology::Topology & topo, { DEBUG(8, "PSCALE::init"); + if (sim.param().pscale.jrest){ + if (sim.param().force.dihedral!=2) { + io::messages.add("Could not access a dihedral interaction. Use NTBDN=1 in COVALENTFORM block.", + "Periodic Scaling", + io::message::error); + return 1; + } + + // copy dihedral types from topology + for (unsigned int i=0; i"; // change the type to a new (private) type - interaction::dihedral_type_struct dts(m_DI->parameter()[d_it->type]); - m_DI->parameter().push_back(dts); - d_it->type = m_DI->parameter().size() - 1; + interaction::dihedral_type_struct dts(m_dihedral_types[d_it->type]); + m_dihedral_types.push_back(dts); + d_it->type = m_dihedral_types.size() - 1; std::cout << std::setw(10) << d_it->type + 1 << "\n"; // store force constant to avoid drift - conf.special().pscale.KDIH[n] = m_DI->parameter()[d_it->type].K; + conf.special().pscale.KDIH[n] = m_dihedral_types[d_it->type].K; conf.special().pscale.JtoDihedral[n] = d; } @@ -242,7 +235,7 @@ ::init(topology::Topology & topo, // do we have a dihedral potential as well? if (conf.special().pscale.JtoDihedral[n] != -1){ - m_DI->parameter()[conf.special().pscale.JtoDihedral[n]].K = + m_dihedral_types[conf.special().pscale.JtoDihedral[n]].K = scale(conf.special().pscale.t[n], sim.param().pscale.T, sim.param().pscale.KDIH) diff --git a/gromosXX/src/interaction/special/pscale.h b/gromosXX/src/interaction/special/pscale.h index b7fbc91cb..c73730648 100644 --- a/gromosXX/src/interaction/special/pscale.h +++ b/gromosXX/src/interaction/special/pscale.h @@ -52,10 +52,11 @@ namespace interaction */ double scale(double t, double T, double s); + /** - * Dihedral interaction + * private dihedral types */ - interaction::Dihedral_Interaction * m_DI; + std::vector m_dihedral_types; }; diff --git a/gromosXX/src/interaction/special/rdc_restraint_interaction.cc b/gromosXX/src/interaction/special/rdc_restraint_interaction.cc index 73d960b53..a8d1fe190 100644 --- a/gromosXX/src/interaction/special/rdc_restraint_interaction.cc +++ b/gromosXX/src/interaction/special/rdc_restraint_interaction.cc @@ -620,7 +620,7 @@ int _calculate_interactions_mfield(topology::Topology & topo, const double stepsize = sim.param().rdc.emstepsize; // eg 1e-3 const double terminate_gradient = sim.param().rdc.emgradient; // eg 1e-5 const double tol = 1e-1; // accuracy of line minimization, the manual suggests 0.1 - const int max_iterations = sim.param().rdc.emmaxiter; + const unsigned int max_iterations = sim.param().rdc.emmaxiter; vector::iterator conf_it = conf.special().rdc.begin(), diff --git a/gromosXX/src/io/blockinput.cc b/gromosXX/src/io/blockinput.cc index c42b29d43..46865597f 100644 --- a/gromosXX/src/io/blockinput.cc +++ b/gromosXX/src/io/blockinput.cc @@ -3,26 +3,16 @@ * defines blockinput functions. */ +#include #include "../stdheader.h" #include "../io/message.h" #include "../ios" #include "blockinput.h" -template -inline std::basic_string& -trim_right( std::basic_string& str ) -{ - return( str = str.substr( 0, str.find_last_not_of( ' ' ) + 1 ) ); -} - -template -inline std::basic_string& -trim( std::basic_string& str ) -{ - if (str.find_first_not_of( ' ' ) == std::string::npos) return (str = ""); - return( trim_right( str ) ); -} - +#undef MODULE +#define MODULE io +#undef SUBMODULE +#define SUBMODULE parameter std::istream& io::getline( @@ -36,16 +26,16 @@ io::getline( while (is.good()) { std::getline(is, s, sep); - std::string bak(s); - trim(bak); + rtrim(s); ii = s.find(comm, 0); - if (!bak.size()) continue; // empty/whitespace only line + if (!s.size()) continue; // empty/whitespace only line else if (ii == std::string::npos) break; // no comment else if (!ii) continue; // comment on first position else { s.erase(s.begin() + ii, s.end()); - if (!trim_right(s).size()) continue; // line with comment only + rtrim(s); + if (!s.size()) continue; // line with comment only break; } } @@ -86,7 +76,8 @@ io::getblock( if (first){ // first has to be a valid blockname // otherwise try next line - if (trim(*dest) == "") continue; + rtrim(*dest); + if (*dest == "") continue; first = false; } @@ -117,6 +108,24 @@ io::concatenate( return s; } +std::string +io::concatenate( + std::vector::const_iterator begin, + std::vector::const_iterator end, + const char& sep + ) +{ + std::string s; + while (begin != end) { + s += *begin; + s += sep; + begin++; + } + + return s; +} + + void io::trimblock(std::vector &block) { @@ -149,3 +158,140 @@ const std::string &replace) { } +/** + * split a string at delimiter + * @returns vector of substrings + */ +std::vector io::split(const std::string &s, std::string delim) { + + std::vector elems; + size_t start=0, pos=0; + std::string item; + + while (( pos=s.find(delim,start)) != std::string::npos) { + item = s.substr(start, pos-start); + elems.push_back(item); + start=pos+delim.length(); + } + // last element + item = s.substr(start, s.length()-start); + elems.push_back(item); + + return elems; +} + +bool io::is_valid_int(const char* x, bool sign) +{ + bool checked = true; + + int i = 0; + do + { if (sign && i==0 && x[i] == '-') i++; + else if (isdigit(x[i])) i++; + else { + i++; + checked = false; + break; + } + } while (x[i] != '\0'); + + return checked; +} + + +template <> +bool io::is_valid_type (int & var, const char* x) { + return is_valid_int(x, true); +} + +template<> +bool io::is_valid_type(unsigned int & var, const char* x) { + return is_valid_int(x, false); +} + +template <> +bool io::is_valid_type (bool & var, const char* x) { + if (std::strcmp(x,"1")==0 ||std::strcmp(x,"0")==0 ) return true; + else return false; +} + +int io::Block::read_buffer(std::vector &buffer, bool required) { + //check if buffer exists and there is something between blockname and END + _numlines=buffer.size(); + if (buffer.size() == 0 && !required) return 1; + + if (buffer.size() <= 2){ + if (required) { + std::string separator="#---------------------------------------\n"; + io::messages.add(_blockname+" block: missing or empty, but required\n"+separator+"# Example block:\n"+separator+_exampleblock+separator, + "blockinput", io::message::error); + _block_error=1; + return 1; + } else { + io::messages.add("empty block found: "+_blockname, + "blockinput", io::message::warning); + return 1; + } + } else { + // we have something in the block + //std::cerr << "# "<> leftover; + if (!_lineStream.eof()) + io::messages.add("Left-over parameters in "+ _blockname +" block: "+leftover+"\n", + "In_Parameter", io::message::warning); + } + // temporary for debugging: + //io::messages.add(get_readparameters()+"\n", "In_Parameter", io::message::warning); +} + +std::string io::Block::get_readparameters() { + std::stringstream oss; + //oss << blockname << "\n"; + + unsigned int entries_per_line=5; + bool end=false; + unsigned int j=0; + while (!end){ + oss << " # "; + for (unsigned int i=j*entries_per_line; i < (j+1)*entries_per_line; i++) { + if (i<_par_names.size()) { + oss << std::setw(14) << _par_names[i]; + } else { + end=true; + break; + } + } + oss << std::endl; + oss << " "; + for (unsigned int i=j*entries_per_line; i < (j+1)*entries_per_line; i++) { + if (i<_par_values.size()) { + oss << std::setw(14) << _par_values[i]; + } else{ + break; + } + } + oss << std::endl; + j+=1; + } + return oss.str(); +} diff --git a/gromosXX/src/io/blockinput.h b/gromosXX/src/io/blockinput.h index ebc9c7b19..bcde7c143 100644 --- a/gromosXX/src/io/blockinput.h +++ b/gromosXX/src/io/blockinput.h @@ -13,7 +13,7 @@ namespace io { * std::getline in that it retrieves the next line (separated * by const char& sep) from the input stream, which, after * having been stripped of comments (indicated by - * const char& comm), is not empty. + * const char& comm) and leading and trailing whitespace, is not empty. */ std::istream& getline( std::istream& is, @@ -47,13 +47,21 @@ namespace io { std::string& s, const char& sep = '\n' ); + // MP: overload, why do we need to give s anyways if it is always first + // cleared AND returned + std::string concatenate( + std::vector::const_iterator begin, + std::vector::const_iterator end, + const char& sep = '\n' + ); + /** * do replacements in a string * @param str the string * @param search the search string * @param replace the replace string - * @return the string with "search" beging replace with "replace" + * @return the string with "search" being replaced with "replace" */ std::string replace_string(std::string str, const std::string &search, const std::string &replace); @@ -64,6 +72,326 @@ namespace io { */ void trimblock(std::vector &block); + + /** + * split string + * @param s the string + * @param delim delimiter + * @returns vector of substrings + */ + std::vector split(const std::string &s, std::string delim); + + bool is_valid_int(const char* x, bool sign=true); + + template + inline std::string to_string ( T Number ) + { + std::ostringstream ss; + ss << Number; + return ss.str(); + } + + + template< class T> + bool is_valid_type(T & var, const char* x) { + std::istringstream is(x); + T tmp_dbl; + is >> tmp_dbl; + if (is.fail()) return false; + else return true; + } + + template <> + bool is_valid_type (int & var, const char* x); + + template<> + bool is_valid_type(unsigned int & var, const char* x) ; + + /** + * true if 0 or 1 + */ + template <> + bool is_valid_type (bool & var, const char* x); + + // trim from start (in place) + static inline void ltrim(std::string &s) { + s.erase(s.begin(), std::find_if(s.begin(), s.end(), + std::not1(std::ptr_fun(std::isspace)))); + } + + // trim from end (in place) + static inline void rtrim(std::string &s) { + s.erase(std::find_if(s.rbegin(), s.rend(), + std::not1(std::ptr_fun(std::isspace))).base(), s.end()); + } + + // trim from both ends (in place) + static inline void trim(std::string &s) { + ltrim(s); + rtrim(s); + } + + // trim from start (copying) + static inline std::string ltrimmed(std::string s) { + ltrim(s); + return s; + } + + // trim from end (copying) + static inline std::string rtrimmed(std::string s) { + rtrim(s); + return s; + } + + // trim from both ends (copying) + static inline std::string trimmed(std::string s) { + trim(s); + return s; + } + + /** + * simple logical expression evaluator + * @param var the value to evaluate + * @param expr terms composed of one of <=, >=, <, > and a number, several + * of them can be connected by || or &&, && has precedence, no brackets! + */ + template < class T > + bool evaluate_comparison(const T &var, std::string expr) { + bool result; + + std::size_t found = expr.find("<="); + if (found != std::string::npos) { + std::vector parts = io::split(expr, "<="); + try { + T value; + std::stringstream stream(parts[1]); + stream >> value; + result = var <= value; + return result; + } catch (...) { + io::messages.add("evaluate_comparison: could not evaluate "+expr+"!", + "In_Parameter", io::message::error); + return false; + } + } + + found = expr.find(">="); + if (found != std::string::npos) { + std::vector parts = io::split(expr, ">="); + try { + T value; + std::stringstream stream(parts[1]); + stream >> value; + result = var >= value; + return result; + } catch (...) { + io::messages.add("evaluate_comparison: could not evaluate "+expr+"!", + "In_Parameter", io::message::error); + return false; + } + } + + found = expr.find("<"); + if (found != std::string::npos) { + std::vector parts = io::split(expr, "<"); + try { + T value; + std::stringstream stream(parts[1]); + stream >> value; + result = var < value; + return result; + } catch (...) { + io::messages.add("evaluate_comparison: could not evaluate "+expr+"!", + "In_Parameter", io::message::error); + return false; + } + } + + found = expr.find(">"); + if (found != std::string::npos) { + std::vector parts = io::split(expr, ">"); + try { + T value; + std::stringstream stream(parts[1]); + stream >> value; + result = var > value; + return result; + } catch (...) { + io::messages.add("evaluate_comparison: could not evaluate "+expr+"!", + "In_Parameter", io::message::error); + return false; + } + } + if (expr != "") { + io::messages.add("evaluate_comparison: could not evaluate "+expr+"!", + "In_Parameter", io::message::error); + return false; + } else { + return true; + } + } + + template < class T > + bool evaluate_logical_expression(const T &var, const std::string &expr) { + bool result = false; + std::vector substrings_or = io::split(expr, "||"); + for (unsigned int i=0; i substrings_and = io::split(io::trimmed(substrings_or[i]), "&&"); + for (unsigned int j=0; j &buffer, std::string exampleblock="") : _blockname(name), _block_error(0), _exampleblock(exampleblock) { read_buffer(buffer); } + + /** + * Destructor. + */ + ~Block() {} + + + /** + * check if there is something in the block + * read block into istringstream + * @param buffer vector of strings, the first of which is the block name, the last the "END" + */ + int read_buffer(std::vector &buffer, bool required=false); + + /** + * get current content of _block_parameters + * so it can be added to error messages + */ + std::string get_readparameters(); + + /** + * read values and check their types and ranges + * @param var the variable + * @param expr e.g. >=0 && < 1 + * @param allowed comma-separated string of allowed values + */ + template + int get_next_parameter(std::string varname, T &var, std::string expr="", std::string allowed=""); + + /** + * print the read parameters if there were errors + * else check if there are leftover parameters and warn + */ + void get_final_messages(bool print_read=true); + + /** + * set the block example string + */ + void set_exampleblock(std::stringstream exampleblock) { _exampleblock=exampleblock.str(); }; + + std::string name() { return _blockname; } + bool error() { return _block_error; } + int numlines() { return _numlines; } + + /** + * get the block example + */ + std::string exampleblock() { return _exampleblock; } + + private: + std::istringstream _lineStream; + std::vector _par_names, _par_values; + std::string _blockname; + int _block_error; + int _numlines; + std::string _exampleblock; + }; + + /** + * if unsuccessful, var is just not set!! this was also the previous behaviour + */ + template < class T > + int io::Block::get_next_parameter(std::string varname, T &var, std::string expr, std::string allowed) { + _par_names.push_back(varname); + std::string tmp_string; + _lineStream >> tmp_string; + + if (_lineStream.eof()) { + io::messages.add(_blockname + " block reached END before "+varname + +" could be read!", + "BlockInput", io::message::error); + _par_values.push_back(tmp_string); + _block_error=1; + return 1; + } + + // check if we have a valid data type + if (io::is_valid_type(var, tmp_string.c_str())) { + std::istringstream iss(tmp_string); + iss >> var; + } else { + io::messages.add(_blockname + " block: wrong value type for "+varname+": " + +tmp_string, //+" (required: "+typeid(var).name()+")" NOTE: I could write also which it should be with typeid(var).name(), but this is a bit cryptic as the output is compiler/system? dependent - I get i and d for int and double + "In_Parameter", io::message::error); + _par_values.push_back(tmp_string); + _block_error=1; + return 1; + } + + _par_values.push_back(io::to_string(var)); + io::trim(expr); + io::trim(allowed); + bool ok=false; + if (allowed == "" && expr == "") ok=true; + + std::ostringstream errormsg; + errormsg << _blockname << " block: " < substrings=io::split(allowed, ","); + for (unsigned int i=0; i> value; + if (var == value) { + ok=true; + } + } + errormsg << allowed; + } + + if (!ok) { + _block_error=1; + io::messages.add(errormsg.str(), "In_Parameter", io::message::error); + return 1; + } + return 0; + } } diff --git a/gromosXX/src/io/configuration/in_configuration.cc b/gromosXX/src/io/configuration/in_configuration.cc index c82a58ac2..71017c999 100644 --- a/gromosXX/src/io/configuration/in_configuration.cc +++ b/gromosXX/src/io/configuration/in_configuration.cc @@ -33,18 +33,18 @@ static std::set block_read; /** * read in a trajectory. */ -void io::In_Configuration::read(configuration::Configuration &conf, - topology::Topology &topo, +void io::In_Configuration::read(configuration::Configuration &conf, + topology::Topology &topo, simulation::Simulation & sim, std::ostream & os) { DEBUG(7, "read configuration"); - + if (!quiet) os << "CONFIGURATION\n"; simulation::Parameter const & param = sim.param(); - + // resize the configuration conf.resize(topo.num_atoms()); @@ -72,8 +72,8 @@ void io::In_Configuration::read(configuration::Configuration &conf, read_leusbias(topo, conf, sim, os); read_bsleus(topo, conf, sim, os); read_order_parameter_restraint_averages(topo, conf, sim, os); - read_rdc(topo, conf, sim, os); - + read_rdc(topo, conf, sim, os); + // and set the boundary type! conf.boundary_type = param.boundary.boundary; @@ -113,15 +113,15 @@ void io::In_Configuration::read(configuration::Configuration &conf, if (!quiet){ os << "\ttotal mass = " << math::sum(topo.mass()) << "\n" << "\tvolume = " << math::volume(conf.current().box, conf.boundary_type); - + if (conf.boundary_type != math::vacuum) - os << "\n\tdensity = " + os << "\n\tdensity = " << math::sum(topo.mass()) / math::volume(conf.current().box, conf.boundary_type); - + os << "\n"; } - + // warn for unread input data for(std::map >::const_iterator @@ -136,12 +136,12 @@ void io::In_Configuration::read(configuration::Configuration &conf, io::message::warning); } } - + if (!quiet) os << "END\n\n"; - + conf.check(topo, sim); - + DEBUG(8, "configuration read"); } @@ -165,7 +165,7 @@ bool io::In_Configuration::read_next // ignore errors reading time step read_time_step(topo, conf, sim, os); - + if (!( read_position(topo, conf, sim, os) && read_box(topo, conf, sim, os) @@ -216,43 +216,43 @@ bool io::In_Configuration::read_position_plain(topology::Topology &topo, DEBUG(8, "Reading in a plain Configuration for at most " << topo.num_atoms() << " atoms."); read_frame(); block_read.clear(); - + //read_position(topo, conf, sim, os); std::vector buffer; buffer = m_block["POSITION"]; - + if (!buffer.size()){ io::messages.add("Could not find POSITION block", "In_Configuration", io::message::error); return false; } - + std::vector::const_iterator it = buffer.begin(), to = buffer.end()-1; - + math::VArray &pos = conf.current().pos; - + int i; for(i=0; it != to; ++i, ++it){ DEBUG(8, "line: " << *it); - + _lineStream.clear(); // first 24 characters are ignored _lineStream.str((*it).substr(24, (*it).size())); // _lineStream >> n >> s1 >> s2 >> nr; _lineStream >> pos(i)(0) >> pos(i)(1) >> pos(i)(2); DEBUG(8, "atom " << i << ": " << v2s(pos(i))); - + if(_lineStream.fail()){ io::messages.add("bad line in POSITION block", "In_Configuration", - io::message::error); + io::message::error); return false; } } - + read_box(topo, conf, sim, os); conf.boundary_type = sim.param().boundary.boundary; @@ -270,8 +270,8 @@ bool io::In_Configuration::read_position_plain(topology::Topology &topo, bool io::In_Configuration::read_position ( - topology::Topology &topo, - configuration::Configuration &conf, + topology::Topology &topo, + configuration::Configuration &conf, simulation::Simulation & sim, std::ostream & os) { @@ -279,9 +279,9 @@ bool io::In_Configuration::read_position std::vector buffer; buffer = m_block["POSITION"]; if (buffer.size()){ - + check_coordinates(topo, conf, sim, buffer.size() - 1, os); - + if (!quiet) os << "\treading POSITION...\n"; _read_position(conf.current().pos, buffer, topo.num_atoms()); @@ -310,8 +310,8 @@ bool io::In_Configuration::read_position bool io::In_Configuration::read_cos_position ( - topology::Topology &topo, - configuration::Configuration &conf, + topology::Topology &topo, + configuration::Configuration &conf, simulation::Simulation & sim, std::ostream & os) { @@ -321,24 +321,24 @@ bool io::In_Configuration::read_cos_position if (sim.param().polarise.cos) { buffer = m_block["COSDISPLACEMENTS"]; if (buffer.size()){ - + check_coordinates(topo, conf, sim, buffer.size() - 1, os); - + if (!quiet) os << "\treading COSDISPLACEMENTS...\n"; _read_cos_position(conf.current().posV, buffer, topo.num_atoms()); - + conf.old().posV = conf.current().posV; - + block_read.insert("COSDISPLACEMENTS"); } - + else{ io::messages.add("no COSDISPLACEMENTS block found in input configuration." " Setting COS position to zero.", "in_configuration", io::message::notice); - + conf.current().posV = 0.0; conf.old().posV = 0.0; } @@ -348,8 +348,8 @@ bool io::In_Configuration::read_cos_position bool io::In_Configuration::read_velocity ( - topology::Topology &topo, - configuration::Configuration &conf, + topology::Topology &topo, + configuration::Configuration &conf, simulation::Simulation & sim, std::ostream & os) { @@ -387,7 +387,12 @@ bool io::In_Configuration::read_velocity } else { // generate initial velocities - util::generate_velocities(sim.param(), sim.param().start.tempi, + block_read.insert("VELOCITY"); + if (m_block["VELOCITY"].size()) + io::messages.add("You are generating new velocities even though there is already a VELOCITY block.", + "in_configuration", io::message::warning); + + util::generate_velocities(sim.param(), sim.param().start.tempi, topo.mass(), conf.current().vel, conf.old().vel, @@ -399,8 +404,8 @@ bool io::In_Configuration::read_velocity bool io::In_Configuration::read_lattice_shifts ( - topology::Topology &topo, - configuration::Configuration &conf, + topology::Topology &topo, + configuration::Configuration &conf, simulation::Simulation & sim, std::ostream & os) { @@ -422,7 +427,7 @@ bool io::In_Configuration::read_lattice_shifts } } else { if (buffer.size()) { - io::messages.add("LATTICESHIFTS block provied but shifts reset to zero.", + io::messages.add("LATTICESHIFTS block provided but shifts reset to zero.", "in_configuration", io::message::warning); conf.special().lattice_shifts = 0.0; } @@ -432,8 +437,8 @@ bool io::In_Configuration::read_lattice_shifts bool io::In_Configuration::read_box ( - topology::Topology &topo, - configuration::Configuration &conf, + topology::Topology &topo, + configuration::Configuration &conf, simulation::Simulation & sim, std::ostream & os) { @@ -473,14 +478,13 @@ bool io::In_Configuration::read_box buffer = m_block["BOX"]; if (buffer.size() && (sim.param().boundary.boundary == math::rectangular || sim.param().boundary.boundary == math::truncoct)){ - if (!quiet) - os << "\treading BOX...\n"; - _read_g96_box(conf.current().box, buffer); - conf.old().box = conf.current().box; - conf.old().phi = conf.current().phi; - conf.old().theta = conf.current().theta; - conf.old().psi = conf.current().psi; - io::messages.add("BOX given" + if (!quiet) os << "\treading BOX...\n"; + _read_g96_box(conf.current().box, buffer); + conf.old().box = conf.current().box; + conf.old().phi = conf.current().phi; + conf.old().theta = conf.current().theta; + conf.old().psi = conf.current().psi; + io::messages.add("BOX given" " - output will be GENBOX", "In_Configuration", io::message::notice); block_read.insert("BOX"); @@ -493,7 +497,7 @@ bool io::In_Configuration::read_box io::message::error); return false; } - } + } } } /* rotate the @@ -507,7 +511,7 @@ bool io::In_Configuration::read_box math::Matrixl Rmat((math::rmat(conf.current().phi, conf.current().theta, conf.current().psi))); DEBUG(10, "box \n " << math::m2s(math::Matrix(conf.current().box))); - + DEBUG(10, "Transformation Matrix \n" << math::m2s(Rmat)); for (int i = 0, to = topo.num_atoms(); i < to; ++i) { DEBUG(10, "Position Cartesian: " << math::v2s(conf.current().pos(i))); @@ -515,15 +519,15 @@ bool io::In_Configuration::read_box DEBUG(10, "Position Rotated : " << math::v2s(conf.current().pos(i))); conf.current().posV(i) = math::Vec(math::product(math::transpose(Rmat), conf.current().posV(i))); conf.current().vel(i) = math::Vec(math::product(math::transpose(Rmat), conf.current().vel(i))); - } - + } + return true; } bool io::In_Configuration::read_jvalue ( - topology::Topology &topo, - configuration::Configuration &conf, + topology::Topology &topo, + configuration::Configuration &conf, simulation::Simulation & sim, std::ostream & os) { @@ -571,7 +575,7 @@ bool io::In_Configuration::read_jvalue } } } // jvalue averages - + if (sim.param().jvalue.le) { buffer = m_block["JVALUERESEPS"]; if (!sim.param().jvalue.read_av){ @@ -588,8 +592,8 @@ bool io::In_Configuration::read_jvalue } else { if (buffer.size()) { block_read.insert("JVALUERESEPS"); - _read_jvalue_le(buffer, conf.special().jvalue_epsilon, - topo.jvalue_restraints(), + _read_jvalue_le(buffer, conf.special().jvalue_epsilon, + topo.jvalue_restraints(), sim.param().jvalue.ngrid); } else{ io::messages.add("reading in of J-value local elevation epsilons " @@ -648,7 +652,7 @@ bool io::In_Configuration::read_xray _read_xray_umbrellaweightthesholds(buffer, topo.xray_umbrella_weights()); } } - + buffer = m_block["XRAYBFOCCSPEC"]; if (buffer.size()) { block_read.insert("XRAYBFOCCSPEC"); @@ -665,8 +669,8 @@ bool io::In_Configuration::read_xray bool io::In_Configuration::read_pscale ( - topology::Topology &topo, - configuration::Configuration &conf, + topology::Topology &topo, + configuration::Configuration &conf, simulation::Simulation & sim, std::ostream & os) { @@ -708,8 +712,8 @@ bool io::In_Configuration::read_pscale bool io::In_Configuration::read_flexv ( - topology::Topology &topo, - configuration::Configuration &conf, + topology::Topology &topo, + configuration::Configuration &conf, simulation::Simulation & sim, std::ostream & os) { @@ -727,7 +731,7 @@ bool io::In_Configuration::read_flexv block_read.insert("FLEXV"); if (!quiet) os << "\treading FLEXV...\n"; - _read_flexv(conf.special().flexible_constraint.flexible_vel, buffer, + _read_flexv(conf.special().flexible_constraint.flexible_vel, buffer, topo.solute().distance_constraints(), topo.perturbed_solute().distance_constraints()); @@ -750,8 +754,8 @@ bool io::In_Configuration::read_flexv bool io::In_Configuration::read_stochastic_integral ( - topology::Topology &topo, - configuration::Configuration &conf, + topology::Topology &topo, + configuration::Configuration &conf, simulation::Simulation & sim, std::ostream & os) { @@ -760,14 +764,14 @@ bool io::In_Configuration::read_stochastic_integral conf.old().stochastic_integral.resize(topo.num_atoms()); conf.current().stochastic_integral.resize(topo.num_atoms()); - + buffer = m_block["STOCHINT"]; if (sim.param().stochastic.generate_integral == false) { if (buffer.size()){ block_read.insert("STOCHINT"); if (!quiet) os << "\treading STOCHINT...\n"; - + _read_stochastic_integral(conf.current().stochastic_integral, buffer, topo.num_atoms(), conf.current().stochastic_seed); } @@ -775,6 +779,10 @@ bool io::In_Configuration::read_stochastic_integral io::messages.add("could not read stochastic integrals from configuration", "In_Configuration", io::message::error); } + } else { + if (buffer.size()) + io::messages.add("STOCHINT block found, but not used.", + "In_Configuration", io::message::warning); } } return true; @@ -782,19 +790,19 @@ bool io::In_Configuration::read_stochastic_integral bool io::In_Configuration::read_perturbation ( - topology::Topology &topo, + topology::Topology &topo, simulation::Simulation & sim, std::ostream & os) { std::vector buffer; - if (sim.param().perturbation.perturbation){ + if (sim.param().perturbation.perturbation){ buffer = m_block["PERTDATA"]; if (sim.param().perturbation.read_initial) { if (buffer.size()){ block_read.insert("PERTDATA"); if (!quiet) os << "\treading PERTDATA...\n"; - + _read_pertdata(topo, buffer); } else { io::messages.add("could not read perturbation data (PERTDATA) from configuration", @@ -807,14 +815,14 @@ bool io::In_Configuration::read_perturbation bool io::In_Configuration::read_distance_restraint_averages ( - topology::Topology &topo, - configuration::Configuration &conf, + topology::Topology &topo, + configuration::Configuration &conf, simulation::Simulation & sim, std::ostream & os) { std::vector buffer; if (sim.param().distanceres.distanceres < 0){ - + buffer = m_block["DISRESEXPAVE"]; if (buffer.size()){ block_read.insert("DISRESEXPAVE"); @@ -826,13 +834,13 @@ bool io::In_Configuration::read_distance_restraint_averages conf.special().distanceres.av); else io::messages.add("distance restraint averages found but not read.", - "in_configuration", + "In_Configuration", io::message::warning); } else{ if (sim.param().distanceres.read) io::messages.add("no DISRESEXPAVE block in configuration.", - "in_configuration", + "In_Configuration", io::message::error); } } @@ -910,19 +918,19 @@ bool io::In_Configuration::read_rdc (topology::Topology &topo, sim.param().rdc.mode == simulation::rdc_restr_biq_weighted) { if (buffer.size()) { if (sim.param().rdc.read_av) { -// io::messages.add("initialising RDC restraint averages from saved values", "in_configuration", io::message::notice); +// io::messages.add("initialising RDC restraint averages from saved values", "In_Configuration", io::message::notice); if(!_read_rdc_av(buffer, conf.special().rdc, topo.rdc_restraints(), os)){ - io::messages.add("reading RDCAVERAGES block failed", "in_configuration", io::message::error); + io::messages.add("reading RDCAVERAGES block failed", "In_Configuration", io::message::error); return false; } } else{ - io::messages.add("you provided an RDCAVERAGES block but chose not to read it", "in_configuration", io::message::warning); + io::messages.add("you provided an RDCAVERAGES block but chose not to read it", "In_Configuration", io::message::warning); } } else{ if (sim.param().rdc.read_av) { - io::messages.add("you chose to read an RDCAVERAGES block but there is none", "in_configuration", io::message::error); + io::messages.add("you chose to read an RDCAVERAGES block but there is none", "In_Configuration", io::message::error); return false; } // else: no block, no reading selected @@ -932,26 +940,26 @@ bool io::In_Configuration::read_rdc (topology::Topology &topo, sim.param().rdc.mode == simulation::rdc_restr_inst_weighted) { if (buffer.size()) { if (sim.param().rdc.read_av) { - io::messages.add("you provided an RDCAVERAGES block and chose to read it, but the restraining mode is instantaneous: ignoring averages", "in_configuration", io::message::warning); + io::messages.add("you provided an RDCAVERAGES block and chose to read it, but the restraining mode is instantaneous: ignoring averages", "In_Configuration", io::message::warning); } else{ - io::messages.add("you provided an RDCAVERAGES block, but chose not to read it and the restraining mode is instantaneous: ignoring averages", "in_configuration", io::message::warning); + io::messages.add("you provided an RDCAVERAGES block, but chose not to read it and the restraining mode is instantaneous: ignoring averages", "In_Configuration", io::message::warning); } } else{ if (sim.param().rdc.read_av) { - io::messages.add("you chose to read an RDCAVERAGES block, but there is none and the restraining mode is instantaneous: I'm going to ignore this", "in_configuration", io::message::warning); + io::messages.add("you chose to read an RDCAVERAGES block, but there is none and the restraining mode is instantaneous: I'm going to ignore this", "In_Configuration", io::message::warning); } // else: no block, no reading selected } } else assert(false); - + // read_align && em does not make sense if(sim.param().rdc.method == simulation::rdc_em){ if(sim.param().rdc.read_align){ - io::messages.add("it does not make sense to read the magnetic field representation in an rdc-em run: ignore reading", "in_configuration", io::message::warning); + io::messages.add("it does not make sense to read the magnetic field representation in an rdc-em run: ignore reading", "In_Configuration", io::message::warning); } } else if (sim.param().rdc.method == simulation::rdc_sd || sim.param().rdc.method == simulation::rdc_md){ @@ -961,72 +969,72 @@ bool io::In_Configuration::read_rdc (topology::Topology &topo, if (buffer.size()) block_read.insert("RDCMF"); // mark block read if (sim.param().rdc.read_align) { if (buffer.size()) { -// io::messages.add("magnetic field vectors from saved values", "in_configuration", io::message::notice); +// io::messages.add("magnetic field vectors from saved values", "In_Configuration", io::message::notice); if(!_read_rdc_mf(buffer, conf.special().rdc, topo.rdc_restraints(), os)){ - io::messages.add("reading of RDCMF block failed", "in_configuration", io::message::error); + io::messages.add("reading of RDCMF block failed", "In_Configuration", io::message::error); return false; } } else { - io::messages.add("you chose to read an RDCMF block but there is none", "in_configuration", io::message::error); + io::messages.add("you chose to read an RDCMF block but there is none", "In_Configuration", io::message::error); return false; } } else { // don't read if (buffer.size()) { - io::messages.add("you provided an RDCMF block but chose not to read it: ignore reading", "in_configuration", io::message::warning); + io::messages.add("you provided an RDCMF block but chose not to read it: ignore reading", "In_Configuration", io::message::warning); } // else: don't read and none given } break; - + case simulation::rdc_t: buffer = m_block["RDCT"]; if (buffer.size()) block_read.insert("RDCT"); // mark block read if (sim.param().rdc.read_align) { if (buffer.size()) { -// io::messages.add("magnetic field vectors from saved values", "in_configuration", io::message::notice); +// io::messages.add("magnetic field vectors from saved values", "In_Configuration", io::message::notice); if(!_read_rdc_t(buffer, conf.special().rdc, os)){ - io::messages.add("reading of RDCT block failed", "in_configuration", io::message::error); + io::messages.add("reading of RDCT block failed", "In_Configuration", io::message::error); return false; } } else { - io::messages.add("you chose to read an RDCT block but there is none", "in_configuration", io::message::error); + io::messages.add("you chose to read an RDCT block but there is none", "In_Configuration", io::message::error); return false; } } else { // don't read if (buffer.size()) { - io::messages.add("you provided an RDCT block but chose not to read it: ignore reading", "in_configuration", io::message::warning); + io::messages.add("you provided an RDCT block but chose not to read it: ignore reading", "In_Configuration", io::message::warning); } // else: don't read and none given } break; - + case simulation::rdc_sh: buffer = m_block["RDCSH"]; if (buffer.size()) block_read.insert("RDCSH"); // mark block read if (sim.param().rdc.read_align) { if (buffer.size()) { -// io::messages.add("magnetic field vectors from saved values", "in_configuration", io::message::notice); +// io::messages.add("magnetic field vectors from saved values", "In_Configuration", io::message::notice); if(!_read_rdc_sh(buffer, conf.special().rdc, os)){ - io::messages.add("reading of RDCSH block failed", "in_configuration", io::message::error); + io::messages.add("reading of RDCSH block failed", "In_Configuration", io::message::error); return false; } } else { - io::messages.add("you chose to read an RDCSH block but there is none", "in_configuration", io::message::error); + io::messages.add("you chose to read an RDCSH block but there is none", "In_Configuration", io::message::error); return false; } } else { // don't read if (buffer.size()) { - io::messages.add("you provided an RDCSH block but chose not to read it: ignore reading", "in_configuration", io::message::warning); + io::messages.add("you provided an RDCSH block but chose not to read it: ignore reading", "In_Configuration", io::message::warning); } // don't read and none given } break; - + default: - io::messages.add("Reading of RDC magnetic field data requested but unknown type of representation given (NTRDCT)", "in_configuration", io::message::error); + io::messages.add("Reading of RDC magnetic field data requested but unknown type of representation given (NTRDCT)", "In_Configuration", io::message::error); return false; } // switch: type } @@ -1038,12 +1046,12 @@ bool io::In_Configuration::read_rdc (topology::Topology &topo, if (buffer.size()) { block_read.insert("RDCSH"); // mark block read if(!_read_rdc_stochint(buffer, conf.special().rdc, sim.param().rdc.type, os)){ - io::messages.add("reading of RDCSTOCHINT block failed", "in_configuration", io::message::error); + io::messages.add("reading of RDCSTOCHINT block failed", "In_Configuration", io::message::error); return false; } } else { - io::messages.add("you chose to read the magnetic field representation, and use SD but there is no RDCSTOCHINT block", "in_configuration", io::message::error); + io::messages.add("you chose to read the magnetic field representation, and use SD but there is no RDCSTOCHINT block", "In_Configuration", io::message::error); return false; } } @@ -1054,14 +1062,14 @@ bool io::In_Configuration::read_rdc (topology::Topology &topo, bool io::In_Configuration::read_nose_hoover_chains ( - topology::Topology &topo, - configuration::Configuration &conf, + topology::Topology &topo, + configuration::Configuration &conf, simulation::Simulation & sim, std::ostream & os) { std::vector buffer; - if (sim.param().multibath.nosehoover > 1){ - + if (sim.param().multibath.algorithm > 1){ + buffer = m_block["NHCVARIABLES"]; if (buffer.size()){ block_read.insert("NHCVARIABLES"); @@ -1072,13 +1080,13 @@ bool io::In_Configuration::read_nose_hoover_chains _read_nose_hoover_chain_variables(buffer, sim.multibath()); else io::messages.add("Nose-Hoover-Chains variables found but not read.", - "in_configuration", + "In_Configuration", io::message::warning); } else{ if (sim.param().start.read_nosehoover_chains) io::messages.add("no NHCVARIABLES block in configuration.", - "in_configuration", + "In_Configuration", io::message::error); } } @@ -1087,14 +1095,14 @@ bool io::In_Configuration::read_nose_hoover_chains bool io::In_Configuration::read_rottrans ( - topology::Topology &topo, - configuration::Configuration &conf, + topology::Topology &topo, + configuration::Configuration &conf, simulation::Simulation & sim, std::ostream & os) { std::vector buffer; if (sim.param().rottrans.rottrans){ - + buffer = m_block["ROTTRANSREFPOS"]; if (buffer.size()){ block_read.insert("ROTTRANSREFPOS"); @@ -1105,15 +1113,17 @@ bool io::In_Configuration::read_rottrans _read_rottrans(buffer, sim.param().rottrans.last, conf.special().rottrans_constr); else io::messages.add("Initial settings for roto-translational constraints found but not read.", - "in_configuration", + "In_Configuration", io::message::warning); } else{ if (sim.param().start.read_rottrans) io::messages.add("no ROTTRANSREFPOS block in configuration.", - "in_configuration", + "In_Configuration", io::message::error); } + } else { + block_read.insert("ROTTRANSREFPOS"); } return true; } @@ -1121,15 +1131,15 @@ bool io::In_Configuration::read_rottrans bool io::In_Configuration::read_position_restraints ( topology::Topology &topo, - configuration::Configuration &conf, + configuration::Configuration &conf, simulation::Simulation & sim, std::ostream & os) { if (sim.param().posrest.posrest == simulation::posrest_off) return true; - + bool result = true; - + std::vector buffer; if (!sim.param().posrest.read) { // read means from spec file! buffer = m_block["REFPOSITION"]; @@ -1139,15 +1149,15 @@ bool io::In_Configuration::read_position_restraints os << "\treading REFPOSITION...\n"; conf.special().reference_positions.resize(topo.num_atoms()); - result = result && + result = result && _read_position(conf.special().reference_positions, buffer, topo.num_atoms(), "REFPOSITION"); } else { io::messages.add("no REFPOSITION block in configuration.", - "in_configuration", io::message::error); + "In_Configuration", io::message::error); return false; } - + if (sim.param().posrest.posrest == simulation::posrest_bfactor) { buffer = m_block["BFACTOR"]; if (buffer.size()) { @@ -1156,16 +1166,16 @@ bool io::In_Configuration::read_position_restraints os << "\treading BFACTOR...\n"; conf.special().bfactors.resize(topo.num_atoms()); - result = result && + result = result && _read_bfactor(conf.special().bfactors, buffer, false); } else { io::messages.add("no BFACTOR block in configuration.", - "in_configuration", io::message::error); + "In_Configuration", io::message::error); return false; } } } - + return result; } @@ -1195,7 +1205,7 @@ bool io::In_Configuration::read_leusbias return result; } else { io::messages.add("no LEUSBIAS block in configuration.", - "in_configuration", io::message::error); + "In_Configuration", io::message::error); return false; } } else { @@ -1203,27 +1213,27 @@ bool io::In_Configuration::read_leusbias if (buffer.size()) { block_read.insert("LEUSBIAS"); io::messages.add("LEUSBIAS block in configuration is ignored", - "in_configuration", io::message::warning); + "In_Configuration", io::message::warning); } } return true; } -bool io::In_Configuration::read_bsleus(topology::Topology& topo, - configuration::Configuration& conf, - simulation::Simulation& sim, +bool io::In_Configuration::read_bsleus(topology::Topology& topo, + configuration::Configuration& conf, + simulation::Simulation& sim, std::ostream& os) { if (sim.param().bsleus.bsleus == simulation::bsleus_off) return true; - + bool result = false; std::vector buffer; buffer = m_block["BSLEUSMEM"]; if (!buffer.size()){ - io::messages.add("No BSLEUSMEM block in configuration file!\n" - "\t\tWill set memory to zero", "in_configuration", io::message::warning); + io::messages.add("No BSLEUSMEM block in configuration file!\n" + "\t\tWill set memory to zero", "In_Configuration", io::message::warning); conf.special().bs_umbrella.setMemoryToZero(); conf.special().bs_umbrella.setAuxMemoryToZero(); } @@ -1235,8 +1245,8 @@ bool io::In_Configuration::read_bsleus(topology::Topology& topo, } buffer = m_block["BSLEUSPOS"]; if (!buffer.size()){ - io::messages.add("No BSLEUSPOS block in configuration file!\n" - "\t\tWill calculate the position", "in_configuration", io::message::warning); + io::messages.add("No BSLEUSPOS block in configuration file!\n" + "\t\tWill calculate the position", "In_Configuration", io::message::warning); } else { block_read.insert("BSLEUSPOS"); @@ -1249,8 +1259,8 @@ bool io::In_Configuration::read_bsleus(topology::Topology& topo, bool io::In_Configuration::read_time ( - topology::Topology &topo, - configuration::Configuration &conf, + topology::Topology &topo, + configuration::Configuration &conf, simulation::Simulation & sim, std::ostream & os) { @@ -1260,11 +1270,12 @@ bool io::In_Configuration::read_time buffer = m_block["TIMESTEP"]; if (!buffer.size()){ io::messages.add("Requested time information from TIMESTEP block, " - "but block not found", "in_configuration", io::message::error); + "but block not found", "In_Configuration", io::message::error); return false; } else{ _read_time(buffer, sim.time()); + sim.param().step.t0=sim.time(); block_read.insert("TIMESTEP"); } } @@ -1278,8 +1289,8 @@ bool io::In_Configuration::read_time bool io::In_Configuration::read_time_step ( - topology::Topology &topo, - configuration::Configuration &conf, + topology::Topology &topo, + configuration::Configuration &conf, simulation::Simulation & sim, std::ostream & os) { @@ -1289,7 +1300,7 @@ bool io::In_Configuration::read_time_step buffer = m_block["TIMESTEP"]; if (!buffer.size()){ io::messages.add("TIMESTEP block not found", - "in_configuration", + "In_Configuration", io::message::error); return false; } @@ -1300,21 +1311,21 @@ bool io::In_Configuration::read_time_step return true; } -bool io::In_Configuration::_read_positionred(math::VArray &pos, +bool io::In_Configuration::_read_positionred(math::VArray &pos, std::vector &buffer, int const num) { DEBUG(8, "read positionred"); - + // no title in buffer! std::vector::const_iterator it = buffer.begin(), to = buffer.end()-1; - + int i; if (pos.size() < unsigned(num)){ io::messages.add("configuration: too many coordinates for given topology", - "in_configuration", + "In_Configuration", io::message::critical); std::cout << "position size is : " << pos.size() << " and num is : " << num << std::endl; return false; @@ -1328,15 +1339,15 @@ bool io::In_Configuration::_read_positionred(math::VArray &pos, io::message::error); break; } - + _lineStream.clear(); _lineStream.str(*it); _lineStream >> pos(i)(0) >> pos(i)(1) >> pos(i)(2); - + if(_lineStream.fail()){ io::messages.add("bad line in POSITIONRED block", "In_Configuration", - io::message::error); + io::message::error); return false; } } @@ -1350,26 +1361,26 @@ bool io::In_Configuration::_read_positionred(math::VArray &pos, } return true; - + } -bool io::In_Configuration::_read_cos_position(math::VArray &pos, +bool io::In_Configuration::_read_cos_position(math::VArray &pos, std::vector &buffer, int const num) { DEBUG(8, "read COSDISPLACEMENTS"); - + // no title in buffer! std::vector::const_iterator it = buffer.begin(), to = buffer.end()-1; - + int i; if (pos.size() < unsigned(num)){ io::messages.add("configuration: too many cos coordinates for given topology", - "in_configuration", + "In_Configuration", io::message::critical); - std::cout << "cos position size is : " << pos.size() << " and num is : " << + std::cout << "cos position size is : " << pos.size() << " and num is : " << num << std::endl; return false; } @@ -1382,15 +1393,15 @@ bool io::In_Configuration::_read_cos_position(math::VArray &pos, io::message::error); break; } - + _lineStream.clear(); _lineStream.str(*it); _lineStream >> pos(i)(0) >> pos(i)(1) >> pos(i)(2); - + if(_lineStream.fail()){ io::messages.add("bad line in COSDISPLACEMENTS block", "In_Configuration", - io::message::error); + io::message::error); return false; } } @@ -1414,7 +1425,7 @@ bool io::In_Configuration::_read_position(math::VArray &pos, std::vector::const_iterator it = buffer.begin(), to = buffer.end()-1; - + int i; std::istringstream _lineStream; @@ -1433,7 +1444,7 @@ bool io::In_Configuration::_read_position(math::VArray &pos, std::vector> n >> s1 >> s2 >> nr; _lineStream >> pos(i)(0) >> pos(i)(1) >> pos(i)(2); - + if(_lineStream.fail()){ io::messages.add("bad line in "+blockname+" block", "In_Configuration", @@ -1451,10 +1462,10 @@ bool io::In_Configuration::_read_position(math::VArray &pos, std::vector &buffer, int const num) { @@ -1463,9 +1474,9 @@ bool io::In_Configuration::_read_velocityred(math::VArray &vel, // no title in buffer! std::vector::const_iterator it = buffer.begin(), to = buffer.end()-1; - + int i; - + for(i=0; it != to; ++i, ++it){ if (i >= num){ io::messages.add("configuration file does not match topology: " @@ -1478,11 +1489,11 @@ bool io::In_Configuration::_read_velocityred(math::VArray &vel, _lineStream.clear(); _lineStream.str(*it); _lineStream >> vel(i)(0) >> vel(i)(1) >> vel(i)(2); - + if(_lineStream.fail()){ io::messages.add("bad line in VELOCITYRED block", "In_Configuration", - io::message::error); + io::message::error); return false; } @@ -1495,23 +1506,23 @@ bool io::In_Configuration::_read_velocityred(math::VArray &vel, io::message::error); return false; } - + return true; - + } -bool io::In_Configuration::_read_velocity(math::VArray &vel, +bool io::In_Configuration::_read_velocity(math::VArray &vel, std::vector &buffer, - int const num) + unsigned int const num) { DEBUG(8, "read velocity"); // no title in buffer! std::vector::const_iterator it = buffer.begin(), to = buffer.end()-1; - + std::string s1, s2; - int i, n, nr; + unsigned int i; for(i=0; it != to; ++i, ++it){ if (i >= num){ @@ -1521,18 +1532,18 @@ bool io::In_Configuration::_read_velocity(math::VArray &vel, io::message::error); break; } - + _lineStream.clear(); // first 24 characters are ignored _lineStream.str((*it).substr(24,(*it).size())); // _lineStream >> n >> s1 >> s2 >> nr; _lineStream >> vel(i)(0) >> vel(i)(1) >> vel(i)(2); - + if(_lineStream.fail()){ io::messages.add("bad line in VELOCITY block", "In_Configuration", io::message::critical); - + return false; } } @@ -1544,12 +1555,12 @@ bool io::In_Configuration::_read_velocity(math::VArray &vel, io::message::error); return false; } - + return true; - + } -bool io::In_Configuration::_read_lattice_shifts(math::VArray &shift, +bool io::In_Configuration::_read_lattice_shifts(math::VArray &shift, std::vector &buffer, int const num) { @@ -1558,7 +1569,7 @@ bool io::In_Configuration::_read_lattice_shifts(math::VArray &shift, // no title in buffer! std::vector::const_iterator it = buffer.begin(), to = buffer.end()-1; - + std::string s1, s2; int i; @@ -1569,11 +1580,11 @@ bool io::In_Configuration::_read_lattice_shifts(math::VArray &shift, "In_Configuration", io::message::error); break; } - + _lineStream.clear(); _lineStream.str(*it); _lineStream >> shift(i)(0) >> shift(i)(1) >> shift(i)(2); - + if(_lineStream.fail()){ io::messages.add("bad line in LATTICESHIFTS block", "In_Configuration", @@ -1592,7 +1603,7 @@ bool io::In_Configuration::_read_lattice_shifts(math::VArray &shift, return true; } -bool io::In_Configuration::_read_genbox(math::Box &box, double &phi, +bool io::In_Configuration::_read_genbox(math::Box &box, double &phi, double &theta, double &psi, std::vector &buffer, math::boundary_enum const boundary) @@ -1602,29 +1613,29 @@ bool io::In_Configuration::_read_genbox(math::Box &box, double &phi, // no title in buffer! std::vector::const_iterator it = buffer.begin(), to = buffer.end()-1; - + int bound; _lineStream.clear(); _lineStream.str(*it); _lineStream >> bound; ++it; - + int i; - + for(i=0; it != to; ++i, ++it){ if (i>=4){ io::messages.add("bad line in GENBOX block","In_Configuration", io::message::error); return false; } - + _lineStream.clear(); _lineStream.str(*it); //point of origin is ignored so far if(i<3) _lineStream >> box(0)(i) >> box(1)(i) >> box(2)(i); - + if(_lineStream.fail()) return false; if (!_lineStream.eof()) { @@ -1632,7 +1643,7 @@ bool io::In_Configuration::_read_genbox(math::Box &box, double &phi, DEBUG(10, msg); } } - + math::boundary_enum conf_bound; switch(bound) { case -1: conf_bound = math::truncoct; break; @@ -1642,7 +1653,7 @@ bool io::In_Configuration::_read_genbox(math::Box &box, double &phi, default: io::messages.add("Invalid boundary conditions.", "In_Configuration", io::message::error); } - + // and check the boundary condition... if (conf_bound != boundary){ io::messages.add("Boundary condition from input file and from GENBOX do not match!" @@ -1662,16 +1673,16 @@ bool io::In_Configuration::_read_genbox(math::Box &box, double &phi, "In_Configuration", io::message::error); } long double cosdelta=(cosl(alpha)-cosl(beta)*cosl(gamma))/(sinl(beta)*sinl(gamma)); - long double sindelta=sqrtl(1-cosdelta*cosdelta); - + long double sindelta=sqrtl(1-cosdelta*cosdelta); + math::Vecl SBx(a, 0.0, 0.0); - math::Vecl SBy(b*cosl(gamma), - b*sinl(gamma), + math::Vecl SBy(b*cosl(gamma), + b*sinl(gamma), 0.0); - math::Vecl SBz(c*cosl(beta), - c*cosdelta*sinl(beta), + math::Vecl SBz(c*cosl(beta), + c*cosdelta*sinl(beta), c*sindelta*sinl(beta)); - + phi = math::Pi*box(0)(2)/180; theta = math::Pi*box(1)(2)/180; psi = math::Pi*box(2)(2)/180; @@ -1679,12 +1690,12 @@ bool io::In_Configuration::_read_genbox(math::Box &box, double &phi, box(0)=math::Vec(SBx); box(1)=math::Vec(SBy); box(2)=math::Vec(SBz); - + /* stay in the frame of the box -> don't rotate phi = math::Pi*box(0)(2)/180; theta = math::Pi*box(1)(2)/180; psi = math::Pi*box(2)(2)/180; - + const math::Vecl Rx(cosl(theta)*cosl(phi), cosl(theta)*sinl(phi), -sinl(theta)); @@ -1694,17 +1705,17 @@ bool io::In_Configuration::_read_genbox(math::Box &box, double &phi, const math::Vecl Rz(cosl(psi)*sinl(theta)*cosl(phi)+sinl(psi)*sinl(phi), cosl(psi)*sinl(theta)*sinl(phi)+(-sinl(psi)*cosl(phi)), cosl(psi)*cosl(theta)); - + math::Matrixl Rmat(Rx,Ry,Rz); - + // we have to convert Vecl to Vec by hand. box(0)=math::Vec(product(Rmat,SBx)); box(1)=math::Vec(product(Rmat,SBy)); box(2)=math::Vec(product(Rmat,SBz)); - + */ - + // and check the boundary condition... if (math::boundary_enum(bound) != boundary){ io::messages.add("Boundary condition from input file and from TRICLINICBOX do not match!" @@ -1714,10 +1725,10 @@ bool io::In_Configuration::_read_genbox(math::Box &box, double &phi, for(int i=0; i<3; i++){ for(int j=0; j<3; j++){ if(fabs(box(i)(j))::const_iterator it = buffer.begin(), to = buffer.end()-1; - + int bound; _lineStream.clear(); _lineStream.str(*it); _lineStream >> bound; ++it; - + int i; - + for(i=0; it != to; ++i, ++it){ if (i>=3){ io::messages.add("bad line in TRICLINICBOX block","In_Configuration", io::message::error); return false; } - + _lineStream.clear(); _lineStream.str(*it); _lineStream >> box(0)(i) >> box(1)(i) >> box(2)(i); - + if(_lineStream.fail()) return false; if (!_lineStream.eof()) { @@ -1760,7 +1771,7 @@ bool io::In_Configuration::_read_box(math::Box &box, double &phi, double &theta, DEBUG(10, msg); } } - + // and check the boundary condition... if (math::boundary_enum(bound) != boundary){ io::messages.add("Boundary condition from input file and from TRICLINICBOX do not match!" @@ -1768,13 +1779,13 @@ bool io::In_Configuration::_read_box(math::Box &box, double &phi, double &theta, "In_Configuration", io::message::warning); } if ( boundary == math::rectangular && - ( math::dot(box(0),box(1))!=0.0 - || math::dot(box(0),box(2))!=0.0 + ( math::dot(box(0),box(1))!=0.0 + || math::dot(box(0),box(2))!=0.0 || math::dot(box(1),box(2))!=0.0 ) ){ io::messages.add("Rectangular box, but box angles != 90", "In_Configuration", io::message::error); } - + //find phi, theta and psi math::Matrixl Rmat = (math::rmat(box)); long double R11R21 = sqrtl(Rmat(0, 0) * Rmat(0, 0) + Rmat(0, 1) * Rmat(0, 1)); @@ -1796,7 +1807,7 @@ bool io::In_Configuration::_read_box(math::Box &box, double &phi, double &theta, DEBUG(10, "original box: \n" << math::m2s(math::Matrix(box))); //box=math::product(math::transpose(Rmat),box); // box=math::product((Rmat),box); - + math::Box m(0.0); for (int i = 0; i < 3; ++i) for (int j = 0; j < 3; ++j) @@ -1814,7 +1825,7 @@ bool io::In_Configuration::_read_box(math::Box &box, double &phi, double &theta, math::Matrixl Smat = (math::smat(box, boundary)); DEBUG(10, "Smat \n" << math::m2s(Smat)); return true; - + } bool io::In_Configuration::_read_g96_box(math::Box &box, std::vector &buffer) @@ -1823,27 +1834,27 @@ bool io::In_Configuration::_read_g96_box(math::Box &box, std::vector::const_iterator it = buffer.begin(); - + _lineStream.clear(); _lineStream.str(*it); - + _lineStream >> box(0)(0) >> box(1)(1) >> box(2)(2); box(0)(1) = box(0)(2) = box(1)(0) = box(1)(2) = box(2)(0) = box(2)(1) = 0.0; - + if(_lineStream.fail()){ io::messages.add("failed to read BOX block", "In_Configuration", io::message::error); return false; } - + if (!_lineStream.eof()) { std::string msg = "Warning, end of line not reached, but should have been: \n" + *it + "\n"; DEBUG(10, msg); } return true; - + } bool io::In_Configuration::_read_flexv @@ -1858,11 +1869,11 @@ bool io::In_Configuration::_read_flexv // no title in buffer! std::vector::const_iterator it = buffer.begin(), to = buffer.end()-1; - - std::vector::const_iterator + + std::vector::const_iterator constr_it = constr.begin(), constr_to = constr.end(); - std::vector::const_iterator + std::vector::const_iterator pert_constr_it = pert_constr.begin(), pert_constr_to = pert_constr.end(); @@ -1870,24 +1881,24 @@ bool io::In_Configuration::_read_flexv int i, j, c, pc; double v, l; - + for(c=0; (it != to) && (constr_it != constr_to); ++it, ++constr_it, ++flexv_it, ++c){ _lineStream.clear(); _lineStream.str(*it); _lineStream >> i >> j >> l >> v; - + --i; --j; - + if(_lineStream.fail()){ io::messages.add("failed to read FLEXV block", "In_Configuration", io::message::error); return false; } - + if (!_lineStream.eof()) { std::string msg = "Warning, end of line not reached, but should have been: \n" + *it + "\n"; DEBUG(10, msg); @@ -1910,10 +1921,10 @@ bool io::In_Configuration::_read_flexv _lineStream.str(*it); _lineStream >> i >> j >> v; - + --i; --j; - + if(_lineStream.fail()){ io::messages.add("Failed to read (perturbed) FLEXV block", "In_Configuration", @@ -1934,14 +1945,14 @@ bool io::In_Configuration::_read_flexv *flexv_it = v; } - + if (c && !quiet) std::cout << "\tvelocities for " << c << " flexible constraints read in\n"; if (pc && !quiet) std::cout << "\tvelocities for " << pc << " perturbed flexible constraints read in\n"; - + return true; - + } bool io::In_Configuration::_read_stochastic_integral @@ -1955,7 +1966,7 @@ bool io::In_Configuration::_read_stochastic_integral // no title in buffer! std::vector::const_iterator it = buffer.begin(), to = buffer.end()-2; - + int i, j, c; std::string a, r; @@ -1964,13 +1975,13 @@ bool io::In_Configuration::_read_stochastic_integral if (c >= num_atoms){ std::cout << "too much data in STOCHINT block! got: " << c << " expected: " << num_atoms << std::endl; - + io::messages.add("too much data in STOCHINT block!", - "in_configuration", + "In_Configuration", io::message::error); return false; } - + _lineStream.clear(); _lineStream.str(*it); @@ -1982,13 +1993,13 @@ bool io::In_Configuration::_read_stochastic_integral if(_lineStream.fail()){ std::cout << "failed to read stochastic integral (STOCHINT block) line: " << c << "\n" << *it << std::endl; - + io::messages.add("failed to read stochastic integral (STOCHINT block)", "In_Configuration", io::message::error); return false; } - + if (!_lineStream.eof()) { std::string msg = "Warning, end of line not reached, but should have been: \n" + *it + "\n"; DEBUG(10, msg); @@ -2001,12 +2012,12 @@ bool io::In_Configuration::_read_stochastic_integral if (c != num_atoms){ std::cout << "not enough stochastic integrals in STOCHINT block! : " << " got: " << c << " expected: " << num_atoms << std::endl; - + io::messages.add("not enough stochastic integrals or seed missing in " "STOCHINT block!", "In_Configuration", io::message::error); return false; } - + // get the seed and trimm of whitespace seed = *it; std::string::size_type pos = seed.find_last_not_of(' '); @@ -2016,7 +2027,7 @@ bool io::In_Configuration::_read_stochastic_integral if(pos != std::string::npos) seed.erase(0, pos); } else seed.erase(seed.begin(), seed.end()); - + DEBUG(12, "trimmed seed: '" << seed << "'"); return true; } @@ -2027,7 +2038,7 @@ bool io::In_Configuration::_read_pertdata(topology::Topology & topo, std::string s; _lineStream.clear(); _lineStream.str(concatenate(buffer.begin(), buffer.end(), s)); - + double lambda; _lineStream >> lambda; if (_lineStream.fail()) { @@ -2035,7 +2046,7 @@ bool io::In_Configuration::_read_pertdata(topology::Topology & topo, io::message::error); return false; } - + // we have to set lambda twice to make sure old_lambda() is also // set to lambda. topo.lambda(lambda); @@ -2052,30 +2063,30 @@ bool io::In_Configuration::_read_distance_restraint_averages ) { DEBUG(8, "read distance restaint averages"); - - std::vector::const_iterator + + std::vector::const_iterator distanceress_it = distanceress.begin(), distanceress_to = distanceress.end(); - + std::string s; - + _lineStream.clear(); _lineStream.str(concatenate(buffer.begin(), buffer.end(), s)); - + for( ;distanceress_it != distanceress_to; ++distanceress_it){ double ave; _lineStream >> ave; - + if (_lineStream.fail() || ave < 0.0) { io::messages.add("Could not read averages from DISRESEXPAVE block", "In_Configuration", io::message::error); return false; } - - distanceres_av.push_back(ave); + + distanceres_av.push_back(ave); } - + return true; } @@ -2089,26 +2100,26 @@ _read_jvalue_av(std::vector &buffer, // no title in buffer! std::vector::const_iterator it = buffer.begin(), to = buffer.end()-1; - - std::vector::const_iterator + + std::vector::const_iterator jval_it = jval_res.begin(), jval_to = jval_res.end(); jval_av.clear(); - + double av; - + if (buffer.size() - 1 != jval_res.size()){ std::cout << "JVALUERESEXPAVE: " << buffer.size() - 1 << " but restraints: " << jval_res.size() << std::endl; io::messages.add("number of J-restraints does not match with number of " - "continuation data", "in_configuration", + "continuation data", "In_Configuration", io::message::error); return false; } - + for( ; (it != to) && (jval_it != jval_to); ++it, ++jval_it){ _lineStream.clear(); @@ -2122,14 +2133,14 @@ _read_jvalue_av(std::vector &buffer, } jval_av.push_back(av); } - + if (jval_it != jval_to || it != to){ io::messages.add("Wrong number of J-Values in JVALUERESEXPAVE block", "In_Configuration", io::message::error); return false; } - + return true; } @@ -2144,32 +2155,32 @@ _read_jvalue_le(std::vector &buffer, // no title in buffer! std::vector::const_iterator it = buffer.begin(), to = buffer.end()-1; - - std::vector::const_iterator + + std::vector::const_iterator jval_it = jval_res.begin(), jval_to = jval_res.end(); jval_epsilon.clear(); - + if (buffer.size() - 1 != jval_res.size()){ std::cout << "JVALRESEPSILON size: " << buffer.size() - 1 << " but restraints size: " << jval_res.size() << std::endl; io::messages.add("number of J-restraints does not match with number of " - "LE continuation data", "in_configuration", + "LE continuation data", "In_Configuration", io::message::error); return false; } - + for( ; (it != to) && (jval_it != jval_to); ++it, ++jval_it){ std::vector eps(grid_size, 0.0); _lineStream.clear(); _lineStream.str(*it); - - for(unsigned int i = 0; i < grid_size; ++i) + + for(unsigned int i = 0; i < grid_size; ++i) _lineStream >> eps[i]; - + if (_lineStream.fail()){ io::messages.add("Bad value in JVALRESEPSILON block", "In_Configuration", io::message::error); @@ -2177,14 +2188,14 @@ _read_jvalue_le(std::vector &buffer, } jval_epsilon.push_back(eps); } - + if (jval_it != jval_to || it != to){ io::messages.add("Wrong number of J-Values in JVALRESEPSILON block", "In_Configuration", io::message::error); return false; } - + return true; } @@ -2213,7 +2224,7 @@ bool io::In_Configuration::_read_order_parameter_restraint_averages( _lineStream >> ave(i, j); } } - + double D; _lineStream >> D; @@ -2290,13 +2301,13 @@ bool io::In_Configuration::_read_rdc_av(std::vector &buffer, // check if number of saved values is correct // we can only check the sum, not the individual values - int count=0; - for(int i=0; i &buffer, buff_to = buffer.end()-1; double av; - int i=0,j=0; // index for rdc-groups and rdcs in groups + unsigned int i=0,j=0; // index for rdc-groups and rdcs in groups for(; buff_it != buff_to; ++buff_it, ++j){ _lineStream.clear(); @@ -2342,7 +2353,7 @@ bool io::In_Configuration::_read_rdc_mf(std::vector &buffer, DEBUG(15, " * : " << rdc.size()*rdc[0].MFpoint.size()) if(rdc.size()*rdc[0].MFpoint.size() != buffer.size()-1){ io::messages.add("no or empty RDCMF block or insufficient information in configuration file", - "in_configuration", io::message::error); + "In_Configuration", io::message::error); return false; } @@ -2415,7 +2426,7 @@ bool io::In_Configuration::_read_rdc_t(std::vector &buffer, // check for buffer size which should be one line per rdc group if(rdc.size() != buffer.size()-1 ){ io::messages.add("no or empty RDCT block or insufficient information in configuration file", - "in_configuration", io::message::error); + "In_Configuration", io::message::error); return false; } @@ -2426,27 +2437,27 @@ bool io::In_Configuration::_read_rdc_t(std::vector &buffer, << std::setw(13) << "Axz" << std::setw(13) << "mass4" << std::setw(13) << "vel4" << std::setw(13) << "Ayz" << std::setw(13) << "mass5" << std::setw(13) << "vel5" << std::endl; } - + // tmp std::vector A(n_ah,0.0); std::vector mass(n_ah,0.0); std::vector vel(n_ah,0.0); - + std::vector::const_iterator it = buffer.begin(), - to = buffer.end() - 1; + to = buffer.end() - 1; int i=0; for (; it!=to; ++it, ++i){ _lineStream.clear(); _lineStream.str(*it); - _lineStream >> A[0] >> mass[0] >> vel[0] >> - A[1] >> mass[1] >> vel[1] >> + _lineStream >> A[0] >> mass[0] >> vel[0] >> + A[1] >> mass[1] >> vel[1] >> A[2] >> mass[2] >> vel[2] >> A[3] >> mass[3] >> vel[3] >> A[4] >> mass[4] >> vel[4]; - + if (_lineStream.fail()) { - io::messages.add("error while reading RDCT block ... there might be too few entries", "in_configuration", io::message::error); + io::messages.add("error while reading RDCT block ... there might be too few entries", "In_Configuration", io::message::error); return false; } @@ -2483,7 +2494,7 @@ bool io::In_Configuration::_read_rdc_sh(std::vector &buffer, // check for buffer size which should be one line per rdc group if(rdc.size() != buffer.size()-1 ){ io::messages.add("no or empty RDCSH block or insufficient information in configuration file", - "in_configuration", io::message::error); + "In_Configuration", io::message::error); return false; } @@ -2494,27 +2505,27 @@ bool io::In_Configuration::_read_rdc_sh(std::vector &buffer, << std::setw(13) << "c2,1" << std::setw(13) << "mass4" << std::setw(13) << "vel4" << std::setw(13) << "c2,2" << std::setw(13) << "mass5" << std::setw(13) << "vel5" << std::endl; } - + // tmp std::vector clm(n_clm,0.0); std::vector mass(n_clm,0.0); std::vector vel(n_clm,0.0); - + std::vector::const_iterator it = buffer.begin(), - to = buffer.end() - 1; + to = buffer.end() - 1; int i=0; for (; it!=to; ++it, ++i){ _lineStream.clear(); _lineStream.str(*it); - _lineStream >> clm[0] >> mass[0] >> vel[0] >> - clm[1] >> mass[1] >> vel[1] >> + _lineStream >> clm[0] >> mass[0] >> vel[0] >> + clm[1] >> mass[1] >> vel[1] >> clm[2] >> mass[2] >> vel[2] >> clm[3] >> mass[3] >> vel[3] >> clm[4] >> mass[4] >> vel[4]; - + if (_lineStream.fail()) { - io::messages.add("error while reading RDCSH block ... there might be too few entries", "in_configuration", io::message::error); + io::messages.add("error while reading RDCSH block ... there might be too few entries", "In_Configuration", io::message::error); return false; } @@ -2539,7 +2550,7 @@ bool io::In_Configuration::_read_rdc_sh(std::vector &buffer, } bool io::In_Configuration::_read_rdc_stochint(std::vector &buffer, - std::vector &rdc, + std::vector &rdc, simulation::rdc_type_enum &type, std::ostream & os) { @@ -2567,22 +2578,22 @@ bool io::In_Configuration::_read_rdc_stochint(std::vector &buffer, } if(!valid){ io::messages.add("no or empty RDCSH block or insufficient information in configuration file", - "in_configuration", io::message::error); + "In_Configuration", io::message::error); return false; } - if(type==simulation::rdc_mf) for (int i=0; i!=rdc.size(); ++i) rdc[i].stochastic_integral_mf.clear(); - else if(type==simulation::rdc_t) for (int i=0; i!=rdc.size(); ++i) rdc[i].stochastic_integral_t.clear(); - else if(type==simulation::rdc_sh) for (int i=0; i!=rdc.size(); ++i) rdc[i].stochastic_integral_sh.clear(); + if(type==simulation::rdc_mf) for (unsigned int i=0; i!=rdc.size(); ++i) rdc[i].stochastic_integral_mf.clear(); + else if(type==simulation::rdc_t) for (unsigned int i=0; i!=rdc.size(); ++i) rdc[i].stochastic_integral_t.clear(); + else if(type==simulation::rdc_sh) for (unsigned int i=0; i!=rdc.size(); ++i) rdc[i].stochastic_integral_sh.clear(); else assert (false); // tmp math::Vec tmp_v; double tmp_d; - + std::vector::const_iterator buff_it = buffer.begin(), - buff_to = buffer.end() - 1; + buff_to = buffer.end() - 1; int i=0; for (; buff_it!=buff_to; ++buff_it){ _lineStream.clear(); @@ -2594,7 +2605,7 @@ bool io::In_Configuration::_read_rdc_stochint(std::vector &buffer, if (_lineStream.fail()) { io::messages.add("error while reading RDCSTOCHINT block ... there might be too few entries", - "in_configuration", io::message::error); + "In_Configuration", io::message::error); return false; } @@ -2630,18 +2641,18 @@ _read_pscale_jrest(std::vector &buffer, // no title in buffer! std::vector::const_iterator it = buffer.begin(), to = buffer.end()-1; - - std::vector::const_iterator + + std::vector::const_iterator jval_it = jval_res.begin(), jval_to = jval_res.end(); if (buffer.size() - 1 != jval_res.size()){ io::messages.add("number of J-restraints does not match with number of " - "periodic scaling data", "in_configuration", + "periodic scaling data", "In_Configuration", io::message::error); return false; } - + pscale.t.clear(); pscale.scaling.clear(); @@ -2654,7 +2665,7 @@ _read_pscale_jrest(std::vector &buffer, if (_lineStream.fail()) { io::messages.add("Bad line in JVALUEPERSCALE block." - "periodic scaling", "in_configuration", + "periodic scaling", "In_Configuration", io::message::error); return false; } @@ -2663,14 +2674,14 @@ _read_pscale_jrest(std::vector &buffer, DEBUG(10, "\tt = " << t << "\tscaling = " << s); } - + if (jval_it != jval_to || it != to){ io::messages.add("Wrong number of J-Restraints in JVALUEPERSCALE block", "In_Configuration", io::message::error); return false; } - + return true; } @@ -2681,15 +2692,14 @@ _read_time(std::vector &buffer, DEBUG(8, "read time"); // no title in buffer! - std::vector::const_iterator it = buffer.begin(), - to = buffer.end()-1; - + std::vector::const_iterator it = buffer.begin(); + _lineStream.clear(); _lineStream.str(*it); int i; _lineStream >> i >> t; - + if (_lineStream.fail() || t < 0){ io::messages.add("Could not read time from configuration file", "In_Configuration", io::message::error); @@ -2706,17 +2716,16 @@ _read_time_step(std::vector &buffer, DEBUG(8, "read time step"); // no title in buffer! - std::vector::const_iterator it = buffer.begin(), - to = buffer.end()-1; - + std::vector::const_iterator it = buffer.begin(); + _lineStream.clear(); _lineStream.str(*it); int i; double t; - + _lineStream >> i >> t; - + if (_lineStream.fail() || t < 0 || i < 0){ io::messages.add("Could not read time from configuration file", "In_Configuration", io::message::error); @@ -2725,7 +2734,9 @@ _read_time_step(std::vector &buffer, sim.steps() = i; sim.time() = t; - + // if we analyze a trajectory we just keep reading until the end + if (sim.param().analyze.analyze) sim.param().step.number_of_steps=sim.steps()+2; + return true; } @@ -2744,36 +2755,36 @@ bool io::In_Configuration::check_coordinates return false; } } - + // do a quick estimate of the number of solvents if (sim.param().system.nsm > 0 && topo.num_solvents() == 1){ const unsigned int coords = num_coords - topo.num_solute_atoms(); - + if (topo.num_solvent_atoms() != coords) { // resolvating is very error prone. We disable it here return false; } /* std::ostringstream os; - os << "[Frame " << sim.steps() << "] resolvating: " + os << "[Frame " << sim.steps() << "] resolvating: " << topo.num_solvent_atoms() / topo.solvent(0).num_atoms() << " -> " << mols << " solvents"; - + io::messages.add(os.str(), - "in_configuration", + "In_Configuration", io::message::notice); - + os << "\tresolvating! expected solvent atoms = " << topo.num_solvent_atoms() << " got " << coords << std::endl; os << "\t(total coords: " << num_coords << "\n\t solute coords: " << topo.num_solute_atoms() << "\n\t solvent mols: " << mols << "\n\t)" << std::endl; - + topo.resolvate(0, mols); conf.resize(num_coords); - + if (sim.multibath().bath_index()[sim.multibath().bath_index().size()-1].last_atom != topo.num_atoms() - 1){ sim.multibath().bath_index()[sim.multibath().bath_index().size()-1].last_atom @@ -2830,7 +2841,7 @@ std::vector &buffer, bool hasTitle) return false; } return true; - + } bool io::In_Configuration::_read_leusbias( @@ -2882,6 +2893,16 @@ bool io::In_Configuration::_read_leusbias( io::message::error); return false; } + + /* + if (form==0 && (u.width[i] !=1 || u.cutoff[i] != 1)) { + io::messages.add("LEUSBIAS block: functional form 0 requires WLES and RLES to be 1.0", + "In_Configuration", + io::message::error); + return false; + } + */ + u.variable_type[i] = util::Umbrella::variable_type_enum(type); DEBUG(10, "variable type: " << u.variable_type[i]); u.functional_form[i] = util::Umbrella::functional_form_enum(form); @@ -2900,7 +2921,7 @@ bool io::In_Configuration::_read_leusbias( u.configuration_block_pos = _lineStream.tellg(); u.configuration_block = _lineStream.str(); umbrellas.push_back(u); - + // skip the rest of the data - read it to dummies unsigned int num_conf; _lineStream >> num_conf; @@ -2926,7 +2947,7 @@ bool io::In_Configuration::_read_leusbias( return true; } -bool io::In_Configuration::_read_bsleus(util::BS_Umbrella& bs_umbrella, +bool io::In_Configuration::_read_bsleus(util::BS_Umbrella& bs_umbrella, std::vector buffer) { DEBUG(8, "read BSLEUSMEM"); @@ -2934,7 +2955,7 @@ bool io::In_Configuration::_read_bsleus(util::BS_Umbrella& bs_umbrella, std::string s; _lineStream.clear(); _lineStream.str(concatenate(buffer.begin(), buffer.end()-1, s)); - + int numPotentials, num_gp, id, have_aux; _lineStream >> numPotentials >> have_aux; if (_lineStream.fail()){ @@ -2950,7 +2971,7 @@ bool io::In_Configuration::_read_bsleus(util::BS_Umbrella& bs_umbrella, "In_Configuration", io::message::error); return false; } - + for (int i = 0; i < numPotentials; i++){ int subid; _lineStream >> id >> subid >> num_gp; @@ -2975,7 +2996,7 @@ bool io::In_Configuration::_read_bsleus(util::BS_Umbrella& bs_umbrella, } bs_umbrella.setMemory(id, subid, memVector); } - + // Auxiliary Memory if (have_aux == 0){ io::messages.add("No auxiliary Memory given. Will set it to zero!", @@ -3011,14 +3032,14 @@ bool io::In_Configuration::_read_bsleus(util::BS_Umbrella& bs_umbrella, subid--; // Convert to GROMOS bs_umbrella.setCounter(subid, auxc, redc); } - + // Read in potentials int subid; for (int i = 0; i < numPotentials; i++) { _lineStream >> id >> subid >> num_gp; if (_lineStream.fail()) { std::ostringstream os; - os << "BSLEUSMEM block: Could not read auxiliary memory of sphere " + os << "BSLEUSMEM block: Could not read auxiliary memory of sphere " << (i + 1); io::messages.add(os.str(), "In_Configuration", io::message::error); return false; @@ -3030,7 +3051,7 @@ bool io::In_Configuration::_read_bsleus(util::BS_Umbrella& bs_umbrella, _lineStream >> mem; if (_lineStream.fail()) { std::ostringstream os; - os << "BSLEUSMEM block: Could not read auxiliary memory of sphere " + os << "BSLEUSMEM block: Could not read auxiliary memory of sphere " << (i + 1); io::messages.add(os.str(), "In_Configuration", io::message::error); return false; @@ -3043,7 +3064,7 @@ bool io::In_Configuration::_read_bsleus(util::BS_Umbrella& bs_umbrella, return true; } -bool io::In_Configuration::_read_bsleuspos(util::BS_Umbrella& bs_umbrella, +bool io::In_Configuration::_read_bsleuspos(util::BS_Umbrella& bs_umbrella, std::vector buffer) { DEBUG(8, "read BSLEUSPOS"); @@ -3051,7 +3072,7 @@ bool io::In_Configuration::_read_bsleuspos(util::BS_Umbrella& bs_umbrella, std::string s; _lineStream.clear(); _lineStream.str(concatenate(buffer.begin(), buffer.end()-1, s)); - + int num_subspaces; _lineStream >> num_subspaces; if (_lineStream.fail()){ @@ -3066,7 +3087,7 @@ bool io::In_Configuration::_read_bsleuspos(util::BS_Umbrella& bs_umbrella, "In_Configuration", io::message::error); return false; } - + for (int i = 0; i < num_subspaces; i++){ int subid, num_dim; _lineStream >> subid >> num_dim; @@ -3091,7 +3112,7 @@ bool io::In_Configuration::_read_bsleuspos(util::BS_Umbrella& bs_umbrella, } bs_umbrella.setPosition(subid, posVector); } - + return true; } @@ -3107,7 +3128,7 @@ simulation::Multibath & multibath) { b_to = multibath.end(); const unsigned int num_zeta = b_it->zeta.size(); - + for (; it != to && b_it != b_to; ++it, ++b_it) { _lineStream.clear(); _lineStream.str(*it); @@ -3127,14 +3148,14 @@ simulation::Multibath & multibath) { "In_Configuration", io::message::error); return false; } - + if (it != to) { io::messages.add("Could not read Nose-Hoover-Chains: Too many lines (baths)", "In_Configuration", io::message::error); return false; } - return true; + return true; } bool io::In_Configuration::_read_rottrans( @@ -3145,7 +3166,7 @@ configuration::Configuration::special_struct::rottrans_constr_struct & rottrans) // no title in buffer! std::vector::const_iterator it = buffer.begin(), to = buffer.end()-1; - + unsigned int i; for (i = 0; it != to && i < 3; ++it, ++i) { _lineStream.clear(); @@ -3165,7 +3186,7 @@ configuration::Configuration::special_struct::rottrans_constr_struct & rottrans) "In_Configuration", io::message::error); return false; } - + for (i = 0; it != to && i < 3; ++it, ++i) { _lineStream.clear(); _lineStream.str(*it); @@ -3184,10 +3205,10 @@ configuration::Configuration::special_struct::rottrans_constr_struct & rottrans) "In_Configuration", io::message::error); return false; } - + // make sure there is enough space for the positions rottrans.pos.resize(last); - + for (i = 0; it != to && i < last; ++it, ++i) { _lineStream.clear(); _lineStream.str(*it); @@ -3200,21 +3221,21 @@ configuration::Configuration::special_struct::rottrans_constr_struct & rottrans) "In_Configuration", io::message::error); return false; } - } - + } + if (it != to) { io::messages.add("ROTTRANSREFPOS block: Too many lines (reference positions)", "In_Configuration", io::message::error); return false; } - + if (i != last) { io::messages.add("ROTTRANSREFPOS block: Not enough lines (reference positions)", "In_Configuration", io::message::error); return false; - } + } - return true; + return true; } bool io::In_Configuration:: @@ -3241,7 +3262,7 @@ _read_xray_av(std::vector &buffer, if (buffer.size() - 1 != xray_res.size() + xray_rfree.size()) { io::messages.add("number of Xray-restraints and R-free hkls does not match with number of " - "continuation data", "in_configuration", + "continuation data", "In_Configuration", io::message::error); return false; } @@ -3305,7 +3326,7 @@ _read_xray_umbrellaweightthesholds(std::vector &buffer, for(unsigned int i = 0; i < umb_weight.size(); ++i) { std::istringstream line(buffer[i]); - line >> umb_weight[i].threshold + line >> umb_weight[i].threshold >> umb_weight[i].threshold_growth_rate >> umb_weight[i].threshold_overshoot >> umb_weight[i].threshold_freeze; @@ -3348,4 +3369,3 @@ _read_xray_bfactors(std::vector &buffer, } return true; } - diff --git a/gromosXX/src/io/configuration/in_configuration.h b/gromosXX/src/io/configuration/in_configuration.h index 171cbbd93..5a5302299 100644 --- a/gromosXX/src/io/configuration/in_configuration.h +++ b/gromosXX/src/io/configuration/in_configuration.h @@ -283,7 +283,7 @@ namespace io { * read VELOCITY block. */ bool _read_velocity(math::VArray &vel, std::vector &buffer, - int const num); + unsigned int const num); /** * read LATTICESHIFTS block. @@ -459,7 +459,7 @@ namespace io { simulation::Multibath & multibath); /** - * read ROTOTRANSREF block + * read ROTTRANSREFPOS block */ bool _read_rottrans(std::vector &buffer, unsigned int last, configuration::Configuration::special_struct::rottrans_constr_struct & rottrans); diff --git a/gromosXX/src/io/configuration/out_configuration.cc b/gromosXX/src/io/configuration/out_configuration.cc index 132caa7a3..5550372af 100644 --- a/gromosXX/src/io/configuration/out_configuration.cc +++ b/gromosXX/src/io/configuration/out_configuration.cc @@ -58,6 +58,7 @@ io::Out_Configuration::Out_Configuration(std::string title, m_output(os), m_final(false), m_replica(false), +m_write_special(false), m_every_pos(0), m_every_vel(0), m_every_force(0), @@ -79,7 +80,6 @@ m_every_adde(0), m_every_nemd(0), m_every_oparam(0), m_every_rdc(0), -m_write_special(false), m_write_blockaverage_energy(false), m_write_blockaverage_free_energy(false), m_precision(9), @@ -249,7 +249,7 @@ void io::Out_Configuration::init(io::Argument & args, io::message::error); } - if (param.replica.num_T * param.replica.num_l) { + if (param.replica.num_T && param.replica.num_l) { m_replica = true; } @@ -556,7 +556,7 @@ void io::Out_Configuration::write(configuration::Configuration &conf, _print_pscale_jrest(conf, topo, m_final_conf); } - if (sim.param().multibath.nosehoover > 1) { + if (sim.param().multibath.algorithm > 1) { _print_nose_hoover_chain_variables(sim.multibath(), m_final_conf); } diff --git a/gromosXX/src/io/configuration/out_configuration.h b/gromosXX/src/io/configuration/out_configuration.h index 11e6a2597..96cb1a127 100644 --- a/gromosXX/src/io/configuration/out_configuration.h +++ b/gromosXX/src/io/configuration/out_configuration.h @@ -435,6 +435,11 @@ namespace io { bool m_final; bool m_replica; + /** + * true if a special trajectory has to be written + */ + bool m_write_special; + int m_every_pos; int m_every_vel; int m_every_force; @@ -442,11 +447,6 @@ namespace io { int m_every_free_energy; int m_every_blockaverage; - - /** - * true if a special trajectory has to be written - */ - bool m_write_special; int m_every_cos_pos; int m_every_jvalue; int m_every_xray; diff --git a/gromosXX/src/io/ifp.h b/gromosXX/src/io/ifp.h index 8c0102362..b1a05f1da 100644 --- a/gromosXX/src/io/ifp.h +++ b/gromosXX/src/io/ifp.h @@ -21,40 +21,6 @@ namespace io { virtual ~IFP() { } - /** - * Read in the harmonic bond parameter. - */ - virtual void read_harmonic_bonds(std::vector &b, - std::ostream & os = std::cout) = 0; - /** - * Read in the quartic bond parameter. - */ - virtual void read_g96_bonds(std::vector &b, - std::ostream & os = std::cout) = 0; - /** - * Read in the bond angle parameter. - */ - virtual void read_angles(std::vector &a, - std::ostream & os = std::cout) = 0; - - /** - * Read in the harmonic bond angle parameter. - */ - virtual void read_harm_angles(std::vector &a, - std::ostream & os = std::cout) = 0; - - /** - * Read in the improper dihedral parameter. - */ - virtual void read_improper_dihedrals(std::vector &i, - std::ostream & os = std::cout) = 0; - - /** - * Read in the dihedral parameter. - */ - virtual void read_dihedrals(std::vector &d, - std::ostream & os = std::cout) = 0; - /** * Read in the nonbonded interaction types (lennard-jones). */ diff --git a/gromosXX/src/io/instream.cc b/gromosXX/src/io/instream.cc index 514c3e340..3d4525103 100644 --- a/gromosXX/src/io/instream.cc +++ b/gromosXX/src/io/instream.cc @@ -68,6 +68,8 @@ void io::GInStream::readStream() { } else { std::string n = buffer[0]; DEBUG(10, "reading block -" << buffer[0] << "- size " << buffer.size()); + if (m_block.find(buffer[0]) != m_block.end()) + io::messages.add("Found more than one "+buffer[0]+" block.", "GInStream", io::message::warning); m_block[buffer[0]] = buffer; } buffer.clear(); diff --git a/gromosXX/src/io/parameter/check_parameter.cc b/gromosXX/src/io/parameter/check_parameter.cc index 3a33716db..666fb2b4e 100644 --- a/gromosXX/src/io/parameter/check_parameter.cc +++ b/gromosXX/src/io/parameter/check_parameter.cc @@ -1,5 +1,5 @@ /** - * @file check_parameter + * @file check_parameter.cc * check those parameters */ @@ -24,43 +24,194 @@ #define SUBMODULE parameter -int io::check_parameter(simulation::Simulation & sim) +int io::check_parameter(simulation::Simulation & sim){ + int check1 = simple_crosschecks(sim); + int check2 = check_features(sim); + if (check1 || check2) + return -1; + else + return 0; +} + +int io::simple_crosschecks(simulation::Simulation & sim) { + const simulation::Parameter & param = sim.param(); + + // no velocity writeout or generation with energy minimization + if (param.minimise.ntem != 0 && param.write.velocity != 0) + io::messages.add("WRITETRAJ: NTWV has to be 0 for energy minimization.", + "In_Parameter", io::message::error); + + if (param.start.generate_velocities && param.minimise.ntem==1) + io::messages.add("INITIALISE block: NTIVEL=1 even though we do an energy minimization", + "In_Parameter", io::message::warning); + + // no pressure or temperature coupling with energy minimization + if (param.pcouple.calculate && param.minimise.ntem==1) + io::messages.add("PRESSURESCALE block: pressure coupling not allowed with steepest descent minimization", + "In_Parameter", io::message::error); + + if (param.multibath.couple && param.minimise.ntem==1) + io::messages.add("MULTIBATH block: temperature coupling not allowed with energy minimization", + "In_Parameter", io::message::error); + + // no reading of atomic shift vectors in vacuum + if (param.boundary.boundary == math::vacuum && param.start.read_lattice_shifts) + io::messages.add("Atomic shift vector reading (NTISHI=0) not possible under vacuum boundary conditions.", + "In_Parameter", io::message::error); + + // free-energy trajectories are useless if there is no perturbation + if (!param.perturbation.perturbation && param.write.free_energy>0) + io::messages.add("NTWG>0: free-energy trajectory writing even though perturbation is off.", + "In_Parameter", io::message::warning); + + // generating nose-hoover chain thermostat variables not allowed when not using + // the corresponding algorithm + if (!param.start.read_nosehoover_chains && param.multibath.algorithm<2) + io::messages.add("MULTIBATH block: NTINHT must be 0 when not using Nose-Hoover chains for temperature coupling", + "In_Parameter", io::message::error); + + // no scaling of reference positions when pressure scaling is off + if (param.pcouple.scale == math::pcouple_off && param.posrest.scale_reference_positions) + io::messages.add("POSITIONRES block: NTPORS=1 can not be used when pressure scaling is off.", + "In_Parameter", io::message::error); + + // center of mass removal and roto-translational constraints should not be used together + if (param.rottrans.rottrans && param.centreofmass.skip_step != 0) + io::messages.add("ROTTRANS or COMTRANSROT should not be used at the same time.", + "In_Parameter", io::message::warning); + + // trajectory analysis not allow with vacuum + if (param.boundary.boundary == math::vacuum && param.analyze.analyze) + io::messages.add("READTRAJ block: not allowed with vacuum boundary conditions.", "In_Parameter", + io::message::error); + + // do not try to generate velocities or shake velocities with trajectory analysis + if (param.analyze.analyze && (param.start.generate_velocities or param.start.shake_vel)) + io::messages.add("READTRAJ block: requires NTIVEL=0 and NTISHK=0,1.", "In_Parameter", + io::message::error); + + // do not write velocity trajectory when doing trajectory analysis + if (param.analyze.analyze && param.write.velocity!=0) + io::messages.add("READTRAJ block requires NTWV=0.", "In_Parameter", + io::message::error); + + // no generation of stochastic integrals when stochastic dynamics is off + if (param.stochastic.generate_integral && param.stochastic.sd==0) + io::messages.add("STOCHDYN block: if stochastic dynamics is off, NTISTI has to be set to 0", + "In_Parameter", io::message::error); + + // perturbation + if (param.montecarlo.mc && !param.perturbation.perturbation) { + io::messages.add("CHEMICALMONTECARLO only possible if perturbation is on." + " Set NTG to 1.", + "In_Parameter", io::message::error); + } + + // Multicell with polarization mey converge differently + if (param.polarise.cos && param.multicell.multicell) { + io::messages.add("MULTICELL block: multiple unit cell simulation using polarisation may " + "converge differently. Use a small MINFIELD parameter.", + "In_Parameter", io::message::warning); + } + + // EDS: make sure we simulate at a given temperature (unambiguous kT) + if (param.eds.eds && !param.multibath.couple) { + io::messages.add("EDS block: EDS requires temperature coupling.", + "In_Parameter", io::message::error); + } + + // check whether all baths have the same temperature (unambiguous kT) + if (param.eds.eds){ + for (unsigned int i = 1; i < param.multibath.multibath.size(); i++) { + if (param.multibath.multibath.bath(i).temperature != + param.multibath.multibath.bath(0).temperature) { + io::messages.add("EDS block: all baths must have the same temperature.", + "In_Parameter", io::message::error); + break; + } + } + } + + // lattice shift and pressure coupling: + if (param.pcouple.scale != math::pcouple_off + && param.nonbonded.method == simulation::el_p3m + && param.nonbonded.accuracy_evaluation == 0) + io::messages.add("NONBONDED block: Pressure scaling but no quality evaluation of influence function." + " Set NQEVAL > 0.", "In_Parameter", io::message::warning); + + if (param.pcouple.scale == math::pcouple_full_anisotropic + && (param.nonbonded.method == simulation::el_p3m || param.nonbonded.method == simulation::el_ewald)) { + io::messages.add("NONBONDED block: Full anisotropic pressure scaling " + "could not be tested yet.", "In_Parameter", io::message::warning); + } + + // pressure scaling and boundary conditions + if (param.pcouple.scale == math::pcouple_full_anisotropic && param.boundary.boundary != math::triclinic) + io::messages.add("PRESSURESCALE block: full anisotropic pressure scaling requires a triclinic box.", + "In_Parameter", io::message::error); + if ((param.pcouple.scale == math::pcouple_anisotropic || param.pcouple.scale == math::pcouple_semi_anisotropic) + && (param.boundary.boundary != math::triclinic && param.boundary.boundary != math::rectangular)) + io::messages.add("PRESSURESCALE block: (semi-)anisotropic pressure scaling requires a rectangular or triclinic box.", + "In_Parameter", io::message::error); + + // warn if Hamiltonian repex but no perturbation + if (param.replica.num_l > 1 && !param.perturbation.perturbation) + io::messages.add("REPLICA block: Hamiltonian replica exchange but perturbation is off.", + "In_Parameter", io::message::warning); + + // extended TI input + if (param.perturbation.perturbation == false && param.precalclam.nr_lambdas > 0) + io::messages.add("PRECALCLAM cannot be on without perturbation", + "In_Parameter", io::message::error); + if (param.precalclam.nr_lambdas > 0 & (param.write.energy == 0 || param.write.free_energy ==0 || + param.write.energy != param.write.free_energy)) + io::messages.add("PRECALCLAM requires NTWE=NTWG > 0", + "In_Parameter", io::message::error); + + if (io::messages.contains(io::message::error) || + io::messages.contains(io::message::critical)) + return -1; + else + return 0; +} + +int io::check_features(simulation::Simulation & sim) { const simulation::Parameter & param = sim.param(); std::vector features; - + // this macro function is needed by the contrib script to automatically // unlock features. Only features added with this add function are recognized // by the script! #define add(x, y, z) features.push_back(util::Feature((x), (y), (z))) - + // Add all features of GROMOS that you want to cross check using the // "add" macro. - + // SYSTEM block add("solute", "solute simulation", param.system.npm == 1); add("solvent", "solvent simulation", param.system.nsm > 0); - add("solvent_only", "solvent only simulation", param.system.npm == 0 && + add("solvent_only", "solvent only simulation", param.system.npm == 0 && param.system.nsm > 0); // ENERGYMIN block - add("steepest_descent", "steepest descent energy minimisation", + add("steepest_descent", "steepest descent energy minimisation", param.minimise.ntem == 1); // CONSTRAINT block - add("solute_constraint_off", "unconstrained solute", + add("solute_constraint_off", "unconstrained solute", param.constraint.solute.algorithm == simulation::constr_off); - add("solute_shake", "SHAKE for solute", + add("solute_shake", "SHAKE for solute", param.constraint.solute.algorithm == simulation::constr_shake); - add("solute_lincs", "LINCS for solute", + add("solute_lincs", "LINCS for solute", param.constraint.solute.algorithm == simulation::constr_lincs); - add("solute_flexshake", "flexible SHAKE for solute", + add("solute_flexshake", "flexible SHAKE for solute", param.constraint.solute.algorithm == simulation::constr_flexshake); - add("solvent_constraint_off", "unconstrained solvent", + add("solvent_constraint_off", "unconstrained solvent", param.constraint.solvent.algorithm == simulation::constr_off); - add("solvent_shake", "SHAKE for solvent", + add("solvent_shake", "SHAKE for solvent", param.constraint.solvent.algorithm == simulation::constr_shake); - add("solvent_lincs", "LINCS for solvent", + add("solvent_lincs", "LINCS for solvent", param.constraint.solvent.algorithm == simulation::constr_lincs); - add("solvent_settle", "SETTLE for solvent", + add("solvent_settle", "SETTLE for solvent", param.constraint.solvent.algorithm == simulation::constr_settle); // PRESSURESCALE block add("pressure_calculation", "pressure calculation", param.pcouple.calculate); @@ -76,9 +227,9 @@ int io::check_parameter(simulation::Simulation & sim) // PERTURBATION block add("perturbation", "free energy perturbation", param.perturbation.perturbation); add("perturbation_scaling", "perturbation scaling", param.perturbation.scaling); - add("slow_growth", "slow growth", param.perturbation.perturbation && + add("slow_growth", "slow growth", param.perturbation.perturbation && param.perturbation.dlamt > 0.0); - + // LAMBDAS block add("individual_lambdas", "individual lambdas", param.lambdas.individual_lambdas); @@ -96,7 +247,7 @@ int io::check_parameter(simulation::Simulation & sim) add("crf", "coulomb reaction field interaction", param.force.nonbonded_crf == 1); add("lj", "Lennard-Jones interaction", param.force.nonbonded_vdw == 1); // COMTRANSROT block - add("com_removal", "COM motion removal", param.centreofmass.remove_rot || + add("com_removal", "COM motion removal", param.centreofmass.remove_rot || param.centreofmass.remove_trans); // LONGRANGE block add("rf_excluded", "reaction field for excluded pairs", param.nonbonded.rf_excluded); @@ -110,20 +261,20 @@ int io::check_parameter(simulation::Simulation & sim) add("cg_martini", "coarse-grained simulation", param.cgrain.level == 1); add("cg_gromos", "coarse-grained simulation", param.cgrain.level == 2); add("mixed_grain", "mixed-grained simulation", param.cgrain.level == 3); - + // MULTIBATH block - add("temp_berendsen", "Berendsen thermostat", param.multibath.nosehoover == 0); - add("temp_nosehoover", "Nose-Hoover thermostat", param.multibath.nosehoover == 1); - add("temp_nosehoover_chains", "Nose-Hoover chains thermostat", - param.multibath.nosehoover == 2); + add("temp_berendsen", "Berendsen thermostat", param.multibath.algorithm == 0); + add("temp_nosehoover", "Nose-Hoover thermostat", param.multibath.algorithm == 1); + add("temp_nosehoover_chains", "Nose-Hoover chains thermostat", + param.multibath.algorithm == 2); // POSITIONRES block add("position_rest", "position restraints", param.posrest.posrest != simulation::posrest_off && param.posrest.posrest != simulation::posrest_const); - add("position_const", "position constraints without reference position scaling", - param.posrest.posrest == simulation::posrest_const && + add("position_const", "position constraints without reference position scaling", + param.posrest.posrest == simulation::posrest_const && !param.posrest.scale_reference_positions); - add("position_const_scaled", "position constraints with reference position scaling", - param.posrest.posrest == simulation::posrest_const && + add("position_const_scaled", "position constraints with reference position scaling", + param.posrest.posrest == simulation::posrest_const && param.posrest.scale_reference_positions); // DISTANCERES block add("distance_rest", "distance restraints", param.distanceres.distanceres != 0); @@ -136,9 +287,9 @@ int io::check_parameter(simulation::Simulation & sim) // JVALUERES block add("jvalue_rest", "J-value restraints", param.jvalue.mode != simulation::jvalue_restr_off); // RDC block - add("rdc_rest", "RDC restraints", param.rdc.mode != simulation::rdc_restr_off); + add("rdc_rest", "RDC restraints", param.rdc.mode != simulation::rdc_restr_off); // PERSCALE block - add("perscale", "peridoic scaling", param.pscale.jrest); + add("perscale", "periodic scaling", param.pscale.jrest); // ROTTRANS block add("rottrans", "roto-translational constraints", param.rottrans.rottrans); // INNERLOOP block @@ -166,9 +317,9 @@ int io::check_parameter(simulation::Simulation & sim) // MONTECARLO block add("montecarlo", "chemical monte-carlo", param.montecarlo.mc); // POLARISE block - add("polarisation_cos", "COS polarisation", param.polarise.cos && + add("polarisation_cos", "COS polarisation", param.polarise.cos && !param.polarise.damp); - add("polarisation_cos_damped", "COS polarisation", param.polarise.cos && + add("polarisation_cos_damped", "COS polarisation", param.polarise.cos && param.polarise.damp); // SASA block add("sasa", "SASA implicit solvent model", param.sasa.switch_sasa == true && @@ -176,13 +327,13 @@ int io::check_parameter(simulation::Simulation & sim) add("sasavol", "SASA/VOL implicit solvent model", param.sasa.switch_volume == true && param.sasa.sigma_v != 0.0); // RANDOMNUMBERS block - add("random_gromos", "GROMOS96 random numbers", + add("random_gromos", "GROMOS96 random numbers", param.rng.rng == simulation::random_g96); - add("random_gsl", "GROMOS96 random numbers", + add("random_gsl", "GROMOS96 random numbers", param.rng.rng == simulation::random_gsl); // EDS block add("eds", "Enveloping distribution sampling", param.eds.eds); - + // parallelization add("parallel_mpi", "MPI parallelization", sim.mpi); int size = 1; @@ -195,22 +346,22 @@ int io::check_parameter(simulation::Simulation & sim) size = omp_get_num_threads(); } } -#endif +#endif add("parallel_omp", "OpenMP parallelization", size > 1); - + // multiple energy groups add("mult_energy_groups", "multiple energy groups", param.force.energy_group.size() > 1); - + // lattice sum: Ewald add("ewald", "Ewald sum electrostatics.\n" " If this is changed in the future, line 2534 in\n" - " out_configuration.cc needs to be adapted", + " out_configuration.cc needs to be adapted", param.nonbonded.method == simulation::el_ewald); - + // lattice sum: P3M add("p3m", "P3M electrostatics.\n" " If this is changed in the future, line 2534 in\n" - " out_configuration.cc needs to be adapted", + " out_configuration.cc needs to be adapted", param.nonbonded.method == simulation::el_p3m); add("leus", "local elevation umbrella sampling", param.localelev.localelev != simulation::localelev_off); @@ -218,15 +369,15 @@ int io::check_parameter(simulation::Simulation & sim) add("bsleus", "Balls and Sticks local elevation umbrella sampling", param.bsleus.bsleus != simulation::bsleus_off); add("xray", "X-ray restraints", param.xrayrest.xrayrest != simulation::xrayrest_off); - + // force groups add("force_groups", "force groups", param.force.force_groups); // we don't need the add function anymore. #undef add - + util::FeatureChecker fc(features); - + // unlock the features here. This can be very tedious. Use the script // unlock_features.pl in the contrib directory to unlock your feature against // all others and delete the lines you don't need. Make sure you don't unlock @@ -276,7 +427,7 @@ int io::check_parameter(simulation::Simulation & sim) fc.unlock("solute", "dihedral_rest"); fc.unlock("solute", "dihedral_const"); fc.unlock("solute", "jvalue_rest"); - fc.unlock("solute", "rdc_rest"); + fc.unlock("solute", "rdc_rest"); fc.unlock("solute", "perscale"); fc.unlock("solute", "rottrans"); fc.unlock("solute", "repex_temp"); @@ -337,7 +488,7 @@ int io::check_parameter(simulation::Simulation & sim) fc.unlock("solvent", "dihedral_rest"); fc.unlock("solvent", "dihedral_const"); fc.unlock("solvent", "jvalue_rest"); - fc.unlock("solvent", "rdc_rest"); + fc.unlock("solvent", "rdc_rest"); fc.unlock("solvent", "perscale"); fc.unlock("solvent", "rottrans"); fc.unlock("solvent", "repex_temp"); @@ -421,7 +572,7 @@ int io::check_parameter(simulation::Simulation & sim) fc.unlock("steepest_descent", "improper"); fc.unlock("steepest_descent", "crf"); fc.unlock("steepest_descent", "lj"); - fc.unlock("steepest_descent", "com_removal"); + //fc.unlock("steepest_descent", "com_removal"); fc.unlock("steepest_descent", "rf_excluded"); fc.unlock("steepest_descent", "pairlist_standard"); fc.unlock("steepest_descent", "pairlist_grid"); @@ -439,11 +590,11 @@ int io::check_parameter(simulation::Simulation & sim) fc.unlock("steepest_descent", "dihedral_rest"); fc.unlock("steepest_descent", "dihedral_const"); fc.unlock("steepest_descent", "jvalue_rest"); - fc.unlock("steepest_descent", "rdc_rest"); + fc.unlock("steepest_descent", "rdc_rest"); fc.unlock("steepest_descent", "perscale"); fc.unlock("steepest_descent", "rottrans"); fc.unlock("steepest_descent", "multicell"); - fc.unlock("steepest_descent", "analysis"); + //fc.unlock("steepest_descent", "analysis"); fc.unlock("steepest_descent", "no_integration"); fc.unlock("steepest_descent", "multistep"); fc.unlock("steepest_descent", "multistep_boost"); @@ -545,7 +696,7 @@ int io::check_parameter(simulation::Simulation & sim) fc.unlock("solute_shake", "dihedral_rest"); fc.unlock("solute_shake", "dihedral_const"); fc.unlock("solute_shake", "jvalue_rest"); - fc.unlock("solute_shake", "rdc_rest"); + fc.unlock("solute_shake", "rdc_rest"); fc.unlock("solute_shake", "perscale"); fc.unlock("solute_shake", "rottrans"); fc.unlock("solute_shake", "repex_temp"); @@ -642,7 +793,7 @@ int io::check_parameter(simulation::Simulation & sim) fc.unlock("solute_flexshake", "distance_rest"); fc.unlock("solute_flexshake", "dihedral_rest"); fc.unlock("solute_flexshake", "jvalue_rest"); - fc.unlock("solute_flexshake", "rdc_rest"); + fc.unlock("solute_flexshake", "rdc_rest"); fc.unlock("solute_flexshake", "perscale"); fc.unlock("solute_flexshake", "rottrans"); fc.unlock("solute_flexshake", "repex_temp"); @@ -690,7 +841,7 @@ int io::check_parameter(simulation::Simulation & sim) fc.unlock("solvent_constraint_off", "dihedral_rest"); fc.unlock("solvent_constraint_off", "dihedral_const"); fc.unlock("solvent_constraint_off", "jvalue_rest"); - fc.unlock("solvent_constraint_off", "rdc_rest"); + fc.unlock("solvent_constraint_off", "rdc_rest"); fc.unlock("solvent_constraint_off", "perscale"); fc.unlock("solvent_constraint_off", "rottrans"); fc.unlock("solvent_constraint_off", "repex_temp"); @@ -743,7 +894,7 @@ int io::check_parameter(simulation::Simulation & sim) fc.unlock("solvent_shake", "dihedral_rest"); fc.unlock("solvent_shake", "dihedral_const"); fc.unlock("solvent_shake", "jvalue_rest"); - fc.unlock("solvent_shake", "rdc_rest"); + fc.unlock("solvent_shake", "rdc_rest"); fc.unlock("solvent_shake", "perscale"); fc.unlock("solvent_shake", "rottrans"); fc.unlock("solvent_shake", "repex_temp"); @@ -793,7 +944,7 @@ int io::check_parameter(simulation::Simulation & sim) fc.unlock("pressure_calculation", "dihedral_rest"); fc.unlock("pressure_calculation", "dihedral_const"); fc.unlock("pressure_calculation", "jvalue_rest"); - fc.unlock("pressure_calculation", "rdc_rest"); + fc.unlock("pressure_calculation", "rdc_rest"); fc.unlock("pressure_calculation", "perscale"); fc.unlock("pressure_calculation", "rottrans"); fc.unlock("pressure_calculation", "repex_temp"); @@ -842,7 +993,7 @@ int io::check_parameter(simulation::Simulation & sim) fc.unlock("pressure_scale_berendsen", "dihedral_rest"); fc.unlock("pressure_scale_berendsen", "dihedral_const"); fc.unlock("pressure_scale_berendsen", "jvalue_rest"); - fc.unlock("pressure_scale_berendsen", "rdc_rest"); + fc.unlock("pressure_scale_berendsen", "rdc_rest"); fc.unlock("pressure_scale_berendsen", "perscale"); fc.unlock("pressure_scale_berendsen", "rottrans"); fc.unlock("pressure_scale_berendsen", "repex_temp"); @@ -889,7 +1040,7 @@ int io::check_parameter(simulation::Simulation & sim) fc.unlock("virial_off", "dihedral_rest"); fc.unlock("virial_off", "dihedral_const"); fc.unlock("virial_off", "jvalue_rest"); - fc.unlock("virial_off", "rdc_rest"); + fc.unlock("virial_off", "rdc_rest"); fc.unlock("virial_off", "perscale"); fc.unlock("virial_off", "rottrans"); fc.unlock("virial_off", "repex_temp"); @@ -936,7 +1087,7 @@ int io::check_parameter(simulation::Simulation & sim) fc.unlock("virial_atomic", "distance_rest"); fc.unlock("virial_atomic", "dihedral_rest"); fc.unlock("virial_atomic", "jvalue_rest"); - fc.unlock("virial_atomic", "rdc_rest"); + fc.unlock("virial_atomic", "rdc_rest"); fc.unlock("virial_atomic", "perscale"); fc.unlock("virial_atomic", "rottrans"); fc.unlock("virial_atomic", "repex_temp"); @@ -984,7 +1135,7 @@ int io::check_parameter(simulation::Simulation & sim) fc.unlock("virial_molecular", "dihedral_rest"); fc.unlock("virial_molecular", "dihedral_const"); fc.unlock("virial_molecular", "jvalue_rest"); - fc.unlock("virial_molecular", "rdc_rest"); + fc.unlock("virial_molecular", "rdc_rest"); fc.unlock("virial_molecular", "perscale"); fc.unlock("virial_molecular", "rottrans"); fc.unlock("virial_molecular", "repex_temp"); @@ -1026,7 +1177,7 @@ int io::check_parameter(simulation::Simulation & sim) fc.unlock("vacuum", "dihedral_rest"); fc.unlock("vacuum", "dihedral_const"); fc.unlock("vacuum", "jvalue_rest"); - fc.unlock("vacuum", "rdc_rest"); + fc.unlock("vacuum", "rdc_rest"); fc.unlock("vacuum", "perscale"); fc.unlock("vacuum", "rottrans"); fc.unlock("vacuum", "repex_temp"); @@ -1069,7 +1220,7 @@ int io::check_parameter(simulation::Simulation & sim) fc.unlock("pbc_r", "dihedral_rest"); fc.unlock("pbc_r", "dihedral_const"); fc.unlock("pbc_r", "jvalue_rest"); - fc.unlock("pbc_r", "rdc_rest"); + fc.unlock("pbc_r", "rdc_rest"); fc.unlock("pbc_r", "perscale"); fc.unlock("pbc_r", "rottrans"); fc.unlock("pbc_r", "repex_temp"); @@ -1113,7 +1264,7 @@ int io::check_parameter(simulation::Simulation & sim) fc.unlock("pbc_c", "dihedral_rest"); fc.unlock("pbc_c", "dihedral_const"); fc.unlock("pbc_c", "jvalue_rest"); - fc.unlock("pbc_c", "rdc_rest"); + fc.unlock("pbc_c", "rdc_rest"); fc.unlock("pbc_c", "perscale"); fc.unlock("pbc_c", "rottrans"); fc.unlock("pbc_c", "repex_temp"); @@ -1155,7 +1306,7 @@ int io::check_parameter(simulation::Simulation & sim) fc.unlock("pbc_t", "dihedral_rest"); fc.unlock("pbc_t", "dihedral_const"); fc.unlock("pbc_t", "jvalue_rest"); - fc.unlock("pbc_t", "rdc_rest"); + fc.unlock("pbc_t", "rdc_rest"); fc.unlock("pbc_t", "perscale"); fc.unlock("pbc_t", "rottrans"); fc.unlock("pbc_t", "repex_temp"); @@ -1234,7 +1385,7 @@ int io::check_parameter(simulation::Simulation & sim) fc.unlock("perturbation_scaling", "dihedral_rest"); fc.unlock("perturbation_scaling", "dihedral_const"); fc.unlock("perturbation_scaling", "jvalue_rest"); - fc.unlock("perturbation_scaling", "rdc_rest"); + fc.unlock("perturbation_scaling", "rdc_rest"); fc.unlock("perturbation_scaling", "perscale"); fc.unlock("perturbation_scaling", "rottrans"); fc.unlock("perturbation_scaling", "repex_temp"); @@ -1295,7 +1446,7 @@ int io::check_parameter(simulation::Simulation & sim) fc.unlock("individual_lambdas", "dihedral_rest"); fc.unlock("individual_lambdas", "dihedral_const"); fc.unlock("individual_lambdas", "jvalue_rest"); - fc.unlock("individual_lambdas", "rdc_rest"); + fc.unlock("individual_lambdas", "rdc_rest"); fc.unlock("individual_lambdas", "perscale"); fc.unlock("individual_lambdas", "rottrans"); fc.unlock("individual_lambdas", "repex_temp"); @@ -1338,7 +1489,7 @@ int io::check_parameter(simulation::Simulation & sim) fc.unlock("bond", "dihedral_rest"); fc.unlock("bond", "dihedral_const"); fc.unlock("bond", "jvalue_rest"); - fc.unlock("bond", "rdc_rest"); + fc.unlock("bond", "rdc_rest"); fc.unlock("bond", "perscale"); fc.unlock("bond", "rottrans"); fc.unlock("bond", "repex_temp"); @@ -1378,7 +1529,7 @@ int io::check_parameter(simulation::Simulation & sim) fc.unlock("angle", "dihedral_rest"); fc.unlock("angle", "dihedral_const"); fc.unlock("angle", "jvalue_rest"); - fc.unlock("angle", "rdc_rest"); + fc.unlock("angle", "rdc_rest"); fc.unlock("angle", "perscale"); fc.unlock("angle", "rottrans"); fc.unlock("angle", "repex_temp"); @@ -1417,7 +1568,7 @@ int io::check_parameter(simulation::Simulation & sim) fc.unlock("dihedral", "dihedral_rest"); fc.unlock("dihedral", "dihedral_const"); fc.unlock("dihedral", "jvalue_rest"); - fc.unlock("dihedral", "rdc_rest"); + fc.unlock("dihedral", "rdc_rest"); fc.unlock("dihedral", "perscale"); fc.unlock("dihedral", "rottrans"); fc.unlock("dihedral", "repex_temp"); @@ -1456,7 +1607,7 @@ int io::check_parameter(simulation::Simulation & sim) fc.unlock("improper", "dihedral_const"); fc.unlock("improper", "jvalue_rest"); fc.unlock("improper", "rdc_rest"); - fc.unlock("improper", "perscale"); + fc.unlock("improper", "perscale"); fc.unlock("improper", "perscale"); fc.unlock("improper", "rottrans"); fc.unlock("improper", "repex_temp"); @@ -1493,7 +1644,7 @@ int io::check_parameter(simulation::Simulation & sim) fc.unlock("crf", "dihedral_rest"); fc.unlock("crf", "dihedral_const"); fc.unlock("crf", "jvalue_rest"); - fc.unlock("crf", "rdc_rest"); + fc.unlock("crf", "rdc_rest"); fc.unlock("crf", "perscale"); fc.unlock("crf", "rottrans"); fc.unlock("crf", "repex_temp"); @@ -1529,7 +1680,7 @@ int io::check_parameter(simulation::Simulation & sim) fc.unlock("lj", "dihedral_rest"); fc.unlock("lj", "dihedral_const"); fc.unlock("lj", "jvalue_rest"); - fc.unlock("lj", "rdc_rest"); + fc.unlock("lj", "rdc_rest"); fc.unlock("lj", "perscale"); fc.unlock("lj", "rottrans"); fc.unlock("lj", "repex_temp"); @@ -1562,7 +1713,7 @@ int io::check_parameter(simulation::Simulation & sim) fc.unlock("com_removal", "dihedral_rest"); fc.unlock("com_removal", "dihedral_const"); fc.unlock("com_removal", "jvalue_rest"); - fc.unlock("com_removal", "rdc_rest"); + fc.unlock("com_removal", "rdc_rest"); fc.unlock("com_removal", "perscale"); fc.unlock("com_removal", "rottrans"); fc.unlock("com_removal", "repex_temp"); @@ -1596,7 +1747,7 @@ int io::check_parameter(simulation::Simulation & sim) fc.unlock("rf_excluded", "dihedral_rest"); fc.unlock("rf_excluded", "dihedral_const"); fc.unlock("rf_excluded", "jvalue_rest"); - fc.unlock("rf_excluded", "rdc_rest"); + fc.unlock("rf_excluded", "rdc_rest"); fc.unlock("rf_excluded", "perscale"); fc.unlock("rf_excluded", "rottrans"); fc.unlock("rf_excluded", "repex_temp"); @@ -1628,7 +1779,7 @@ int io::check_parameter(simulation::Simulation & sim) fc.unlock("pairlist_standard", "dihedral_rest"); fc.unlock("pairlist_standard", "dihedral_const"); fc.unlock("pairlist_standard", "jvalue_rest"); - fc.unlock("pairlist_standard", "rdc_rest"); + fc.unlock("pairlist_standard", "rdc_rest"); fc.unlock("pairlist_standard", "perscale"); fc.unlock("pairlist_standard", "rottrans"); fc.unlock("pairlist_standard", "repex_temp"); @@ -1659,7 +1810,7 @@ int io::check_parameter(simulation::Simulation & sim) fc.unlock("pairlist_grid", "dihedral_rest"); fc.unlock("pairlist_grid", "dihedral_const"); fc.unlock("pairlist_grid", "jvalue_rest"); - fc.unlock("pairlist_grid", "rdc_rest"); + fc.unlock("pairlist_grid", "rdc_rest"); fc.unlock("pairlist_grid", "perscale"); fc.unlock("pairlist_grid", "rottrans"); fc.unlock("pairlist_grid", "repex_temp"); @@ -1690,7 +1841,7 @@ int io::check_parameter(simulation::Simulation & sim) fc.unlock("cutoff_atomic", "dihedral_rest"); fc.unlock("cutoff_atomic", "dihedral_const"); fc.unlock("cutoff_atomic", "jvalue_rest"); - fc.unlock("cutoff_atomic", "rdc_rest"); + fc.unlock("cutoff_atomic", "rdc_rest"); fc.unlock("cutoff_atomic", "perscale"); fc.unlock("cutoff_atomic", "rottrans"); fc.unlock("cutoff_atomic", "repex_temp"); @@ -1778,7 +1929,7 @@ int io::check_parameter(simulation::Simulation & sim) fc.unlock("temp_berendsen", "dihedral_rest"); fc.unlock("temp_berendsen", "dihedral_const"); fc.unlock("temp_berendsen", "jvalue_rest"); - fc.unlock("temp_berendsen", "rdc_rest"); + fc.unlock("temp_berendsen", "rdc_rest"); fc.unlock("temp_berendsen", "perscale"); fc.unlock("temp_berendsen", "rottrans"); fc.unlock("temp_berendsen", "repex_temp"); @@ -1803,7 +1954,7 @@ int io::check_parameter(simulation::Simulation & sim) fc.unlock("temp_nosehoover", "dihedral_rest"); fc.unlock("temp_nosehoover", "dihedral_const"); fc.unlock("temp_nosehoover", "jvalue_rest"); - fc.unlock("temp_nosehoover", "rdc_rest"); + fc.unlock("temp_nosehoover", "rdc_rest"); fc.unlock("temp_nosehoover", "perscale"); fc.unlock("temp_nosehoover", "rottrans"); fc.unlock("temp_nosehoover", "repex_temp"); @@ -1828,7 +1979,7 @@ int io::check_parameter(simulation::Simulation & sim) fc.unlock("temp_nosehoover_chains", "dihedral_rest"); fc.unlock("temp_nosehoover_chains", "dihedral_const"); fc.unlock("temp_nosehoover_chains", "jvalue_rest"); - fc.unlock("temp_nosehoover_chains", "rdc_rest"); + fc.unlock("temp_nosehoover_chains", "rdc_rest"); fc.unlock("temp_nosehoover_chains", "perscale"); fc.unlock("temp_nosehoover_chains", "rottrans"); fc.unlock("temp_nosehoover_chains", "repex_temp"); @@ -1850,7 +2001,7 @@ int io::check_parameter(simulation::Simulation & sim) fc.unlock("position_rest", "dihedral_rest"); fc.unlock("position_rest", "dihedral_const"); fc.unlock("position_rest", "jvalue_rest"); - fc.unlock("position_rest", "rdc_rest"); + fc.unlock("position_rest", "rdc_rest"); fc.unlock("position_rest", "perscale"); fc.unlock("position_rest", "rottrans"); fc.unlock("position_rest", "repex_temp"); @@ -1871,7 +2022,7 @@ int io::check_parameter(simulation::Simulation & sim) fc.unlock("position_const", "distance_rest"); fc.unlock("position_const", "dihedral_rest"); fc.unlock("position_const", "jvalue_rest"); - fc.unlock("position_const", "rdc_rest"); + fc.unlock("position_const", "rdc_rest"); fc.unlock("position_const", "perscale"); fc.unlock("position_const", "repex_temp"); fc.unlock("position_const", "repex_lambda"); @@ -1891,7 +2042,7 @@ int io::check_parameter(simulation::Simulation & sim) fc.unlock("position_const_scaled", "distance_rest"); fc.unlock("position_const_scaled", "dihedral_rest"); fc.unlock("position_const_scaled", "jvalue_rest"); - fc.unlock("position_const_scaled", "rdc_rest"); + fc.unlock("position_const_scaled", "rdc_rest"); fc.unlock("position_const_scaled", "perscale"); fc.unlock("position_const_scaled", "rottrans"); fc.unlock("position_const_scaled", "repex_temp"); @@ -1912,7 +2063,7 @@ int io::check_parameter(simulation::Simulation & sim) fc.unlock("distance_rest", "dihedral_rest"); fc.unlock("distance_rest", "dihedral_const"); fc.unlock("distance_rest", "jvalue_rest"); - fc.unlock("distance_rest", "rdc_rest"); + fc.unlock("distance_rest", "rdc_rest"); fc.unlock("distance_rest", "perscale"); fc.unlock("distance_rest", "rottrans"); fc.unlock("distance_rest", "repex_temp"); @@ -1931,7 +2082,7 @@ int io::check_parameter(simulation::Simulation & sim) fc.unlock("distance_rest", "parallel_mpi"); fc.unlock("distance_rest", "parallel_omp"); fc.unlock("dihedral_rest", "jvalue_rest"); - fc.unlock("dihedral_rest", "rdc_rest"); + fc.unlock("dihedral_rest", "rdc_rest"); fc.unlock("dihedral_rest", "perscale"); fc.unlock("dihedral_rest", "rottrans"); fc.unlock("dihedral_rest", "repex_temp"); @@ -1950,7 +2101,7 @@ int io::check_parameter(simulation::Simulation & sim) fc.unlock("dihedral_rest", "parallel_mpi"); fc.unlock("dihedral_rest", "parallel_omp"); fc.unlock("dihedral_const", "jvalue_rest"); - fc.unlock("dihedral_const", "rdc_rest"); + fc.unlock("dihedral_const", "rdc_rest"); fc.unlock("dihedral_const", "perscale"); fc.unlock("dihedral_const", "rottrans"); fc.unlock("dihedral_const", "repex_temp"); @@ -1968,7 +2119,7 @@ int io::check_parameter(simulation::Simulation & sim) fc.unlock("dihedral_const", "random_gsl"); fc.unlock("dihedral_const", "parallel_mpi"); fc.unlock("dihedral_const", "parallel_omp"); - fc.unlock("jvalue_rest", "rdc_rest"); + fc.unlock("jvalue_rest", "rdc_rest"); fc.unlock("jvalue_rest", "perscale"); fc.unlock("jvalue_rest", "rottrans"); fc.unlock("jvalue_rest", "repex_temp"); @@ -2036,7 +2187,7 @@ int io::check_parameter(simulation::Simulation & sim) fc.unlock("rottrans", "parallel_omp"); fc.unlock("repex_temp", "repex_lambda"); fc.unlock("repex_temp", "multicell"); - fc.unlock("repex_temp", "analysis"); + //fc.unlock("repex_temp", "analysis"); fc.unlock("repex_temp", "no_integration"); fc.unlock("repex_temp", "montecarlo"); fc.unlock("repex_temp", "polarisation_cos"); @@ -2047,7 +2198,7 @@ int io::check_parameter(simulation::Simulation & sim) fc.unlock("repex_temp", "parallel_omp"); //fc.unlock("repex_temp", "stochdyn"); fc.unlock("repex_lambda", "multicell"); - fc.unlock("repex_lambda", "analysis"); + //fc.unlock("repex_lambda", "analysis"); fc.unlock("repex_lambda", "no_integration"); fc.unlock("repex_lambda", "polarisation_cos"); fc.unlock("repex_lambda", "polarisation_cos_damped"); @@ -2065,7 +2216,7 @@ int io::check_parameter(simulation::Simulation & sim) fc.unlock("multicell", "analysis"); fc.unlock("multicell", "parallel_omp"); fc.unlock("analysis", "no_integration"); - fc.unlock("analysis", "stochdyn"); + //fc.unlock("analysis", "stochdyn"); fc.unlock("analysis", "multistep"); fc.unlock("analysis", "multistep_boost"); fc.unlock("analysis", "montecarlo"); @@ -2120,7 +2271,7 @@ int io::check_parameter(simulation::Simulation & sim) fc.unlock("random_gromos", "parallel_mpi"); fc.unlock("random_gromos", "parallel_omp"); fc.unlock("random_gsl", "parallel_mpi"); - fc.unlock("random_gsl", "parallel_omp"); + fc.unlock("random_gsl", "parallel_omp"); fc.unlock("slow_growth", "solute"); fc.unlock("slow_growth", "solvent"); fc.unlock("slow_growth", "solvent_only"); @@ -2162,7 +2313,7 @@ int io::check_parameter(simulation::Simulation & sim) fc.unlock("slow_growth", "dihedral_rest"); fc.unlock("slow_growth", "dihedral_const"); fc.unlock("slow_growth", "jvalue_rest"); - fc.unlock("slow_growth", "rdc_rest"); + fc.unlock("slow_growth", "rdc_rest"); fc.unlock("slow_growth", "perscale"); fc.unlock("slow_growth", "rottrans"); fc.unlock("slow_growth", "repex_temp"); @@ -2216,7 +2367,7 @@ int io::check_parameter(simulation::Simulation & sim) fc.unlock("eds", "temp_berendsen"); fc.unlock("eds", "temp_nosehoover"); fc.unlock("eds", "temp_nosehoover_chains"); - fc.unlock("eds", "position_rest"); + fc.unlock("eds", "position_rest"); fc.unlock("eds", "distance_rest"); fc.unlock("eds", "dihedral_rest"); fc.unlock("eds", "dihedral_const"); @@ -2238,7 +2389,7 @@ int io::check_parameter(simulation::Simulation & sim) fc.unlock("eds", "random_gsl"); fc.unlock("eds", "parallel_mpi"); fc.unlock("eds", "parallel_omp"); - + fc.unlock("mult_energy_groups", "solute"); fc.unlock("mult_energy_groups", "solvent"); fc.unlock("mult_energy_groups", "solvent_only"); @@ -2286,7 +2437,7 @@ int io::check_parameter(simulation::Simulation & sim) fc.unlock("mult_energy_groups", "dihedral_rest"); fc.unlock("mult_energy_groups", "dihedral_const"); fc.unlock("mult_energy_groups", "jvalue_rest"); - fc.unlock("mult_energy_groups", "rdc_rest"); + fc.unlock("mult_energy_groups", "rdc_rest"); fc.unlock("mult_energy_groups", "perscale"); fc.unlock("mult_energy_groups", "rottrans"); fc.unlock("mult_energy_groups", "repex_temp"); @@ -2354,7 +2505,7 @@ int io::check_parameter(simulation::Simulation & sim) fc.unlock("ewald", "dihedral_rest"); fc.unlock("ewald", "dihedral_const"); fc.unlock("ewald", "jvalue_rest"); - fc.unlock("ewald", "rdc_rest"); + fc.unlock("ewald", "rdc_rest"); fc.unlock("ewald", "perscale"); fc.unlock("ewald", "rottrans"); //fc.unlock("ewald", "innerloop_spc"); @@ -2374,7 +2525,7 @@ int io::check_parameter(simulation::Simulation & sim) //fc.unlock("ewald", "eds"); fc.unlock("ewald", "parallel_mpi"); //fc.unlock("ewald", "parallel_omp"); - //fc.unlock("ewald", "mult_energy_groups"); + //fc.unlock("ewald", "mult_energy_groups"); //fc.unlock("ewald", "p3m"); // unlocking features for P3M electrostatics @@ -2425,12 +2576,12 @@ int io::check_parameter(simulation::Simulation & sim) fc.unlock("p3m", "dihedral_rest"); fc.unlock("p3m", "dihedral_const"); fc.unlock("p3m", "jvalue_rest"); - fc.unlock("p3m", "rdc_rest"); + fc.unlock("p3m", "rdc_rest"); fc.unlock("p3m", "perscale"); fc.unlock("p3m", "rottrans"); //fc.unlock("p3m", "innerloop_spc"); - fc.unlock("p3m", "repex_temp"); - fc.unlock("p3m", "repex_lambda"); + fc.unlock("p3m", "repex_temp"); + fc.unlock("p3m", "repex_lambda"); fc.unlock("p3m", "multicell"); //fc.unlock("p3m", "analysis"); --works if box invariant (recalculation of infl. func. necessary otherwise) fc.unlock("p3m", "no_integration"); @@ -2447,7 +2598,7 @@ int io::check_parameter(simulation::Simulation & sim) fc.unlock("p3m", "parallel_omp"); //fc.unlock("p3m", "mult_energy_groups"); //fc.unlock("p3m", "ewald"); - + fc.unlock("innerloop_method_off", "solute"); fc.unlock("innerloop_method_off", "solvent"); fc.unlock("innerloop_method_off", "solvent_only"); @@ -2495,7 +2646,7 @@ int io::check_parameter(simulation::Simulation & sim) fc.unlock("innerloop_method_off", "dihedral_rest"); fc.unlock("innerloop_method_off", "dihedral_const"); fc.unlock("innerloop_method_off", "jvalue_rest"); - fc.unlock("innerloop_method_off", "rdc_rest"); + fc.unlock("innerloop_method_off", "rdc_rest"); fc.unlock("innerloop_method_off", "perscale"); fc.unlock("innerloop_method_off", "rottrans"); fc.unlock("innerloop_method_off", "innerloop_solvent_topology"); @@ -2518,7 +2669,7 @@ int io::check_parameter(simulation::Simulation & sim) fc.unlock("innerloop_method_off", "mult_energy_groups"); fc.unlock("innerloop_method_off", "ewald"); fc.unlock("innerloop_method_off", "p3m"); - + fc.unlock("innerloop_method_generic", "solute"); fc.unlock("innerloop_method_generic", "solvent"); fc.unlock("innerloop_method_generic", "solvent_only"); @@ -2562,7 +2713,7 @@ int io::check_parameter(simulation::Simulation & sim) fc.unlock("innerloop_method_generic", "dihedral_rest"); fc.unlock("innerloop_method_generic", "dihedral_const"); fc.unlock("innerloop_method_generic", "jvalue_rest"); - fc.unlock("innerloop_method_generic", "rdc_rest"); + fc.unlock("innerloop_method_generic", "rdc_rest"); fc.unlock("innerloop_method_generic", "perscale"); fc.unlock("innerloop_method_generic", "rottrans"); fc.unlock("innerloop_method_generic", "innerloop_solvent_topology"); @@ -2582,7 +2733,7 @@ int io::check_parameter(simulation::Simulation & sim) fc.unlock("innerloop_method_generic", "parallel_mpi"); fc.unlock("innerloop_method_generic", "parallel_omp"); fc.unlock("innerloop_method_generic", "mult_energy_groups"); - + fc.unlock("innerloop_method_hardcode", "solute"); fc.unlock("innerloop_method_hardcode", "solvent"); fc.unlock("innerloop_method_hardcode", "solvent_only"); @@ -2626,7 +2777,7 @@ int io::check_parameter(simulation::Simulation & sim) fc.unlock("innerloop_method_hardcode", "dihedral_rest"); fc.unlock("innerloop_method_hardcode", "dihedral_const"); fc.unlock("innerloop_method_hardcode", "jvalue_rest"); - fc.unlock("innerloop_method_hardcode", "rdc_rest"); + fc.unlock("innerloop_method_hardcode", "rdc_rest"); fc.unlock("innerloop_method_hardcode", "perscale"); fc.unlock("innerloop_method_hardcode", "rottrans"); fc.unlock("innerloop_method_hardcode", "innerloop_solvent_spc"); @@ -2645,7 +2796,7 @@ int io::check_parameter(simulation::Simulation & sim) fc.unlock("innerloop_method_hardcode", "parallel_mpi"); fc.unlock("innerloop_method_hardcode", "parallel_omp"); fc.unlock("innerloop_method_hardcode", "mult_energy_groups"); - + fc.unlock("innerloop_method_table", "solute"); fc.unlock("innerloop_method_table", "solvent"); fc.unlock("innerloop_method_table", "solvent_only"); @@ -2708,7 +2859,7 @@ int io::check_parameter(simulation::Simulation & sim) fc.unlock("innerloop_method_table", "parallel_mpi"); fc.unlock("innerloop_method_table", "parallel_omp"); fc.unlock("innerloop_method_table", "mult_energy_groups"); - + fc.unlock("innerloop_solvent_topology", "solute"); fc.unlock("innerloop_solvent_topology", "solvent"); fc.unlock("innerloop_solvent_topology", "solvent_only"); @@ -2756,7 +2907,7 @@ int io::check_parameter(simulation::Simulation & sim) fc.unlock("innerloop_solvent_topology", "dihedral_rest"); fc.unlock("innerloop_solvent_topology", "dihedral_const"); fc.unlock("innerloop_solvent_topology", "jvalue_rest"); - fc.unlock("innerloop_solvent_topology", "rdc_rest"); + fc.unlock("innerloop_solvent_topology", "rdc_rest"); fc.unlock("innerloop_solvent_topology", "perscale"); fc.unlock("innerloop_solvent_topology", "rottrans"); fc.unlock("innerloop_solvent_topology", "repex_temp"); @@ -2825,7 +2976,7 @@ int io::check_parameter(simulation::Simulation & sim) fc.unlock("innerloop_solvent_spc", "dihedral_rest"); fc.unlock("innerloop_solvent_spc", "dihedral_const"); fc.unlock("innerloop_solvent_spc", "jvalue_rest"); - fc.unlock("innerloop_solvent_spc", "rdc_rest"); + fc.unlock("innerloop_solvent_spc", "rdc_rest"); fc.unlock("innerloop_solvent_spc", "perscale"); fc.unlock("innerloop_solvent_spc", "rottrans"); fc.unlock("innerloop_solvent_spc", "repex_temp"); @@ -2845,7 +2996,7 @@ int io::check_parameter(simulation::Simulation & sim) fc.unlock("innerloop_solvent_spc", "parallel_mpi"); fc.unlock("innerloop_solvent_spc", "parallel_omp"); fc.unlock("innerloop_solvent_spc", "mult_energy_groups"); - + fc.unlock("solvent_lincs", "solute"); fc.unlock("solvent_lincs", "solvent"); fc.unlock("solvent_lincs", "solvent_only"); @@ -2889,7 +3040,7 @@ int io::check_parameter(simulation::Simulation & sim) fc.unlock("solvent_lincs", "dihedral_rest"); fc.unlock("solvent_lincs", "dihedral_const"); fc.unlock("solvent_lincs", "jvalue_rest"); - fc.unlock("solvent_lincs", "rdc_rest"); + fc.unlock("solvent_lincs", "rdc_rest"); fc.unlock("solvent_lincs", "perscale"); fc.unlock("solvent_lincs", "rottrans"); fc.unlock("solvent_lincs", "innerloop_method_off"); @@ -2917,7 +3068,7 @@ int io::check_parameter(simulation::Simulation & sim) fc.unlock("solvent_lincs", "mult_energy_groups"); fc.unlock("solvent_lincs", "ewald"); fc.unlock("solvent_lincs", "p3m"); - + fc.unlock("solvent_settle", "solute"); fc.unlock("solvent_settle", "solvent"); fc.unlock("solvent_settle", "solvent_only"); @@ -2961,7 +3112,7 @@ int io::check_parameter(simulation::Simulation & sim) fc.unlock("solvent_settle", "dihedral_rest"); fc.unlock("solvent_settle", "dihedral_const"); fc.unlock("solvent_settle", "jvalue_rest"); - fc.unlock("solvent_settle", "rdc_rest"); + fc.unlock("solvent_settle", "rdc_rest"); fc.unlock("solvent_settle", "perscale"); fc.unlock("solvent_settle", "rottrans"); fc.unlock("solvent_settle", "innerloop_method_off"); @@ -3024,7 +3175,7 @@ int io::check_parameter(simulation::Simulation & sim) fc.unlock("innerloop_method_cuda", "dihedral_rest"); fc.unlock("innerloop_method_cuda", "dihedral_const"); fc.unlock("innerloop_method_cuda", "jvalue_rest"); - fc.unlock("innerloop_method_cuda", "rdc_rest"); + fc.unlock("innerloop_method_cuda", "rdc_rest"); fc.unlock("innerloop_method_cuda", "perscale"); fc.unlock("innerloop_method_cuda", "rottrans"); fc.unlock("innerloop_method_cuda", "innerloop_solvent_topology"); @@ -3042,7 +3193,7 @@ int io::check_parameter(simulation::Simulation & sim) fc.unlock("innerloop_method_cuda", "virial_molecular"); fc.unlock("innerloop_method_cuda", "parallel_omp"); //allow multiple energy groups - fc.unlock("innerloop_method_cuda", "mult_energy_groups"); + fc.unlock("innerloop_method_cuda", "mult_energy_groups"); fc.unlock("leus", "solute"); @@ -3094,7 +3245,7 @@ int io::check_parameter(simulation::Simulation & sim) fc.unlock("leus", "dihedral_rest"); fc.unlock("leus", "dihedral_const"); fc.unlock("leus", "jvalue_rest"); - fc.unlock("leus", "rdc_rest"); + fc.unlock("leus", "rdc_rest"); fc.unlock("leus", "perscale"); fc.unlock("leus", "rottrans"); fc.unlock("leus", "innerloop_method_off"); @@ -3174,7 +3325,7 @@ int io::check_parameter(simulation::Simulation & sim) fc.unlock("xray", "dihedral_rest"); fc.unlock("xray", "dihedral_const"); fc.unlock("xray", "jvalue_rest"); - fc.unlock("xray", "rdc_rest"); + fc.unlock("xray", "rdc_rest"); fc.unlock("xray", "perscale"); fc.unlock("xray", "rottrans"); fc.unlock("xray", "innerloop_method_off"); @@ -3255,7 +3406,7 @@ int io::check_parameter(simulation::Simulation & sim) fc.unlock("sasa", "dihedral_rest"); fc.unlock("sasa", "dihedral_const"); fc.unlock("sasa", "jvalue_rest"); - fc.unlock("sasa", "rdc_rest"); + fc.unlock("sasa", "rdc_rest"); fc.unlock("sasa", "perscale"); fc.unlock("sasa", "rottrans"); fc.unlock("sasa", "innerloop_method_off"); @@ -3338,7 +3489,7 @@ int io::check_parameter(simulation::Simulation & sim) fc.unlock("sasavol", "dihedral_rest"); fc.unlock("sasavol", "dihedral_const"); fc.unlock("sasavol", "jvalue_rest"); - fc.unlock("sasavol", "rdc_rest"); + fc.unlock("sasavol", "rdc_rest"); fc.unlock("sasavol", "perscale"); fc.unlock("sasavol", "rottrans"); fc.unlock("sasavol", "innerloop_method_off"); @@ -3418,7 +3569,7 @@ int io::check_parameter(simulation::Simulation & sim) fc.unlock("pairlist_gridcell", "dihedral_rest"); fc.unlock("pairlist_gridcell", "dihedral_const"); fc.unlock("pairlist_gridcell", "jvalue_rest"); - fc.unlock("pairlist_gridcell", "rdc_rest"); + fc.unlock("pairlist_gridcell", "rdc_rest"); fc.unlock("pairlist_gridcell", "perscale"); fc.unlock("pairlist_gridcell", "rottrans"); fc.unlock("pairlist_gridcell", "innerloop_method_off"); @@ -3502,7 +3653,7 @@ int io::check_parameter(simulation::Simulation & sim) fc.unlock("cutoff_cg", "dihedral_rest"); fc.unlock("cutoff_cg", "dihedral_const"); fc.unlock("cutoff_cg", "jvalue_rest"); - fc.unlock("cutoff_cg", "rdc_rest"); + fc.unlock("cutoff_cg", "rdc_rest"); fc.unlock("cutoff_cg", "perscale"); fc.unlock("cutoff_cg", "rottrans"); fc.unlock("cutoff_cg", "innerloop_method_off"); @@ -3615,10 +3766,10 @@ int io::check_parameter(simulation::Simulation & sim) fc.unlock("distance_field", "virial_off"); // fc.unlock("distance_field", "virial_atomic"); // fc.unlock("distance_field", "virial_molecular"); - fc.unlock("distance_field", "vacuum"); + // fc.unlock("distance_field", "vacuum"); fc.unlock("distance_field", "pbc_r"); - fc.unlock("distance_field", "pbc_c"); - fc.unlock("distance_field", "pbc_t"); + // fc.unlock("distance_field", "pbc_c"); + // fc.unlock("distance_field", "pbc_t"); fc.unlock("distance_field", "perturbation"); fc.unlock("distance_field", "perturbation_scaling"); fc.unlock("distance_field", "slow_growth"); @@ -3861,6 +4012,6 @@ int io::check_parameter(simulation::Simulation & sim) if (fc.check()) return 0; - + return -1; } diff --git a/gromosXX/src/io/parameter/check_parameter.h b/gromosXX/src/io/parameter/check_parameter.h index be6e0c649..ecad902ad 100644 --- a/gromosXX/src/io/parameter/check_parameter.h +++ b/gromosXX/src/io/parameter/check_parameter.h @@ -9,9 +9,23 @@ namespace io { /** - * does basic cross checks on the parameters + * cross checks on the parameters */ int check_parameter(simulation::Simulation &sim); + + /** + * does basic cross checks on parameters from different blocks + * cross-checks of parameters within one block should be done in the + * read_XXX functions in @ref In_Parameter + */ + int simple_crosschecks(simulation::Simulation &sim); + + /** + * does basic cross checks on the parameters + * checks each feature against all others + * every allowed combination has to be unlocked + */ + int check_features(simulation::Simulation &sim); } #endif diff --git a/gromosXX/src/io/parameter/in_parameter.cc b/gromosXX/src/io/parameter/in_parameter.cc index daf846b95..ecf019f30 100644 --- a/gromosXX/src/io/parameter/in_parameter.cc +++ b/gromosXX/src/io/parameter/in_parameter.cc @@ -2,6 +2,7 @@ * @file in_parameter.cc * implements methods of In_Parameter */ +#include #include #include @@ -88,7 +89,7 @@ void io::In_Parameter::read(simulation::Parameter ¶m, read_STOCHDYN(param); read_EWARN(param); read_MULTISTEP(param); - read_MONTECARLO(param); + read_CHEMICALMONTECARLO(param); read_POLARISE(param); read_RANDOMNUMBERS(param); read_EDS(param); @@ -121,5540 +122,4467 @@ void io::In_Parameter::read(simulation::Parameter ¶m, } } - if (!quiet) - os << "END\n"; - + if (!quiet) + os << "END\n"; } /** * @section system SYSTEM block - * @verbatim -SYSTEM -# NPM : protein molecules (0, 1) -# NSM : solvent molecules (>= 0) -# NPM NSM - 1 0 -END -@endverbatim + * @snippet snippets/snippets.cc SYSTEM */ void io::In_Parameter::read_SYSTEM(simulation::Parameter ¶m, - std::ostream & os) { - DEBUG(8, "reading SYSTEM"); - - std::vector buffer; - buffer = m_block["SYSTEM"]; - std::string s; - - if (!buffer.size()) { - io::messages.add("no SYSTEM block in input", "In_Parameter", io::message::error); - param.system.nsm = 0; - param.system.npm = 0; - return; - } - - block_read.insert("SYSTEM"); - - _lineStream.clear(); - _lineStream.str(concatenate(buffer.begin() + 1, buffer.end() - 1, s)); - - _lineStream >> param.system.npm - >> param.system.nsm; - - if (_lineStream.fail()) - io::messages.add("bad line in SYSTEM block", - "In_Parameter", io::message::error); - - /* - if (!_lineStream.eof()) - io::messages.add("End of line not reached in SYSTEM block, but should have been: \n" + _lineStream.str() + "\n", - "In_Parameter", io::message::warning); - */ - - // we might need to also allow for 0... - if (param.system.npm != 1 && param.system.npm != 0) - io::messages.add("SYSTEM: currently only NPM=1 allowed (NPM=0 experimental)", - "io::In_Parameter::read_SYSTEM", - io::message::error); - if (param.system.nsm < 0) - io::messages.add("SYSTEM: NSM should be >0", - "io::In_Parameter::read_SYSTEM", - io::message::error); - + std::ostream & os) { + DEBUG(8, "reading SYSTEM"); + + std::stringstream exampleblock; + // lines starting with 'exampleblock<<"' and ending with '\n";' (spaces don't matter) + // will be used to generate snippets that can be included in the doxygen doc; + // the first line is the tag + exampleblock << "SYSTEM\n"; + exampleblock << "# NPM : protein molecules (0, 1)\n"; + exampleblock << "# NSM : solvent molecules (>= 0)\n"; + exampleblock << "# NPM NSM\n"; + exampleblock << " 1 0\n"; + exampleblock << "END\n"; + + std::string blockname = "SYSTEM"; + Block block(blockname, exampleblock.str()); + + if (block.read_buffer(m_block[blockname], true) == 0) { + block_read.insert("SYSTEM"); + + block.get_next_parameter("NPM", param.system.npm, "", "0,1"); + block.get_next_parameter("NSM", param.system.nsm, ">=0", ""); + + if (param.system.npm == 0 && param.system.nsm == 0) + io::messages.add("SYSTEM block: no molecules: both NSM and NPM are 0", + "io::In_Parameter", io::message::error); + + block.get_final_messages(); + } else { + param.system.nsm = 0; + param.system.npm = 0; + return; + } } /** * @section energymin ENERGYMIN block - * @verbatim -ENERGYMIN -# NTEM: 0..2 controls energy minimisation mode -# 0: do not do energy minimisation (default) -# 1: steepest-descent minimisation -# 2: conjugate-gradient minimisation (promd only) -# NCYC: >0 number of steps before resetting of conjugate-gradient search direction -# DELE: >0.0 energy threshold for convergence -# DX0: > 0.0 initial step size -# DXM: > 0.0 maximum step size -# NMIN > 0 minimum number of minimisation steps -# FLIM >= 0.0 limit force to maximum value (FLIM > 0.0 is not recommended). -# NTEM NCYC DELE DX0 DXM NMIN FLIM - 1 0 0.1 0.01 0.05 1 0 -END -@endverbatim + * @snippet snippets/snippets.cc ENERGYMIN */ void io::In_Parameter::read_ENERGYMIN(simulation::Parameter ¶m, - std::ostream & os) { - DEBUG(8, "reading ENERGYMIN"); - - std::vector buffer; - buffer = m_block["ENERGYMIN"]; - std::string s; - - if (!buffer.size()) { - // no minimisation - return; - } - - buffer = m_block["ENERGYMIN"]; - - block_read.insert("ENERGYMIN"); - - _lineStream.clear(); - _lineStream.str(concatenate(buffer.begin() + 1, buffer.end() - 1, s)); - - _lineStream >> param.minimise.ntem - >> param.minimise.ncyc - >> param.minimise.dele - >> param.minimise.dx0 - >> param.minimise.dxm - >> param.minimise.nmin - >> param.minimise.flim; - - if (_lineStream.fail()) - io::messages.add("bad line in ENERGYMIN block", - "In_Parameter", io::message::error); - - // allow 0 to disable feature... - if (param.minimise.nmin == 0) - param.minimise.nmin = 1; - - if (param.minimise.ntem != 0 && param.minimise.ntem != 1) - io::messages.add("ENERGYMIN block: currently only steepest descent implemented", - "io::In_Parameter", - io::message::error); - if (param.minimise.ntem == 1 && param.minimise.ncyc > 0) - io::messages.add("ENERGYMIN block: NCYC > 0 has no effect for steepest descent", - "io::In_Parameter", - io::message::warning); - - if (param.minimise.ncyc < 0) - io::messages.add("ENERGYMIN block: NCYC should be >0", - "io::In_Parameter", - io::message::error); - - if (param.minimise.dele < 0) - io::messages.add("ENERGYMIN block: DELE should be >0", - "io::In_Parameter", - io::message::error); - - if (param.minimise.dx0 < 0) - io::messages.add("ENERGYMIN block: DX0 should be >0", - "io::In_Parameter", io::message::error); - - if (param.minimise.dxm < param.minimise.dx0) - io::messages.add("ENERGYMIN block: DXM should be > DX0", - "io::In_Parameter", io::message::error); - - if (param.minimise.nmin <= 0) - io::messages.add("ENERGYMIN block: NMIN should be >= 0", - "io::In_Parameter", io::message::error); - - if (param.minimise.flim < 0) - io::messages.add("ENERGYMIN: FLIM should be >= 0", - "io::In_Parameter", - io::message::error); - if (param.minimise.flim > 0) - io::messages.add("ENERGYMIN: FLIM > 0 may result in " - "failure of the minimisation procedure." - " Only to be used in special cases.", - "io::In_Parameter", - io::message::warning); - -} + std::ostream & os) { + DEBUG(8, "reading ENERGYMIN"); + + std::stringstream exampleblock; + // lines starting with 'exampleblock<<"' and ending with '\n";' (spaces don't matter) + // will be used to generate snippets that can be included in the doxygen doc; + // the first line is the tag + exampleblock << "ENERGYMIN\n"; + exampleblock << "# NTEM: 0..1 controls energy minimisation mode\n"; + exampleblock << "# 0: do not do energy minimisation (default)\n"; + exampleblock << "# 1: steepest-descent minimisation\n"; + exampleblock << "# NCYC: >0 number of steps before resetting of conjugate-gradient search direction (not in use !!)\n"; + exampleblock << "# DELE: >0.0 energy threshold for convergence\n"; + exampleblock << "# DX0: > 0.0 initial step size\n"; + exampleblock << "# DXM: > 0.0 maximum step size\n"; + exampleblock << "# NMIN > 0 minimum number of minimisation steps\n"; + exampleblock << "# FLIM >= 0.0 limit force to maximum value (FLIM > 0.0 is not recommended).\n"; + exampleblock << "# NTEM NCYC DELE DX0 DXM NMIN FLIM\n"; + exampleblock << " 1 0 0.1 0.01 0.05 1 0\n"; + exampleblock << "END\n"; + + std::string blockname = "ENERGYMIN"; + Block block(blockname, exampleblock.str()); + + if (block.read_buffer(m_block[blockname], false) == 0) { + block_read.insert("ENERGYMIN"); + + block.get_next_parameter("NTEM", param.minimise.ntem, "", "0,1"); + block.get_next_parameter("NCYC", param.minimise.ncyc, ">0", ""); + block.get_next_parameter("DELE", param.minimise.dele, ">0", ""); + block.get_next_parameter("DX0", param.minimise.dx0, ">0", ""); + std::string str_dx0=io::to_string(param.minimise.dx0); + block.get_next_parameter("DXM", param.minimise.dxm, ">="+str_dx0, ""); + block.get_next_parameter("NMIN", param.minimise.nmin, ">0", ""); + block.get_next_parameter("FLIM", param.minimise.flim, ">=0", ""); + + /* if (param.minimise.ntem == 1 && param.minimise.ncyc > 0) + io::messages.add("ENERGYMIN block: NCYC > 0 has no effect for steepest descent", + "io::In_Parameter", + io::message::warning); */ + + if (param.minimise.flim > 0) + io::messages.add("ENERGYMIN: FLIM > 0 may result in " + "failure of the minimisation procedure." + " Only to be used in special cases.", + "io::In_Parameter", + io::message::warning); + + block.get_final_messages(); + } +} // ENERGYMIN /** * @section step STEP block - * @verbatim -STEP -# NSTLIM number of steps -# T initial time -# DT time step -# -# NSTLIM T DT - 100 0.0 0.005 -END -@endverbatim + * @snippet snippets/snippets.cc STEP */ void io::In_Parameter::read_STEP(simulation::Parameter ¶m, - std::ostream & os) { - DEBUG(8, "read STEP"); + std::ostream & os) { + DEBUG(8, "reading STEP"); - std::vector buffer; - std::string s; + std::stringstream exampleblock; + // lines starting with 'exampleblock<<"' and ending with '\n";' (spaces don't matter) + // will be used to generate snippets that can be included in the doxygen doc; + // the first line is the tag + exampleblock << "STEP\n"; + exampleblock << "# NSTLIM >0 number of steps\n"; + exampleblock << "# T >=0 initial time\n"; + exampleblock << "# -1 read time from configuration file\n"; + exampleblock << "# DT >0 time step\n"; + exampleblock << "#\n"; + exampleblock << "# NSTLIM T DT\n"; + exampleblock << " 100 0.0 0.005\n"; + exampleblock << "END\n"; - buffer = m_block["STEP"]; - if (!buffer.size()) { - io::messages.add("no STEP block in input", "In_Parameter", io::message::error); - return; - } - - block_read.insert("STEP"); + std::string blockname = "STEP"; + Block block(blockname, exampleblock.str()); - _lineStream.clear(); - _lineStream.str(concatenate(buffer.begin() + 1, buffer.end() - 1, s)); + if (block.read_buffer(m_block[blockname], true) == 0) { + block_read.insert(blockname); - _lineStream >> param.step.number_of_steps - >> param.step.t0 - >> param.step.dt; + block.get_next_parameter("NSTLIM", param.step.number_of_steps, ">0", ""); + block.get_next_parameter("T", param.step.t0, ">=0", "-1"); + block.get_next_parameter("DT", param.step.dt, ">0", ""); - if (_lineStream.fail()) - io::messages.add("bad line in STEP block", "In_Parameter", io::message::error); - - if (param.step.t0 < 0 && param.step.t0 != -1.0) - io::messages.add("STEP block: Negative time is not supported", - "In_Parameter", io::message::error); - if (param.step.number_of_steps <= 0) - io::messages.add("STEP block: We want to do at least one step...", - "In_Parameter", io::message::error); + block.get_final_messages(); + } } /** * @section constraint CONSTRAINT block - * @verbatim -CONSTRAINT -# NTC -# 1 "solvent" solvent only -# 2 "hydrogen" solvent and solute bonds containing hydrogens -# 3 "all" solvent and solute all bonds -# 4 "specified" solvent and constraints in the CONSTRAINTS block - 3 -# NTCP: solute algorithm -# 1 shake -# 2 lincs -# 3 flexshake -# NTCP - 1 -# NTCP0(1)..(3): algorithm options -# - shake: tolerance -# - lincs: order -# - flexshake: tolerance, readin, order -# NTCP0(1) NTCP0(2) NTCP0(3) - 0.0001 -# NTCS: solvent algorithm -# 1 shake -# 2 lincs -# 3 flexshake -# 4 settle -# 5 m_shake (only implemented for water and methanol!) -# 6 gpu_shake -# NTCS - 1 -# NTCS0(1): algorithm options -# - shake: tolerance -# - lincs: order -# - flexshake: tolerance, readin, order -# - settle: no arguments -# - m_shake: tolerance -# NTCS0(1) - 0.0001 -# NTCG: Number of GPUs -# NTCD: Device number of the GPU -# NTCG NTCD - 1 0 -END -@endverbatim + * @snippet snippets/snippets.cc CONSTRAINT */ void io::In_Parameter::read_CONSTRAINT(simulation::Parameter ¶m, - std::ostream & os) { - DEBUG(8, "read CONSTRAINT"); - - std::vector buffer; - std::string s, salg; - - buffer = m_block["CONSTRAINT"]; - - if (!buffer.size()) { - param.constraint.ntc = 1; - param.constraint.solute.algorithm = simulation::constr_off; - param.constraint.solvent.algorithm = simulation::constr_shake; - - io::messages.add("no CONSTRAINT block", "In_Parameter", - io::message::warning); - return; - } - - block_read.insert("CONSTRAINT"); - - _lineStream.clear(); - _lineStream.str(concatenate(buffer.begin() + 1, buffer.end() - 1, s)); - - std::string sntc; - _lineStream >> sntc; - if (sntc == "off" || sntc == "0") param.constraint.ntc = 0; - if (sntc == "solvent" || sntc == "1") param.constraint.ntc = 1; - else if (sntc == "hydrogen" || sntc == "2") param.constraint.ntc = 2; - else if (sntc == "all" || sntc == "3") param.constraint.ntc = 3; - else if (sntc == "specified" || sntc == "4") param.constraint.ntc = 4; - else { - std::stringstream ss(sntc); - if (!(ss >> param.constraint.ntc)) - io::messages.add("CONSTRAINT block: NTC not understood", - "In_Parameter", io::message::error); - } - - if (param.constraint.ntc < 0 || param.constraint.ntc > 4) { - io::messages.add("CONSTRAINT block: NTC out of range", - "In_Parameter", io::message::error); - - param.constraint.solute.algorithm = simulation::constr_off; - param.constraint.solvent.algorithm = simulation::constr_off; - - return; - } - - // SOLUTE - _lineStream >> salg; - - DEBUG(8, "Constraints (solute): " << salg); - - if (_lineStream.fail()) - io::messages.add("bad line in CONSTRAINT block", - "In_Parameter", io::message::error); - - std::transform(salg.begin(), salg.end(), salg.begin(), tolower); - - if (salg == "shake" || salg == "1") { - DEBUG(9, "constraints solute shake"); - - if (param.constraint.ntc > 1) - param.constraint.solute.algorithm = simulation::constr_shake; - else param.constraint.solute.algorithm = simulation::constr_off; - - _lineStream >> param.constraint.solute.shake_tolerance; + std::ostream & os) { + DEBUG(8, "reading CONSTRAINT"); + + std::stringstream exampleblock; + // lines starting with 'exampleblock<<"' and ending with '\n";' (spaces don't matter) + // will be used to generate snippets that can be included in the doxygen doc; + // the first line is the tag + exampleblock << "CONSTRAINT\n"; + exampleblock << "# NTC\n"; + exampleblock << "# 1 solvent solvent only\n"; + exampleblock << "# 2 hydrogen solvent and solute bonds containing hydrogens and \n"; + exampleblock << "# constraints in the topology's CONSTRAINTS block\n"; + exampleblock << "# 3 all solvent and solute all bonds\n"; + exampleblock << "# 4 specified solvent and constraints in the topology's CONSTRAINTS block\n"; + exampleblock << " 3\n"; + exampleblock << "# NTCP: solute algorithm\n"; + exampleblock << "# 1 shake\n"; + exampleblock << "# 2 lincs\n"; + exampleblock << "# 3 flexshake\n"; + exampleblock << "# NTCP\n"; + exampleblock << " 1\n"; + exampleblock << "# NTCP0(1)..(3): algorithm options\n"; + exampleblock << "# - shake: tolerance\n"; + exampleblock << "# - lincs: order\n"; + exampleblock << "# - flexshake: tolerance, readin, order\n"; + exampleblock << "# NTCP0(1) NTCP0(2) NTCP0(3)\n"; + exampleblock << " 0.0001\n"; + exampleblock << "# NTCS: solvent algorithm\n"; + exampleblock << "# 1 shake\n"; + exampleblock << "# 2 lincs\n"; + exampleblock << "# 3 flexshake\n"; + exampleblock << "# 4 settle\n"; + exampleblock << "# 5 m_shake (only implemented for water and methanol!)\n"; + exampleblock << "# 6 gpu_shake\n"; + exampleblock << "# NTCS\n"; + exampleblock << " 1\n"; + exampleblock << "# NTCS0(1): algorithm options\n"; + exampleblock << "# - shake: tolerance\n"; + exampleblock << "# - lincs: order\n"; + exampleblock << "# - flexshake: tolerance, readin, order\n"; + exampleblock << "# - settle: no arguments\n"; + exampleblock << "# - m_shake: tolerance\n"; + exampleblock << "# NTCS0(1)\n"; + exampleblock << " 0.0001\n"; + exampleblock << "# NTCG: Number of GPUs\n"; + exampleblock << "# NTCD: Device number of the GPU\n"; + exampleblock << "# NTCG NTCD\n"; + exampleblock << " 1 0\n"; + exampleblock << "END\n"; + + + std::string blockname = "CONSTRAINT"; + Block block(blockname, exampleblock.str()); + + if (block.read_buffer(m_block[blockname], false) == 0) { + block_read.insert(blockname); + + std::string sntc; + block.get_next_parameter("NTC", sntc, "", "off, 0, solvent, 1, hydrogen, 2, all, 3, specified, 4"); + + if (sntc == "off" || sntc == "0") param.constraint.ntc = 0; + else if (sntc == "solvent" || sntc == "1") param.constraint.ntc = 1; + else if (sntc == "hydrogen" || sntc == "2") param.constraint.ntc = 2; + else if (sntc == "all" || sntc == "3") param.constraint.ntc = 3; + else if (sntc == "specified" || sntc == "4") param.constraint.ntc = 4; + + + if (block.error()) { + param.constraint.solute.algorithm = simulation::constr_off; + param.constraint.solvent.algorithm = simulation::constr_off; + block.get_final_messages(); + return; + } - if (param.constraint.solute.shake_tolerance <= 0.0) - io::messages.add("CONSTRAINT block: shake tolerance should be > 0", - "In_Parameter", io::message::error); - } else if (salg == "flexshake" || salg == "3") { - DEBUG(9, "constraints solute flexshake"); + // SOLUTE + std::string salg; + block.get_next_parameter("NTCP", salg, "", "shake, 1, lincs, 2, flexshake, 3"); - if (param.constraint.ntc > 1) - param.constraint.solute.algorithm = simulation::constr_flexshake; - else param.constraint.solute.algorithm = simulation::constr_off; + DEBUG(8, "Constraints (solute): " << salg); - _lineStream >> param.constraint.solute.shake_tolerance - >> param.constraint.solute.flexshake_readin - >> param.constraint.solute.flexshake_mode; + if (salg == "shake" || salg == "1") { + DEBUG(9, "constraints solute shake"); - if (param.constraint.solute.shake_tolerance <= 0.0) - io::messages.add("CONSTRAINT block: shake tolerance should be > 0.0", - "In_Parameter", io::message::error); + if (param.constraint.ntc > 1) + param.constraint.solute.algorithm = simulation::constr_shake; + else param.constraint.solute.algorithm = simulation::constr_off; - if (param.constraint.solute.flexshake_mode < 0 || - param.constraint.solute.flexshake_mode > 3) - io::messages.add("CONSTRAINT block: flexshake mode should be >= 0 and <= 3", - "In_Parameter", io::message::error); + block.get_next_parameter("NTCP[0]", param.constraint.solute.shake_tolerance, ">0", ""); - } else if (salg == "lincs" || salg == "2") { - DEBUG(9, "constraints solute lincs"); + } else if (salg == "flexshake" || salg == "3") { + DEBUG(9, "constraints solute flexshake"); - if (param.constraint.ntc > 1) - param.constraint.solute.algorithm = simulation::constr_lincs; - else - param.constraint.solute.algorithm = simulation::constr_off; + if (param.constraint.ntc > 1) + param.constraint.solute.algorithm = simulation::constr_flexshake; + else param.constraint.solute.algorithm = simulation::constr_off; - _lineStream >> param.constraint.solute.lincs_order; + block.get_next_parameter("NTCP[0]", param.constraint.solute.shake_tolerance, ">0", ""); + block.get_next_parameter("NTCP[1]", param.constraint.solute.flexshake_readin, "", ""); + block.get_next_parameter("NTCP[2]", param.constraint.solute.flexshake_mode, ">=0 && <=3", ""); - if (param.constraint.solute.lincs_order < 1) - io::messages.add("CONSTRAINT block: lincs order should be > 1", - "In_Parameter", io::message::error); + } else if (salg == "lincs" || salg == "2") { + DEBUG(9, "constraints solute lincs"); - } else if (salg == "off" || salg == "0") { - DEBUG(9, "constraints solute off"); - param.constraint.solute.algorithm = simulation::constr_off; - } else { - DEBUG(9, "constraints solute error"); + if (param.constraint.ntc > 1) + param.constraint.solute.algorithm = simulation::constr_lincs; + else + param.constraint.solute.algorithm = simulation::constr_off; - io::messages.add("CONSTRAINT block: unknown algorithm (solute)", - "In_Parameter", io::message::error); - param.constraint.solute.algorithm = simulation::constr_off; - } + block.get_next_parameter("NTCP[0]", param.constraint.solute.lincs_order, ">=1", ""); - // SOLVENT - _lineStream >> salg; + } else if (salg == "off" || salg == "0") { + DEBUG(9, "constraints solute off"); + param.constraint.solute.algorithm = simulation::constr_off; + } else { + DEBUG(9, "constraints solute error"); - DEBUG(8, "constraints solvent: " << salg); + io::messages.add("CONSTRAINT block: unknown algorithm (solute)", + "In_Parameter", io::message::error); + param.constraint.solute.algorithm = simulation::constr_off; + } - if (_lineStream.fail()) - io::messages.add("bad line in CONSTRAINT block", - "In_Parameter", io::message::error); + // SOLVENT + block.get_next_parameter("NTCS", salg, "", "shake, 1, lincs, 2, flexshake, 3, settle, 4, m_shake, 5, gpu_shake, 6"); - std::transform(salg.begin(), salg.end(), salg.begin(), tolower); + DEBUG(8, "constraints solvent: " << salg); - if (salg == "shake" || salg == "1") { - DEBUG(9, "constraints solvent shake"); + if (salg == "shake" || salg == "1") { + DEBUG(9, "constraints solvent shake"); - param.constraint.solvent.algorithm = simulation::constr_shake; - _lineStream >> param.constraint.solvent.shake_tolerance; + param.constraint.solvent.algorithm = simulation::constr_shake; + block.get_next_parameter("NTCS[0]", param.constraint.solvent.shake_tolerance, ">0", ""); - if (param.constraint.solvent.shake_tolerance <= 0.0) - io::messages.add("CONSTRAINT block: shake tolerance should be > 0.0", - "In_Parameter", io::message::error); - } else if (salg == "flexshake" || salg == "3") { - DEBUG(9, "constraints solvent flexshake"); + } else if (salg == "flexshake" || salg == "3") { + DEBUG(9, "constraints solvent flexshake"); - param.constraint.solvent.algorithm = simulation::constr_flexshake; - _lineStream >> param.constraint.solvent.shake_tolerance; + param.constraint.solvent.algorithm = simulation::constr_flexshake; + block.get_next_parameter("NTCS[0]", param.constraint.solvent.shake_tolerance, ">0", ""); - if (param.constraint.solvent.shake_tolerance <= 0.0) - io::messages.add("CONSTRAINT block: shake tolerance should be > 0.0", - "In_Parameter", io::message::error); - } else if (salg == "lincs" || salg == "2") { - DEBUG(9, "constraints solvent lincs"); + } else if (salg == "lincs" || salg == "2") { + DEBUG(9, "constraints solvent lincs"); - param.constraint.solvent.algorithm = simulation::constr_lincs; - _lineStream >> param.constraint.solvent.lincs_order; + param.constraint.solvent.algorithm = simulation::constr_lincs; + block.get_next_parameter("NTCS[0]", param.constraint.solvent.lincs_order, ">=1", ""); - if (param.constraint.solvent.lincs_order < 1) - io::messages.add("CONSTRAINT block: lincs order should be >1", - "In_Parameter", io::message::error); + } else if (salg == "settle" || salg == "4") { + DEBUG(9, "constraints solvent settle"); - } else if (salg == "settle" || salg == "4") { - DEBUG(9, "constraints solvent settle"); + param.constraint.solvent.algorithm = simulation::constr_settle; + } else if (salg == "m_shake" || salg == "5") { + DEBUG(9, "constraints solvent m_shake"); - param.constraint.solvent.algorithm = simulation::constr_settle; - } else if (salg == "m_shake" || salg == "5") { - DEBUG(9, "constraints solvent m_shake"); + param.constraint.solvent.algorithm = simulation::constr_m_shake; + block.get_next_parameter("NTCS[0]", param.constraint.solvent.shake_tolerance, ">0", ""); - param.constraint.solvent.algorithm = simulation::constr_m_shake; - _lineStream >> param.constraint.solvent.shake_tolerance; + } else if (salg == "gpu_shake" || salg == "6") { + DEBUG(9, "constraints solvent gpu_shake"); - if (param.constraint.solvent.shake_tolerance <= 0.0) - io::messages.add("CONSTRAINT block: m_shake tolerance should be > 0.0", - "In_Parameter", io::message::error); - }/*else if (salg == "gpu_settle" || salg == "6") { - DEBUG(9, "constraints solvent settle on GPU"); + param.constraint.solvent.algorithm = simulation::constr_gpu_shake; + block.get_next_parameter("NTCS[0]", param.constraint.solvent.shake_tolerance, ">0", ""); - param.constraint.solvent.algorithm = simulation::constr_gpu_settle; + // Get number of GPUs and their IDs + block.get_next_parameter("NTCG", param.constraint.solvent.number_gpus, ">0", ""); - } */ else if (salg == "gpu_shake" || salg == "6") { - DEBUG(9, "constraints solvent gpu_shake"); + if (param.constraint.solvent.number_gpus == (unsigned int) 0) + io::messages.add("CUDA enabled, but number of GPUs is zero", + "In_Parameter", io::message::error); + else { + unsigned int temp; + bool fail = false; + for (unsigned int i = 0; i < param.constraint.solvent.number_gpus; i++) { + if (block.get_next_parameter("NTCD", temp, "", "")) { + fail = true; + break; + } + param.constraint.solvent.gpu_device_number.push_back(temp); + } + if (fail) { + param.constraint.solvent.gpu_device_number.clear(); + param.constraint.solvent.gpu_device_number.resize(param.constraint.solvent.number_gpus, -1); + io::messages.add("CUDA driver will determine devices for M-SHAKE", + "In_Parameter", io::message::notice); + } + } + } else if (salg == "off" || salg == "0") { + DEBUG(9, "constraints solvent off"); - param.constraint.solvent.algorithm = simulation::constr_gpu_shake; - _lineStream >> param.constraint.solvent.shake_tolerance; + param.constraint.solvent.algorithm = simulation::constr_off; + io::messages.add("CONSTRAINT block: no constraints for SOLVENT", + "In_Parameter", io::message::warning); + } else { - if (param.constraint.solvent.shake_tolerance <= 0.0) - io::messages.add("CONSTRAINT block: gpu_shake tolerance should be > 0.0", - "In_Parameter", io::message::error); + DEBUG(9, "constraints solvent error"); + io::messages.add("CONSTRAINT block: unknown algorithm (solvent)", + "In_Parameter", io::message::error); - // Get number of GPUs and their IDs - _lineStream >> param.constraint.solvent.number_gpus; - if (_lineStream.fail() || param.constraint.solvent.number_gpus == (unsigned int) 0) - io::messages.add("CUDA enabled, but number of GPUs is zero", - "In_Parameter", io::message::error); - else { - unsigned int temp; - bool fail = false; - for (unsigned int i = 0; i < param.constraint.solvent.number_gpus; i++) { - _lineStream >> temp; - if (_lineStream.fail()) { - fail = true; - break; + param.constraint.solvent.algorithm = simulation::constr_off; } - param.constraint.solvent.gpu_device_number.push_back(temp); - } - if (fail) { - param.constraint.solvent.gpu_device_number.clear(); - param.constraint.solvent.gpu_device_number.resize(param.constraint.solvent.number_gpus, -1); - io::messages.add("CUDA driver will determine devices for M-SHAKE", - "In_Parameter", io::message::notice); - } - } - } else if (salg == "off" || salg == "0") { - DEBUG(9, "constraints solvent off"); - - param.constraint.solvent.algorithm = simulation::constr_off; - io::messages.add("CONSTRAINT block: no constraints for SOLVENT", - "In_Parameter", io::message::warning); - } else { - DEBUG(9, "constraints solvent error"); - io::messages.add("CONSTRAINT block: unknown algorithm (solvent)", - "In_Parameter", io::message::error); + block.get_final_messages(); + } else { + param.constraint.ntc = 1; + param.constraint.solute.algorithm = simulation::constr_off; + param.constraint.solvent.algorithm = simulation::constr_shake; - param.constraint.solvent.algorithm = simulation::constr_off; - } -} + io::messages.add("no CONSTRAINT block", "In_Parameter", + io::message::error); + return; + } +} //CONSTRAINT /** * @section printout PRINTOUT block - * @verbatim -PRINTOUT -# NTPR: print out energies, etc. every NTPR steps -# NTPP: =1 perform dihedral angle transition monitoring -# NTPR NTPP - 0 0 -END -@endverbatim + * @snippet snippets/snippets.cc PRINTOUT */ void io::In_Parameter::read_PRINTOUT(simulation::Parameter ¶m, - std::ostream & os) { - DEBUG(8, "read PRINTOUT"); - - std::vector buffer; - std::string s; - - buffer = m_block["PRINTOUT"]; - - if (!buffer.size()) { - io::messages.add("no PRINTOUT block", "In_Parameter", io::message::notice); - return; - } - - block_read.insert("PRINTOUT"); + std::ostream & os) { + DEBUG(8, "reading PRINTOUT"); - _lineStream.clear(); - _lineStream.str(concatenate(buffer.begin() + 1, buffer.end() - 1, s)); + std::stringstream exampleblock; + // lines starting with 'exampleblock<<"' and ending with '\n";' (spaces don't matter) + // will be used to generate snippets that can be included in the doxygen doc; + // the first line is the tag + exampleblock << "PRINTOUT\n"; + exampleblock << "# NTPR: print out energies, etc. every NTPR steps\n"; + exampleblock << "# NTPP: =1 perform dihedral angle transition monitoring\n"; + exampleblock << "# NTPR NTPP\n"; + exampleblock << " 0 0\n"; + exampleblock << "END\n"; - _lineStream >> param.print.stepblock - >> param.print.monitor_dihedrals; - if (_lineStream.fail()) - io::messages.add("bad line in PRINTOUT block", - "In_Parameter", io::message::error); + std::string blockname = "PRINTOUT"; + Block block(blockname, exampleblock.str()); - if (param.print.stepblock < 0) - io::messages.add("PRINTOUT block: NTPR should be >=0.", - "In_Parameter", io::message::error); + if (block.read_buffer(m_block[blockname], false) == 0) { + block_read.insert(blockname); - if (param.print.monitor_dihedrals < 0 || param.print.monitor_dihedrals > 1) - io::messages.add("PRINTOUT block: NTPP should be 0 or 1.", - "In_Parameter", io::message::error); + block.get_next_parameter("NTPR", param.print.stepblock, ">=0", ""); + block.get_next_parameter("NTPP", param.print.monitor_dihedrals, "", "0,1"); + block.get_final_messages(); + } } /** * @section writetraj WRITETRAJ block - * @verbatim -WRITETRAJ -# NTWX controls writing of coordinate trajectory -# 0: no coordinate trajectory is written (default) -# >0: write solute and solvent coordinates every NTWX steps -# <0: write solute coordinates every |NTWX| steps -# NTWSE >= 0 selection criteria for coordinate trajectory writing -# 0: write normal coordinate trajectory -# >0: write minimum-energy coordinate and energy trajectory (based on the -# energy entry selected by NTWSE and as blocks of length NTWX) -# (see configuration/energy.cc or ene_ana library for indices) -# NTWV controls writing of velocity trajectory -# 0: no velocity trajectory is written (default) -# >0: write solute and solvent velocities every NTWV steps -# <0: write solute velocities every |NTWV| steps -# NTWF controls writing of force trajectory -# 0: no force trajectory is written (default) -# >0: write solute and solvent forces every NTWF steps -# <0: write solute forces every |NTWF| steps -# NTWE >= 0 controls writing of energy trajectory -# 0: no energy trajectory is written (default) -# >0: write energy trajectory every NTWE steps -# NTWG >= 0 controls writing of free energy trajectory -# 0: no free energy trajectory is written (default) -# >0: write free energy trajectory every NTWG steps -# NTWB >= 0 controls writing of block-averaged energy trajectory -# 0: no block averaged energy trajectory is written (default) -# >0: write block-averaged energy variables every |NTWB| steps -# (and free energies if NTWG > 0) trajectory -# -# NTWX NTWSE NTWV NTWF NTWE NTWG NTWB - 100 0 0 0 100 0 100 -END -@endverbatim + * @snippet snippets/snippets.cc WRITETRAJ */ void io::In_Parameter::read_WRITETRAJ(simulation::Parameter ¶m, - std::ostream & os) { - DEBUG(8, "read WRITETRAJ"); - - std::vector buffer; - std::string s; + std::ostream & os) { + DEBUG(8, "reading WRITETRAJ"); + + std::stringstream exampleblock; + // lines starting with 'exampleblock<<"' and ending with '\n";' (spaces don't matter) + // will be used to generate snippets that can be included in the doxygen doc; + // the first line is the tag + exampleblock << "WRITETRAJ\n"; + exampleblock << "# NTWX controls writing of coordinate trajectory\n"; + exampleblock << "# 0: no coordinate trajectory is written (default)\n"; + exampleblock << "# >0: write solute and solvent coordinates every NTWX steps\n"; + exampleblock << "# <0: write solute coordinates every |NTWX| steps\n"; + exampleblock << "# NTWSE >= 0 selection criteria for coordinate trajectory writing\n"; + exampleblock << "# 0: write normal coordinate trajectory\n"; + exampleblock << "# >0: write minimum-energy coordinate and energy trajectory (based on the\n"; + exampleblock << "# energy entry selected by NTWSE and as blocks of length NTWX)\n"; + exampleblock << "# (see configuration/energy.cc or ene_ana library for indices)\n"; + exampleblock << "# NTWV controls writing of velocity trajectory\n"; + exampleblock << "# 0: no velocity trajectory is written (default)\n"; + exampleblock << "# >0: write solute and solvent velocities every NTWV steps\n"; + exampleblock << "# <0: write solute velocities every |NTWV| steps\n"; + exampleblock << "# NTWF controls writing of force trajectory\n"; + exampleblock << "# 0: no force trajectory is written (default)\n"; + exampleblock << "# >0: write solute and solvent forces every NTWF steps\n"; + exampleblock << "# <0: write solute forces every |NTWF| steps\n"; + exampleblock << "# NTWE >= 0 controls writing of energy trajectory\n"; + exampleblock << "# 0: no energy trajectory is written (default)\n"; + exampleblock << "# >0: write energy trajectory every NTWE steps\n"; + exampleblock << "# NTWG >= 0 controls writing of free energy trajectory\n"; + exampleblock << "# 0: no free energy trajectory is written (default)\n"; + exampleblock << "# >0: write free energy trajectory every NTWG steps\n"; + exampleblock << "# NTWB >= 0 controls writing of block-averaged energy trajectory\n"; + exampleblock << "# 0: no block averaged energy trajectory is written (default)\n"; + exampleblock << "# >0: write block-averaged energy variables every |NTWB| steps\n"; + exampleblock << "# (and free energies if NTWG > 0) trajectory\n"; + exampleblock << "#\n"; + exampleblock << "# NTWX NTWSE NTWV NTWF NTWE NTWG NTWB\n"; + exampleblock << " 100 0 0 0 100 0 100\n"; + exampleblock << "END\n"; + + + std::string blockname = "WRITETRAJ"; + Block block(blockname, exampleblock.str()); + + if (block.read_buffer(m_block[blockname], false) == 0) { + block_read.insert(blockname); + + block.get_next_parameter("NTWX", param.write.position, "", ""); + std::string str_max_ene = io::to_string(configuration::Energy::MAX_ENERGY_INDEX); + block.get_next_parameter("NTWSE", param.write.energy_index, ">=0 && <="+str_max_ene, ""); + block.get_next_parameter("NTWV", param.write.velocity, "", ""); + block.get_next_parameter("NTWF", param.write.force, "", ""); + block.get_next_parameter("NTWE", param.write.energy, ">=0", ""); + block.get_next_parameter("NTWG", param.write.free_energy, ">=0", ""); + block.get_next_parameter("NTWB", param.write.block_average, ">=0", ""); + + if (param.write.energy_index > 0) { + if (param.write.position == 0) { + io::messages.add("WRITETRAJ block: NTWX must be a block size > 0 for " + "minimum-energy trajectory.", + "In_Parameter", io::message::error); + } + if (param.write.energy != 0 && param.write.energy != abs(param.write.position)) { + io::messages.add("WRITETRAJ block: NTWE must be 0 or abs(NTWX) for " + "minimum-energy trajectory.", + "In_Parameter", io::message::error); + } + // from the documentation all others needs to be zero + if (param.write.velocity != 0 || param.write.force != 0 || + param.write.free_energy != 0 || param.write.block_average != 0) { + io::messages.add("WRITETRAJ block: NTWV, NTWF, NTWG and NTWB must be 0 for " + "minimum-energy trajectory.", + "In_Parameter", io::message::error); + } + } - buffer = m_block["WRITETRAJ"]; + if (param.write.position < 0) { + param.write.position_solute_only = true; + param.write.position = -param.write.position; + io::messages.add("writing solute only position trajectory", + "In_Parameter", io::message::notice); + } - if (!buffer.size()) { - io::messages.add("no WRITETRAJ block", "In_Parameter", io::message::notice); - return; - } + if (param.write.velocity < 0) { + param.write.velocity_solute_only = true; + param.write.velocity = -param.write.velocity; + io::messages.add("writing solute only velocity trajectory", + "In_Parameter", io::message::notice); + } - block_read.insert("WRITETRAJ"); - - _lineStream.clear(); - _lineStream.str(concatenate(buffer.begin() + 1, buffer.end() - 1, s)); - - _lineStream >> param.write.position - >> param.write.energy_index - >> param.write.velocity - >> param.write.force - >> param.write.energy - >> param.write.free_energy - >> param.write.block_average; - - if (_lineStream.fail()) - io::messages.add("bad line in WRITETRAJ block", - "In_Parameter", io::message::error); - - if (param.write.energy_index < 0 || - param.write.energy_index > int(configuration::Energy::MAX_ENERGY_INDEX)) { - std::ostringstream msg; - msg << "WRITETRAJ block: NTWSE must be 0 to " - << configuration::Energy::MAX_ENERGY_INDEX; - io::messages.add(msg.str(), "In_Parameter", io::message::error); - } + if (param.write.force < 0) { + param.write.force_solute_only = true; + param.write.force = -param.write.force; + io::messages.add("writing solute only force trajectory", + "In_Parameter", io::message::notice); + } - if (param.write.energy_index > 0) { - if (param.write.position == 0) { - io::messages.add("WRITETRAJ block: NTWX must be a block size >= 0 for " - "minimum-energy trajectory.", - "In_Parameter", io::message::error); - } - if (param.write.energy != 0 && param.write.energy != abs(param.write.position)) { - io::messages.add("WRITETRAJ block: NTWE must be 0 or abs(NTWX) for " - "minimum-energy trajectory.", - "In_Parameter", io::message::error); - } - // from the documentation all others needs to be zero - if (param.write.velocity != 0 || param.write.force != 0 || - param.write.free_energy != 0 || param.write.block_average != 0) { - io::messages.add("WRITETRAJ block: NTWV, NTWF, NTWG and NTWB must be 0 for " - "minimum-energy trajectory.", - "In_Parameter", io::message::error); + block.get_final_messages(); } - } - - if (param.write.position < 0) { - param.write.position_solute_only = true; - param.write.position = -param.write.position; - io::messages.add("writing solute only position trajectory", - "In_Parameter", io::message::notice); - } - - if (param.write.velocity < 0) { - param.write.velocity_solute_only = true; - param.write.velocity = -param.write.velocity; - io::messages.add("writing solute only velocity trajectory", - "In_Parameter", io::message::notice); - } - - if (param.write.force < 0) { - param.write.force_solute_only = true; - param.write.force = -param.write.force; - io::messages.add("writing solute only force trajectory", - "In_Parameter", io::message::notice); - } - - if (param.write.energy < 0) - io::messages.add("WRITETRAJ block: NTWE should be >= 0", - "In_Parameter", io::message::error); - if (param.write.free_energy < 0) - io::messages.add("WRITETRAJ block: NTWG should be >= 0", - "In_Parameter", io::message::error); - if (param.write.block_average < 0) - io::messages.add("WRITETRAJ block: NTWB should be >= 0", - "In_Parameter", io::message::error); -} +} // WRITETRAJ /** * @section pressurescale PRESSURESCALE block - * @verbatim -PRESSURESCALE -# COUPLE: off(0), calc(1), scale(2) -# SCALE: off(0), iso(1), aniso(2), full(3), semianiso(4) -# VIRIAL: none(0), atomic(1), group(2) -# -# COUPLE SCALE COMP TAUP VIRIAL - calc iso 4.575E-4 0.5 atomic -# SEMI (semianisotropic couplings: X, Y, Z) -# e.g. 1 1 2: x and y jointly coupled and z separately coupled -# e.g. 0 0 1: constant area (xy-plane) and z coupled to a bath - 1 1 2 -# reference pressure - 0.06102 0.00000 0.00000 - 0.00000 0.06102 0.00000 - 0.00000 0.00000 0.06102 -END -@endverbatim + * @snippet snippets/snippets.cc PRESSURESCALE */ void io::In_Parameter::read_PRESSURESCALE(simulation::Parameter ¶m, - std::ostream & os) { - DEBUG(8, "read PRESSURESCALE"); - - std::vector buffer; - std::string s; - - - // first try for a PRESSURESCALE block - buffer = m_block["PRESSURESCALE"]; - - if (buffer.size()) { - - block_read.insert("PRESSURESCALE"); - - _lineStream.clear(); - _lineStream.str(concatenate(buffer.begin() + 1, buffer.end() - 1, s)); - - std::string s1, s2, s3; - int xs, ys, zs; - - _lineStream >> s1 >> s2 - >> param.pcouple.compressibility - >> param.pcouple.tau - >> s3; + std::ostream & os) { + DEBUG(8, "reading PRESSURESCALE"); + + std::stringstream exampleblock; + // lines starting with 'exampleblock<<"' and ending with '\n";' (spaces don't matter) + // will be used to generate snippets that can be included in the doxygen doc; + // the first line is the tag + exampleblock << "PRESSURESCALE\n"; + exampleblock << "# COUPLE: off(0), calc(1), scale(2)\n"; + exampleblock << "# SCALE: off(0), iso(1), aniso(2), full(3), semianiso(4)\n"; + exampleblock << "# VIRIAL: none(0), atomic(1), group(2)\n"; + exampleblock << "#\n"; + exampleblock << "# COUPLE SCALE COMP TAUP VIRIAL\n"; + exampleblock << " calc iso 4.575E-4 0.5 atomic\n"; + exampleblock << "# SEMI (semianisotropic couplings: X, Y, Z)\n"; + exampleblock << "# e.g. 1 1 2: x and y jointly coupled and z separately coupled\n"; + exampleblock << "# e.g. 0 0 1: constant area (xy-plane) and z coupled to a bath\n"; + exampleblock << " 1 1 2\n"; + exampleblock << "# reference pressure\n"; + exampleblock << " 0.06102 0.00000 0.00000\n"; + exampleblock << " 0.00000 0.06102 0.00000\n"; + exampleblock << " 0.00000 0.00000 0.06102\n"; + exampleblock << "END\n"; + + + std::string blockname = "PRESSURESCALE"; + Block block(blockname, exampleblock.str()); + + if (block.read_buffer(m_block[blockname], false) == 0) { + block_read.insert(blockname); + + std::string couple, scale, vir; + int xs, ys, zs; + block.get_next_parameter("COUPLE", couple, "", "off, 0, calc, 1, scale, 2"); + block.get_next_parameter("SCALE", scale, "", "off, 0, iso, 1, aniso, 2, full, 3, semianiso, 4"); + block.get_next_parameter("COMP", param.pcouple.compressibility, ">0", ""); + block.get_next_parameter("TAUP", param.pcouple.tau, ">0", ""); + block.get_next_parameter("VIRIAL", vir, "", "none, 0, atomic, 1, group, molecular, 2"); + block.get_next_parameter("SEMIX", xs, ">=0 && <=2", ""); + block.get_next_parameter("SEMIY", ys, ">=0 && <=2", ""); + block.get_next_parameter("SEMIZ", zs, ">=0 && <=2", ""); + + for (int i = 0; i < 3; ++i) { + std::string idx = io::to_string(i); + for (int j = 0; j < 3; ++j) { + std::string jdx = io::to_string(j); + block.get_next_parameter("PRES["+idx+"]["+jdx+"]", param.pcouple.pres0(i, j), ">=0", ""); + } + } - _lineStream >> xs >> ys >> zs; + if (couple == "off" || couple == "0") { + param.pcouple.calculate = false; + param.pcouple.scale = math::pcouple_off; + } else if (couple == "calc" || couple == "1") { + param.pcouple.calculate = true; + param.pcouple.scale = math::pcouple_off; + } else if (couple == "scale" || couple == "2") { + param.pcouple.calculate = true; + + if (scale == "off" || scale == "0") { + io::messages.add("PRESSURESCALE block: requesting scaling but SCALE set to OFF", + "In_Parameter", io::message::error); + param.pcouple.scale = math::pcouple_off; + } else if (scale == "iso" || scale == "1") + param.pcouple.scale = math::pcouple_isotropic; + else if (scale == "aniso" || scale == "2") + param.pcouple.scale = math::pcouple_anisotropic; + else if (scale == "full" || scale == "3") + param.pcouple.scale = math::pcouple_full_anisotropic; + else if (scale == "semianiso" || scale == "4") { + param.pcouple.scale = math::pcouple_semi_anisotropic; + if (xs == ys && ys == zs) + io::messages.add("PRESSURESCALE block: x_semi = y_semi = z_semi in SEMI, maybe you want isotropic pressure scaling?", + "In_Parameter", io::message::error); + param.pcouple.x_semi = xs; + param.pcouple.y_semi = ys; + param.pcouple.z_semi = zs; + } else { + param.pcouple.scale = math::pcouple_off; + } - for (int i = 0; i < 3; ++i) { - for (int j = 0; j < 3; ++j) { - _lineStream >> param.pcouple.pres0(i, j); - } - } + } else { + param.pcouple.calculate = false; + } - if (_lineStream.fail()) - io::messages.add("bad line in PRESSURESCALE block", - "In_Parameter", io::message::error); + if (param.pcouple.calculate) { + if (vir == "none" || vir == "0") { + param.pcouple.virial = math::no_virial; + } else if (vir == "atomic" || vir == "1") + param.pcouple.virial = math::atomic_virial; + else if (vir == "molecular" || vir == "group" || vir == "2") + param.pcouple.virial = math::molecular_virial; + else { + param.pcouple.virial = math::no_virial; + } + } else + param.pcouple.virial = math::no_virial; - //std::transform(s1.begin(), s1.end(), s1.begin(), tolower); - //std::transform(s2.begin(), s2.end(), s2.begin(), tolower); - //std::transform(s3.begin(), s3.end(), s3.begin(), tolower); - - if (s1 == "off" || s1 == "0") { - param.pcouple.calculate = false; - param.pcouple.scale = math::pcouple_off; - } else if (s1 == "calc" || s1 == "1") { - param.pcouple.calculate = true; - param.pcouple.scale = math::pcouple_off; - } else if (s1 == "scale" || s1 == "2") { - param.pcouple.calculate = true; - - if (s2 == "off" || s2 == "0") { - io::messages.add("PRESSURESCALE block: requesting scaling but SCALE set to OFF", - "In_Parameter", io::message::error); - param.pcouple.scale = math::pcouple_off; - } else if (s2 == "iso" || s2 == "1") - param.pcouple.scale = math::pcouple_isotropic; - else if (s2 == "aniso" || s2 == "2") - param.pcouple.scale = math::pcouple_anisotropic; - else if (s2 == "full" || s2 == "3") - param.pcouple.scale = math::pcouple_full_anisotropic; - else if (s2 == "semianiso" || s2 == "4") { - param.pcouple.scale = math::pcouple_semi_anisotropic; - if (xs < 0 || xs > 2) - io::messages.add("PRESSURESCALE block: bad value for x component of COUPLINGS FOR SEMIANISOTROPIC" - "(0,1,2)", - "In_Parameter", io::message::error); - if (ys < 0 || ys > 2) - io::messages.add("PRESSURESCALE block: bad value for y component of COUPLINGS FOR SEMIANISOTROPIC" - "(0,1,2)", - "In_Parameter", io::message::error); - if (zs < 0 || zs > 2) - io::messages.add("PRESSURESCALE block: bad value for z component of COUPLINGS FOR SEMIANISOTROPIC" - "(0,1,2)", - "In_Parameter", io::message::error); - if (xs == ys && ys == zs) - io::messages.add("PRESSURESCALE block: x_semi = y_semi = z_semi in SEMI, maybe you want isotropic pressure scaling?" - "(0,1,2)", - "In_Parameter", io::message::error); - param.pcouple.x_semi = xs; - param.pcouple.y_semi = ys; - param.pcouple.z_semi = zs; - } else { - io::messages.add("PRESSURESCALE block: bad value for SCALE switch " - "(off,iso,aniso,full)", - "In_Parameter", io::message::error); - param.pcouple.scale = math::pcouple_off; - } + if (param.pcouple.calculate == false && param.pcouple.scale != math::pcouple_off) + io::messages.add("PRESSURESCALE block: pressure coupling activated but " + "not calculating pressure", + "In_Parameter", + io::message::error); + if (param.pcouple.calculate && param.pcouple.virial == math::no_virial) + io::messages.add("requesting pressure calculation but " + "no virial specified", + "In_Parameter", io::message::error); - } else { - io::messages.add("bad value for calc switch in PRESSURESCALE block\n" - "(off,calc,scale)", - "In_Parameter", io::message::error); - param.pcouple.calculate = false; + block.get_final_messages(); } - - if (param.pcouple.calculate) { - if (s3 == "none" || s3 == "0") { - io::messages.add("requesting pressure calculation but " - "no virial specified", - "In_Parameter", io::message::error); - param.pcouple.virial = math::no_virial; - } else if (s3 == "atomic" || s3 == "1") - param.pcouple.virial = math::atomic_virial; - else if (s3 == "molecular" || s3 == "group" || s3 == "2") - param.pcouple.virial = math::molecular_virial; - else { - io::messages.add("bad value for virial switch in PRESSURESCALE block\n" - "(none,atomic,molecular)", - "In_Parameter", io::message::error); - param.pcouple.virial = math::no_virial; - } - } else - param.pcouple.virial = math::no_virial; - - } // PRESSURESCALE block - - if (param.pcouple.calculate == false && param.pcouple.scale != math::pcouple_off) - io::messages.add("PRESSURESCALE block: pressure coupling activated but " - "not calculating pressure", - "In_Parameter", - io::message::error); - if (param.pcouple.calculate == true && param.pcouple.virial == math::no_virial) - io::messages.add("PRESSURESCALE block: pressure calculation requested but" - " no virial specified!", "In_Parameter", - io::message::error); - if (param.pcouple.compressibility <= 0) - io::messages.add("PRESSURESCALE block: compressibility should be >0 ", - "In_Parameter", io::message::error); - if (param.pcouple.tau <= 0) - io::messages.add("PRESSURESCALE block: tau should be >0 ", - "In_Parameter", io::message::error); -} +} // PRESSURESCALE block /** * @section boundcond BOUNDCOND block - * @verbatim -BOUNDCOND -# NTB: boundary conditions -# -1 : truncoct -# 0 : vacuum -# 1 : rectangular -# 2 : triclinic -# NDFMIN: number of degrees of freedin subtracted for temperature -# -# NTB NDFMIN - 1 0 -END -@endverbatim + * @snippet snippets/snippets.cc BOUNDCOND */ void io::In_Parameter::read_BOUNDCOND(simulation::Parameter ¶m, - std::ostream & os) { - DEBUG(8, "read BOUNDCOND"); - - std::vector buffer; - std::string s; - - buffer = m_block["BOUNDCOND"]; + std::ostream & os) { + DEBUG(8, "reading BOUNDCOND"); + + std::stringstream exampleblock; + // lines starting with 'exampleblock<<"' and ending with '\n";' (spaces don't matter) + // will be used to generate snippets that can be included in the doxygen doc; + // the first line is the tag + exampleblock << "BOUNDCOND\n"; + exampleblock << "# NTB: boundary conditions\n"; + exampleblock << "# -1 : truncated octahedral\n"; + exampleblock << "# 0 : vacuum\n"; + exampleblock << "# 1 : rectangular\n"; + exampleblock << "# 2 : triclinic\n"; + exampleblock << "# NDFMIN: number of degrees of freedom subtracted for temperature\n"; + exampleblock << "#\n"; + exampleblock << "# NTB NDFMIN\n"; + exampleblock << " 1 0\n"; + exampleblock << "END\n"; + + + std::string blockname = "BOUNDCOND"; + Block block(blockname, exampleblock.str()); + + if (block.read_buffer(m_block[blockname], true) == 0) { + block_read.insert(blockname); + + int ntb; + block.get_next_parameter("NTB", ntb, "", "-1, 0, 1, 2"); + block.get_next_parameter("NDFMIN", param.boundary.dof_to_subtract, ">=0", ""); + + if (ntb == 0) { + param.boundary.boundary = math::vacuum; + } + else if (ntb == 1) param.boundary.boundary = math::rectangular; + else if (ntb == 2) param.boundary.boundary = math::triclinic; + else if (ntb == -1) { + param.boundary.boundary = math::truncoct; + io::messages.add("Truncated octahedral: the box is converted to triclinic boundary conditions internally", + "In_Parameter", io::message::notice); + } else { + std::ostringstream msg; + param.boundary.boundary = math::vacuum; + } - if (!buffer.size()) { - io::messages.add("no BOUNDCOND block", "In_Parameter", io::message::error); - param.boundary.boundary = math::vacuum; - return; - } + block.get_final_messages(); - block_read.insert("BOUNDCOND"); - - _lineStream.clear(); - _lineStream.str(concatenate(buffer.begin() + 1, buffer.end() - 1, s)); - - int ntb; - _lineStream >> ntb >> param.boundary.dof_to_subtract; - - if (_lineStream.fail()) - io::messages.add("bad line in BOUNDCOND block", - "In_Parameter", io::message::error); - - if (ntb == 0) param.boundary.boundary = math::vacuum; - else if (ntb == 1) param.boundary.boundary = math::rectangular; - else if (ntb == 2) param.boundary.boundary = math::triclinic; - else if (ntb == -1) { - param.boundary.boundary = math::truncoct; - io::messages.add("The box is converted to triclinic boundary coniditons internally", "In_Parameter", io::message::notice); - } else { - std::ostringstream msg; - msg << "BOUNDCOND block: wrong value for NTB " - << ntb << "\nvacuum (0), rectangular (1), triclinic (2), truncoct (-1)"; - io::messages.add(msg.str(), "In_Parameter", io::message::error); - param.boundary.boundary = math::vacuum; - } + } else { + param.boundary.boundary = math::vacuum; + return; + } - if (param.boundary.dof_to_subtract < 0) { - io::messages.add("BOUNDCOND block: NDFMIN must be >= 0.", - "In_Parameter", io::message::error); - param.boundary.dof_to_subtract = 0; - } } /** * @section perturbation PERTURBATION block - * @verbatim -PERTURBATION -# NTG: 0..1 controls use of free-energy calculation. -# 0: no free-energy calculation (default) -# 1: calculate dH/dRLAM -# NRDGL: 0,1 controls reading of initial value for RLAM. -# 0: use initial RLAM parameter from PERTURBATION block -# 1: read from configuration -# RLAM: 0.0..1.0 initial value for lambda -# DLAMT: >= 0.0 rate of lambda increase in time. -# ALPHLJ: >= 0.0 Lennard-Jones soft-core parameter -# ALPHC: >= 0.0 Coulomb-RF soft-core parameter -# NLAM: > 0 power dependence of lambda coupling -# NSCALE: 0..2 controls use of interaction scaling -# 0: no interaction scaling -# 1: interaction scaling -# 2: perturbation for all atom pairs with scaled -# interactions. No perturbation for others. -# -# NTG NRDGL RLAM DLAMT - 0 0 0.0 0.0 -# ALPHLJ ALPHC NLAM NSCALE - 0.0 0.0 1 0 -END -@endverbatim + * @snippet snippets/snippets.cc PERTURBATION */ void io::In_Parameter::read_PERTURBATION(simulation::Parameter ¶m, - std::ostream & os) { - DEBUG(8, "read PERTURBATION"); - - std::vector buffer; - std::string s; - - buffer = m_block["PERTURBATION"]; - if (!buffer.size()) - return; - - block_read.insert("PERTURBATION"); - - - _lineStream.clear(); - _lineStream.str(concatenate(buffer.begin() + 1, buffer.end() - 1, s)); - - std::string b, s1, s2; - int ntg, scale; - int nrdgl; - - _lineStream >> ntg - >> nrdgl - >> param.perturbation.lambda - >> param.perturbation.dlamt - >> param.perturbation.soft_vdw - >> param.perturbation.soft_crf - >> param.perturbation.lambda_exponent - >> scale; - - if (_lineStream.fail()) - io::messages.add("bad line in PERTURBATION block", - "In_Parameter", io::message::error); - - switch (ntg) { - case 0: - param.perturbation.perturbation = false; - break; - case 1: - param.perturbation.perturbation = true; - break; - default: - io::messages.add("PERTURBATION block: NTG must be 0 or 1.", - "In_Parameter", io::message::error); - } - - switch (nrdgl) { - case 0: // use from input file - param.perturbation.read_initial = false; - break; - case 1: // use from configuration - param.perturbation.read_initial = true; - break; - default: - io::messages.add("PERTURBATION block: NRDGL must be 0 or 1.", - "In_Parameter", io::message::error); - } - - if (param.perturbation.lambda < 0.0 || - param.perturbation.lambda > 1.0) { - io::messages.add("PERTURBATION block: RLAM must be 0.0 to 1.0.", - "In_Parameter", io::message::error); - } - - if (param.perturbation.dlamt < 0.0) { - io::messages.add("PERTURBATION block: DLAMT must be >= 0.", - "In_Parameter", io::message::error); - } - - if (param.perturbation.lambda_exponent <= 0) { - io::messages.add("PERTURBATION block: NLAM must be > 0.", - "In_Parameter", io::message::error); - } + std::ostream & os) { + DEBUG(8, "reading PERTURBATION"); + + std::stringstream exampleblock; + // lines starting with 'exampleblock<<"' and ending with '\n";' (spaces don't matter) + // will be used to generate snippets that can be included in the doxygen doc; + // the first line is the tag + exampleblock << "PERTURBATION\n"; + exampleblock << "# NTG: 0..1 controls use of free-energy calculation.\n"; + exampleblock << "# 0: no free-energy calculation (default)\n"; + exampleblock << "# 1: calculate dH/dRLAM\n"; + exampleblock << "# NRDGL: 0,1 controls reading of initial value for RLAM.\n"; + exampleblock << "# 0: use initial RLAM parameter from PERTURBATION block\n"; + exampleblock << "# 1: read from configuration\n"; + exampleblock << "# RLAM: 0.0..1.0 initial value for lambda\n"; + exampleblock << "# DLAMT: >= 0.0 rate of lambda increase in time.\n"; + exampleblock << "# ALPHLJ: >= 0.0 Lennard-Jones soft-core parameter\n"; + exampleblock << "# ALPHC: >= 0.0 Coulomb-RF soft-core parameter\n"; + exampleblock << "# NLAM: > 0 power dependence of lambda coupling\n"; + exampleblock << "# NSCALE: 0..2 controls use of interaction scaling\n"; + exampleblock << "# 0: no interaction scaling\n"; + exampleblock << "# 1: interaction scaling\n"; + exampleblock << "# 2: perturbation for all atom pairs with scaled\n"; + exampleblock << "# interactions. No perturbation for others.\n"; + exampleblock << "#\n"; + exampleblock << "# NTG NRDGL RLAM DLAMT\n"; + exampleblock << " 0 0 0.0 0.0\n"; + exampleblock << "# ALPHLJ ALPHC NLAM NSCALE\n"; + exampleblock << " 0.0 0.0 1 0\n"; + exampleblock << "END\n"; + + + std::string blockname = "PERTURBATION"; + Block block(blockname, exampleblock.str()); + + if (block.read_buffer(m_block[blockname], false) == 0) { + block_read.insert(blockname); + + std::string b, s1, s2; + int ntg, scale, nrdgl; + block.get_next_parameter("NTG", ntg, "", "0,1"); + block.get_next_parameter("NRDGL", nrdgl, "", "0,1"); + block.get_next_parameter("RLAM", param.perturbation.lambda, ">=0 && <=1", ""); + block.get_next_parameter("DLAMT", param.perturbation.dlamt, ">=0", ""); + block.get_next_parameter("ALPHLJ", param.perturbation.soft_vdw, ">=0", ""); + block.get_next_parameter("ALPHC", param.perturbation.soft_crf, ">=0", ""); + block.get_next_parameter("NLAM", param.perturbation.lambda_exponent, ">0", ""); + block.get_next_parameter("NSCALE", scale, "", "0,1,2"); + + switch (ntg) { + case 0: + param.perturbation.perturbation = false; + break; + case 1: + param.perturbation.perturbation = true; + break; + default: + break; + } - if (param.perturbation.soft_vdw < 0.0) { - io::messages.add("PERTURBATION block: ALPHLJ must be >= 0.", - "In_Parameter", io::message::error); - } + switch (nrdgl) { + case 0: // use from input file + param.perturbation.read_initial = false; + break; + case 1: // use from configuration + param.perturbation.read_initial = true; + break; + default: + break; + } - if (param.perturbation.soft_crf < 0.0) { - io::messages.add("PERTURBATION block: ALPHC must be >= 0.", - "In_Parameter", io::message::error); - } + switch (scale) { + case 0: // no scaling + param.perturbation.scaling = false; + param.perturbation.scaled_only = false; + break; + case 1: // scaling on + param.perturbation.scaling = true; + param.perturbation.scaled_only = false; + break; + case 2: // scaled only + param.perturbation.scaling = true; + param.perturbation.scaled_only = true; + break; + default: + break; + } + block.get_final_messages(); + } - switch (scale) { - case 0: // no scaling - param.perturbation.scaling = false; - param.perturbation.scaled_only = false; - break; - case 1: // scaling on - param.perturbation.scaling = true; - param.perturbation.scaled_only = false; - break; - case 2: // scaled only - param.perturbation.scaling = true; - param.perturbation.scaled_only = true; - break; - default: - io::messages.add("PERTURBATION block: NSCALE must be 0 to 2.", - "In_Parameter", io::message::error); - } -} +} //PERTURBATION /** * @section force FORCE block - * @verbatim -FORCE -# NTF(1..6): 0,1 determines terms used in force calculation -# 0: do not include terms -# 1: include terms -# NEGR: ABS(NEGR): number of energy groups -# > 0: use energy groups -# < 0: use energy and force groups -# NRE(1..NEGR): >= 1.0 last atom in each energy group -# NTF(1) NTF(2) NTF(3) NTF(4) NTF(5) NTF(6) -# bonds angles improper dihedral electrostatic vdW - 0 1 1 1 1 1 -# NEGR NRE(1) NRE(2) ... NRE(NEGR) - 1 60 -END -@endverbatim + * @snippet snippets/snippets.cc FORCE */ void io::In_Parameter::read_FORCE(simulation::Parameter ¶m, - std::ostream & os) { - DEBUG(8, "read FORCE"); - - std::vector buffer; - std::string s; - - buffer = m_block["FORCE"]; - - if (!buffer.size()) { - DEBUG(8, "no force block found???"); - io::messages.add("no FORCE block", "In_Parameter", io::message::error); - return; - } - - block_read.insert("FORCE"); - - // NTS - _lineStream.clear(); - _lineStream.str(buffer[1]); - - int a; - std::vector ntf; - while (_lineStream >> a) { - ntf.push_back(a); - } - - int bondH, angleH, impH, dihedralH; - if (ntf.size() == 6) { - param.force.bond = ntf[0]; - param.force.angle = ntf[1]; - param.force.improper = ntf[2]; - param.force.dihedral = ntf[3]; - param.force.nonbonded_crf = ntf[4]; - param.force.nonbonded_vdw = ntf[5]; - } else { - io::messages.add("FORCE block: bad line in NTS", - "In_Parameter", io::message::error); - } - - // energy groups - _lineStream.clear(); - _lineStream.str(concatenate(buffer.begin() + 2, buffer.end() - 1, s)); - - int snum; - unsigned int num, e, old_e = 0; - - _lineStream >> snum; - - if (snum < 0) { + std::ostream & os) { + DEBUG(8, "reading FORCE"); + + std::stringstream exampleblock; + // lines starting with 'exampleblock<<"' and ending with '\n";' (spaces don't matter) + // will be used to generate snippets that can be included in the doxygen doc; + // the first line is the tag + exampleblock << "FORCE\n"; + exampleblock << "# NTF(1..6): 0,1 determines terms used in force calculation\n"; + exampleblock << "# 0: do not include terms\n"; + exampleblock << "# 1: include terms\n"; + exampleblock << "# NEGR: ABS(NEGR): number of energy groups\n"; + exampleblock << "# > 0: use energy groups\n"; + exampleblock << "# < 0: use energy and force groups\n"; + exampleblock << "# NRE(1..NEGR): >= 1 last atom in each energy group\n"; + exampleblock << "# NTF(1) NTF(2) NTF(3) NTF(4) NTF(5) NTF(6)\n"; + exampleblock << "# bonds angles improper dihedral electrostatic vdW\n"; + exampleblock << " 0 1 1 1 1 1\n"; + exampleblock << "# NEGR NRE(1) NRE(2) ... NRE(NEGR)\n"; + exampleblock << " 1 60\n"; + exampleblock << "END\n"; + + + std::string blockname = "FORCE"; + Block block(blockname, exampleblock.str()); + + if (block.read_buffer(m_block[blockname], true) == 0) { + block_read.insert(blockname); + + block.get_next_parameter("NTF(1)", param.force.bond, "", "0,1"); + block.get_next_parameter("NTF(2)", param.force.angle, "", "0,1"); + block.get_next_parameter("NTF(3)", param.force.improper, "", "0,1"); + block.get_next_parameter("NTF(4)", param.force.dihedral, "", "0,1"); + block.get_next_parameter("NTF(5)", param.force.nonbonded_crf, "", "0,1"); + block.get_next_parameter("NTF(6)", param.force.nonbonded_vdw, "", "0,1"); + + int snum; + unsigned int num, e, old_e = 0; + block.get_next_parameter("NEGR", snum, "", ""); + + if (snum < 0) { #ifdef XXFORCEGROUPS - param.force.force_groups = true; - num = abs(snum); + param.force.force_groups = true; #else - io::messages.add("Force groups requested but not compiled with support for them." - "Use --enable-forcegroups for configure.", "In_Parameter", - io::message::error); - return; + io::messages.add("Force groups requested but not compiled with support for them." + "Use --enable-forcegroups for configure.", "In_Parameter", + io::message::error); #endif - } - num = abs(snum); - if (!num) { - io::messages.add("number of energy groups must not be zero.", "In_Parameter", - io::message::error); - return; - } + } + num = abs(snum); + + for (unsigned int i = 0; i < num; ++i) { + std::string idx=io::to_string(i); + block.get_next_parameter("NRE["+idx+"]", e, ">0", ""); + DEBUG(10, "\tadding energy group " << e - 1); + param.force.energy_group.push_back(e - 1); + if (e <= old_e) { + DEBUG(10, "energy groups not in order..."); + io::messages.add("FORCE block: energy groups are not in order", + "In_Parameter", io::message::error); + } + old_e = e; + } - for (unsigned int i = 0; i < num; ++i) { - _lineStream >> e; - DEBUG(10, "\tadding energy group " << e - 1); - param.force.energy_group.push_back(e - 1); - if (e <= old_e) { - DEBUG(10, "energy groups not in order..."); - io::messages.add("FORCE block: energy groups are not in order", - "In_Parameter", io::message::error); - return; - } - old_e = e; - } - // Now that we have the energy groups, we initialize the - // LAMBDAS parameters that depend on them. - // NOTE: lambdas vectors may be resized again in in_topology.cc - // in case an extra energy group is added. This will be the case - // if the last atom of the last energy group in the force array - // is not the last atom of the system. - - int maxnilg = param.force.energy_group.size(); - std::vector< double > one(maxnilg, 1.0); - std::vector< double > zero(maxnilg, 0.0); - for (unsigned int i = 0; i < param.lambdas.a.size(); i++) { - param.lambdas.a[i].resize(maxnilg, zero); - param.lambdas.b[i].resize(maxnilg, zero); - param.lambdas.c[i].resize(maxnilg, zero); - param.lambdas.d[i].resize(maxnilg, one); - param.lambdas.e[i].resize(maxnilg, zero); - } + DEBUG(10, "number of energy groups: " << param.force.energy_group.size()); + + if ((!param.force.nonbonded_crf) && param.force.nonbonded_vdw) + io::messages.add("FORCE block: setting charges to zero", + "In_Parameter", io::message::notice); + + if (param.force.nonbonded_crf && (!param.force.nonbonded_vdw)) + io::messages.add("FORCE block: setting atom types to dummy", + "In_Parameter", io::message::notice); + + // Now that we have the energy groups, we initialize the + // LAMBDAS parameters that depend on them. + // NOTE: lambdas vectors may be resized again in in_topology.cc + // in case an extra energy group is added. This will be the case + // if the last atom of the last energy group in the force array + // is not the last atom of the system. + int maxnilg = param.force.energy_group.size(); + std::vector< double > one(maxnilg, 1.0); + std::vector< double > zero(maxnilg, 0.0); + for (unsigned int i = 0; i < param.lambdas.a.size(); i++) { + param.lambdas.a[i].resize(maxnilg, zero); + param.lambdas.b[i].resize(maxnilg, zero); + param.lambdas.c[i].resize(maxnilg, zero); + param.lambdas.d[i].resize(maxnilg, one); + param.lambdas.e[i].resize(maxnilg, zero); + } - DEBUG(10, "number of energy groups: " << param.force.energy_group.size()); - - if (_lineStream.fail()) - io::messages.add("FORCE block: bad line in ENERGYGROUP", - "In_Parameter", io::message::error); - - if ((!param.force.nonbonded_crf) && param.force.nonbonded_vdw) - io::messages.add("FORCE block: setting charges to zero", - "In_Parameter", io::message::notice); - - if (param.force.nonbonded_crf && (!param.force.nonbonded_vdw)) - io::messages.add("FORCE block: setting atom types to dummy", - "In_Parameter", io::message::notice); - - if (_lineStream.fail()) - io::messages.add("bad line in FORCE block", "In_Parameter", io::message::error); - - /* - if (!_lineStream.eof()) - io::messages.add("End of line not reached in FORCE block, but should have been: \n" + s + "\n", - "In_Parameter", io::message::warning); - */ - - if (param.force.bond < 0 || param.force.bond > 1) - io::messages.add("FORCE block: Illegal value for force switch for bond", - "In_Parameter", io::message::error); - if (param.force.angle < 0 || param.force.angle > 1) - io::messages.add("FORCE block: Illegal value for force switch for angle", - "In_Parameter", io::message::error); - if (param.force.improper < 0 || param.force.improper > 1) - io::messages.add("FORCE block: Illegal value for force switch for improper dihedral", - "In_Parameter", io::message::error); - if (param.force.dihedral < 0 || param.force.dihedral > 1) - io::messages.add("FORCE block: Illegal value for force switch for dihedral", - "In_Parameter", io::message::error); - if (param.force.nonbonded_vdw < 0 || param.force.nonbonded_vdw > 1) - io::messages.add("FORCE block: Illegal value for force switch for nonbonded (vdw)", - "In_Parameter", io::message::error); - if (param.force.nonbonded_crf < 0 || param.force.nonbonded_crf > 1) - io::messages.add("FORCE block: Illegal value for force switch for nonbonded (crf)", - "In_Parameter", io::message::error); -} + block.get_final_messages(); + } +} //FORCE /** * @section covalentform COVALENTFORM block - * @verbatim -COVALENTFORM -# NTBBH: 0,1 controls bond-stretching potential -# 0: quartic form (default) -# 1: harmonic form -# NTBAH: 0,1 controls bond-angle bending potential -# 0: cosine-harmonic (default) -# 1: harmonic -# NTBDN: 0,1 controls torsional dihedral potential -# 0: arbitrary phase shifts (default) -# 1: phase shifts limited to 0 and 180 degrees. -# NTBBH NTBAH NTBDN - 0 0 0 -END -@endverbatim + * @snippet snippets/snippets.cc COVALENTFORM */ void io::In_Parameter::read_COVALENTFORM(simulation::Parameter ¶m, - std::ostream & os) { - DEBUG(8, "read COVALENTFORM"); - - std::vector buffer; - std::string s; - - buffer = m_block["COVALENTFORM"]; - - if (!buffer.size()) { - return; - } - - block_read.insert("COVALENTFORM"); - - _lineStream.clear(); - _lineStream.str(concatenate(buffer.begin() + 1, buffer.end() - 1, s)); - - int bond, angle, dihedral; - - _lineStream >> bond - >> angle - >> dihedral; + std::ostream & os) { + DEBUG(8, "reading COVALENTFORM"); + + std::stringstream exampleblock; + // lines starting with 'exampleblock<<"' and ending with '\n";' (spaces don't matter) + // will be used to generate snippets that can be included in the doxygen doc; + // the first line is the tag + exampleblock << "COVALENTFORM\n"; + exampleblock << "# NTBBH: 0,1 controls bond-stretching potential\n"; + exampleblock << "# 0: quartic form (default)\n"; + exampleblock << "# 1: harmonic form\n"; + exampleblock << "# NTBAH: 0,1 controls bond-angle bending potential\n"; + exampleblock << "# 0: cosine-harmonic (default)\n"; + exampleblock << "# 1: harmonic\n"; + exampleblock << "# NTBDN: 0,1 controls torsional dihedral potential\n"; + exampleblock << "# 0: arbitrary phase shifts (default)\n"; + exampleblock << "# 1: phase shifts limited to 0 and 180 degrees.\n"; + exampleblock << "# NTBBH NTBAH NTBDN\n"; + exampleblock << " 0 0 0\n"; + exampleblock << "END\n"; + + + std::string blockname = "COVALENTFORM"; + Block block(blockname, exampleblock.str()); + + if (block.read_buffer(m_block[blockname], false) == 0) { + block_read.insert(blockname); + + int bond, angle, dihedral; + block.get_next_parameter("NTBBH", bond, "", "0,1"); + block.get_next_parameter("NTBAH", angle, "", "0,1"); + block.get_next_parameter("NTBDN", dihedral, "", "0,1"); + + if (param.force.bond != 0) { + switch (bond) { + case 1: param.force.bond = 2; + break; + case 0: + default: param.force.bond = 1; + } + } - if (bond != 0 && bond != 1) { - io::messages.add("COVALENTFORM block: NTBBH must be 0 (quartic) " - "or 1 (harmonic).", - "In_Parameter", io::message::error); - } else { - if (param.force.bond != 0) { - switch (bond) { - case 1: param.force.bond = 2; - break; - case 0: - default: param.force.bond = 1; - } - } - } + if (param.force.angle != 0) { + switch (angle) { + case 1: param.force.angle = 2; + break; + case 0: + default: param.force.angle = 1; + } + } - if (angle != 0 && angle != 1) { - io::messages.add("COVALENTFORM block: NTBAH must be 0 (quartic) " - "or 1 (harmonic).", - "In_Parameter", io::message::error); - } else { - if (param.force.angle != 0) { - switch (angle) { - case 1: param.force.angle = 2; - break; - case 0: - default: param.force.angle = 1; - } - } - } + if (param.force.dihedral != 0) { + switch (dihedral) { + case 1: param.force.dihedral = 2; + break; + case 0: + default: param.force.dihedral = 1; + } + } - if (dihedral != 0 && dihedral != 1) { - io::messages.add("COVALENTFORM block: NTBDN must be 0 (arbitrary " - "phase shifts) or 1 (phase shifts limited).", - "In_Parameter", io::message::error); - } else { - if (param.force.dihedral != 0) { - switch (dihedral) { - case 1: param.force.dihedral = 2; - break; - case 0: - default: param.force.dihedral = 1; - } + block.get_final_messages(); } - } } /** * @section initialise INITIALISE block - * @verbatim -INITIALISE -# NTIVEL: 0,1 controls generation of initial velocities. -# 0: read from configuration (default) -# 1: generate from Maxell distribution at temperature TEMPI -# NTISHK: 0..3 controls shaking of initial configuration -# 0: no intial SHAKE (default) -# 1: initial SHAKE on coordinates only -# 2: initial SHAKE on velocities only -# 3: initial SHAKE on coordinates and velocities -# NTINHT: 0,1 controls generation of initial Nose-Hoover chain variables -# 0: read from configuration (default) -# 1: reset variables to zero. -# NTINHB: 0,1 controls generation of initial Nose-Hoover (chain) barostat -# variables -# 0: read from strartup file (if applicable) (default) -# 1: reset variables to zero -# NTISHI: 0,1 controls initial setting for lattice shift vectors -# 0: read from configuration (default) -# 1: reset shifts to zero. -# NTIRTC: 0,1 controls initial setting of positions and orientations for -# roto-translational constraints -# 0: read from configuration (default) -# 1: reset based on initial configuraion of startup file -# NTICOM: 0,1 controls initial removal of COM motion -# 0: no initial system COM motion removal (default) -# 1: initial COM translation is removed -# 2: initial COM rotation is removed -# NTISTI: 0,1 controls generation of stochastic integrals -# 0: read stochastic integrals and IG from configuration (default) -# 1: set stochastic integrals to zero and use IG from here. -# IG: random number generator seed -# TEMPI: initial temperature -# -# NTIVEL NTISHK NTINHT NTINHB - 0 0 0 0 -# NTISHI NTIRTC NTICOM - 0 0 0 -# NTISTI - 0 -# IG TEMPI - 0 0.0 -END -@endverbatim + * @snippet snippets/snippets.cc INITIALISE */ void io::In_Parameter::read_INITIALISE(simulation::Parameter ¶m, - std::ostream & os) { - DEBUG(8, "read INITIALISE"); - - std::vector buffer; - std::string s; - - buffer = m_block["INITIALISE"]; - - if (!buffer.size()) { - io::messages.add("no INITIALISE block", "In_Parameter", io::message::error); - return; - } + std::ostream & os) { + DEBUG(8, "reading INITIALISE"); + + std::stringstream exampleblock; + // lines starting with 'exampleblock<<"' and ending with '\n";' (spaces don't matter) + // will be used to generate snippets that can be included in the doxygen doc; + // the first line is the tag + exampleblock << "INITIALISE\n"; + exampleblock << "# NTIVEL: 0,1 controls generation of initial velocities.\n"; + exampleblock << "# 0: read from configuration (default)\n"; + exampleblock << "# 1: generate from Maxell distribution at temperature TEMPI\n"; + exampleblock << "# NTISHK: 0..3 controls shaking of initial configuration\n"; + exampleblock << "# 0: no intial SHAKE (default)\n"; + exampleblock << "# 1: initial SHAKE on coordinates only\n"; + exampleblock << "# 2: initial SHAKE on velocities only\n"; + exampleblock << "# 3: initial SHAKE on coordinates and velocities\n"; + exampleblock << "# NTINHT: 0,1 controls generation of initial Nose-Hoover chain variables\n"; + exampleblock << "# 0: read from configuration (default)\n"; + exampleblock << "# 1: reset variables to zero.\n"; + exampleblock << "# NTINHB: 0,1 controls generation of initial Nose-Hoover (chain) barostat\n"; + exampleblock << "# variables\n"; + exampleblock << "# 0: read from strartup file (if applicable) (default)\n"; + exampleblock << "# 1: reset variables to zero\n"; + exampleblock << "# NTISHI: 0,1 controls initial setting for lattice shift vectors\n"; + exampleblock << "# 0: read from configuration (default)\n"; + exampleblock << "# 1: reset shifts to zero.\n"; + exampleblock << "# NTIRTC: 0,1 controls initial setting of positions and orientations for\n"; + exampleblock << "# roto-translational constraints\n"; + exampleblock << "# 0: read from configuration (default)\n"; + exampleblock << "# 1: reset based on initial configuraion of startup file\n"; + exampleblock << "# NTICOM: 0,1 controls initial removal of COM motion\n"; + exampleblock << "# 0: no initial system COM motion removal (default)\n"; + exampleblock << "# 1: initial COM translation is removed\n"; + exampleblock << "# 2: initial COM rotation is removed\n"; + exampleblock << "# NTISTI: 0,1 controls generation of stochastic integrals\n"; + exampleblock << "# 0: read stochastic integrals and IG from configuration (default)\n"; + exampleblock << "# 1: set stochastic integrals to zero and use IG from here.\n"; + exampleblock << "# IG: random number generator seed\n"; + exampleblock << "# TEMPI: initial temperature\n"; + exampleblock << "#\n"; + exampleblock << "# NTIVEL NTISHK NTINHT NTINHB\n"; + exampleblock << " 0 0 0 0\n"; + exampleblock << "# NTISHI NTIRTC NTICOM\n"; + exampleblock << " 0 0 0\n"; + exampleblock << "# NTISTI\n"; + exampleblock << " 0\n"; + exampleblock << "# IG TEMPI\n"; + exampleblock << " 0 0.0\n"; + exampleblock << "END\n"; + + + std::string blockname = "INITIALISE"; + Block block(blockname, exampleblock.str()); + + if (block.read_buffer(m_block[blockname], true) == 0) { + block_read.insert(blockname); + + int ntivel, ntishk, ntinht, ntinhb, ntishi, ntirtc, nticom, ntisti; + block.get_next_parameter("NTIVEL", ntivel, "", "0,1"); + block.get_next_parameter("NTISHK", ntishk, "", "0,1,2,3"); + block.get_next_parameter("NTINHT", ntinht, "", "0,1"); + block.get_next_parameter("NTINHB", ntinhb, "", "0,1"); + block.get_next_parameter("NTISHI", ntishi, "", "0,1"); + block.get_next_parameter("NTIRTC", ntirtc, "", "0,1"); + block.get_next_parameter("NTICOM", nticom, "", "0,1,2"); + block.get_next_parameter("NTISTI", ntisti, "", "0,1"); + block.get_next_parameter("IG", param.start.ig, "", ""); + block.get_next_parameter("TEMPI", param.start.tempi, ">=0", ""); + + // generation of initial velocities + switch (ntivel) { + case 0: param.start.generate_velocities = false; + break; + case 1: param.start.generate_velocities = true; + break; + default: + break; + } - _lineStream.clear(); - _lineStream.str(concatenate(buffer.begin() + 1, buffer.end() - 1, s)); - - block_read.insert("INITIALISE"); - - int ntivel, ntishk, ntinht, ntinhb, ntishi, ntirtc, nticom, ntisti; - _lineStream >> ntivel >> ntishk >> ntinht >> ntinhb - >> ntishi >> ntirtc >> nticom - >> ntisti - >> param.start.ig >> param.start.tempi; - - if (_lineStream.fail()) - io::messages.add("bad line in INITIALISE block", - "In_Parameter", io::message::error); - - // generation of initial velocities - switch (ntivel) { - case 0: param.start.generate_velocities = false; - break; - case 1: param.start.generate_velocities = true; - break; - default: io::messages.add("INITIALISE block: NTIVEL must be 0 or 1", - "In_Parameter", io::message::error); - } + // controls initial SHAKE + switch (ntishk) { + case 0: // no initial SHAKE + param.start.shake_pos = false; + param.start.shake_vel = false; + break; + case 1: // SHAKE coordinates + param.start.shake_pos = true; + param.start.shake_vel = false; + break; + case 2: // SHAKE velocities + param.start.shake_pos = false; + param.start.shake_vel = true; + break; + case 3: // SHAKE coordinates & velocities + param.start.shake_pos = true; + param.start.shake_vel = true; + break; + default: + break; + } - // controls initial SHAKE - switch (ntishk) { - case 0: // no initial SHAKE - param.start.shake_pos = false; - param.start.shake_vel = false; - break; - case 1: // SHAKE coordinates - param.start.shake_pos = true; - param.start.shake_vel = false; - break; - case 2: // SHAKE velocities - param.start.shake_pos = false; - param.start.shake_vel = true; - break; - case 3: // SHAKE coordinates & velocities - param.start.shake_pos = true; - param.start.shake_vel = true; - break; - default: io::messages.add("INITIALISE block: NTISHK must be 0 to 3", - "In_Parameter", io::message::error); - } + // controls reading of Nose-Hoover chain variables. + switch (ntinht) { + case 0: param.start.read_nosehoover_chains = true; + break; + case 1: param.start.read_nosehoover_chains = false; + break; // reset them + default: + break; + } - // controls reading of Nose-Hoover chain variables. - switch (ntinht) { - case 0: param.start.read_nosehoover_chains = true; - break; - case 1: param.start.read_nosehoover_chains = false; - break; // reset them - default: io::messages.add("INITIALISE block: NTINHT must be 0 or 1", - "In_Parameter", io::message::error); - } + // controls reading of Nose-Hoover chain barostat variables: not implemented. + switch (ntinhb) { + case 0: param.start.read_nosehoover_barostat = true; + break; + case 1: param.start.read_nosehoover_barostat = false; + break; // reset them + default: + break; + } - // controls reading of Nose-Hoover chain barostat variables: not implemented. - switch (ntinhb) { - case 0: param.start.read_nosehoover_barostat = true; - break; - case 1: param.start.read_nosehoover_barostat = false; - break; // reset them - default: io::messages.add("INITIALISE block: NTINHB must be 0 or 1", - "In_Parameter", io::message::error); - } + switch (ntishi) { + case 0: param.start.read_lattice_shifts = true; + break; + case 1: param.start.read_lattice_shifts = false; + break; + default: + break; + } - switch (ntishi) { - case 0: param.start.read_lattice_shifts = true; - break; - case 1: param.start.read_lattice_shifts = false; - break; - default: io::messages.add("INITIALISE block: NTISHI must be 0 or 1", - "In_Parameter", io::message::error); - } + // controls reading of restart data for roto-translational constraints + switch (ntirtc) { + case 0: param.start.read_rottrans = true; + break; + case 1: param.start.read_rottrans = false; + break; + default: + break; + } - // controls reading of restart data for roto-translational constraints - switch (ntirtc) { - case 0: param.start.read_rottrans = true; - break; - case 1: param.start.read_rottrans = false; - break; - default: io::messages.add("INITIALISE block: NTIRTC must be 0 or 1", - "In_Parameter", io::message::error); - } + // controls removal of COM translation and rotation. + switch (nticom) { + case 0: + param.start.remove_com_rotation = false; + param.start.remove_com_translation = false; + break; + case 1: + param.start.remove_com_rotation = false; + param.start.remove_com_translation = true; + break; + case 2: + param.start.remove_com_rotation = true; + param.start.remove_com_translation = true; + break; + default: + break; + } - // controls removal of COM translation and rotation. - switch (nticom) { - case 0: - param.start.remove_com_rotation = false; - param.start.remove_com_translation = false; - break; - case 1: - param.start.remove_com_rotation = false; - param.start.remove_com_translation = true; - break; - case 2: - param.start.remove_com_rotation = true; - param.start.remove_com_translation = true; - break; - default: io::messages.add("INITIALISE block: NTICOM must be 0 to 2", - "In_Parameter", io::message::error); - } + // controls reading of stochastic integrals + switch (ntisti) { + case 0: + param.stochastic.generate_integral = false; + break; + case 1: + param.stochastic.generate_integral = true; + break; + default: + break; + } - // controls reading of stochastic integrals - switch (ntisti) { - case 0: - param.stochastic.generate_integral = false; - break; - case 1: - param.stochastic.generate_integral = true; - break; - default: io::messages.add("INITIALISE block: NTISTI must be 0 or 1", - "In_Parameter", io::message::error); + block.get_final_messages(); } - - if (param.start.tempi < 0) - io::messages.add("Illegal value for TEMPI in INITIALISE block (>=0)", - "In_Parameter", io::message::error); } /** * @section comtransrot COMTRANSROT block - * @verbatim -COMTRANSROT -# NSCM : controls system centre-of-mass (com) motion removal -# 0: no com motion removal (default) -# < 0: com translation and rotation are removed every abs(NSCM) -# steps. -# > 0: com tranlsation is removed every NSCM steps. -# NSCM - 0 -END -@endverbatim + * @snippet snippets/snippets.cc COMTRANSROT */ void io::In_Parameter::read_COMTRANSROT(simulation::Parameter ¶m, - std::ostream & os) { - DEBUG(8, "read COMTRANSROT"); - - std::vector buffer; - std::string s; - - DEBUG(10, "reading COMTRANSROT block"); - buffer = m_block["COMTRANSROT"]; - - if (!buffer.size()) { - return; - } + std::ostream & os) { + DEBUG(8, "reading COMTRANSROT"); + + std::stringstream exampleblock; + // lines starting with 'exampleblock<<"' and ending with '\n";' (spaces don't matter) + // will be used to generate snippets that can be included in the doxygen doc; + // the first line is the tag + exampleblock << "COMTRANSROT\n"; + exampleblock << "# NSCM : controls system centre-of-mass (com) motion removal\n"; + exampleblock << "# 0: no com motion removal (default)\n"; + exampleblock << "# < 0: com translation and rotation are removed every abs(NSCM)\n"; + exampleblock << "# steps.\n"; + exampleblock << "# > 0: com translation is removed every NSCM steps.\n"; + exampleblock << "# NSCM\n"; + exampleblock << " 0\n"; + exampleblock << "END\n"; + + + std::string blockname = "COMTRANSROT"; + Block block(blockname, exampleblock.str()); + + if (block.read_buffer(m_block[blockname], false) == 0) { + block_read.insert(blockname); + + int nscm; + block.get_next_parameter("NSCM", nscm, "", ""); + + if (nscm > 0) { + param.centreofmass.skip_step = nscm; + param.centreofmass.remove_rot = false; + param.centreofmass.remove_trans = true; + } else if (nscm < 0) { + param.centreofmass.skip_step = -nscm; + param.centreofmass.remove_rot = true; + param.centreofmass.remove_trans = true; + } else { // nscm == 0; + param.centreofmass.skip_step = 0; + param.centreofmass.remove_rot = false; + param.centreofmass.remove_trans = false; + } - block_read.insert("COMTRANSROT"); - - _lineStream.clear(); - _lineStream.str(concatenate(buffer.begin() + 1, buffer.end() - 1, s)); - int nscm; - - _lineStream >> nscm; - - if (_lineStream.fail()) - io::messages.add("bad line in COMTRANSROT block", - "In_Parameter", io::message::error); - - if (nscm > 0) { - param.centreofmass.skip_step = nscm; - param.centreofmass.remove_rot = false; - param.centreofmass.remove_trans = true; - } else if (nscm < 0) { - param.centreofmass.skip_step = -nscm; - param.centreofmass.remove_rot = true; - param.centreofmass.remove_trans = true; - } else { // nscm == 0; - param.centreofmass.skip_step = 0; - param.centreofmass.remove_rot = false; - param.centreofmass.remove_trans = false; - } + block.get_final_messages(); + } } /** * @section hoomd HOOMD block (optional) - * @verbatim -HOOMD -# PROCESSOR: cpu gpus -# -# PROCESSOR - gpus -END -@endverbatim + * @snippet snippets/snippets.cc HOOMD */ void io::In_Parameter::read_HOOMD(simulation::Parameter ¶m, - std::ostream & os) { - DEBUG(8, "read HOOMD"); + std::ostream & os) { + DEBUG(8, "reading HOOMD"); - std::vector buffer; - std::string s; + std::stringstream exampleblock; + // lines starting with 'exampleblock<<"' and ending with '\n";' (spaces don't matter) + // will be used to generate snippets that can be included in the doxygen doc; + // the first line is the tag + exampleblock << "HOOMD\n"; + exampleblock << "# PROCESSOR: cpu gpus\n"; + exampleblock << "#\n"; + exampleblock << "# PROCESSOR\n"; + exampleblock << " gpus\n"; + exampleblock << "END\n"; - DEBUG(10, "hoomd block"); + std::string blockname = "HOOMD"; + Block block(blockname, exampleblock.str()); - // try a HOOMD - buffer = m_block["HOOMD"]; - if (buffer.size()) { - block_read.insert("HOOMD"); + if (block.read_buffer(m_block[blockname], false) == 0) { + block_read.insert(blockname); + param.setDevelop("HOOMD is under development."); - std::string s1; - _lineStream.clear(); - _lineStream.str(concatenate(buffer.begin() + 1, buffer.end() - 1, s)); + DEBUG(10, "hoomd block"); - _lineStream >> s1; + // try a HOOMD - if (_lineStream.fail()) { - io::messages.add("bad line in HOOMD block", - "In_Parameter", io::message::error); - } + std::string s1; + block.get_next_parameter("PROCESSOR", s1, "", "cpu, gpus"); #ifndef HAVE_HOOMD - io::messages.add("HOOMD block not supported. Recompile with --with-hoomd=DIR", "In_Parameter", io::message::error); + io::messages.add("HOOMD block not supported. Recompile with --with-hoomd=DIR", "In_Parameter", io::message::error); #else - if (s1 == "cpu") { - param.hoomd.processor = simulation::cpu; - } else if (s1 == "gpus") { - param.hoomd.processor = simulation::gpus; - } else { - io::messages.add("HOOMD block: wrong processor chosen", - "In_Parameter", io::message::error); - } + if (s1 == "cpu") { + param.hoomd.processor = simulation::cpu; + } else if (s1 == "gpus") { + param.hoomd.processor = simulation::gpus; + } else { + io::messages.add("HOOMD block: wrong processor chosen", + "In_Parameter", io::message::error); + } + block.get_final_messages(); #endif - } + } } /** * @section pairlist PAIRLIST block - * @verbatim -PAIRLIST -# ALGORITHM: standard(0) (gromos96 like pairlist) -# grid(1) (md++ grid pairlist) -# grid_cell(2) (creates a mask) -# SIZE: grid cell size (or auto = 0.5 * RCUTP) -# TYPE: chargegoup(0) (chargegroup based cutoff) -# atomic(1) (atom based cutoff) -# -# ALGORITHM NSNB RCUTP RCUTL SIZE TYPE - grid 5 0.8 1.4 auto chargegroup -# -END -@endverbatim + * @snippet snippets/snippets.cc PAIRLIST */ void io::In_Parameter::read_PAIRLIST(simulation::Parameter ¶m, - std::ostream & os) { - DEBUG(8, "read PAIRLIST"); + std::ostream & os) { + DEBUG(8, "reading PAIRLIST"); + + std::stringstream exampleblock; + // lines starting with 'exampleblock<<"' and ending with '\n";' (spaces don't matter) + // will be used to generate snippets that can be included in the doxygen doc; + // the first line is the tag + exampleblock << "PAIRLIST\n"; + exampleblock << "# ALGORITHM standard(0) (gromos96 like pairlist)\n"; + exampleblock << "# grid(1) (md++ grid pairlist)\n"; + exampleblock << "# grid_cell(2) (creates a mask)\n"; + exampleblock << "# NSNB >0 frequency (number of steps) a pairlist is constructed\n"; + exampleblock << "# RCUTP >0.0 short-range cut-off in twin-range\n"; + exampleblock << "# RCUTL >0.0 intermediate-range cut-off in twin-range\n"; + exampleblock << "# SIZE >0 grid cell size (or auto = 0.5 * RCUTP)\n"; + exampleblock << "# TYPE chargegoup(0) (chargegroup based cutoff)\n"; + exampleblock << "# atomic(1) (atom based cutoff)\n"; + exampleblock << "#\n"; + exampleblock << "# ALGORITHM NSNB RCUTP RCUTL SIZE TYPE\n"; + exampleblock << " grid 5 0.8 1.4 auto chargegroup\n"; + exampleblock << "#\n"; + exampleblock << "END\n"; + + + std::string blockname = "PAIRLIST"; + Block block(blockname, exampleblock.str()); + + if (block.read_buffer(m_block[blockname], true) == 0) { + block_read.insert(blockname); + + std::string s1, s2, s3; + block.get_next_parameter("ALGORITHM", s1, "", "standard, 0, grid, 1, grid_cell, 2"); + block.get_next_parameter("NSNB", param.pairlist.skip_step, ">0", ""); + block.get_next_parameter("RCUTP", param.pairlist.cutoff_short, ">=0", ""); + std::string str_rcutp=io::to_string(param.pairlist.cutoff_short); + block.get_next_parameter("RCUTL", param.pairlist.cutoff_long, ">="+str_rcutp, ""); + block.get_next_parameter("SIZE", s2, "", ""); + block.get_next_parameter("TYPE", s3, "", "chargegroup, 0, atomic, 1"); + + if (s1 == "standard" || s1 == "0") param.pairlist.grid = 0; + else if (s1 == "grid" || s1 == "1") param.pairlist.grid = 1; + else if (s1 == "grid_cell" || s1 == "2") param.pairlist.grid = 2; + else param.pairlist.grid = 0; + + if (param.pairlist.grid) { + if (s2 == "auto") + param.pairlist.grid_size = 0.5 * param.pairlist.cutoff_short; + else { + std::istringstream css; + css.str(s2); + css >> param.pairlist.grid_size; + if (!param.pairlist.grid_size) + param.pairlist.grid_size = 0.5 * param.pairlist.cutoff_short; + if (css.fail()) { + io::messages.add("PAIRLIST block: wrong pairlist grid size chosen", + "In_Parameter", io::message::error); + param.pairlist.grid_size = 0.5 * param.pairlist.cutoff_short; + } + } + if (param.pairlist.grid_size <= 0) + io::messages.add("PAIRLIST block: Illegal value for grid size (>0)", + "In_Parameter", io::message::error); + } else param.pairlist.grid_size = 0; - std::vector buffer; - std::string s; + if (s3 == "atomic" || s3 == "1") param.pairlist.atomic_cutoff = true; + else if (s3 == "chargegroup" || s3 == "0") param.pairlist.atomic_cutoff = false; + else param.pairlist.atomic_cutoff = false; + block.get_final_messages(); + } +} // PAIRLIST - DEBUG(10, "pairlist block"); +/** + * @section cgrain CGRAIN block + * @snippet snippets/snippets.cc CGRAIN + */ +void io::In_Parameter::read_CGRAIN(simulation::Parameter ¶m, + std::ostream & os) { + DEBUG(8, "reading CGRAIN"); + + std::stringstream exampleblock; + // lines starting with 'exampleblock<<"' and ending with '\n";' (spaces don't matter) + // will be used to generate snippets that can be included in the doxygen doc; + // the first line is the tag + exampleblock << "CGRAIN\n"; + exampleblock << "# NTCGRAN 0..3 coarse grain selection\n"; + exampleblock << "# 0: atomistic (off)\n"; + exampleblock << "# 1: coarse-grained using MARTINI model (on)\n"; + exampleblock << "# 2: coarse-grained using GROMOS model (on)\n"; + exampleblock << "# 3: mixed-grained using GROMOS model (on)\n"; + exampleblock << "# EPS >= 0.0 dielectric constant for coarse grained coulombic interaction\n"; + exampleblock << "# EPSM >= 0.0 dielectric constant for mixed CG-FG coulombic interaction\n"; + exampleblock << "# NTCGRAN EPS EPSM\n"; + exampleblock << " 1 20 1\n"; + exampleblock << "END\n"; + + + std::string blockname = "CGRAIN"; + Block block(blockname, exampleblock.str()); + + if (block.read_buffer(m_block[blockname], false) == 0) { + block_read.insert(blockname); + + int ntcgran; + block.get_next_parameter("NTCGRAN", ntcgran, "", "0,1,2,3"); + block.get_next_parameter("EPS", param.cgrain.EPS, ">=0", ""); + block.get_next_parameter("EPSM", param.cgrain.EPSM, ">=0", ""); + + switch (ntcgran) { + case 0: + param.cgrain.level = 0; + break; + case 1: + param.cgrain.level = 1; + param.force.interaction_function = simulation::cgrain_func; + break; + case 2: + param.cgrain.level = 2; + param.force.interaction_function = simulation::cggromos_func; + break; + case 3: + param.cgrain.level = 3; + param.force.interaction_function = simulation::cggromos_func; + break; + default: + param.cgrain.level = 0; + io::messages.add("CGRAIN block: NTCGRAN must be 0 to 3.", + "In_Parameter", io::message::error); + } + DEBUG(6, "coarse graining level = " << param.cgrain.level); - // try a PAIRLIST - buffer = m_block["PAIRLIST"]; - if (buffer.size()) { - block_read.insert("PAIRLIST"); + block.get_final_messages(); + } +} - std::string s1, s2, s3; - _lineStream.clear(); - _lineStream.str(concatenate(buffer.begin() + 1, buffer.end() - 1, s)); +/** + * @section multibath MULTIBATH block + * @snippet snippets/snippets.cc MULTIBATH + */ +void io::In_Parameter::read_MULTIBATH(simulation::Parameter ¶m, + std::ostream & os) { + + DEBUG(8, "reading MULTIBATH"); + + std::stringstream exampleblock; + // lines starting with 'exampleblock<<"' and ending with '\n";' (spaces don't matter) + // will be used to generate snippets that can be included in the doxygen doc; + // the first line is the tag + exampleblock << "MULTIBATH\n"; + exampleblock << "# NTBTYP: temperature coupling algorithm\n"; + exampleblock << "# weak-coupling(0)\n"; + exampleblock << "# nose-hoover(1)\n"; + exampleblock << "# nose-hoover-chains(2) num\n"; + exampleblock << "# (where num is the number of chains to use)\n"; + exampleblock << "# NTBTYP NUM\n"; + exampleblock << " nose-hoover-chains 3\n"; + exampleblock << "# NBATHS: number of baths\n"; + exampleblock << " 2\n"; + exampleblock << "# TEMP0 TAU\n"; + exampleblock << " 300 0.10\n"; + exampleblock << " 300 0.10\n"; + exampleblock << "# DOFSET: number of different couplings\n"; + exampleblock << " 1\n"; + exampleblock << "# LAST COM-BATH IR-BATH\n"; + exampleblock << " 60 1 2\n"; + exampleblock << "# (this couples the first 60 atoms com motion to bath 1 and\n"; + exampleblock << "# the internal / rotational motion to bath 2)\n"; + exampleblock << "END\n"; + + std::string blockname = "MULTIBATH"; + Block block(blockname, exampleblock.str()); + + param.multibath.couple = false; + + if (!block.read_buffer(m_block[blockname], false)) { + block_read.insert(blockname); + + param.multibath.found_multibath = true; + param.multibath.found_tcouple = false; + + // the algorithm + std::string alg; + block.get_next_parameter("NTBTYP", alg, "", "weak-coupling, 0, nose-hoover, 1, nose-hoover-chains, 2"); + + if (alg == "weak-coupling" || alg == "0") + param.multibath.algorithm = 0; + else if (alg == "nose-hoover" || alg == "1") + param.multibath.algorithm = 1; + else if (alg == "nose-hoover-chains" || alg == "2") { + param.multibath.algorithm = 2; + // read in the number of chains => overwrites algorithm number!! + block.get_next_parameter("NUM", param.multibath.algorithm, ">=2", ""); + } - _lineStream >> s1 - >> param.pairlist.skip_step - >> param.pairlist.cutoff_short - >> param.pairlist.cutoff_long - >> s2 - >> s3; + int num_baths, num_dof; + unsigned int last, com_bath, ir_bath; + double temp, tau; - if (_lineStream.fail()) { - io::messages.add("bad line in PAIRLIST block", - "In_Parameter", io::message::error); - } + // the baths + block.get_next_parameter("NBATHS", num_baths, ">=0", ""); - std::transform(s1.begin(), s1.end(), s1.begin(), tolower); - std::transform(s2.begin(), s2.end(), s2.begin(), tolower); - std::transform(s3.begin(), s3.end(), s3.begin(), tolower); + if (block.error()) { + block.get_final_messages(); + return; + } - if (s1 == "grid" || s1 == "1") param.pairlist.grid = 1; - else if (s1 == "standard" || s1 == "0") param.pairlist.grid = 0; - else if (s1 == "grid_cell" || s1 == "2") { - param.pairlist.grid = 2; - } - else { - io::messages.add("PAIRLIST block: wrong pairlist algorithm chosen", - "In_Parameter", io::message::error); - param.pairlist.grid = false; - } + for (int i = 0; i < num_baths; ++i) { + std::string idx = io::to_string(i); + block.get_next_parameter("TEMP["+idx+"]", temp, ">=0.0", ""); + block.get_next_parameter("TAU["+idx+"]", tau, ">=0.0", "-1"); - if (param.pairlist.grid) { - if (s2 == "auto") - param.pairlist.grid_size = 0.5 * param.pairlist.cutoff_short; - else { - std::istringstream css; - css.str(s2); - css >> param.pairlist.grid_size; - if (!param.pairlist.grid_size) - param.pairlist.grid_size = 0.5 * param.pairlist.cutoff_short; - // param.pairlist.grid_size = atof(s2.c_str()); - if (css.fail()) { - io::messages.add("PAIRLIST block: wrong pairlist grid size chosen", - "In_Parameter", io::message::error); - param.pairlist.grid_size = 0.5 * param.pairlist.cutoff_short; + param.multibath.multibath.add_bath(temp, tau); + if (tau != -1) param.multibath.couple = true; } - } - } else param.pairlist.grid_size = 0; - - if (s3 == "atomic" || s3 == "1") param.pairlist.atomic_cutoff = true; - else if (s3 == "chargegroup" || s3 == "0") param.pairlist.atomic_cutoff = false; - else { - io::messages.add("PAIRLIST block: wrong cutoff type chosen " - "(allowed: atomic(1), chargegroup(0)", - "In_Parameter", io::message::error); - param.pairlist.atomic_cutoff = false; - } - } - - if (param.pairlist.grid && param.pairlist.grid_size <= 0) - io::messages.add("PAIRLIST block: Illegal value for grid size (>0)", - "In_Parameter", io::message::error); - if (param.pairlist.cutoff_short < 0) { - io::messages.add("PAIRLIST block: Illegal value for short range cutoff (>0)", - "In_Parameter", io::message::error); - } - if (param.pairlist.cutoff_long < param.pairlist.cutoff_short) { - io::messages.add("PAIRLIST block: Illegal value for long range cutoff (>=RCUTP)", - "In_Parameter", io::message::error); - } -} - -/** - * @section cgrain CGRAIN block - * @verbatim -CGRAIN -# NTCGRAN 0..3 coarse grain selection -# 0: atomistic (off) -# 1: coarse-grained using MARTINI model (on) -# 2: coarse-grained using GROMOS model (on) -# 3: mixed-grained using GROMOS model (on) -# EPS >= 0.0 dielectric constant for coarse grained coulombic interaction -# EPSM >= 0.0 dielectric constant for mixed CG-FG coulombic interaction -# NTCGRAN EPS EPSM - 1 20 1 -END -@endverbatim - */ -void io::In_Parameter::read_CGRAIN(simulation::Parameter ¶m, - std::ostream & os) { - DEBUG(8, "read CGRAIN"); - - std::vector buffer; - std::string s; - buffer = m_block["CGRAIN"]; + // now the DOF sets + block.get_next_parameter("DOFSET", num_dof, ">=0", ""); - if (buffer.size()) { - - block_read.insert("CGRAIN"); - - _lineStream.clear(); - _lineStream.str(concatenate(buffer.begin() + 1, buffer.end() - 1, s)); - - int ntcgran; - _lineStream >> ntcgran >> param.cgrain.EPS >> param.cgrain.EPSM; - - if (_lineStream.fail()) - io::messages.add("bad line in CGRAIN block", - "In_Parameter", io::message::error); - - switch (ntcgran) { - case 0: - param.cgrain.level = 0; - break; - case 1: - param.cgrain.level = 1; - param.force.interaction_function = simulation::cgrain_func; - break; - case 2: - param.cgrain.level = 2; - param.force.interaction_function = simulation::cggromos_func; - break; - case 3: - param.cgrain.level = 3; - param.force.interaction_function = simulation::cggromos_func; - break; - default: - param.cgrain.level = 0; - io::messages.add("CGRAIN block: NTCGRAN must be 0 to 3.", - "In_Parameter", io::message::error); - } - DEBUG(6, "coarse graining level = " << param.cgrain.level); - - if (param.cgrain.EPS < 0) - io::messages.add("CGRAIN block: EPS must be >= 0.0.", - "In_Parameter", io::message::error); - if (param.cgrain.EPSM < 0) - io::messages.add("CGRAIN block: EPSM must be >= 0.0.", - "In_Parameter", io::message::error); - } -} - -/** - * @section multibath MULTIBATH block - * @verbatim -MULTIBATH -# ALGORITHM: temperature coupling algorithm -# weak-coupling(0) -# nose-hoover(1) -# nose-hoover-chains(2) num -# (where num is the number of chains to use) -# ALGORITHM NUM - nose-hoover-chains 3 -# NBATHS: number of baths - 2 -# TEMP0 TAU - 300 0.10 - 300 0.10 -# DOFSET: number of different couplings - 1 -# LAST COM-BATH IR-BATH - 60 1 2 -# (this couples the first 60 atoms com motion to bath 1 and -# the internal / rotational motion to bath 2) -END -@endverbatim - */ -void io::In_Parameter::read_MULTIBATH(simulation::Parameter ¶m, - std::ostream & os) { - DEBUG(8, "read MULTIBATH"); - - std::vector buffer; - std::string s; - - DEBUG(10, "TEMPERATURE COUPLING block"); - - param.multibath.couple = false; - - // is there a MULTIBATH block - buffer = m_block["MULTIBATH"]; - - if (buffer.size()) { - - block_read.insert("MULTIBATH"); - - param.multibath.found_multibath = true; - param.multibath.found_tcouple = false; - - DEBUG(11, "MULTIBATH present"); - /*io::messages.add("using MULTIBATH block", - "In_Parameter", io::message::notice);*/ - - _lineStream.clear(); - _lineStream.str(concatenate(buffer.begin() + 1, buffer.end() - 1, s)); - - std::string alg; - - // the algorithm - _lineStream >> alg; - std::transform(alg.begin(), alg.end(), alg.begin(), tolower); - - if (alg == "weak-coupling") - param.multibath.nosehoover = 0; - else if (alg == "nose-hoover") - param.multibath.nosehoover = 1; - else if (alg == "nose-hoover-chains") - param.multibath.nosehoover = 2; - else { - std::stringstream s(alg); - if (!(s >> param.multibath.nosehoover) || - param.multibath.nosehoover < 0 || param.multibath.nosehoover > 2) { - io::messages.add("MUTLIBATH block: algorithm not understood", - "In_Parameter", io::message::error); - - param.multibath.nosehoover = 0; - return; - } - } - - if (param.multibath.nosehoover == 2) { - // read in the number of chains - int num; - _lineStream >> num; - - if (num < 2) { - io::messages.add("MULTIBATH block: wrong number of Nose-Hoover chains", - "In_Parameter", io::message::error); - param.multibath.nosehoover = 0; - return; - } - param.multibath.nosehoover = num; - } - - int num; - unsigned int last; - unsigned int com_bath, ir_bath; - double temp, tau; - - // the baths - _lineStream >> num; - - for (int i = 0; i < num; ++i) { - _lineStream >> temp >> tau; - - if (temp < 0.0 || (tau <= 0.0 && tau != -1)) { - io::messages.add("MULTIBATH block: illegal value for temp or tau", - "In_Parameter", io::message::error); - } + if (block.error()) { + block.get_final_messages(); + return; + } - param.multibath.multibath.add_bath(temp, tau); - if (tau != -1) param.multibath.couple = true; - } + if (param.multibath.multibath.size() == 0) { + if (num_dof != 0) { + io::messages.add("MULTIBATH block: no baths but coupling groups specified", + "In_Parameter", io::message::error); + num_dof = 0; + } else { + io::messages.add("MULTIBATH block: no baths and no coupling groups => no temperature coupling", + "In_Parameter", io::message::warning); + param.multibath.couple = false; + return; + } - if (_lineStream.fail()) { - io::messages.add("bad line in MULTIBATH block", - "In_Parameter", io::message::error); - } + } + std::string str_bathsize = io::to_string(param.multibath.multibath.size()); - // now the ranges - _lineStream >> num; + for (int i = 0; i < num_dof; ++i) { + std::string idx = io::to_string(i); + block.get_next_parameter("LAST["+idx+"]", last, ">1", ""); + block.get_next_parameter("COM-BATH["+idx+"]", com_bath, ">=1 && <="+ str_bathsize, ""); + block.get_next_parameter("IR-BATH["+idx+"]", ir_bath, ">=1 && <="+ str_bathsize, ""); - if (param.multibath.multibath.size() == 0 && - num > 0) { + if (last < 1) last = 1; + if (com_bath < 1) com_bath = 1; + if (ir_bath < 1) ir_bath = 1; - io::messages.add("MULTIBATH block: no baths but coupling groups specified", - "In_Parameter", io::message::error); - num = 0; - } + if (com_bath > param.multibath.multibath.size()) com_bath = param.multibath.multibath.size(); + if (ir_bath > param.multibath.multibath.size()) ir_bath = param.multibath.multibath.size(); - for (int i = 0; i < num; ++i) { - _lineStream >> last >> com_bath >> ir_bath; - // let it figure out the last molecule on its own - - if (last < 1 || com_bath < 1 || ir_bath < 1) { - io::messages.add("MULTIBATH block: range parameter < 1", - "In_Parameter", io::message::error); - if (last < 1) last = 1; - if (com_bath < 1) com_bath = 1; - if (ir_bath < 1) ir_bath = 1; - } - - if (com_bath > param.multibath.multibath.size() || - ir_bath > param.multibath.multibath.size()) { - io::messages.add("MULTIBATH block: ir bath or com bath index too large", - "In_Parameter", io::message::error); - if (com_bath > param.multibath.multibath.size()) com_bath = param.multibath.multibath.size(); - if (ir_bath > param.multibath.multibath.size()) ir_bath = param.multibath.multibath.size(); - } - - param.multibath.multibath.add_bath_index(last - 1, 0, com_bath - 1, ir_bath - 1); - } + param.multibath.multibath.add_bath_index(last - 1, 0, com_bath - 1, ir_bath - 1); + } - if (_lineStream.fail()) { - io::messages.add("bad line in MULTIBATH block", - "In_Parameter", io::message::error); + block.get_final_messages(); } - - } } // MULTIBATH /** * @section positionres POSITIONRES block - * @verbatim -POSITIONRES -# NTPOR 0..3 controls atom positions re(con)straining. -# 0: no position re(con)straints. -# 1: restraining with force constant CPOR -# 2: restraining with force constant CPOR wieghted by -# atomic B-factors -# 3: constraining -# NTPORB 0,1 controls reading of reference positions and -# B-factors -# 0: read reference positions from startup file. -# 1: read reference positions and B-factors from -# special file -# NTPORS 0,1 controls scaling of reference positions upon -# pressure scaling -# 0: do not scale reference positions -# 1: scale reference positions -# CPOR >= 0 position restraining force constant -# -# NTPOR NTPORB NTPORS CPOR - 0 0 0 2.5E4 -END -@endverbatim + * @snippet snippets/snippets.cc POSITIONRES */ void io::In_Parameter::read_POSITIONRES(simulation::Parameter ¶m, - std::ostream & os) { - DEBUG(8, "read POSITIONRES"); - - std::vector buffer; - std::string s; - - DEBUG(10, "positionres block"); - buffer = m_block["POSITIONRES"]; - - if (!buffer.size()) { - return; - } - - block_read.insert("POSITIONRES"); - - _lineStream.clear(); - _lineStream.str(concatenate(buffer.begin() + 1, buffer.end() - 1, s)); - - int ntpor, ntpors, read; - _lineStream >> ntpor - >> read - >> ntpors - >> param.posrest.force_constant; - - if (_lineStream.fail()) - io::messages.add("bad line in POSITIONRES block", - "In_Parameter", io::message::error); - - switch (ntpor) { - case 0: - param.posrest.posrest = simulation::posrest_off; - break; - case 1: - param.posrest.posrest = simulation::posrest_on; - break; - case 2: - param.posrest.posrest = simulation::posrest_bfactor; - break; - case 3: - param.posrest.posrest = simulation::posrest_const; - break; - default: - io::messages.add("POSITIONRES block: NTPOR must be 0 to 3.", - "In_Parameter", io::message::error); - } - - switch (read) { - case 0: - param.posrest.read = false; - break; - case 1: - param.posrest.read = true; - break; - default: - param.posrest.read = false; - io::messages.add("POSITIONRES block: NTPORS must be 0 or 1.", - "In_Parameter", io::message::error); - } + std::ostream & os) { + DEBUG(8, "reading POSITIONRES"); + + std::stringstream exampleblock; + // lines starting with 'exampleblock<<"' and ending with '\n";' (spaces don't matter) + // will be used to generate snippets that can be included in the doxygen doc; + // the first line is the tag + exampleblock << "POSITIONRES\n"; + exampleblock << "# NTPOR 0..3 controls atom positions re(con)straining.\n"; + exampleblock << "# 0: no position re(con)straints (default)\n"; + exampleblock << "# 1: restraining with force constant CPOR\n"; + exampleblock << "# 2: restraining with force constant CPOR weighted by\n"; + exampleblock << "# atomic B-factors\n"; + exampleblock << "# 3: constraining\n"; + exampleblock << "# NTPORB 0,1 controls reading of reference positions and\n"; + exampleblock << "# B-factors\n"; + exampleblock << "# 0: read reference positions from startup file.\n"; + exampleblock << "# 1: read reference positions and B-factors from\n"; + exampleblock << "# special file\n"; + exampleblock << "# NTPORS 0,1 controls scaling of reference positions upon\n"; + exampleblock << "# pressure scaling\n"; + exampleblock << "# 0: do not scale reference positions\n"; + exampleblock << "# 1: scale reference positions\n"; + exampleblock << "# CPOR >= 0 position restraining force constant\n"; + exampleblock << "#\n"; + exampleblock << "# NTPOR NTPORB NTPORS CPOR\n"; + exampleblock << " 0 0 0 2.5E4\n"; + exampleblock << "END\n"; + + + std::string blockname = "POSITIONRES"; + Block block(blockname, exampleblock.str()); + + if (block.read_buffer(m_block[blockname], false) == 0) { + block_read.insert(blockname); + + int ntpor, ntpors, read; + block.get_next_parameter("NTPOR", ntpor, "", "0,1,2,3"); + block.get_next_parameter("NTPORB", read, "", "0,1"); + block.get_next_parameter("NTPORS", ntpors, "", "0,1"); + block.get_next_parameter("CPOR", param.posrest.force_constant, ">=0", ""); + + switch (ntpor) { + case 0: + param.posrest.posrest = simulation::posrest_off; + break; + case 1: + param.posrest.posrest = simulation::posrest_on; + break; + case 2: + param.posrest.posrest = simulation::posrest_bfactor; + break; + case 3: + param.posrest.posrest = simulation::posrest_const; + break; + default: + break; + } - switch (ntpors) { - case 0: - param.posrest.scale_reference_positions = false; - break; - case 1: - param.posrest.scale_reference_positions = true; - break; - default: - param.posrest.scale_reference_positions = false; - io::messages.add("POSITIONRES block: NTPORS must be 0 or 1.", - "In_Parameter", io::message::error); - } + switch (read) { + case 0: + param.posrest.read = false; + break; + case 1: + param.posrest.read = true; + break; + default: + param.posrest.read = false; + } - if (param.posrest.force_constant < 0.0) - io::messages.add("POSITIONRES block: Illegal value for CPOR.", - "In_Parameter", io::message::error); + switch (ntpors) { + case 0: + param.posrest.scale_reference_positions = false; + break; + case 1: + param.posrest.scale_reference_positions = true; + break; + default: + param.posrest.scale_reference_positions = false; + } + block.get_final_messages(); + } } // POSITIONRES /** * @section xrayres XRAYRES block - * @verbatim -XRAYRES -# NTXR -2: time-averaged electron density restraints -# -1: instantaneous electron density restraints -# 0: no xray restraints. -# 1: instantaneous structure factor restraints -# 2: time-averaged structure factor restraints -# 3: biquadratic/timeaveraged structure factor restraints -# NTXLE 0: do not perform local elevation -# 1: do perform local elevation -# CXR >= 0 xray restraining force constant -# NTWXR >= 0 write xray data to output file -# 0: don't write xray data -# > 0 write every NTPXRth step -# NTWDE 0..3 write density-maps -# 0: write nothing -# 1: write electron densitiy map -# 2: write asymmetric-unit-only electron densitiy map -# 3: write both -# NTWXM >= 0 write every NTWXMth step electron density map(s) to external file -# CXTAU >=0 xray time-average restraining memory-constant -# RDAVG 0/1 read sf-timeaverages (from job to job) -# -# NTXR NTXLE CXR NTWXR NTWDE NTWXM CXTAU RDAVG - 0 0 0.0 0 0 0 0.0 0 -END -@endverbatim + * @snippet snippets/snippets.cc XRAYRES */ void io::In_Parameter::read_XRAYRES(simulation::Parameter ¶m, - std::ostream & os) { - DEBUG(8, "read XRAYRES"); - - std::vector buffer; - std::string s; - - DEBUG(10, "xrayres block"); - buffer = m_block["XRAYRES"]; - - if (!buffer.size()) { - return; - } - - block_read.insert("XRAYRES"); - - _lineStream.clear(); - _lineStream.str(concatenate(buffer.begin() + 1, buffer.end() - 1, s)); - - int ntxr, ntxle; - _lineStream >> ntxr >> ntxle - >> param.xrayrest.force_constant - >> param.xrayrest.write - >> param.xrayrest.writedensity - >> param.xrayrest.writexmap - >> param.xrayrest.tau - >> param.xrayrest.readavg; - - if (_lineStream.fail()) - io::messages.add("bad line in XRAYRES block", - "In_Parameter", io::message::error); - - if (ntxr < 0) - param.xrayrest.mode = simulation::xrayrest_mode_electron_density; - else - param.xrayrest.mode = simulation::xrayrest_mode_structure_factor; - - switch (abs(ntxr)) { - case 0: - param.xrayrest.xrayrest = simulation::xrayrest_off; - break; - case 1: - param.xrayrest.xrayrest = simulation::xrayrest_inst; - break; - case 2: - param.xrayrest.xrayrest = simulation::xrayrest_avg; - break; - case 3: - param.xrayrest.xrayrest = simulation::xrayrest_biq; - break; - default: - io::messages.add("XRAYRES block: NTXR must be -2 to 3.", - "In_Parameter", io::message::error); - } - - if (ntxr == -3) { - io::messages.add("XRAYRES block: NTXR must be -2 to 3.", - "In_Parameter", io::message::error); - } + std::ostream & os) { + DEBUG(8, "reading XRAYRES"); + + std::stringstream exampleblock; + // lines starting with 'exampleblock<<"' and ending with '\n";' (spaces don't matter) + // will be used to generate snippets that can be included in the doxygen doc; + // the first line is the tag + exampleblock << "XRAYRES\n"; + exampleblock << "# NTXR -2: time-averaged electron density restraints\n"; + exampleblock << "# -1: instantaneous electron density restraints\n"; + exampleblock << "# 0: no xray restraints.\n"; + exampleblock << "# 1: instantaneous structure factor restraints\n"; + exampleblock << "# 2: time-averaged structure factor restraints\n"; + exampleblock << "# 3: biquadratic/timeaveraged structure factor restraints\n"; + exampleblock << "# NTXLE 0: do not perform local elevation\n"; + exampleblock << "# 1: do perform local elevation\n"; + exampleblock << "# CXR >= 0 xray restraining force constant\n"; + exampleblock << "# NTWXR >= 0 write xray data to output file\n"; + exampleblock << "# 0: don't write xray data\n"; + exampleblock << "# > 0 write every NTPXRth step\n"; + exampleblock << "# NTWDE 0..3 write density-maps\n"; + exampleblock << "# 0: write nothing\n"; + exampleblock << "# 1: write electron densitiy map\n"; + exampleblock << "# 2: write asymmetric-unit-only electron densitiy map\n"; + exampleblock << "# 3: write both\n"; + exampleblock << "# NTWXM >= 0 write every NTWXMth step electron density map(s) to external file\n"; + exampleblock << "# CXTAU >=0 xray time-average restraining memory-constant\n"; + exampleblock << "# RDAVG 0/1 read sf-timeaverages (from job to job)\n"; + exampleblock << "#\n"; + exampleblock << "# NTXR NTXLE CXR NTWXR NTWDE NTWXM CXTAU RDAVG\n"; + exampleblock << " 0 0 0.0 0 0 0 0.0 0\n"; + exampleblock << "END\n"; + + + std::string blockname = "XRAYRES"; + Block block(blockname, exampleblock.str()); + + if (block.read_buffer(m_block[blockname], false) == 0) { + block_read.insert(blockname); + param.setDevelop("XRAY restraining is under development."); + + int ntxr, ntxle; + block.get_next_parameter("NTXR", ntxr, "", "-2,-1,0,1,2,3"); + block.get_next_parameter("NTXLE", ntxle, "", "0,1"); + block.get_next_parameter("CXR", param.xrayrest.force_constant, ">=0", ""); + block.get_next_parameter("NTWXR", param.xrayrest.write, ">=0", ""); + block.get_next_parameter("NTWDE", param.xrayrest.writedensity, "", "0,1,2,3"); + block.get_next_parameter("NTWXM", param.xrayrest.writexmap, ">=0", ""); + block.get_next_parameter("CXTAU", param.xrayrest.tau, ">0", ""); + block.get_next_parameter("RDAVG", param.xrayrest.readavg, "", "0,1"); + + if (ntxr < 0) + param.xrayrest.mode = simulation::xrayrest_mode_electron_density; + else + param.xrayrest.mode = simulation::xrayrest_mode_structure_factor; + + switch (abs(ntxr)) { + case 0: + param.xrayrest.xrayrest = simulation::xrayrest_off; + break; + case 1: + param.xrayrest.xrayrest = simulation::xrayrest_inst; + break; + case 2: + param.xrayrest.xrayrest = simulation::xrayrest_avg; + break; + case 3: + param.xrayrest.xrayrest = simulation::xrayrest_biq; + break; + default: + break; + } - if (param.xrayrest.xrayrest == simulation::xrayrest_off) { - // abort reading of rest - return; - } + if (param.xrayrest.xrayrest == simulation::xrayrest_off) { + // abort reading of rest + return; + } - switch (ntxle) { - case 0: - param.xrayrest.local_elevation = false; - break; - case 1: - param.xrayrest.local_elevation = true; - break; - default: - io::messages.add("XRAYRES block: NTXLE must be 0 or 1.", - "In_Parameter", io::message::error); + switch (ntxle) { + case 0: + param.xrayrest.local_elevation = false; + break; + case 1: + param.xrayrest.local_elevation = true; + break; + default: + break; + } - } + if (param.xrayrest.local_elevation) { + if (param.xrayrest.mode != simulation::xrayrest_mode_electron_density || + param.xrayrest.xrayrest == simulation::xrayrest_biq) { + io::messages.add("XRAYRES block: NTXLE 1 requires NTXR -2 or -1.", + "In_Parameter", io::message::error); + } + } - if (param.xrayrest.local_elevation) { - if (param.xrayrest.mode != simulation::xrayrest_mode_electron_density || - param.xrayrest.xrayrest == simulation::xrayrest_biq) { - io::messages.add("XRAYRES block: NTXLE 1 requires NTXR -2 or -1.", - "In_Parameter", io::message::error); + block.get_final_messages(); } - } - - if (param.xrayrest.force_constant < 0.0) { - io::messages.add("XRAYRES block: Illegal value for CXR.", - "In_Parameter", io::message::error); - } - if ((ntxr == 2 || ntxr == 3) && param.xrayrest.force_constant <= 0.0) { - io::messages.add("XRAYRES block: Illegal value for CXTAU", - "In_Parameter", io::message::error); - } - if (param.xrayrest.writedensity > 3) { - io::messages.add("XRAYRES block: Illegal value for NTWDE (0..3)", - "In_Parameter", io::message::error); - } } // XRAYRES /** * @section distanceres DISTANCERES block - * @verbatim -DISTANCERES -# NTDIR -2..2 controls distance restraining -# 0: no distrance restraining (default) -# 1: instantaneous, using force constant CDIR -# 2: instantaneous, using force constant CDIR x W0 -# -1: time-averaged, using force constant CDIR -# -2: time-averaged, using force constant CDIR x W0 -# NTDIRA 0,1 controls values for initial distance averages -# 0: generate initial averages -# 1: read from configuration -# CDIR >= 0.0 force constant for distance restraining -# DIR0 > 0.0 distance offset in restraining function -# TAUDIR >= 0.0 coupling time for time averaging -# FORCESCALE 0..2 controls approximation of force scaling -# 0: approximate d/dr = 1 -# 1: approximate d/dr = (1.0 - exp(-Dt/tau)) -# 2: use d/dr = (1.0 - exp(-Dt/tau))*(/r)^4 -# VDIR 0,1 controls contribution to virial -# 0: no contribution -# 1: distance restraints contribute to virial -# NTWDIR >= 0 write every NTWDIRth step dist. restr. information to external file -# NTDIR NTDIRA CDIR DIR0 TAUDIR FORCESCALE VDIR NTWDIR - 0 0 0.0 1.0 0.0 0 0 0 -END -@endverbatim + * @snippet snippets/snippets.cc DISTANCERES */ void io::In_Parameter::read_DISTANCERES(simulation::Parameter ¶m, - std::ostream & os) { - DEBUG(8, "read DISTANCERES"); - - std::vector buffer; - std::string s; - - DEBUG(10, "distanceres block"); - buffer = m_block["DISTANCERES"]; - - if (!buffer.size()) { - return; - } - - block_read.insert("DISTANCERES"); - - _lineStream.clear(); - _lineStream.str(concatenate(buffer.begin() + 1, buffer.end() - 1, s)); - - int ntdira; - _lineStream >> param.distanceres.distanceres - >> ntdira - >> param.distanceres.K - >> param.distanceres.r_linear - >> param.distanceres.tau - >> param.distanceres.forcescale - >> param.distanceres.virial - >> param.distanceres.write; - - if (_lineStream.fail()) - io::messages.add("bad line in DISTANCERES block", - "In_Parameter", io::message::error); - - - if (param.distanceres.distanceres < -2 || param.distanceres.distanceres > 2) { - io::messages.add("DISTANCERES block: NTDIR must be -2..2.", - "In_Parameter", io::message::error); - } - - switch (ntdira) { - case 0: param.distanceres.read = false; - break; - case 1: param.distanceres.read = true; - break; - default: param.distanceres.read = false; - io::messages.add("DISTANCERES block: NTDIRA must be 0 or 1.", - "In_Parameter", io::message::error); - } - - if (param.distanceres.r_linear <= 0.0) { - io::messages.add("DISTANCERES block: DIR0 must be > 0.0.", - "In_Parameter", io::message::error); - } - - if (param.distanceres.tau < 0.0) { - io::messages.add("DISTANCERES block: TAUDIR must be >= 0.0.", - "In_Parameter", io::message::error); - } - - if (param.distanceres.K < 0) { - io::messages.add("DISTANCERES block: CDIR must be >= 0.0.", - "In_Parameter", io::message::error); - } + std::ostream & os) { + DEBUG(8, "reading DISTANCERES"); + + std::stringstream exampleblock; + // lines starting with 'exampleblock<<"' and ending with '\n";' (spaces don't matter) + // will be used to generate snippets that can be included in the doxygen doc; + // the first line is the tag + exampleblock << "DISTANCERES\n"; + exampleblock << "# NTDIR -2..2 controls distance restraining\n"; + exampleblock << "# 0: no distance restraining (default)\n"; + exampleblock << "# 1: instantaneous, using force constant CDIR\n"; + exampleblock << "# 2: instantaneous, using force constant CDIR x W0\n"; + exampleblock << "# -1: time-averaged, using force constant CDIR\n"; + exampleblock << "# -2: time-averaged, using force constant CDIR x W0\n"; + exampleblock << "# NTDIRA 0,1 controls values for initial distance averages\n"; + exampleblock << "# 0: generate initial averages\n"; + exampleblock << "# 1: read from configuration\n"; + exampleblock << "# CDIR >= 0.0 force constant for distance restraining\n"; + exampleblock << "# DIR0 > 0.0 distance offset in restraining function\n"; + exampleblock << "# TAUDIR > 0.0 coupling time for time averaging\n"; + exampleblock << "# FORCESCALE 0..2 controls approximation of force scaling\n"; + exampleblock << "# 0: approximate d/dr = 1\n"; + exampleblock << "# 1: approximate d/dr = (1.0 - exp(-Dt/tau))\n"; + exampleblock << "# 2: use d/dr = (1.0 - exp(-Dt/tau))*(/r)^4\n"; + exampleblock << "# VDIR 0,1 controls contribution to virial\n"; + exampleblock << "# 0: no contribution\n"; + exampleblock << "# 1: distance restraints contribute to virial\n"; + exampleblock << "# NTWDIR >= 0 write every NTWDIRth step dist. restr. information to external file\n"; + exampleblock << "# NTDIR NTDIRA CDIR DIR0 TAUDIR FORCESCALE VDIR NTWDIR\n"; + exampleblock << " 0 0 0.0 1.0 0.0 0 0 0\n"; + exampleblock << "END\n"; + + + std::string blockname = "DISTANCERES"; + Block block(blockname, exampleblock.str()); + + if (block.read_buffer(m_block[blockname], false) == 0) { + block_read.insert(blockname); + + int ntdira; + block.get_next_parameter("NTDIR", param.distanceres.distanceres, "", "0, 1, -1, 2, -2"); + block.get_next_parameter("NTDIRA", ntdira, "", "0,1"); + block.get_next_parameter("CDIR", param.distanceres.K, ">=0", ""); + block.get_next_parameter("DIR0", param.distanceres.r_linear, ">=0", ""); + block.get_next_parameter("TAUDIR", param.distanceres.tau, ">0", ""); + block.get_next_parameter("FORCESCALE", param.distanceres.forcescale, "", "0, 1, 2"); + block.get_next_parameter("VDIR", param.distanceres.virial, "", "0,1"); + block.get_next_parameter("NTWDIR", param.distanceres.write, ">=0", ""); + + switch (ntdira) { + case 0: param.distanceres.read = false; + break; + case 1: param.distanceres.read = true; + break; + default: param.distanceres.read = false; + break; + } - if (param.distanceres.read > 0 && param.distanceres.distanceres > 0) { - io::messages.add("DISTANCERES block: NTDIRA > 0 but NTDIR > 0 - DISRESEXPAVE ignored", - "In_Parameter", io::message::warning); - } + if (param.distanceres.read && param.distanceres.distanceres > 0) { + io::messages.add("DISTANCERES block: NTDIRA=1 but NTDIR > 0 - DISRESEXPAVE ignored", + "In_Parameter", io::message::warning); + } - if(param.distanceres.virial !=0 && param.distanceres.virial != 1){ - io::messages.add("DISTANCERES block: VDIR must be 0 or 1", - "In_Parameter", io::message::error); - } - if(param.distanceres.forcescale < 0 || param.distanceres.forcescale > 2){ - io::messages.add("DISTANCERES block: FORCESCALE must be 0, 1 or 2", - "In_Parameter", io::message::error); - } + block.get_final_messages(); + } } // DISTANCERES /** * @section distancefield DISTANCEFIELD block - * @verbatim -DISTANCEFIELD -# NTDFR 0,1 controls distance field restraining -# 0: no distance field restraining -# 1: apply distance field restraining -# GRID > 0.0 grid size for distance field -# PROTEINOFFSET > 0 penalty for distances through the host -# PROTEINCUTOFF > 0 distance to protein aitoms to be considered inside -# PROTECT >= 0 protect grid points within this radius around the zero-distance -# point from being flagged as protein -# UPDATE > 0 update frequency for grid -# RL >= 0 linearize forces for distances larger than RL -# SMOOTH >= 0 smoothen the protein boundary after grid construction -# by SMOOTH layers -# NTWDF >= 0 write every NTWDF step disfield information to external file -# PRINTGRID = 0,1 write grid to final configuration file -# -# NTDFR - 1 -# GRID PROTEINOFFSET PROTEINCUTOFF PROTECT - 0.2 15 0.2 0 -# UPDATE SMOOTH RL NTWDF PRINTGRID - 100 1 1.0 50 0 -END -@endverbatim + * @snippet snippets/snippets.cc DISTANCEFIELD */ void io::In_Parameter::read_DISTANCEFIELD(simulation::Parameter ¶m, - std::ostream & os) { - DEBUG(8, "read DISTANCEFIELD"); - - std::vector buffer; - std::string s; - - DEBUG(10, "distancefield block"); - buffer = m_block["DISTANCEFIELD"]; - - if (!buffer.size()) { - return; - } - - block_read.insert("DISTANCEFIELD"); - - _lineStream.clear(); - _lineStream.str(concatenate(buffer.begin() + 1, buffer.end() - 1, s)); - - int printgrid = -1; - _lineStream >> param.distancefield.distancefield - >> param.distancefield.grid - >> param.distancefield.proteinoffset - >> param.distancefield.proteincutoff - >> param.distancefield.protect - >> param.distancefield.update - >> param.distancefield.smooth - >> param.distancefield.r_l - >> param.distancefield.write - >> printgrid; - - if (_lineStream.fail()) - io::messages.add("bad line in DISTANCEFIELD block", - "In_Parameter", io::message::error); - - - if (param.distancefield.distancefield != 0 && - param.distancefield.distancefield != 1) { - io::messages.add("DISTANCEFIELD block: NTDRF must be 0,1.", - "In_Parameter", io::message::error); - } - if (param.distancefield.grid <= 0.0) { - io::messages.add("DISTANCEFIELD block: GRID must be >= 0.0.", - "In_Parameter", io::message::error); - } - if (param.distancefield.proteinoffset < 0.0) { - io::messages.add("DISTANCEFIELD block: PROTEINOFFSET must be >= 0.0.", - "In_Parameter", io::message::error); - } - if (param.distancefield.proteincutoff < 0.0) { - io::messages.add("DISTANCEFIELD block: PROTEINCUTOFF must be >= 0.0.", - "In_Parameter", io::message::error); - } - if (param.distancefield.update < 0) { - io::messages.add("DISTANCEFIELD block: UPDATE must be > 0.", - "In_Parameter", io::message::error); - } - if (param.distancefield.smooth < 0) { - io::messages.add("DISTANCEFIELD block: SMOOTH must be >= 0.", - "In_Parameter", io::message::error); - } - if (printgrid!=0 && printgrid!=1) { - io::messages.add("DISTANCEFIELD block: PRINTGRID must be 0 or 1.", - "In_Parameter", io::message::error); - } - if(printgrid==1) param.distancefield.printgrid = true; - else param.distancefield.printgrid = false; - - if (param.distancefield.protect < 0.0) { - io::messages.add("DISTANCEFIELD block: PROTECT must be >= 0.0.", - "In_Parameter", io::message::error); - } - + std::ostream & os) { + DEBUG(8, "reading DISTANCEFIELD"); + + std::stringstream exampleblock; + // lines starting with 'exampleblock<<"' and ending with '\n";' (spaces don't matter) + // will be used to generate snippets that can be included in the doxygen doc; + // the first line is the tag + exampleblock << "DISTANCEFIELD\n"; + exampleblock << "# NTDFR 0,1 controls distance field restraining\n"; + exampleblock << "# 0: no distance field restraining (default)\n"; + exampleblock << "# 1: apply distance field restraining\n"; + exampleblock << "# GRID > 0.0 grid size for distance field\n"; + exampleblock << "# PROTEINOFFSET >= 0 penalty for distances through the host\n"; + exampleblock << "# PROTEINCUTOFF >= 0 distance to protein atoms to be considered inside\n"; + exampleblock << "# PROTECT >= 0 protect grid points within this radius around the zero-distance\n"; + exampleblock << "# point from being flagged as protein\n"; + exampleblock << "# UPDATE > 0 update frequency for grid\n"; + exampleblock << "# RL >= 0 linearize forces for distances larger than RL\n"; + exampleblock << "# SMOOTH >= 0 smoothen the protein boundary after grid construction\n"; + exampleblock << "# by SMOOTH layers\n"; + exampleblock << "# NTWDF >= 0 write every NTWDF step disfield information to external file\n"; + exampleblock << "# PRINTGRID = 0,1 write grid to final configuration file\n"; + exampleblock << "#\n"; + exampleblock << "# NTDFR\n"; + exampleblock << " 1\n"; + exampleblock << "# GRID PROTEINOFFSET PROTEINCUTOFF PROTECT\n"; + exampleblock << " 0.2 15 0.2 0\n"; + exampleblock << "# UPDATE SMOOTH RL NTWDF PRINTGRID\n"; + exampleblock << " 100 1 1.0 50 0\n"; + exampleblock << "END\n"; + + + std::string blockname = "DISTANCEFIELD"; + Block block(blockname, exampleblock.str()); + + if (block.read_buffer(m_block[blockname], false) == 0) { + block_read.insert(blockname); + + int printgrid = -1; + + block.get_next_parameter("NTDFR", param.distancefield.distancefield, "", "0,1"); + block.get_next_parameter("GRID", param.distancefield.grid, ">0.0", ""); + block.get_next_parameter("PROTEINOFFSET", param.distancefield.proteinoffset, ">=0.0", ""); + block.get_next_parameter("PROTEINCUTOFF", param.distancefield.proteincutoff, ">=0.0", ""); + block.get_next_parameter("PROTECT", param.distancefield.protect, ">=0", ""); + block.get_next_parameter("UPDATE", param.distancefield.update, ">0", ""); + block.get_next_parameter("SMOOTH", param.distancefield.smooth, ">=0", ""); + block.get_next_parameter("RL", param.distancefield.r_l, ">=0", ""); + block.get_next_parameter("NTWDF", param.distancefield.write, ">=0", ""); + block.get_next_parameter("PRINTGRID", printgrid, "", "0,1"); + + if(printgrid==1) param.distancefield.printgrid = true; + else param.distancefield.printgrid = false; + + block.get_final_messages(); + } } // DISTANCEFIELD /** * @section dihedralres DIHEDRALRES block - * @verbatim -DIHEDRALRES -# NTDLR 0...3 controls dihedral-angle restraining and constraining -# 0: off [default] -# 1: dihedral restraining using CDLR -# 2: dihedral restraining using CDLR * WDLR -# 3: dihedral constraining -# -# CDLR >=0.0 force constant for dihedral restraining -# PHILIN >0.0 deviation after which the potential energy function is linearized -# NTWDLR >= 0 write every NTWDLR step dihedral information to external file -# -# NTDLR CDLR PHILIN NTWDLR - 1 100.0 180.0 100 -END -@endverbatim + * @snippet snippets/snippets.cc DIHEDRALRES */ void io::In_Parameter::read_DIHEDRALRES(simulation::Parameter ¶m, - std::ostream & os) { - DEBUG(8, "read DIHEDRALRES"); - - std::vector buffer; - std::string s; - double phi_lin; - - DEBUG(10, "DIHEDRALRES block"); - buffer = m_block["DIHEDRALRES"]; - - if (!buffer.size()) { - return; - } - - block_read.insert("DIHEDRALRES"); - - _lineStream.clear(); - _lineStream.str(concatenate(buffer.begin() + 1, buffer.end() - 1, s)); - - /* - # NTDLR 0...3 controls dihedral-angle restraining and constraining - # 0: off [default] - # 1: dihedral restraining using CDLR - # 2: dihedral restraining using CDLR * WDLR - # 3: dihedral constraining - */ - - int dihrest; - _lineStream >> dihrest - >> param.dihrest.K - >> phi_lin - >> param.dihrest.write; - - if (_lineStream.fail()) - io::messages.add("bad line in DIHEDRALRES block", - "In_Parameter", io::message::error); - - switch (dihrest) { - case 0: - param.dihrest.dihrest = simulation::dihedral_restr_off; - break; - case 1: - param.dihrest.dihrest = simulation::dihedral_restr_inst; - break; - case 2: - param.dihrest.dihrest = simulation::dihedral_restr_inst_weighted; - break; - case 3: - param.dihrest.dihrest = simulation::dihedral_constr; - param.setDevelop("Dihedral constraining is under development."); - break; - default: - io::messages.add("DIHEDRALRES block: NTDLR must be 0...3.", - "In_Parameter", io::message::error); - } - - if (phi_lin <= 0.0) - io::messages.add("DIHEDRALRES block: Illegal value for force constant (>=0)", - "In_Parameter", io::message::error); - - param.dihrest.phi_lin = phi_lin * 2 * math::Pi / 360; + std::ostream & os) { + DEBUG(8, "reading DIHEDRALRES"); + + std::stringstream exampleblock; + // lines starting with 'exampleblock<<"' and ending with '\n";' (spaces don't matter) + // will be used to generate snippets that can be included in the doxygen doc; + // the first line is the tag + exampleblock << "DIHEDRALRES\n"; + exampleblock << "# NTDLR 0...3 controls dihedral-angle restraining and constraining\n"; + exampleblock << "# 0: off [default]\n"; + exampleblock << "# 1: dihedral restraining using CDLR\n"; + exampleblock << "# 2: dihedral restraining using CDLR * WDLR\n"; + exampleblock << "# 3: dihedral constraining\n"; + exampleblock << "#\n"; + exampleblock << "# CDLR >=0.0 force constant for dihedral restraining [kJ/mol/degree^2]\n"; + exampleblock << "# PHILIN >0.0 deviation after which the potential energy function is linearized\n"; + exampleblock << "# NTWDLR >=0 write every NTWDLR step dihedral information to external file\n"; + exampleblock << "#\n"; + exampleblock << "# NTDLR CDLR PHILIN NTWDLR\n"; + exampleblock << " 1 100.0 180.0 100\n"; + exampleblock << "END\n"; + + + std::string blockname = "DIHEDRALRES"; + Block block(blockname, exampleblock.str()); + + if (block.read_buffer(m_block[blockname], false) == 0) { + block_read.insert(blockname); + + double phi_lin, K; + int dihrest; + block.get_next_parameter("NTDLR", dihrest, "", "0,1,2,3"); + block.get_next_parameter("CDLR", K, ">=0", ""); + block.get_next_parameter("PHILIN", phi_lin, ">0", ""); + block.get_next_parameter("NTWDLR", param.dihrest.write, ">=0", ""); + + switch (dihrest) { + case 0: + param.dihrest.dihrest = simulation::dihedral_restr_off; + break; + case 1: + param.dihrest.dihrest = simulation::dihedral_restr_inst; + break; + case 2: + param.dihrest.dihrest = simulation::dihedral_restr_inst_weighted; + break; + case 3: + param.dihrest.dihrest = simulation::dihedral_constr; + param.setDevelop("Dihedral constraining is under development."); + break; + default: + break; + } - if (param.dihrest.K < 0) - io::messages.add("DIHEDRALRES block: Illegal value for force constant (>=0)", - "In_Parameter", io::message::error); + param.dihrest.K = K*180*180 / (math::Pi * math::Pi); + param.dihrest.phi_lin = phi_lin * 2 * math::Pi / 360; - if (param.dihrest.dihrest == simulation::dihedral_constr) { - if (param.constraint.ntc == 1 && param.constraint.solute.algorithm == simulation::constr_off) - param.constraint.solute.algorithm = simulation::constr_shake; + if (param.dihrest.dihrest == simulation::dihedral_constr) { + if (param.constraint.ntc == 1 && param.constraint.solute.algorithm == simulation::constr_off) + param.constraint.solute.algorithm = simulation::constr_shake; - if (param.constraint.solute.algorithm != simulation::constr_shake) { - io::messages.add("DIHEDRALRES block: needs SHAKE as (solute) constraints algorithm", - "In_Parameter", - io::message::error); + if (param.constraint.solute.algorithm != simulation::constr_shake) { + io::messages.add("DIHEDRALRES block: needs SHAKE as (solute) constraints algorithm", + "In_Parameter", + io::message::error); + } + } + block.get_final_messages(); } - } - } // DIHEDRALRES /** * @section jval JVALUERES block - * @verbatim -JVALUERES -# NTJVR -3..2 -# -3 biquadratic using CJVR * WJVR -# -2 time-averaged using CJVR * WJVR -# -1 time-avaraged using CJVR -# 0 no J-value restraints [default] -# 1 instantaneous using CJVR -# 2 instantaneous using CJVR * WJVR -# NTJVRA 0 controls reading of averages from startup file -# 0 start from initial values of J0 [default] -# 1 read time averages from startup file (for continuation time-averaged run) -# CJVR >= 0 J-value restraining force constant -# (weighted by individual WJVR) -# TAUJVR >= 0 coupling time for time-averaging -# NJVRTARS 0,1 omits or includes force scaling by memory decay factor in case of time-averaging -# 0 omit factor (set (1 - exp(-Dt/tau)) = 1) -# 1 scale force by (1 - exp(-Dt/tau)) -# NJVRBIQW 0..2 controls weights (X in Eq. 19 of MD98.17) of the two terms in biquadratic restraining -# 0 X = 1 -# 1 X = (1 - exp(-Dt/tau)) -# 2 X = 0 -# LE 0,1 local elevation restraining -# 0 local elevation off [default] -# 1 local elevation on -# NGRID > 0 number of grid points in local elevation restraining -# DELTA >= 0.0 no elevation of potential if J is within DELTA of J0 -# NTWJV >= 0 write J-value averages and LE grid to special trajectory -# 0 don't write [default] -# > 0 write every NTWJVth step -# -# NTJVR NTJVRA CJVR TAUJVR NJVRTARS NJVRBIQW LE NGRID DELTA NTWJV - -3 0 10.0 5.0 0 0 1 16 0.5 0 -END -@endverbatim + * @snippet snippets/snippets.cc JVALUERES */ void io::In_Parameter::read_JVALUERES(simulation::Parameter ¶m, - std::ostream & os) { - DEBUG(8, "read JVALUERES"); - - std::vector buffer; - std::string s; - - buffer = m_block["JVALUERES"]; - if (buffer.size()) { - - block_read.insert("JVALUERES"); - - _lineStream.clear(); - _lineStream.str(concatenate(buffer.begin() + 1, buffer.end() - 1, s)); - - int ntjvr; - _lineStream >> ntjvr // NTJVR - >> param.jvalue.read_av // NTJVRA - >> param.jvalue.K // CJVR - >> param.jvalue.tau // TAUJVR - >> param.jvalue.tarfscale // NJVRTARS - >> param.jvalue.biqweight // NJVRBIQW - >> param.jvalue.le // LE - >> param.jvalue.ngrid // NGRID - >> param.jvalue.delta // DELTA - >> param.jvalue.write; // NTJVW - - if (_lineStream.fail()) - io::messages.add("bad line in JVALUERES block", - "In_Parameter", io::message::error); - - switch (ntjvr) { - case -3: - param.jvalue.mode = simulation::jvalue_restr_biq_weighted; - break; - case -2: - param.jvalue.mode = simulation::jvalue_restr_av_weighted; - break; - case -1: - param.jvalue.mode = simulation::jvalue_restr_av; - break; - case 0: - param.jvalue.mode = simulation::jvalue_restr_off; - break; - case 1: - param.jvalue.mode = simulation::jvalue_restr_inst; - break; - case 2: - param.jvalue.mode = simulation::jvalue_restr_inst_weighted; - break; - default: - io::messages.add("JVALUERES block: NTJVR must be -3..2.", - "In_Parameter", io::message::error); - } + std::ostream & os) { + DEBUG(8, "reading JVALUERES"); + + std::stringstream exampleblock; + // lines starting with 'exampleblock<<"' and ending with '\n";' (spaces don't matter) + // will be used to generate snippets that can be included in the doxygen doc; + // the first line is the tag + exampleblock << "JVALUERES\n"; + exampleblock << "# NTJVR -3..2\n"; + exampleblock << "# -3 biquadratic using CJVR * WJVR\n"; + exampleblock << "# -2 time-averaged using CJVR * WJVR\n"; + exampleblock << "# -1 time-avaraged using CJVR\n"; + exampleblock << "# 0 no J-value restraints [default]\n"; + exampleblock << "# 1 instantaneous using CJVR\n"; + exampleblock << "# 2 instantaneous using CJVR * WJVR\n"; + exampleblock << "# NTJVRA 0 controls reading of averages from startup file\n"; + exampleblock << "# 0 start from initial values of J0 [default]\n"; + exampleblock << "# 1 read time averages from startup file (for continuation time-averaged run)\n"; + exampleblock << "# CJVR >= 0 J-value restraining force constant\n"; + exampleblock << "# (weighted by individual WJVR)\n"; + exampleblock << "# TAUJVR >= 0 coupling time for time-averaging\n"; + exampleblock << "# NJVRTARS 0,1 omits or includes force scaling by memory decay factor in case of time-averaging\n"; + exampleblock << "# 0 omit factor (set (1 - exp(-Dt/tau)) = 1)\n"; + exampleblock << "# 1 scale force by (1 - exp(-Dt/tau))\n"; + exampleblock << "# NJVRBIQW 0..2 controls weights (X in Eq. 19 of MD98.17) of the two terms in biquadratic restraining\n"; + exampleblock << "# 0 X = 1\n"; + exampleblock << "# 1 X = (1 - exp(-Dt/tau))\n"; + exampleblock << "# 2 X = 0\n"; + exampleblock << "# LE 0,1 local elevation restraining\n"; + exampleblock << "# 0 local elevation off [default]\n"; + exampleblock << "# 1 local elevation on\n"; + exampleblock << "# NGRID > 1 number of grid points in local elevation restraining\n"; + exampleblock << "# DELTA >= 0.0 no elevation of potential if J is within DELTA of J0\n"; + exampleblock << "# NTWJV >= 0 write J-value averages and LE grid to special trajectory\n"; + exampleblock << "# 0 don't write [default]\n"; + exampleblock << "# > 0 write every NTWJVth step\n"; + exampleblock << "#\n"; + exampleblock << "# NTJVR NTJVRA CJVR TAUJVR NJVRTARS NJVRBIQW LE NGRID DELTA NTWJV\n"; + exampleblock << " -3 0 10.0 5.0 0 0 1 16 0.5 0\n"; + exampleblock << "END\n"; + + + std::string blockname = "JVALUERES"; + Block block(blockname, exampleblock.str()); + + if (block.read_buffer(m_block[blockname], false) == 0) { + block_read.insert(blockname); + + int ntjvr; + block.get_next_parameter("NTJVR", ntjvr, "", "-3,-2,-1,0,1,2"); + block.get_next_parameter("NTJVRA", param.jvalue.read_av, "", "0,1"); + block.get_next_parameter("CJVR", param.jvalue.K, ">=0", ""); + block.get_next_parameter("TAUJVR", param.jvalue.tau, ">0", ""); + block.get_next_parameter("NJVRTARS", param.jvalue.tarfscale, "", "0,1"); + block.get_next_parameter("NJVRBIQW", param.jvalue.biqweight, "", "0,1,2"); + block.get_next_parameter("LE", param.jvalue.le, "", "0,1"); + block.get_next_parameter("NGRID", param.jvalue.ngrid, ">1", ""); + block.get_next_parameter("DELTA", param.jvalue.delta, ">=0.0", ""); + block.get_next_parameter("NTWJV", param.jvalue.write, ">=0", ""); + + switch (ntjvr) { + case -3: + param.jvalue.mode = simulation::jvalue_restr_biq_weighted; + break; + case -2: + param.jvalue.mode = simulation::jvalue_restr_av_weighted; + break; + case -1: + param.jvalue.mode = simulation::jvalue_restr_av; + break; + case 0: + param.jvalue.mode = simulation::jvalue_restr_off; + break; + case 1: + param.jvalue.mode = simulation::jvalue_restr_inst; + break; + case 2: + param.jvalue.mode = simulation::jvalue_restr_inst_weighted; + break; + default: + break; + } - if (param.jvalue.tau < 0 || - (param.jvalue.tau == 0 && (param.jvalue.mode != simulation::jvalue_restr_off || - param.jvalue.mode != simulation::jvalue_restr_inst || - param.jvalue.mode != simulation::jvalue_restr_inst_weighted))) { - io::messages.add("JVALUERES block: bad value for TAU, should be > 0.0", - "In_Parameter", io::message::error); - } - if (param.jvalue.tarfscale < 0 || param.jvalue.tarfscale > 1){ - io::messages.add("JVALUERES block: NJVRTARS must be 0 or 1", - "In_Parameter", io::message::error); - } - if (param.jvalue.biqweight < 0 || param.jvalue.biqweight > 2){ - io::messages.add("JVALUERES block: NJVRBIQW must be 0, 1 or 2", - "In_Parameter", io::message::error); - } - if (param.jvalue.mode != simulation::jvalue_restr_off && param.jvalue.K < 0.0) { - io::messages.add("JVALUERES block: bad value for K in JVALUERES block," - "should be > 0.0", - "In_Parameter", io::message::error); - } - if (param.jvalue.le > 0) { - if (param.jvalue.ngrid < 1) { - io::messages.add("JVALUERES block: bad value for NGRID in JVALUERES block, " - "should be > 1", - "In_Parameter", io::message::error); - } - } - if (param.jvalue.read_av && (param.jvalue.mode != simulation::jvalue_restr_av && - param.jvalue.mode != simulation::jvalue_restr_av_weighted - && param.jvalue.mode != simulation::jvalue_restr_biq_weighted - && !param.jvalue.le)) { - io::messages.add("JVALUERES block: Continuation only needed " - "with time-averaging or LE.", - "In_Parameter", io::message::error); + if (param.jvalue.read_av && (ntjvr >= 0 && !param.jvalue.le)) { + io::messages.add("JVALUERES block: NTJVRA: Continuation only needed " + "with time-averaging or LE.", + "In_Parameter", io::message::error); + } + block.get_final_messages(); } - } // JVALUERES -} // JVALUE +} // JVALUERES /** * @section orderparamres ORDERPARAMRES block - * @verbatim -ORDERPARAMRES -# NTOPR -2..0 -# -2 time-averaged using COPR * WOPR -# -1 time-avaraged using COPR -# 0 no order-parameter restraints [default] -# NTOPRA 0 controls reading of averages from startup file -# 0 start from initial values of S0 [default] -# 1 read time averages from startup file (for continuation time-averaged run) -# COPR >= 0.0 order-parameter restraining force constant -# (weighted by individual WOPR) -# TAUOPR >= 0.0 coupling time for time-averaging -# UPDOPR > 0 update average every UPDOPRth step -# NTWOP >= 0 write order-parameter to special trajectory -# 0 don't write [default] -# > 0 write every NTWOP step -# -# NTOPR NTOPRA COPR TAUOPR UPDOPR NTWOP - -2 0 10.0 5.0 1 0 -END -@endverbatim + * @snippet snippets/snippets.cc ORDERPARAMRES */ void io::In_Parameter::read_ORDERPARAMRES(simulation::Parameter ¶m, - std::ostream & os) { - DEBUG(8, "read ORDERPARAMRES"); - - std::vector buffer; - std::string s; - - buffer = m_block["ORDERPARAMRES"]; - if (buffer.size()) { - - block_read.insert("ORDERPARAMRES"); - - _lineStream.clear(); - _lineStream.str(concatenate(buffer.begin() + 1, buffer.end() - 1, s)); - - int ntopr; - _lineStream >> ntopr // NTJVR - >> param.orderparamrest.read // NTOPRA - >> param.orderparamrest.K // COPR - >> param.orderparamrest.tau // TAUOPR - >> param.orderparamrest.update_step // UPDOPR - >> param.orderparamrest.write; // NTOPR + std::ostream & os) { + DEBUG(8, "reading ORDERPARAMRES"); + + std::stringstream exampleblock; + // lines starting with 'exampleblock<<"' and ending with '\n";' (spaces don't matter) + // will be used to generate snippets that can be included in the doxygen doc; + // the first line is the tag + exampleblock << "ORDERPARAMRES\n"; + exampleblock << "# NTOPR -2..2\n"; + exampleblock << "# -2 time-averaged using COPR * WOPR\n"; + exampleblock << "# -1 time-averaged using COPR\n"; + exampleblock << "# 0 no order-parameter restraints [default]\n"; + exampleblock << "# 1 window-averaged using COPR\n"; + exampleblock << "# 2 window-averaged using COPR * WOPR\n"; + exampleblock << "# NTOPRA 0 controls reading of averages from startup file\n"; + exampleblock << "# 0 start from initial values of S0 [default]\n"; + exampleblock << "# 1 read time averages from startup file (for continuation time-averaged run)\n"; + exampleblock << "# COPR >= 0.0 order-parameter restraining force constant\n"; + exampleblock << "# (weighted by individual WOPR)\n"; + exampleblock << "# TAUOPR >= 0.0 coupling time for time-averaging\n"; + exampleblock << "# UPDOPR > 0 update average every UPDOPRth step\n"; + exampleblock << "# NTWOP >= 0 write order-parameter to special trajectory\n"; + exampleblock << "# 0 don't write [default]\n"; + exampleblock << "# > 0 write every NTWOP step\n"; + exampleblock << "#\n"; + exampleblock << "# NTOPR NTOPRA COPR TAUOPR UPDOPR NTWOP\n"; + exampleblock << " -2 0 10.0 5.0 1 0\n"; + exampleblock << "END\n"; + + std::string blockname = "ORDERPARAMRES"; + Block block(blockname, exampleblock.str()); + + if (block.read_buffer(m_block[blockname], false) == 0) { + block_read.insert(blockname); + + int ntopr; + + block.get_next_parameter("NTOPR", ntopr, "", "-2,-1,0,1,2"); + block.get_next_parameter("NTOPRA", param.orderparamrest.read, "", "0,1"); + block.get_next_parameter("COPR", param.orderparamrest.K, ">=", ""); + block.get_next_parameter("TAUOPR", param.orderparamrest.tau, ">=", ""); + block.get_next_parameter("UPDOPR", param.orderparamrest.update_step, ">0", ""); + block.get_next_parameter("NTWOP", param.orderparamrest.write, ">=0", ""); + + + switch (ntopr) { + case -2: + param.orderparamrest.orderparamrest = simulation::oparam_restr_av_weighted; + break; + case -1: + param.orderparamrest.orderparamrest = simulation::oparam_restr_av; + break; + case 0: + param.orderparamrest.orderparamrest = simulation::oparam_restr_off; + break; + case 1: + param.orderparamrest.orderparamrest = simulation::oparam_restr_winav; + break; + case 2: + param.orderparamrest.orderparamrest = simulation::oparam_restr_winav_weighted; + break; + default: + break; + } - if (_lineStream.fail()) - io::messages.add("bad line in ORDERPARAMRES block", - "In_Parameter", io::message::error); - switch (ntopr) { - case -2: - param.orderparamrest.orderparamrest = simulation::oparam_restr_av_weighted; - break; - case -1: - param.orderparamrest.orderparamrest = simulation::oparam_restr_av; - break; - case 0: - param.orderparamrest.orderparamrest = simulation::oparam_restr_off; - break; - case 1: - param.orderparamrest.orderparamrest = simulation::oparam_restr_winav; - break; - case 2: - param.orderparamrest.orderparamrest = simulation::oparam_restr_winav_weighted; - break; - default: - io::messages.add("ORDERPARAMRES block: NTOPR must be -2..0.", - "In_Parameter", io::message::error); - } + if ((param.orderparamrest.orderparamrest == simulation::oparam_restr_av || + param.orderparamrest.orderparamrest == simulation::oparam_restr_av_weighted) && + param.orderparamrest.update_step != 1) { + io::messages.add("ORDERPARAMRES block: bad value for UPDOPR, should be 1 for exponential averaging", + "In_Parameter", io::message::error); + } - if (param.orderparamrest.orderparamrest != simulation::oparam_restr_off && param.orderparamrest.tau < 0.0) { - io::messages.add("ORDERPARAMRES block: bad value for TAUOPR, should be >= 0.0", - "In_Parameter", io::message::error); - } - if (param.orderparamrest.orderparamrest != simulation::oparam_restr_off && param.orderparamrest.K < 0.0) { - io::messages.add("ORDERPARAMRES block: bad value for COPR, should be > 0.0", - "In_Parameter", io::message::error); - } - - if (param.orderparamrest.orderparamrest != simulation::oparam_restr_off && - param.orderparamrest.update_step == 0) { - io::messages.add("ORDERPARAMRES block: bad value for UPDOPR, should be > 0", - "In_Parameter", io::message::error); - } + if (param.orderparamrest.orderparamrest == simulation::oparam_restr_winav || + param.orderparamrest.orderparamrest == simulation::oparam_restr_winav_weighted) { + unsigned int window = int(param.orderparamrest.tau / param.step.dt); + if (window / param.orderparamrest.update_step == 0) { + io::messages.add("ORDERPARAMRES block: bad value for UPDOPR smaller than TAUOPR / DT.", + "In_Parameter", io::message::error); + } + } - if ((param.orderparamrest.orderparamrest == simulation::oparam_restr_av || - param.orderparamrest.orderparamrest == simulation::oparam_restr_av_weighted) && - param.orderparamrest.update_step != 1) { - io::messages.add("ORDERPARAMRES block: bad value for UPDOPR, should be 1 for exponential averaging", - "In_Parameter", io::message::error); - } - - if (param.orderparamrest.orderparamrest == simulation::oparam_restr_winav || - param.orderparamrest.orderparamrest == simulation::oparam_restr_winav_weighted) { - unsigned int window = int(param.orderparamrest.tau / param.step.dt); - if (window / param.orderparamrest.update_step == 0) { - io::messages.add("ORDERPARAMRES block: bad value for UPDOPR smaller than TAUOPR / DT.", - "In_Parameter", io::message::error); - } + block.get_final_messages(); } - - - } // ORDERPARAMRES } // ORDERPARAMRES /** * @section rdcres RDCRES block - * @verbatim -RDCRES -# NTRDCR -4..2 RDC restraining -# -4: biquadratic using CRDCR * WRDCR -# -3: biquadratic using CRDCR -# -2: time averaged using CRDCR * WRDCR -# -1: time averaged using CRDCR -# 0: no RDC restraints [default] -# 1: instantaneous using CRDCR -# 2: instantaneous using CRDCR * WRDCR -# NTRDCRA 0,1 controls reading of average RDCs -# 0: take initial values RDC0 from the RDC restraint file -# 1: read time averages from initial coordinate file -# (for continuation run) -# -# NTRDCT 0..2 Type of alignment representation -# 0: cartesian magnetic field vectors -# 1: alignment tensor -# 2: spherical harmonics -# NTALR 0,1 controls reading of values in the chosen representation -# 0: start from values given in RDC restraint file -# 1: read values from initial coordinate file (for continuation run) -# -# METHOD 0..3 Method of updating the magnetic field vectors -# 0: Energy minimisation -# 1: Stochastic dynamics -# 2: Molecular dynamics -# EMGRAD > 0.0 (METHOD = 0, EM) stop minimisation if gradient is below EMGRAD -# EMDX0 > 0.0 (METHOD = 0, EM) initial step size -# EMNMAX > 0 (METHOD = 0, EM) maximum number of minimisation steps -# SDCFRIC >= 0.0 (METHOD = 1, SD) global friction coefficient gamma -# TEMP >= 0.0 temperature of stochastic bath (SD) and temperature used for initial velocities (MD, SD) -# DELTA >= 0 the flatbottom potential is 2 DELTA wide -# CRDCR >= 0 RDC restraining force constant -# (weighted by individual WRDCR) -# TAU >= 0 coupling time for time averaging -# NRDCRTARS 0,1 omits or includes force scaling by memory decay factor in case of time-averaging -# 0 omit factor (set (1-exp(-dt/tau))=1 ) -# 1 scale force by (1-exp(-dt/tau)) -# NRDCRBIQW 0..2 controls weights of the two terms in biquadratic restraining -# 0 X = 1 -# 1 X = (1 - exp(-dt/tau)) -# 2 X = 0 -# NTWRDC >= 0 write output to special trajectory -# 0: don't write -# >0: write every NTWRDCth step. -# -# NTRDCR NTRDCRA NTRDCT NTALR METHOD - 2 0 0 0 0 -# EMGRAD EMDX0 EMNMAX SDCFRIC TEMP DELTA CRDCR TAU NRDCRBIQW NTWRDC NTWRDC - 0.001 0.01 1000 20 300 0 1 1 0 0 10000 -END -@endverbatim + * @snippet snippets/snippets.cc RDCRES */ void io::In_Parameter::read_RDCRES(simulation::Parameter ¶m, std::ostream & os) { - DEBUG(8, "read RDCRES"); - - std::vector buffer; - std::string s; - - buffer = m_block["RDCRES"]; - if (buffer.size()){ - - //set at develop flag - param.setDevelop("RDC restraining is under development!"); - - block_read.insert("RDCRES"); - - _lineStream.clear(); - _lineStream.str(concatenate(buffer.begin()+1, buffer.end()-1, s)); - - int ntrdcr, ntrdct, method; - _lineStream >> ntrdcr // NTRDCR - >> param.rdc.read_av // NTRDCRA - >> ntrdct // NTRDCT - >> param.rdc.read_align // NTALR - >> method // METHOD - >> param.rdc.emgradient // EMGRAD - >> param.rdc.emstepsize // EMDX0 - >> param.rdc.emmaxiter // EMNMAX - >> param.rdc.sdfric // SDCFRIC - >> param.rdc.temp // TEMP - >> param.rdc.delta // DELTA [ps^-1] - >> param.rdc.K // CRDCR // [kJ*ps^2] - >> param.rdc.tau // TAU // [ps] - >> param.rdc.tAVfactor // NRDCRTARS - >> param.rdc.biqfactor // NRDCRBIQW - >> param.rdc.write; // NTWRDC - - if (_lineStream.fail()){ - io::messages.add("bad line in RDCRES block", "In_Parameter", io::message::error); - } + DEBUG(8, "reading RDCRES"); + + std::stringstream exampleblock; + // lines starting with 'exampleblock<<"' and ending with '\n";' (spaces don't matter) + // will be used to generate snippets that can be included in the doxygen doc; + // the first line is the tag + exampleblock << "RDCRES\n"; + exampleblock << "# NTRDCR -4..2 RDC restraining\n"; + exampleblock << "# -4: biquadratic using CRDCR * WRDCR\n"; + exampleblock << "# -3: biquadratic using CRDCR\n"; + exampleblock << "# -2: time averaged using CRDCR * WRDCR\n"; + exampleblock << "# -1: time averaged using CRDCR\n"; + exampleblock << "# 0: no RDC restraints [default]\n"; + exampleblock << "# 1: instantaneous using CRDCR\n"; + exampleblock << "# 2: instantaneous using CRDCR * WRDCR\n"; + exampleblock << "# NTRDCRA 0,1 controls reading of average RDCs\n"; + exampleblock << "# 0: take initial values RDC0 from the RDC restraint file\n"; + exampleblock << "# 1: read time averages from initial coordinate file\n"; + exampleblock << "# (for continuation run)\n"; + exampleblock << "#\n"; + exampleblock << "# NTRDCT 0..2 Type of alignment representation\n"; + exampleblock << "# 0: cartesian magnetic field vectors\n"; + exampleblock << "# 1: alignment tensor\n"; + exampleblock << "# 2: spherical harmonics\n"; + exampleblock << "# NTALR 0,1 controls reading of values in the chosen representation\n"; + exampleblock << "# 0: start from values given in RDC restraint file\n"; + exampleblock << "# 1: read values from initial coordinate file (for continuation run)\n"; + exampleblock << "#\n"; + exampleblock << "# METHOD 0..2 Method of updating the magnetic field vectors\n"; + exampleblock << "# 0: Energy minimisation\n"; + exampleblock << "# 1: Stochastic dynamics\n"; + exampleblock << "# 2: Molecular dynamics\n"; + exampleblock << "# EMGRAD > 0.0 (METHOD = 0, EM) stop minimisation if gradient is below EMGRAD\n"; + exampleblock << "# EMDX0 > 0.0 (METHOD = 0, EM) initial step size\n"; + exampleblock << "# EMNMAX > 0 (METHOD = 0, EM) maximum number of minimisation steps\n"; + exampleblock << "# SDCFRIC >= 0.0 (METHOD = 1, SD) global friction coefficient gamma\n"; + exampleblock << "# TEMP >= 0.0 temperature of stochastic bath (SD) and temperature used for initial velocities (MD, SD)\n"; + exampleblock << "# DELTA >= 0 the flatbottom potential is 2 DELTA wide [ps^-1]\n"; + exampleblock << "# CRDCR >= 0 RDC restraining force constant [kJ*ps^2]\n"; + exampleblock << "# (weighted by individual WRDCR)\n"; + exampleblock << "# TAU >= 0 coupling time for time averaging [ps]\n"; + exampleblock << "# NRDCRTARS 0,1 omits or includes force scaling by memory decay factor in case of time-averaging\n"; + exampleblock << "# 0 omit factor (set (1-exp(-dt/tau))=1 )\n"; + exampleblock << "# 1 scale force by (1-exp(-dt/tau))\n"; + exampleblock << "# NRDCRBIQW 0..2 controls weights of the two terms in biquadratic restraining\n"; + exampleblock << "# 0 X = 1\n"; + exampleblock << "# 1 X = (1 - exp(-dt/tau))\n"; + exampleblock << "# 2 X = 0\n"; + exampleblock << "# NTWRDC >= 0 write output to special trajectory\n"; + exampleblock << "# 0: don't write\n"; + exampleblock << "# >0: write every NTWRDCth step.\n"; + exampleblock << "#\n"; + exampleblock << "# NTRDCR NTRDCRA NTRDCT NTALR METHOD\n"; + exampleblock << " 2 0 0 0 0\n"; + exampleblock << "# EMGRAD EMDX0 EMNMAX SDCFRIC TEMP DELTA CRDCR TAU NRDCRTARS NRDCRBIQW NTWRDC NTWRDC\n"; + exampleblock << " 0.001 0.01 1000 20 300 0 1 1 0 0 0 10000\n"; + exampleblock << "END\n"; + + + std::string blockname = "RDCRES"; + Block block(blockname, exampleblock.str()); + + if (block.read_buffer(m_block[blockname], false) == 0) { + block_read.insert(blockname); + + //set at develop flag + param.setDevelop("RDC restraining is under development!"); + + int ntrdcr, ntrdct, method; + block.get_next_parameter("NTRDCR", ntrdcr, "", "-4,-3,-2,-1,0,1,2"); + block.get_next_parameter("NTRDCRA", param.rdc.read_av, "", "0,1"); + block.get_next_parameter("NTRDCT", ntrdct, "", "0,1,2"); + block.get_next_parameter("NTALR", param.rdc.read_align, "", "0,1"); + block.get_next_parameter("METHOD", method, "", "0,1,2"); + block.get_next_parameter("EMGRAD", param.rdc.emgradient, ">0", ""); + block.get_next_parameter("EMDX0", param.rdc.emstepsize, ">0", ""); + block.get_next_parameter("EMNMAX", param.rdc.emmaxiter, ">0", ""); + block.get_next_parameter("SDCFRIC", param.rdc.sdfric, ">=0", ""); + block.get_next_parameter("TEMP", param.rdc.temp, ">=0", ""); + block.get_next_parameter("DELTA", param.rdc.delta, ">=0", ""); + block.get_next_parameter("CRDCR", param.rdc.K, ">=0", ""); + block.get_next_parameter("TAU", param.rdc.tau, ">=0", ""); + block.get_next_parameter("NRDCRTARS", param.rdc.tAVfactor, "", "0,1"); + block.get_next_parameter("NRDCRBIQW", param.rdc.biqfactor, "", "0,1,2"); + block.get_next_parameter("NTWRDC", param.rdc.write, ">=0", ""); + + switch (ntrdct) { + case 0: + param.rdc.type = simulation::rdc_mf; + break; + case 1: + param.rdc.type = simulation::rdc_t; + break; + case 2: + param.rdc.type = simulation::rdc_sh; + break; + default: + break; + } - switch (ntrdct) { - case 0: - param.rdc.type = simulation::rdc_mf; - break; - case 1: - param.rdc.type = simulation::rdc_t; - break; - case 2: - param.rdc.type = simulation::rdc_sh; - break; - default: - io::messages.add("RDCRES block: NTRDCT must be 0..2", "In_Parameter", io::message::error); - } - - switch (method) { - case 0: - param.rdc.method = simulation::rdc_em; - break; - case 1: - param.rdc.method = simulation::rdc_sd; - break; - case 2: - param.rdc.method = simulation::rdc_md; - break; - default: - io::messages.add("RDCRES block: METHOD must be 0..2", "In_Parameter", io::message::error); - } + switch (method) { + case 0: + param.rdc.method = simulation::rdc_em; + break; + case 1: + param.rdc.method = simulation::rdc_sd; + break; + case 2: + param.rdc.method = simulation::rdc_md; + break; + default: + break; + } - if(method != simulation::rdc_em){ - io::messages.add("RDCRES block: Your choice of METHOD is legal. However, be aware, that rdc_em is faster and always a better choice except when you are experimenting.", - "In_Parameter", io::message::warning); - } - if(ntrdct != simulation::rdc_t){ - io::messages.add("RDCRES block: Your choice of NTRDCT is legal. However, be aware, that rdc_t is faster and always a better choice except when you are experimenting.", - "In_Parameter", io::message::warning); - } + if(method != simulation::rdc_em) { + io::messages.add("RDCRES block: Your choice of METHOD is legal. However, be aware, that rdc_em is faster and always a better choice except when you are experimenting.", + "In_Parameter", io::message::warning); + } + if(ntrdct != simulation::rdc_t) { + io::messages.add("RDCRES block: Your choice of NTRDCT is legal. However, be aware, that rdc_t is faster and always a better choice except when you are experimenting.", + "In_Parameter", io::message::warning); + } - switch (ntrdcr) { - case -4: - param.rdc.mode = simulation::rdc_restr_biq_weighted; - param.rdc.K *= 10e20; // multiply with 10e20 ps^2 to roughly compensate for second quadratic term - io::messages.add("Multyplying RDC force constant K with 10e20 ps^2 to compensate for second quadratic term", "In_Parameter", io::message::notice); - break; - case -3: - param.rdc.mode = simulation::rdc_restr_biq; - param.rdc.K *= 10e20; // multiply with 10e20 ps^2 to roughly compensate for second quadratic term - io::messages.add("Multyplying RDC force constant K with 10e20 ps^2 to compensate for second quadratic term", "In_Parameter", io::message::notice); - break; - case -2: - param.rdc.mode = simulation::rdc_restr_av_weighted; - break; - case -1: - param.rdc.mode = simulation::rdc_restr_av; - break; - case 0: - param.rdc.mode = simulation::rdc_restr_off; - break; - case 1: - param.rdc.mode = simulation::rdc_restr_inst; - break; - case 2: - param.rdc.mode = simulation::rdc_restr_inst_weighted; - break; - default: - io::messages.add("RDCRES block: NTRDCR must be -4..2.", "In_Parameter", io::message::error); - } + switch (ntrdcr) { + case -4: + param.rdc.mode = simulation::rdc_restr_biq_weighted; + param.rdc.K *= 10e20; // multiply with 10e20 ps^2 to roughly compensate for second quadratic term + io::messages.add("Multyplying RDC force constant K with 10e20 ps^2 to compensate for second quadratic term", "In_Parameter", io::message::notice); + break; + case -3: + param.rdc.mode = simulation::rdc_restr_biq; + param.rdc.K *= 10e20; // multiply with 10e20 ps^2 to roughly compensate for second quadratic term + io::messages.add("Multyplying RDC force constant K with 10e20 ps^2 to compensate for second quadratic term", "In_Parameter", io::message::notice); + break; + case -2: + param.rdc.mode = simulation::rdc_restr_av_weighted; + break; + case -1: + param.rdc.mode = simulation::rdc_restr_av; + break; + case 0: + param.rdc.mode = simulation::rdc_restr_off; + break; + case 1: + param.rdc.mode = simulation::rdc_restr_inst; + break; + case 2: + param.rdc.mode = simulation::rdc_restr_inst_weighted; + break; + default: + break; + } - if (param.rdc.mode != simulation::rdc_restr_off){ - if (param.rdc.tau <= 0.0 && ( param.rdc.mode != simulation::rdc_restr_inst && param.rdc.mode != simulation::rdc_restr_inst_weighted)){ - io::messages.add("RDCRES block: bad value for TAU, should be > 0.0", - "In_Parameter", io::message::error); - } - if (param.rdc.K < 0.0){ - io::messages.add("RDCRES block: bad value for CRDCR(K) in RDCRES block, should be > 0.0", - "In_Parameter", io::message::error); - } - if (param.rdc.read_av && (param.rdc.mode != simulation::rdc_restr_av - && param.rdc.mode != simulation::rdc_restr_av_weighted - && param.rdc.mode != simulation::rdc_restr_biq - && param.rdc.mode != simulation::rdc_restr_biq_weighted )){ - io::messages.add("RDCRES block: Continuation only needed with averaging.", - "In_Parameter", io::message::error); - } - } // rdcs not switched off + if (param.rdc.mode != simulation::rdc_restr_off) { + if (param.rdc.tau <= 0.0 && ( param.rdc.mode != simulation::rdc_restr_inst && param.rdc.mode != simulation::rdc_restr_inst_weighted)) { + io::messages.add("RDCRES block: bad value for TAU, should be > 0.0", + "In_Parameter", io::message::error); + } + if (param.rdc.K < 0.0) { + io::messages.add("RDCRES block: bad value for CRDCR(K) in RDCRES block, should be > 0.0", + "In_Parameter", io::message::error); + } + if (param.rdc.read_av && (param.rdc.mode != simulation::rdc_restr_av + && param.rdc.mode != simulation::rdc_restr_av_weighted + && param.rdc.mode != simulation::rdc_restr_biq + && param.rdc.mode != simulation::rdc_restr_biq_weighted )) { + io::messages.add("RDCRES block: Continuation only needed with averaging.", + "In_Parameter", io::message::error); + } + } // rdcs not switched off - if(!(param.rdc.tAVfactor == 0 || param.rdc.tAVfactor == 1 )) - io::messages.add("RDCRES block: The only possible values for NRDCRTARS are 0 and 1.", "In_Parameter", io::message::error); + if(!(param.rdc.tAVfactor == 0 || param.rdc.tAVfactor == 1 )) + io::messages.add("RDCRES block: The only possible values for NRDCRTARS are 0 and 1.", "In_Parameter", io::message::error); - if(!(param.rdc.biqfactor == 0 || param.rdc.biqfactor == 1 || param.rdc.biqfactor == 2)) - io::messages.add("RDCRES block: The only possible values for NRDCRBIQW are 0, 1 and 2.", "In_Parameter", io::message::error); + if(!(param.rdc.biqfactor == 0 || param.rdc.biqfactor == 1 || param.rdc.biqfactor == 2)) + io::messages.add("RDCRES block: The only possible values for NRDCRBIQW are 0, 1 and 2.", "In_Parameter", io::message::error); - } // RDCRES block -} // read RDCs + block.get_final_messages(); + } +} // RDCRES /** * @section perscale PERSCALE block - * @verbatim -PERSCALE -# RESTYPE special energy term to which periodic scaling should -# be applied -# off don't apply periodic scaling -# jrest apply periodic scaling to J-value restraints -# -# parameters for periodic scaling of J-value restraints -# KDIH >= 0 maximum scaling factor for dihedral angle potential -# KJ >= 0 maximum scaling factor for J-Value restraint potential -# T >= 0 period of cosine scaling function -# DIFF >= 0 minimum deviation from target value at which to start -# scaling period -# RATIO >= 0 minimum fraction of T that needs to be passed before -# starting a new scaling period -# READ 0,1 controls reading of scaling parameters -# 0 reset scaling parameters -# 1 read from configuration -# -# RESTYPE - off -# KDIH KJ T DIFF RATIO READ - 0.1 0.1 0.2 0.7 1.0 0 -END -@endverbatim + * @snippet snippets/snippets.cc PERSCALE */ void io::In_Parameter::read_PERSCALE(simulation::Parameter ¶m, - std::ostream & os) { - DEBUG(8, "read PERSCALE"); - - std::vector buffer; - std::string s; - - buffer = m_block["PERSCALE"]; - if (buffer.size()) { - - block_read.insert("PERSCALE"); - - _lineStream.clear(); - _lineStream.str(concatenate(buffer.begin() + 1, buffer.end() - 1, s)); - - std::string s1; - int read; - _lineStream >> s1 - >> param.pscale.KDIH >> param.pscale.KJ - >> param.pscale.T >> param.pscale.difference - >> param.pscale.ratio >> read; - if (_lineStream.fail()) { - io::messages.add("bad line in PERSCALE block", - "In_Parameter", io::message::error); - return; - } - - std::transform(s1.begin(), s1.end(), s1.begin(), tolower); - - if (s1 == "jrest" || s1 == "1") { - param.pscale.jrest = true; - } else if (s1 == "off" || s1 == "0") { - param.pscale.jrest = false; - } else { - io::messages.add("PERSCALE block: RESTYPE must be jrest or off.", - "In_Parameter", io::message::error); - } - - if (param.pscale.KDIH < 0.0) - io::messages.add("PERSCALE block: KDIH must be >= 0.0.", - "In_Parameter", io::message::error); - if (param.pscale.KJ < 0.0) - io::messages.add("PERSCALE block: KJ must be >= 0.0.", - "In_Parameter", io::message::error); - if (param.pscale.T < 0.0) - io::messages.add("PERSCALE block: T must be >= 0.0.", - "In_Parameter", io::message::error); - if (param.pscale.difference < 0.0) - io::messages.add("PERSCALE block: DIFF must be >= 0.0.", - "In_Parameter", io::message::error); + std::ostream & os) { + DEBUG(8, "reading PERSCALE"); + + std::stringstream exampleblock; + // lines starting with 'exampleblock<<"' and ending with '\n";' (spaces don't matter) + // will be used to generate snippets that can be included in the doxygen doc; + // the first line is the tag + exampleblock << "PERSCALE\n"; + exampleblock << "# RESTYPE special energy term to which periodic scaling should\n"; + exampleblock << "# be applied\n"; + exampleblock << "# 0 don't apply periodic scaling\n"; + exampleblock << "# 1 apply periodic scaling to J-value restraints\n"; + exampleblock << "#\n"; + exampleblock << "# parameters for periodic scaling of J-value restraints\n"; + exampleblock << "# KDIH >= 0 maximum scaling factor for dihedral angle potential\n"; + exampleblock << "# KJ >= 0 maximum scaling factor for J-Value restraint potential\n"; + exampleblock << "# T >= 0 period of cosine scaling function\n"; + exampleblock << "# DIFF >= 0 minimum deviation from target value at which to start\n"; + exampleblock << "# scaling period\n"; + exampleblock << "# RATIO >= 0 minimum fraction of T that needs to be passed before\n"; + exampleblock << "# starting a new scaling period\n"; + exampleblock << "# READ 0,1 controls reading of scaling parameters\n"; + exampleblock << "# 0 reset scaling parameters\n"; + exampleblock << "# 1 read from configuration\n"; + exampleblock << "#\n"; + exampleblock << "# RESTYPE\n"; + exampleblock << " 0\n"; + exampleblock << "# KDIH KJ T DIFF RATIO READ\n"; + exampleblock << " 0.1 0.1 0.2 0.7 1.0 0\n"; + exampleblock << "END\n"; + + + std::string blockname = "PERSCALE"; + Block block(blockname, exampleblock.str()); + + if (block.read_buffer(m_block[blockname], false) == 0) { + block_read.insert(blockname); + + std::string s1; + int read; + block.get_next_parameter("RESTYPE", s1, "", "off, 0, jrest, 1"); + block.get_next_parameter("KDIH", param.pscale.KDIH, ">=0", ""); + block.get_next_parameter("KJ", param.pscale.KJ, ">=0", ""); + block.get_next_parameter("T", param.pscale.T, ">=0", ""); + block.get_next_parameter("DIFF", param.pscale.difference, ">=0", ""); + block.get_next_parameter("RATIO", param.pscale.ratio, "", ""); + block.get_next_parameter("READ", read, "", ""); + + if (s1 == "jrest" || s1 == "1") { + param.pscale.jrest = true; + } else if (s1 == "off" || s1 == "0") { + param.pscale.jrest = false; + } - switch (read) { - case 0: - param.pscale.read_data = false; - break; - case 1: - param.pscale.read_data = true; - break; - default: - io::messages.add("PERSCALE block: READ must be 0 or 1.", - "In_Parameter", io::message::error); + switch (read) { + case 0: + param.pscale.read_data = false; + break; + case 1: + param.pscale.read_data = true; + break; + default: + break; + } + block.get_final_messages(); } - } } // PERSCALE /** * @section rottrans ROTTRANS block - * @verbatim -ROTTRANS -# roto-translational constraints -# use either centre of mass removal or roto-translational constraints -# not both! -# -# RTC: 0,1 controls roto-translational constraints -# 0 don't use roto-translational constraints -# 1 use roto-translational constraints -# RTCLAST: last atom to be roto-translationally constrained -# RTC RTCLAST - 0 0 -END -@endverbatim + * @snippet snippets/snippets.cc ROTTRANS */ void io::In_Parameter::read_ROTTRANS(simulation::Parameter ¶m, - std::ostream & os) { - DEBUG(8, "read ROTTRANS"); - - std::vector buffer; - std::string s; - - buffer = m_block["ROTTRANS"]; - - if (buffer.size()) { - block_read.insert("ROTTRANS"); - - _lineStream.clear(); - _lineStream.str(concatenate(buffer.begin() + 1, buffer.end() - 1, s)); - - int rtc; - _lineStream >> rtc >> param.rottrans.last; - - if (_lineStream.fail()) - io::messages.add("bad line in ROTTRANS block", - "In_Parameter", io::message::error); + std::ostream & os) { + DEBUG(8, "reading ROTTRANS"); + + std::stringstream exampleblock; + // lines starting with 'exampleblock<<"' and ending with '\n";' (spaces don't matter) + // will be used to generate snippets that can be included in the doxygen doc; + // the first line is the tag + exampleblock << "ROTTRANS\n"; + exampleblock << "# roto-translational constraints\n"; + exampleblock << "# use either centre of mass removal or roto-translational constraints\n"; + exampleblock << "# not both!\n"; + exampleblock << "#\n"; + exampleblock << "# RTC: 0,1 controls roto-translational constraints\n"; + exampleblock << "# 0 don't use roto-translational constraints (default)\n"; + exampleblock << "# 1 use roto-translational constraints\n"; + exampleblock << "# RTCLAST: last atom to be roto-translationally constrained\n"; + exampleblock << "# RTC RTCLAST\n"; + exampleblock << " 1 1155\n"; + exampleblock << "END\n"; + + + std::string blockname = "ROTTRANS"; + Block block(blockname, exampleblock.str()); + + if (block.read_buffer(m_block[blockname], false) == 0) { + block_read.insert(blockname); + + int rtc; + block.get_next_parameter("RTC", rtc, "", "0,1"); + block.get_next_parameter("RTCLAST", param.rottrans.last, ">0", ""); + + switch (rtc) { + case 0: + param.rottrans.rottrans = false; + break; + case 1: + param.rottrans.rottrans = true; + break; + default: + break; + } - switch (rtc) { - case 0: - param.rottrans.rottrans = false; - break; - case 1: - param.rottrans.rottrans = true; - break; - default: - io::messages.add("ROTTRANS block: RTC must be 0 or 1", - "In_Parameter", io::message::error); + block.get_final_messages(); } - - if (param.rottrans.last <= 0) - io::messages.add("ROTTRANS block: RTCLAST must be > 0.", - "In_Parameter", io::message::error); - } } /** * @section spc_loops INNERLOOP block - * @verbatim -INNERLOOP -# NTILM: 0..3, acceleration method used -# 0: use standard solvent loops [default] -# 1: use fast generic solvent loops -# 2: use solvent loops with hardcoded parameters -# 3: use solvent loops with tabulated forces and energies -# 4: use solvent loops with CUDA library -# NTILS: 0..1, solvent used -# 0: use topology [default] -# 1: use SPC -# NGPUS: number of GPUs to use -# NDEVG: Which GPU device number to use. If not given driver will determine. - -# NTILM NTILS NGPUS NDEVG - 4 0 2 0 1 -END -@endverbatim + * @snippet snippets/snippets.cc INNERLOOP */ void io::In_Parameter::read_INNERLOOP(simulation::Parameter ¶m, - std::ostream & os) { - DEBUG(8, "read INNERLOOP"); - - std::vector buffer; - std::string s; - - buffer = m_block["INNERLOOP"]; - - if (buffer.size()) { - block_read.insert("INNERLOOP"); - - _lineStream.clear(); - _lineStream.str(concatenate(buffer.begin() + 1, buffer.end() - 1, s)); - - int method, solvent; - _lineStream >> method >> solvent; - - if (_lineStream.fail()) - io::messages.add("bad line in INNERLOOP block", - "In_Parameter", io::message::error); - - switch (method) { - case 0: - { - // standard solvent loops - param.innerloop.method = simulation::sla_off; - break; - } - case 1: - { - // fast solvent loops - param.innerloop.method = simulation::sla_generic; - break; - } - case 2: - { - param.innerloop.method = simulation::sla_hardcode; - break; - } - case 3: - { - // tabulated forces and energies - param.innerloop.method = simulation::sla_table; - break; - } - case 4: - { + std::ostream & os) { + DEBUG(8, "reading INNERLOOP"); + + std::stringstream exampleblock; + // lines starting with 'exampleblock<<"' and ending with '\n";' (spaces don't matter) + // will be used to generate snippets that can be included in the doxygen doc; + // the first line is the tag + exampleblock << "INNERLOOP\n"; + exampleblock << "# NTILM: 0..4, acceleration method used\n"; + exampleblock << "# 0: use standard solvent loops [default]\n"; + exampleblock << "# 1: use fast generic solvent loops\n"; + exampleblock << "# 2: use solvent loops with hardcoded parameters\n"; + exampleblock << "# 3: use solvent loops with tabulated forces and energies\n"; + exampleblock << "# 4: use solvent loops with CUDA library\n"; + exampleblock << "# NTILS: 0..1, solvent used\n"; + exampleblock << "# 0: use topology [default]\n"; + exampleblock << "# 1: use SPC\n"; + exampleblock << "# NGPUS: number of GPUs to use\n"; + exampleblock << "# NDEVG: Which GPU device number to use. If not given driver will determine.\n"; + exampleblock << "# NTILM NTILS NGPUS NDEVG\n"; + exampleblock << " 4 0 2 0 1\n"; + exampleblock << "END\n"; + + + std::string blockname = "INNERLOOP"; + Block block(blockname, exampleblock.str()); + + if (block.read_buffer(m_block[blockname], false) == 0) { + block_read.insert(blockname); + + int method, solvent; + block.get_next_parameter("NTILM", method, "", "0,1,2,3,4"); + block.get_next_parameter("NTILS", solvent, "", "0,1"); + + switch (method) { + case 0: + { + // standard solvent loops + param.innerloop.method = simulation::sla_off; + break; + } + case 1: + { + // fast solvent loops + param.innerloop.method = simulation::sla_generic; + break; + } + case 2: + { + param.innerloop.method = simulation::sla_hardcode; + break; + } + case 3: + { + // tabulated forces and energies + param.innerloop.method = simulation::sla_table; + break; + } + case 4: + { #ifdef HAVE_LIBCUKERNEL - // cuda library - param.innerloop.method = simulation::sla_cuda; + // cuda library + param.innerloop.method = simulation::sla_cuda; #else - param.innerloop.method = simulation::sla_off; - io::messages.add("INNERLOOP block: CUDA solvent loops are not available " - "in your compilation. Use --with-cukernel for compiling.", - "In_Parameter", io::message::error); + param.innerloop.method = simulation::sla_off; + io::messages.add("INNERLOOP block: CUDA solvent loops are not available " + "in your compilation. Use --with-cukernel for compiling.", + "In_Parameter", io::message::error); #endif - break; - } - default: - { - param.innerloop.method = simulation::sla_off; - io::messages.add("INNERLOOP block: bad value for NTILM (0..4)", - "In_Parameter", io::message::error); - } - } - - switch (solvent) { - case 0: - { - // use topology - param.innerloop.solvent = simulation::sls_topo; - break; - } - case 1: - { - // use SPC - param.innerloop.solvent = simulation::sls_spc; - break; - } - default: - { - param.innerloop.solvent = simulation::sls_topo; - io::messages.add("INNERLOOP block: bad value for NTILS (0,1)", - "In_Parameter", io::message::error); - } - } + break; + } + default: + { + param.innerloop.method = simulation::sla_off; + } + } - // Get the number of gpus and their device number - if (param.innerloop.method == simulation::sla_cuda) { - _lineStream >> param.innerloop.number_gpus; - - if (_lineStream.fail() || param.innerloop.number_gpus == (unsigned int) 0) - io::messages.add("CUDA enabled, but number of GPUs is zero", - "In_Parameter", io::message::error); - else { - unsigned int temp; - bool fail = false; - for (unsigned int i = 0; i < param.innerloop.number_gpus; i++) { - _lineStream >> temp; - if (_lineStream.fail()) { - fail = true; - break; - } - param.innerloop.gpu_device_number.push_back(temp); + switch (solvent) { + case 0: + { + // use topology + param.innerloop.solvent = simulation::sls_topo; + break; + } + case 1: + { + // use SPC + param.innerloop.solvent = simulation::sls_spc; + break; + } + default: + { + param.innerloop.solvent = simulation::sls_topo; + } } - if (fail) { - param.innerloop.gpu_device_number.clear(); - param.innerloop.gpu_device_number.resize(param.innerloop.number_gpus, -1); - io::messages.add("CUDA driver will determine devices for nonbonded interaction evaluation.", - "In_Parameter", io::message::notice); + + // Get the number of gpus and their device number + if (param.innerloop.method == simulation::sla_cuda) { + block.get_next_parameter("NGPUS", param.innerloop.number_gpus, ">0", ""); + + if (!block.error()) { + unsigned int temp; + bool fail = false; + for (unsigned int i = 0; i < param.innerloop.number_gpus; i++) { + std::string idx=io::to_string(i); + block.get_next_parameter("NDEVG["+idx+"]", temp, ">0", ""); + if (block.error()) { + fail = true; + break; + } + param.innerloop.gpu_device_number.push_back(temp); + } + if (fail) { + param.innerloop.gpu_device_number.clear(); + param.innerloop.gpu_device_number.resize(param.innerloop.number_gpus, -1); + io::messages.add("CUDA driver will determine devices for nonbonded interaction evaluation.", + "In_Parameter", io::message::notice); + } + } + } else { + // we don't care if there is a value for NGPUS even if we do not need it + int tmp; + block.get_next_parameter("NGPUS", tmp, "", ""); } - } + block.get_final_messages(); } - } -} +} //INNERLOOP /** * @section replica REPLICA block - * @verbatim -REPLICA -# NRET >= 0 number of replica exchange temperatures -# RET() >= 0.0 temperature for each replica -# LRESCALE 0,1 controls temperature scaling -# 0 don't scale temperatures after exchange trial -# 1 scale temperatures after exchange trial -# NRELAM >= 0 number of replica exchange lambda values -# RELAM() >= 0.0 lambda value for each lambda-replica -# RETS() >= 0.0 timestep of each lambda-replica -# NRETRIAL >= 0 number of overall exchange trials -# NREQUIL >= 0 number of exchange periods to equilibrate -# (disallow switches) -# CONT >= 0 continuation run -# 0 start from one configuration file -# 1 start from multiple configuration files -# -# NRET - 10 -# RET(1..NRET) - 300.0 320.0 340.0 360.0 380.0 - 400.0 420.0 440.0 460.0 480.0 -# LRESCALE - 1 -# NRELAM - 10 -# RELAM(1..NRELAM) - 0.0 0.1 0.2 0.3 0.4 - 0.5 0.6 0.7 0.8 0.9 -# RETS(1..NRELAM) - 0.002 0.001 0.001 0.001 0.002 - 0.003 0.002 0.001 0.001 0.002 -# NERTRIAL - 100 -# NREQUIL - 10 -# CONT - 0 -END -@endverbatim + * @snippet snippets/snippets.cc REPLICA */ void io::In_Parameter::read_REPLICA(simulation::Parameter ¶m, - std::ostream & os) { - DEBUG(8, "read REPLICA"); - - std::vector buffer; - std::string s; - - buffer = m_block["REPLICA"]; - if (buffer.size()) { - block_read.insert("REPLICA"); - - bool error = false; - - _lineStream.clear(); - _lineStream.str(concatenate(buffer.begin() + 1, buffer.end() - 1, s)); - - _lineStream >> param.replica.num_T; - - if (_lineStream.fail() || param.replica.num_T < 0) { - io::messages.add("REPLICA block: NRET must be >= 0.", - "In_Parameter", io::message::error); - error = true; - } - - if (!error) - param.replica.temperature.resize(param.replica.num_T, 0.0); - - for (int i = 0; i < param.replica.num_T; ++i) { - _lineStream >> param.replica.temperature[i]; - if (_lineStream.fail() || param.replica.temperature[i] < 0.0) { - std::ostringstream msg; - msg << "REPLICA block: RET(" << i + 1 << ") must be >= 0.0"; - io::messages.add(msg.str(), "In_Parameter", io::message::error); - error = true; - } - } - - int scale; - _lineStream >> scale; - switch (scale) { - case 0: - param.replica.scale = false; - break; - case 1: - param.replica.scale = true; - break; - default: - io::messages.add("REPLICA block: LRSCALE must be 0 or 1", - "In_Parameter", io::message::error); - error = true; - } - - if (_lineStream.fail() || error) { - param.replica.num_T = 0; - param.replica.num_l = 0; + std::ostream & os) { + DEBUG(8, "reading REPLICA"); + + std::stringstream exampleblock; + // lines starting with 'exampleblock<<"' and ending with '\n";' (spaces don't matter) + // will be used to generate snippets that can be included in the doxygen doc; + // the first line is the tag + exampleblock << "REPLICA\n"; + exampleblock << "# NRET >= 1 number of replica exchange temperatures\n"; + exampleblock << "# RET() >= 0.0 temperature for each replica\n"; + exampleblock << "# LRESCALE 0,1 controls temperature scaling\n"; + exampleblock << "# 0 don't scale temperatures after exchange trial\n"; + exampleblock << "# 1 scale temperatures after exchange trial\n"; + exampleblock << "# NRELAM >= 1 number of replica exchange lambda values\n"; + exampleblock << "# RELAM() >= 0.0 lambda value for each lambda-replica\n"; + exampleblock << "# RETS() >= 0.0 timestep of each lambda-replica\n"; + exampleblock << "# NRETRIAL >= 0 number of overall exchange trials\n"; + exampleblock << "# NREQUIL >= 0 number of exchange periods to equilibrate\n"; + exampleblock << "# (disallow switches)\n"; + exampleblock << "# CONT >= 0 continuation run\n"; + exampleblock << "# 0 start from one configuration file\n"; + exampleblock << "# 1 start from multiple configuration files\n"; + exampleblock << "#\n"; + exampleblock << "# NRET\n"; + exampleblock << " 10\n"; + exampleblock << "# RET(1..NRET)\n"; + exampleblock << " 300.0 320.0 340.0 360.0 380.0\n"; + exampleblock << " 400.0 420.0 440.0 460.0 480.0\n"; + exampleblock << "# LRESCALE\n"; + exampleblock << " 1\n"; + exampleblock << "# NRELAM\n"; + exampleblock << " 10\n"; + exampleblock << "# RELAM(1..NRELAM)\n"; + exampleblock << " 0.0 0.1 0.2 0.3 0.4\n"; + exampleblock << " 0.5 0.6 0.7 0.8 0.9\n"; + exampleblock << "# RETS(1..NRELAM)\n"; + exampleblock << " 0.002 0.001 0.001 0.001 0.002\n"; + exampleblock << " 0.003 0.002 0.001 0.001 0.002\n"; + exampleblock << "# NERTRIAL\n"; + exampleblock << " 100\n"; + exampleblock << "# NREQUIL\n"; + exampleblock << " 10\n"; + exampleblock << "# CONT\n"; + exampleblock << " 0\n"; + exampleblock << "END\n"; + + + std::string blockname = "REPLICA"; + Block block(blockname, exampleblock.str()); + + if (block.read_buffer(m_block[blockname], false) == 0) { + block_read.insert(blockname); + + block.get_next_parameter("NRET", param.replica.num_T, ">=1", ""); + + if (block.error()) { + block.get_final_messages(); + return; + } + param.replica.temperature.resize(param.replica.num_T, 0.0); - param.replica.temperature.clear(); - param.replica.lambda.clear(); - param.replica.dt.clear(); - error = false; - } + for (int i = 0; i < param.replica.num_T; ++i) { + std::string idx = io::to_string(i); + block.get_next_parameter("RET["+idx+"]", param.replica.temperature[i], ">=0", ""); + } - _lineStream >> param.replica.num_l; + int scale; + block.get_next_parameter("LRESCALE", scale, "", "0,1"); + switch (scale) { + case 0: + param.replica.scale = false; + break; + case 1: + param.replica.scale = true; + break; + default: + break; + } + if (param.replica.scale && param.replica.num_T<2) + io::messages.add("REPLICA block: NRESCALE=1 requires more than one replica exchange temperature.", + "In_Parameter", io::message::error); - if (_lineStream.fail() || param.replica.num_l < 0) { - io::messages.add("REPLICA block: NRELAM must be >= 0.", - "In_Parameter", io::message::error); - error = true; - } + block.get_next_parameter("NRELAM", param.replica.num_l, ">=1", ""); - if (!error) { - param.replica.lambda.resize(param.replica.num_l, 0.0); - param.replica.dt.resize(param.replica.num_l, 0.0); - } + if (block.error()) { + block.get_final_messages(); + return; + } - for (int i = 0; i < param.replica.num_l; ++i) { - _lineStream >> param.replica.lambda[i]; - if (_lineStream.fail() || param.replica.lambda[i] < 0.0) { - std::ostringstream msg; - msg << "REPLICA block: RELAM(" << i + 1 << ") must be >= 0.0"; - io::messages.add(msg.str(), "In_Parameter", io::message::error); - error = true; - } - } - for (int i = 0; i < param.replica.num_l; ++i) { - _lineStream >> param.replica.dt[i]; - if (_lineStream.fail() || param.replica.dt[i] < 0.0) { - std::ostringstream msg; - msg << "REPLICA block: RETS(" << i + 1 << ") must be >= 0.0"; - io::messages.add(msg.str(), "In_Parameter", io::message::error); - error = true; - } - } + param.replica.lambda.resize(param.replica.num_l, 0.0); + param.replica.dt.resize(param.replica.num_l, 0.0); - if (_lineStream.fail() || error) { - param.replica.num_T = 0; - param.replica.num_l = 0; + for (int i = 0; i < param.replica.num_l; ++i) { + std::string idx = io::to_string(i); + block.get_next_parameter("RELAM["+idx+"]", param.replica.lambda[i], ">=0 && <=1", ""); + } + for (int i = 0; i < param.replica.num_l; ++i) { + std::string idx = io::to_string(i); + block.get_next_parameter("RETS["+idx+"]", param.replica.dt[i], ">=0", ""); + } - param.replica.temperature.clear(); - param.replica.lambda.clear(); - param.replica.dt.clear(); - error = false; - } + if (block.error()) { + block.get_final_messages(); + return; + } - _lineStream >> param.replica.trials; - if (_lineStream.fail() || param.replica.trials < 0) { - io::messages.add("REPLICA block: NRETRIAL must be >= 0.", - "In_Parameter", io::message::error); - error = true; - } - _lineStream >> param.replica.equilibrate; - if (_lineStream.fail() || param.replica.equilibrate < 0) { - io::messages.add("REPLICA block: NREQUIL must be >= 0.", - "In_Parameter", io::message::error); - error = true; - } - // do continuation run - _lineStream >> param.replica.cont; - if (_lineStream.fail() || param.replica.cont < 0 || param.replica.cont > 1 ) { - io::messages.add("REPLICA block: CONT must be 0 or 1", - "In_Parameter", io::message::error); - error = true; - } + block.get_next_parameter("NRETRIAL", param.replica.trials, ">=0", ""); + block.get_next_parameter("NREQUIL", param.replica.equilibrate, ">=0", ""); + // do continuation run + block.get_next_parameter("", param.replica.cont, "", "0,1"); - if (_lineStream.fail() || error) { - io::messages.add("bad line in REPLICA block", - "In_Parameter", io::message::error); - param.replica.num_T = 0; - param.replica.num_l = 0; + if (block.error()) { + param.replica.num_T = 0; + param.replica.num_l = 0; - param.replica.temperature.clear(); - param.replica.lambda.clear(); - param.replica.dt.clear(); + param.replica.temperature.clear(); + param.replica.lambda.clear(); + param.replica.dt.clear(); + } + block.get_final_messages(); } - } } /** * @section multicell MULTICELL block - * @verbatim -MULTICELL -# NTM: 0,1 switch for multiple-unit-cell simulation. -# 0 : single-unit-cell simulation [default] -# 1 : multiple-unit-cell simulation -# NTM - 0 -# number of subdivisions along axis -# NCELLA NCELLB NCELLC - 1 1 1 -# periodicity checks (relative tolerance) -# not available in md++ -> 0.0 -# TOLPX TOLPV TOLPF TOLPFW - 0.0 0.0 0.0 0.0 -END -@endverbatim + * @snippet snippets/snippets.cc MULTICELL */ void io::In_Parameter::read_MULTICELL(simulation::Parameter & param, - std::ostream & os) { - DEBUG(8, "read MULTICELL"); - - std::vector buffer; - std::string s; - - buffer = m_block["MULTICELL"]; - - if (buffer.size()) { - - block_read.insert("MULTICELL"); - - _lineStream.clear(); - _lineStream.str(concatenate(buffer.begin() + 1, buffer.end() - 1, s)); - int ntm; - double tolpx, tolpv, tolpf, tolpfw; - _lineStream >> ntm - >> param.multicell.x >> param.multicell.y >> param.multicell.z - >> tolpx >> tolpv >> tolpf >> tolpfw; - - if (_lineStream.fail()) { - io::messages.add("bad line in MULTICELL block", - "In_Parameter", io::message::error); + std::ostream & os) { + DEBUG(8, "reading MULTICELL"); + + std::stringstream exampleblock; + // lines starting with 'exampleblock<<"' and ending with '\n";' (spaces don't matter) + // will be used to generate snippets that can be included in the doxygen doc; + // the first line is the tag + exampleblock << "MULTICELL\n"; + exampleblock << "# NTM: 0,1 switch for multiple-unit-cell simulation.\n"; + exampleblock << "# 0 : single-unit-cell simulation [default]\n"; + exampleblock << "# 1 : multiple-unit-cell simulation\n"; + exampleblock << "# NTM\n"; + exampleblock << " 0\n"; + exampleblock << "# number of subdivisions along axis\n"; + exampleblock << "# NCELLA NCELLB NCELLC\n"; + exampleblock << " 1 1 1\n"; + exampleblock << "# periodicity checks (relative tolerance)\n"; + exampleblock << "# not available in md++ -> 0.0\n"; + exampleblock << "# TOLPX TOLPV TOLPF TOLPFW\n"; + exampleblock << " 0.0 0.0 0.0 0.0\n"; + exampleblock << "END\n"; + + + std::string blockname = "MULTICELL"; + Block block(blockname, exampleblock.str()); + + if (block.read_buffer(m_block[blockname], false) == 0) { + block_read.insert(blockname); + + param.setDevelop("MULTICELL is under development."); + + int ntm; + double tolpx, tolpv, tolpf, tolpfw; + block.get_next_parameter("NTM", ntm, "", "0,1"); + block.get_next_parameter("NCELLA", param.multicell.x, ">=1", ""); + block.get_next_parameter("NCELLB", param.multicell.y, ">=1", ""); + block.get_next_parameter("NCELLC", param.multicell.z, ">=1", ""); + + block.get_next_parameter("TOLPX", tolpx, "", ""); + block.get_next_parameter("TOLPV", tolpv, "", ""); + block.get_next_parameter("TOLPF", tolpf, "", ""); + block.get_next_parameter("TOLPW", tolpfw, "", ""); + + switch (ntm) { + case 1: + param.multicell.multicell = true; + break; + case 0: + param.multicell.multicell = false; + break; + default: + param.multicell.multicell = false; + } - param.multicell.multicell = false; - } + if (param.multicell.multicell) { + /* + // disable because broken + param.multicell.multicell = false; + io::messages.add("MULTICELL simulations are broken in MD++", + "In_Parameter", io::message::error); */ + + if (param.multicell.x == 1 && param.multicell.y == 1 && + param.multicell.z == 1) { + io::messages.add("MULTICELL block: NCELLA, NCELLB and NCELLC are all 1.\n" + "disabling MULTICELL simulation.", "In_Parameter", + io::message::warning); + param.multicell.multicell = false; + } - switch (ntm) { - case 1: - param.multicell.multicell = true; - break; - case 0: - param.multicell.multicell = false; - break; - default: - param.multicell.multicell = false; - io::messages.add("MULTICELL block: NTM must be 0 or 1.", - "In_Parameter", io::message::error); - } + if (tolpx || tolpv || tolpf || tolpfw) { + io::messages.add("MULTICELL block: Periodicity checks are not needed " + "in the MD++ implementation of MULTICELL.", + "In_Parameter", io::message::warning); + } + } else { + // make sure all values are set to one in a normal, non-multicell, simulation! + param.multicell.x = param.multicell.y = param.multicell.z = 1; + } - if (param.multicell.multicell) { - /* - // disable because broken - param.multicell.multicell = false; - io::messages.add("MULTICELL simulations are broken in MD++", - "In_Parameter", io::message::error); */ - - - // do these checks only if mutlicell is really used. - if (param.multicell.x < 1 || param.multicell.y < 1 || - param.multicell.z < 1) { - io::messages.add("MULTICELL block: NCELLA, NCELLB and NCELLC " - "must be >= 1.", "In_Parameter", io::message::error); - } - - if (param.multicell.x == 1 && param.multicell.y == 1 && - param.multicell.z == 1) { - io::messages.add("MULTICELL block: NCELLA, NCELLB and NCELLC are all 1.\n" - "disabling MULTICELL simulation.", "In_Parameter", - io::message::warning); - param.multicell.multicell = false; - } - - if (tolpx || tolpv || tolpf || tolpfw) { - io::messages.add("MULTICELL block: Periodicity checks are not needed " - "in the MD++ implementation of MULTICELL.", - "In_Parameter", io::message::warning); - } - } else { - // make sure all values are set to one in a normal, non-multicell, simulation! - param.multicell.x = param.multicell.y = param.multicell.z = 1; + block.get_final_messages(); } - } } -/** +/* * @section readtraj READTRAJ block - * @verbatim -READTRAJ -# NTRD 0,1 controls trajectory-reevaluation mode -# 0: do not use trajectory-reevaluation mode -# 1: use trajectory-reevaluation mode -# NTRN number of files (ignored) -# NTRB read box (must be 1) -# NTSHK 0,1 controls SHAKE on old coordinates -# 0 perform SHAKE with respect to previous coordinates -# 1 perform SHAKE with respect to current coordinates -# -# NTRD NTRN NTRB NTSHK - 0 0 1 0 -END -@endverbatim + * @snippet snippets/snippets.cc READTRAJ */ void io::In_Parameter::read_READTRAJ(simulation::Parameter & param, - std::ostream & os) { - DEBUG(8, "read READTRAJ"); - - std::vector buffer; - std::string s; - - buffer = m_block["READTRAJ"]; - - if (buffer.size()) { - - block_read.insert("READTRAJ"); - - _lineStream.clear(); - _lineStream.str(concatenate(buffer.begin() + 1, buffer.end() - 1, s)); - - int ntrd, ntrn, ntrb, ntshk; - _lineStream >> ntrd >> ntrn >> ntrb >> ntshk; - - if (_lineStream.fail()) { - io::messages.add("bad line in READTRAJ block", - "In_Parameter", io::message::error); + std::ostream & os) { + DEBUG(8, "reading READTRAJ"); + + std::stringstream exampleblock; + // lines starting with 'exampleblock<<"' and ending with '\n";' (spaces don't matter) + // will be used to generate snippets that can be included in the doxygen doc; + // the first line is the tag + exampleblock << "READTRAJ\n"; + exampleblock << "# NTRD 0,1 controls trajectory-reevaluation mode\n"; + exampleblock << "# 0: do not use trajectory-reevaluation mode (default)\n"; + exampleblock << "# 1: use trajectory-reevaluation mode\n"; + exampleblock << "# NTRN number of files (ignored)\n"; + exampleblock << "# NTRB read box (must be 1)\n"; + exampleblock << "# NTSHK 0,1 controls SHAKE on old coordinates\n"; + exampleblock << "# 0 perform SHAKE with respect to previous coordinates\n"; + exampleblock << "# 1 perform SHAKE with respect to current coordinates\n"; + exampleblock << "#\n"; + exampleblock << "# NTRD NTRN NTRB NTSHK\n"; + exampleblock << " 0 0 1 0\n"; + exampleblock << "END\n"; + + + std::string blockname = "READTRAJ"; + Block block(blockname, exampleblock.str()); + + if (block.read_buffer(m_block[blockname], false) == 0) { + block_read.insert(blockname); + + int ntrd, ntrn, ntrb, ntshk; + block.get_next_parameter("NTRD", ntrd, "", "0,1"); + block.get_next_parameter("NTRN", ntrn, "", ""); + block.get_next_parameter("NTRB", ntrb, "", "1"); + block.get_next_parameter("NTSHK", ntshk, "", "0,1"); + + if (block.error()) { + block.get_final_messages(); + return; + } - param.analyze.analyze = false; - return; - } + switch (ntrd) { + case 1: + param.analyze.analyze = true; + break; + case 0: + param.analyze.analyze = false; + break; + default: + break; + } - switch (ntrd) { - case 1: - param.analyze.analyze = true; - break; - case 0: - param.analyze.analyze = false; - break; - default: - param.analyze.analyze = false; - io::messages.add("READTRAJ block: NTRD must be 0 or 1", - "In_Parameter", io::message::error); - } + if (ntrn) + io::messages.add("READTRAJ block: NTRN was ignored", "In_Parameter", + io::message::warning); + + if (ntrb != 1) + io::messages.add("READTRAJ block: NTRB must be 1.", "In_Parameter", + io::message::error); + + switch (ntshk) { + case 1: + param.analyze.copy_pos = true; + break; + case 0: + param.analyze.copy_pos = false; + break; + default: + break; + } - if (ntrn) - io::messages.add("READTRAJ block: NTRN was ignored", "In_Parameter", - io::message::warning); - - if (ntrb != 1) - io::messages.add("READTRAJ block: NTRB must be 1.", "In_Parameter", - io::message::error); - - switch (ntshk) { - case 1: - param.analyze.copy_pos = true; - break; - case 0: - param.analyze.copy_pos = false; - break; - default: - param.analyze.copy_pos = false; - io::messages.add("READTRAJ block: NTSHK must be 0 or 1", - "In_Parameter", io::message::error); + block.get_final_messages(); } - - } -} +} //READTRAJ /** * @section integrate INTEGRATE block - * @verbatim -INTEGRATE -# NINT 0..1 selects integration method -# 0: no integration performed -# 1: leap-frog integration scheme performed -# -# NINT - 1 -END -@endverbatim + * @snippet snippets/snippets.cc INTEGRATE */ void io::In_Parameter::read_INTEGRATE(simulation::Parameter & param, - std::ostream & os) { - DEBUG(8, "read INTEGRATE"); - - std::vector buffer; - std::string s; - - buffer = m_block["INTEGRATE"]; - - if (buffer.size()) { - - block_read.insert("INTEGRATE"); - - _lineStream.clear(); - _lineStream.str(concatenate(buffer.begin() + 1, buffer.end() - 1, s)); - - int nint; - _lineStream >> nint; - - if (_lineStream.fail()) { - io::messages.add("bad line in INTEGRATE block", - "In_Parameter", io::message::error); - - } - - switch (nint) { - case 0: - param.integrate.method = simulation::integrate_off; - break; - case 1: - param.integrate.method = simulation::integrate_leap_frog; - break; - default: - io::messages.add("INTEGRATE block: NINT must be 0 or 1", - "In_Parameter", io::message::error); + std::ostream & os) { + DEBUG(8, "reading INTEGRATE"); + + std::stringstream exampleblock; + // lines starting with 'exampleblock<<"' and ending with '\n";' (spaces don't matter) + // will be used to generate snippets that can be included in the doxygen doc; + // the first line is the tag + exampleblock << "INTEGRATE\n"; + exampleblock << "# NINT 0..1 selects integration method\n"; + exampleblock << "# 0: no integration performed\n"; + exampleblock << "# 1: leap-frog integration scheme performed (default)\n"; + exampleblock << "#\n"; + exampleblock << "# NINT\n"; + exampleblock << " 1\n"; + exampleblock << "END\n"; + + std::string blockname = "INTEGRATE"; + Block block(blockname, exampleblock.str()); + + if (block.read_buffer(m_block[blockname], false) == 0) { + block_read.insert(blockname); + + int nint; + block.get_next_parameter("NINT", nint, "", "0,1"); + + switch (nint) { + case 0: + param.integrate.method = simulation::integrate_off; + break; + case 1: + param.integrate.method = simulation::integrate_leap_frog; + break; + default: + break; + } + block.get_final_messages(); } - } } /** * @section stochdyn STOCHDYN block - * @verbatim -STOCHDYN -# NTSD 0,1 controls stochastic dynamics mode -# 0: do not do stochastic dynamics (default) -# 1: do stochastic dynamics -# NTFR 0..3 defines atomic friction coefficients gamma -# 0: set gamma to 0.0 (default) -# 1: set gamma to CFRIC -# 2: set gamma to CFRIC*GAM0 -# 3: calculate gamma using subroutine FRIC (based on CFRIC) -# NSFR > 0 recalculate gamma every NSFR steps -# NBREF > 0 threshold number of neighbour atoms for a buried atom -# RCUTF >= 0.0 interatomic distance considered when calculating gamma -# CFRIC >= 0.0 global weighting for gamma -# TEMPSD >= 0.0 temperature of stochastic bath -# -# NTSD NTFR NSFR NBREF RCUTF CFRIC TEMPSD - 0 1 0 6 0.3 91.0 300.0 -END -@endverbatim + * @snippet snippets/snippets.cc STOCHDYN */ void io::In_Parameter::read_STOCHDYN(simulation::Parameter & param, - std::ostream & os) { - DEBUG(8, "read STOCHDYN"); - - std::vector buffer; - std::string s; - - buffer = m_block["STOCHDYN"]; - - if (buffer.size()) { - - block_read.insert("STOCHDYN"); - - _lineStream.clear(); - _lineStream.str(concatenate(buffer.begin() + 1, buffer.end() - 1, s)); - - _lineStream >> param.stochastic.sd >> param.stochastic.ntfr - >> param.stochastic.nsfr >> param.stochastic.nbref - >> param.stochastic.rcutf >> param.stochastic.cfric - >> param.stochastic.temp; - - if (_lineStream.fail()) { - io::messages.add("bad line in STOCHDYN block", - "In_Parameter", io::message::error); - return; + std::ostream & os) { + DEBUG(8, "reading STOCHDYN"); + + std::stringstream exampleblock; + // lines starting with 'exampleblock<<"' and ending with '\n";' (spaces don't matter) + // will be used to generate snippets that can be included in the doxygen doc; + // the first line is the tag + exampleblock << "STOCHDYN\n"; + exampleblock << "# NTSD 0,1 controls stochastic dynamics mode\n"; + exampleblock << "# 0: do not do stochastic dynamics (default)\n"; + exampleblock << "# 1: do stochastic dynamics\n"; + exampleblock << "# NTFR 0..3 defines atomic friction coefficients gamma\n"; + exampleblock << "# 0: set gamma to 0.0 (default)\n"; + exampleblock << "# 1: set gamma to CFRIC\n"; + exampleblock << "# 2: set gamma to CFRIC*GAM0\n"; + exampleblock << "# 3: set gamma to CFRIC*w where w approximates the solvent-accessible \n"; + exampleblock << "# surface area as described in the Stochastic Dynamics Chapter in Vol.2 of the manual \n"; + exampleblock << "# NSFR > 0 recalculate gamma every NSFR steps\n"; + exampleblock << "# NBREF > 0 threshold number of neighbour atoms for a buried atom\n"; + exampleblock << "# RCUTF >= 0.0 interatomic distance considered when calculating gamma\n"; + exampleblock << "# CFRIC >= 0.0 global weighting for gamma\n"; + exampleblock << "# TEMPSD >= 0.0 temperature of stochastic bath\n"; + exampleblock << "#\n"; + exampleblock << "# NTSD NTFR NSFR NBREF RCUTF CFRIC TEMPSD\n"; + exampleblock << " 0 1 0 6 0.3 91.0 300.0\n"; + exampleblock << "END\n"; + + + std::string blockname = "STOCHDYN"; + Block block(blockname, exampleblock.str()); + + param.stochastic.sd=0; + + if (block.read_buffer(m_block[blockname], false) == 0) { + block_read.insert(blockname); + + block.get_next_parameter("NTSD", param.stochastic.sd, "", "0,1"); + block.get_next_parameter("NTFR", param.stochastic.ntfr, "", "0,1,2,3"); + block.get_next_parameter("NSFR", param.stochastic.nsfr, ">0", ""); + block.get_next_parameter("NBREF", param.stochastic.nbref, ">0", ""); + block.get_next_parameter("RCUTF", param.stochastic.rcutf, ">=0.0", ""); + block.get_next_parameter("CFRIC", param.stochastic.cfric, ">=0.0", ""); + block.get_next_parameter("TEMPSD", param.stochastic.temp, ">=0.0", ""); + + block.get_final_messages(); } - - if (param.stochastic.sd < 0 || param.stochastic.sd > 1) - io::messages.add("STOCHDYN block: NTSD must be 0 or 1", - "In_Parameter", io::message::error); - - if (param.stochastic.ntfr < 0 || param.stochastic.ntfr > 3) - io::messages.add("STOCHDYN block: NTFR must be 0 to 3", - "In_Parameter", io::message::error); - - if (param.stochastic.nsfr <= 0) - io::messages.add("STOCHDYN block: NSFR must be > 0", - "In_Parameter", io::message::error); - - if (param.stochastic.nbref <= 0) - io::messages.add("STOCHDYN block: NBREF must be > 0", - "In_Parameter", io::message::error); - - if (param.stochastic.rcutf < 0) - io::messages.add("STOCHDYN block: RCUTF must be >= 0", - "In_Parameter", io::message::error); - - if (param.stochastic.cfric < 0) - io::messages.add("STOCHDYN block: CFRIC must be >= 0", - "In_Parameter", io::message::error); - - if (param.stochastic.temp < 0) - io::messages.add("STOCHDYN block: TEMPSD must be >= 0", - "In_Parameter", io::message::error); - } } /** * @section ewarn EWARN block - * @verbatim -EWARN -# MAXENER issue a warning if total energy is larger than this value -# -# MAXENER - 100000 -END -@endverbatim + * @snippet snippets/snippets.cc EWARN */ void io::In_Parameter::read_EWARN(simulation::Parameter & param, - std::ostream & os) { - DEBUG(8, "read EWARN"); - - std::vector buffer; - std::string s; + std::ostream & os) { + DEBUG(8, "reading EWARN"); - buffer = m_block["EWARN"]; + std::stringstream exampleblock; + // lines starting with 'exampleblock<<"' and ending with '\n";' (spaces don't matter) + // will be used to generate snippets that can be included in the doxygen doc; + // the first line is the tag + exampleblock << "EWARN\n"; + exampleblock << "# MAXENER issue a warning if total energy is larger than this value\n"; + exampleblock << "#\n"; + exampleblock << "# MAXENER\n"; + exampleblock << " 100000\n"; + exampleblock << "END\n"; - if (buffer.size()) { + std::string blockname = "EWARN"; + Block block(blockname, exampleblock.str()); - block_read.insert("EWARN"); + if (block.read_buffer(m_block[blockname], false) == 0) { + block_read.insert(blockname); - _lineStream.clear(); - _lineStream.str(concatenate(buffer.begin() + 1, buffer.end() - 1, s)); + block.get_next_parameter("MAXENER", param.ewarn.limit, "", ""); - _lineStream >> param.ewarn.limit; - - if (_lineStream.fail()) { - io::messages.add("bad line in EWARN block", - "In_Parameter", io::message::error); - return; - } - } else { + block.get_final_messages(); + } else { #ifndef HAVE_ISNAN - io::messages.add("std::isnan() is not available for your compilation. " - "Consider using the EWARN block.", - "In_Parameter", io::message::warning); + io::messages.add("std::isnan() is not available for your compilation. " + "Consider using the EWARN block.", + "In_Parameter", io::message::warning); #endif - } + } } /** * @section multistep MULTISTEP block - * @verbatim -MULTISTEP -# STEPS calculate non-bonded every STEPSth step. -# BOOST 0,1 -# 0: stored forces of STEPSth step are added every step -# 1: stored forces of STEPSth setp are multiplied by STEPS -# and added every STEPSth step. -# -# STEPS BOOST - 0 0 -END -@endverbatim + * @snippet snippets/snippets.cc MULTISTEP */ void io::In_Parameter::read_MULTISTEP(simulation::Parameter & param, - std::ostream & os) { - DEBUG(8, "read MULTISTEP"); - - std::vector buffer; - std::string s; - - buffer = m_block["MULTISTEP"]; - - if (buffer.size()) { - block_read.insert("MULTISTEP"); - - _lineStream.clear(); - _lineStream.str(concatenate(buffer.begin() + 1, buffer.end() - 1, s)); - int boost; - _lineStream >> param.multistep.steps >> boost; - - if (_lineStream.fail()) { - io::messages.add("bad line in MULTISTEP block", - "In_Parameter", io::message::error); - return; - } - - if (param.multistep.steps < 0) { - io::messages.add("MULTISTEP block: STEPS must be >= 0.", - "In_Parameter", io::message::error); - } - switch (boost) { - case 0: - param.multistep.boost = false; - break; - case 1: - param.multistep.boost = true; - break; - default: - io::messages.add("MULTISTEP block: BOOST must be 0 or 1", - "In_Parameter", io::message::error); + std::ostream & os) { + DEBUG(8, "reading MULTISTEP"); + + std::stringstream exampleblock; + // lines starting with 'exampleblock<<"' and ending with '\n";' (spaces don't matter) + // will be used to generate snippets that can be included in the doxygen doc; + // the first line is the tag + exampleblock << "MULTISTEP\n"; + exampleblock << "# STEPS calculate non-bonded every STEPSth step.\n"; + exampleblock << "# BOOST 0,1\n"; + exampleblock << "# 0: stored forces of STEPSth step are added every step\n"; + exampleblock << "# 1: stored forces of STEPSth setp are multiplied by STEPS\n"; + exampleblock << "# and added every STEPSth step (default)\n"; + exampleblock << "#\n"; + exampleblock << "# STEPS BOOST\n"; + exampleblock << " 0 0\n"; + exampleblock << "END\n"; + + std::string blockname = "MULTISTEP"; + Block block(blockname, exampleblock.str()); + + if (block.read_buffer(m_block[blockname], false) == 0) { + block_read.insert(blockname); + + int boost; + block.get_next_parameter("STEPS", param.multistep.steps, ">=0", ""); + block.get_next_parameter("BOOST", boost, "", "0,1"); + + switch (boost) { + case 0: + param.multistep.boost = false; + break; + case 1: + param.multistep.boost = true; + break; + default: + break; + } + block.get_final_messages(); } - } } -void io::In_Parameter::read_MONTECARLO(simulation::Parameter & param, - std::ostream & os) { - DEBUG(8, "read MONTECARLO"); - - std::vector buffer; - std::string s; - - buffer = m_block["MONTECARLO"]; - - if (buffer.size()) { - block_read.insert("MONTECARLO"); - - _lineStream.clear(); - _lineStream.str(concatenate(buffer.begin() + 1, buffer.end() - 1, s)); - int mc; - _lineStream >> mc >> param.montecarlo.steps >> param.montecarlo.dlambda; - - if (_lineStream.fail()) { - io::messages.add("bad line in MONTECARLO block", - "In_Parameter", io::message::error); - return; - } - - switch (mc) { - case 0: param.montecarlo.mc = mc; - break; - case 1: param.montecarlo.mc = mc; - break; - default: - { - io::messages.add("MONTECARLO block: MC must be 0 or 1", - "In_Parameter", io::message::error); - break; - } - } +/** + * @section montecarlo CHEMICALMONTECARLO block + * @snippet snippets/snippets.cc CHEMICALMONTECARLO + */ +void io::In_Parameter::read_CHEMICALMONTECARLO(simulation::Parameter & param, + std::ostream & os) { + DEBUG(8, "reading CHEMICALMONTECARLO"); + + std::stringstream exampleblock; + // lines starting with 'exampleblock<<"' and ending with '\n";' (spaces don't matter) + // will be used to generate snippets that can be included in the doxygen doc; + // the first line is the tag + exampleblock << "CHEMICALMONTECARLO\n"; + exampleblock << "#\n"; + exampleblock << "# MC MCSTEPS MCDLAM\n"; + exampleblock << " 0 1 0.5\n"; + exampleblock << "END\n"; + + std::string blockname = "CHEMICALMONTECARLO"; + Block block(blockname, exampleblock.str()); + + if (block.read_buffer(m_block[blockname], false) == 0) { + block_read.insert(blockname); + + int mc; + block.get_next_parameter("MC", mc, "", "0,1"); + block.get_next_parameter("MCSTEPS", param.montecarlo.steps, ">=0", ""); + block.get_next_parameter("MCDLAM", param.montecarlo.dlambda, ">=0", ""); + + switch (mc) { + case 0: param.montecarlo.mc = mc; + break; + case 1: param.montecarlo.mc = mc; + break; + default: + break; + } - // parameters are all positive - if (param.montecarlo.steps < 0 || param.montecarlo.dlambda < 0) { - io::messages.add("MONTECARLO block: Negative parameter", - "In_Parameter", io::message::error); - return; + block.get_final_messages(); } - // perturbation - if (param.montecarlo.mc && !param.perturbation.perturbation) { - io::messages.add("Chemical MONTECARLO only possible if perturbation is on." - " Set NTG to 1.", - "In_Parameter", io::message::error); - return; - } - } } /** * @section polarise POLARISE block - * @verbatim -POLARISE -# COS 0,1 use polarisation -# 0: don't use polarisation -# 1: use charge-on-spring model for dipolar polarisation -# 2: use charge-on-spring model for dipolar polarisation with off atom site -# EFIELD 0,1 controls evaluation site for electric field -# 0: evaluate at atom position -# 1: evaluate at cos position -# MINFIELD >0.0 convergence criterium -# DAMP 0,1 controls polarisability damping -# 0: don't damp polarisability -# 1: damp polarisability (with paramaters from topology) -# WRITE > 0 write COS positions to special trajectory -# 0: don't write -# >0: write COS positions every WRITEth step -# -# COS EFIELD MINFIELD DAMP WRITE - 0 0 2.5 0 0 -END -@endverbatim + * @snippet snippets/snippets.cc POLARISE */ void io::In_Parameter::read_POLARISE(simulation::Parameter & param, - std::ostream & os) { - DEBUG(8, "read POLARISE"); - - std::vector buffer; - std::string s; - - buffer = m_block["POLARISE"]; - - if (buffer.size()) { - - //param.setDevelop("Polarisation is under development."); - - block_read.insert("POLARISE"); - - _lineStream.clear(); - _lineStream.str(concatenate(buffer.begin() + 1, buffer.end() - 1, s)); - - int cos, damp, efield; - _lineStream >> cos >> efield >> param.polarise.minfield >> damp - >> param.polarise.write; - - if (_lineStream.fail()) { - io::messages.add("bad line in POLARISE block", - "In_Parameter", io::message::error); - return; - } - - switch (cos) { - case 0: - { - param.polarise.cos = 0; - param.polarise.write = 0; - break; - } - case 1: - { - param.polarise.cos = 1; - param.force.interaction_function = simulation::pol_lj_crf_func; - break; - } - case 2: - { - param.polarise.cos = 2; - param.force.interaction_function = simulation::pol_off_lj_crf_func; - break; - } - - default: - io::messages.add("POLARISE block: COS must be 0, 1 or 2.", - "In_Parameter", io::message::error); - } - - switch (efield) { - case 0: param.polarise.efield_site = simulation::ef_atom; - break; - case 1: param.polarise.efield_site = simulation::ef_cos; - break; - default: - io::messages.add("POLARISE block: EFIELD must be 0 or 1.", - "In_Parameter", io::message::error); - } + std::ostream & os) { + DEBUG(8, "reading POLARISE"); + + std::stringstream exampleblock; + // lines starting with 'exampleblock<<"' and ending with '\n";' (spaces don't matter) + // will be used to generate snippets that can be included in the doxygen doc; + // the first line is the tag + exampleblock << "POLARISE\n"; + exampleblock << "# COS 0,1,2 use polarisation\n"; + exampleblock << "# 0: don't use polarisation (default)\n"; + exampleblock << "# 1: use charge-on-spring model for dipolar polarisation\n"; + exampleblock << "# 2: use charge-on-spring model for dipolar polarisation with off atom site\n"; + exampleblock << "# EFIELD 0,1 controls evaluation site for electric field\n"; + exampleblock << "# 0: evaluate at atom position\n"; + exampleblock << "# 1: evaluate at cos position\n"; + exampleblock << "# MINFIELD >0.0 convergence criterion in terms of the el. field (dU/(|qO|*dOH))\n"; + exampleblock << "# where dU .. maximum change in energy due to the change in field\n"; + exampleblock << "# [typically 2.5 kJ/mol]\n"; + exampleblock << "# qO .. charge of an oxygen atom\n"; + exampleblock << "# dOH .. length of OH bond\n"; + exampleblock << "# DAMP 0,1 controls polarisability damping\n"; + exampleblock << "# 0: don't damp polarisability\n"; + exampleblock << "# 1: damp polarisability (with paramaters from topology)\n"; + exampleblock << "# WRITE > 0 write COS positions to special trajectory\n"; + exampleblock << "# 0: don't write\n"; + exampleblock << "# >0: write COS positions every WRITEth step\n"; + exampleblock << "#\n"; + exampleblock << "# COS EFIELD MINFIELD DAMP WRITE\n"; + exampleblock << " 0 0 2.5 0 0\n"; + exampleblock << "END\n"; + + + std::string blockname = "POLARISE"; + Block block(blockname, exampleblock.str()); + + if (block.read_buffer(m_block[blockname], false) == 0) { + block_read.insert(blockname); + + int cos, damp, efield; + block.get_next_parameter("COS", cos, "", "0,1,2"); + block.get_next_parameter("EFIELD", efield, "", "0,1"); + block.get_next_parameter("MINFIELD", param.polarise.minfield, ">0.0", ""); + block.get_next_parameter("DAMP", damp, "", "0,1"); + block.get_next_parameter("WRITE", param.polarise.write, ">=0", ""); + + switch (cos) { + case 0: + { + param.polarise.cos = 0; + param.polarise.write = 0; + break; + } + case 1: + { + param.polarise.cos = 1; + param.force.interaction_function = simulation::pol_lj_crf_func; + break; + } + case 2: + { + param.polarise.cos = 2; + param.force.interaction_function = simulation::pol_off_lj_crf_func; + break; + } - if (param.polarise.minfield <= 0.0) { - io::messages.add("POLARISE block: MINFIELD must be > 0.0", - "In_Parameter", io::message::error); - } + default: + break; + } - switch (damp) { - case 0: param.polarise.damp = false; - break; - case 1: param.polarise.damp = true; - break; - default: - io::messages.add("POLARISE block: DAMP must be 0 or 1.", - "In_Parameter", io::message::error); - } + switch (efield) { + case 0: param.polarise.efield_site = simulation::ef_atom; + break; + case 1: param.polarise.efield_site = simulation::ef_cos; + break; + default: + break; + } - if (!param.polarise.cos) - param.polarise.write = 0; + switch (damp) { + case 0: param.polarise.damp = false; + break; + case 1: param.polarise.damp = true; + break; + default: + break; + } - if (param.polarise.write < 0) { - io::messages.add("POLARISE block: WRITE must be >= 0", - "In_Parameter", io::message::error); - } + if (!param.polarise.cos) + param.polarise.write = 0; - if (param.polarise.damp && !param.polarise.cos) { - io::messages.add("POLARISE block: DAMP is ignored if no polarisation is used", - "In_Parameter", io::message::warning); - } + if (param.polarise.damp && !param.polarise.cos) { + io::messages.add("POLARISE block: DAMP is ignored if no polarisation is used", + "In_Parameter", io::message::warning); + } - if (param.polarise.cos && param.multicell.multicell) { - io::messages.add("multiple unit cell simulation using polarisation may " - "converge differently. Use a small MINFIELD parameter.", - "In_Parameter", io::message::warning); + block.get_final_messages(); } - } -} +} //POLARISE /** * @section randomnumbers RANDOMNUMBERS block - * @verbatim -RANDOMNUMBERS -# NTRNG 0,1 random number generator -# 0 use G96 algorithm (default) -# 1 use GSL library -# NTGSL -1.. GSL random number generation algorithm -# -1: use default algorithm (mt19937) -# >=0 : run contrib/rng_gsl for a list of possible arguments -# -# NTRNG NTGSL - 1 -1 -END -@endverbatim + * @snippet snippets/snippets.cc RANDOMNUMBERS */ void io::In_Parameter::read_RANDOMNUMBERS(simulation::Parameter & param, - std::ostream & os) { - DEBUG(8, "read RANDOMNUMBERS"); - - std::vector buffer; - std::string s; - - buffer = m_block["RANDOMNUMBERS"]; - - if (buffer.size()) { - block_read.insert("RANDOMNUMBERS"); - - _lineStream.clear(); - _lineStream.str(concatenate(buffer.begin() + 1, buffer.end() - 1, s)); - - int rng; - _lineStream >> rng >> param.rng.gsl_rng; - - if (_lineStream.fail()) { - io::messages.add("bad line in RANDOMNUMBERS block", - "In_Parameter", io::message::error); - return; - } + std::ostream & os) { + DEBUG(8, "reading RANDOMNUMBERS"); + + std::stringstream exampleblock; + // lines starting with 'exampleblock<<"' and ending with '\n";' (spaces don't matter) + // will be used to generate snippets that can be included in the doxygen doc; + // the first line is the tag + exampleblock << "RANDOMNUMBERS\n"; + exampleblock << "# NTRNG 0,1 random number generator\n"; + exampleblock << "# 0 use G96 algorithm (default)\n"; + exampleblock << "# 1 use GSL library\n"; + exampleblock << "# NTGSL -1.. GSL random number generation algorithm\n"; + exampleblock << "# -1: use default algorithm (mt19937)\n"; + exampleblock << "# >=0 : run contrib/rng_gsl for a list of possible arguments\n"; + exampleblock << "#\n"; + exampleblock << "# NTRNG NTGSL\n"; + exampleblock << " 1 -1\n"; + exampleblock << "END\n"; + + + std::string blockname = "RANDOMNUMBERS"; + Block block(blockname, exampleblock.str()); + + if (block.read_buffer(m_block[blockname], false) == 0) { + block_read.insert(blockname); + + int rng; + block.get_next_parameter("NTRNG", rng, "", "0,1"); + block.get_next_parameter("NTGSL", param.rng.gsl_rng, ">=0", "-1"); + + switch (rng) { + case 0: + param.rng.rng = simulation::random_g96; + break; + case 1: + param.rng.rng = simulation::random_gsl; + break; + default: + break; + } - switch (rng) { - case 0: - param.rng.rng = simulation::random_g96; - break; - case 1: - param.rng.rng = simulation::random_gsl; - break; - default: - io::messages.add("RANDOMNUMBERS block: NTRNG must be 0 (G96) " - "or 1 (GSL)", "In_Parameter", io::message::error); + math::RandomGenerator::check(param); + block.get_final_messages(); } - - math::RandomGenerator::check(param); - } -} +} // RANDOMNUMBERS /** * @section EDS EDS block - * @verbatim -EDS -# EDS 0,1 -# 0: no enveloping distribution sampling (EDS) [default] -# 1: enveloping distribution sampling -# ALPHLJ: >= 0.0 Lennard-Jones soft-core parameter -# ALPHC: >= 0.0 Coulomb-RF soft-core parameter -# FORM 1-3 -# 1: Single s Hamiltonian -# 2: Hamiltonian with NUMSTATES*(NUMSTATES-1)/2 (pairwise) s parameters -# 3: Hamiltonian with (NUMSTATES-1) s parameters -# NUMSTATES >1 : number of states -# if NUMSTATES != 3: -# S >0.0: smoothness parameter(s) -# if NUMSTATES == 3: -# i j S : state pair i j and associated s parameter -# EIR : energy offsets for states -# -# EDS - 1 -# SOFT CORE -# ALPHLJ ALPHC - 0.0 0.0 -# FUNCTIONAL FORM - 3 -# NUMSTATES - 3 -# S - 0.2 0.01 0.1 -# EIR - 0 20 40 -END -# example for FORM = 3 -EDS - 1 -# SOFT CORE -# ALPHLJ ALPHC - 0.0 0.0 -# FUNCTIONAL FORM - 3 -# NUMSTATES - 3 -# i j S - 1 2 0.1 - 2 3 0.5 -# EIR - 0 20 40 -END -@endverbatim + * @snippet snippets/snippets.cc EDS + */ void io::In_Parameter::read_EDS(simulation::Parameter & param, - std::ostream & os) { - DEBUG(8, "read EDS"); - - std::vector buffer; - std::string s; - int form; - double soft_lj, soft_crf; - - buffer = m_block["EDS"]; - - if (buffer.size()) { - block_read.insert("EDS"); - - _lineStream.clear(); - _lineStream.str(concatenate(buffer.begin() + 1, buffer.end() - 1, s)); - - int eds; - _lineStream >> eds >> soft_lj >> soft_crf >> form >> param.eds.numstates; - if (_lineStream.fail()) { - io::messages.add("bad line in EDS block", - "In_Parameter", io::message::error); - return; - } - + std::ostream & os) { + DEBUG(8, "reading EDS"); + + std::stringstream exampleblock; + // lines starting with 'exampleblock<<"' and ending with '\n";' (spaces don't matter) + // will be used to generate snippets that can be included in the doxygen doc; + // the first line should be the blockname and is used as snippet tag + exampleblock << "EDS\n"; + exampleblock << "# EDS 0,1\n"; + exampleblock << "# 0: no enveloping distribution sampling (EDS) [default]\n"; + exampleblock << "# 1: enveloping distribution sampling\n"; + exampleblock << "# ALPHLJ: >= 0.0 Lennard-Jones soft-core parameter\n"; + exampleblock << "# ALPHC: >= 0.0 Coulomb-RF soft-core parameter\n"; + exampleblock << "# FORM 1-3\n"; + exampleblock << "# 1: Single s Hamiltonian\n"; + exampleblock << "# 2: Hamiltonian with NUMSTATES*(NUMSTATES-1)/2 (pairwise) S parameters\n"; + exampleblock << "# 3: Hamiltonian with (NUMSTATES-1) S parameters\n"; + exampleblock << "# NUMSTATES >1 : number of states\n"; + exampleblock << "# if NUMSTATES != 3:\n"; + exampleblock << "# S >0.0: smoothness parameter(s)\n"; + exampleblock << "# if NUMSTATES == 3:\n"; + exampleblock << "# i j S : state pair i j and associated s parameter\n"; + exampleblock << "# EIR : energy offsets for states\n"; + exampleblock << "#\n"; + exampleblock << "# EDS\n"; + exampleblock << " 1\n"; + exampleblock << "# ALPHLJ ALPHC FORM NUMSTATES\n"; + exampleblock << " 0.0 0.0 2 3\n"; + exampleblock << "# S\n"; + exampleblock << " 0.2 0.01 0.1\n"; + exampleblock << "# EIR\n"; + exampleblock << " 0 20 40\n"; + exampleblock << "#\n"; + exampleblock << "# ---- OR: example for FORM = 3:\n"; + exampleblock << "#\n"; + exampleblock << "# EDS\n"; + exampleblock << " 1\n"; + exampleblock << "# ALPHLJ ALPHC FORM NUMSTATES\n"; + exampleblock << " 0.0 0.0 3 3\n"; + exampleblock << "# i j S\n"; + exampleblock << " 1 2 0.1\n"; + exampleblock << " 2 3 0.5\n"; + exampleblock << "# EIR\n"; + exampleblock << " 0 20 40\n"; + exampleblock << "END\n"; + + + std::string blockname = "EDS"; + Block block(blockname, exampleblock.str()); + + if (block.read_buffer(m_block[blockname], false) == 0) { + block_read.insert(blockname); + + int eds, form; + double soft_lj, soft_crf; + block.get_next_parameter("EDS", eds, "", "0,1"); + block.get_next_parameter("ALPHLJ", soft_lj, ">=0", ""); + block.get_next_parameter("ALPHC", soft_crf, ">=0", ""); + block.get_next_parameter("FORM", form, "", "1,2,3"); + block.get_next_parameter("NUMSTATES", param.eds.numstates, ">=2", ""); + + switch (eds) { + case 0: + param.eds.eds = false; + param.eds.numstates = 0; + break; + case 1: + param.eds.eds = true; + break; + default: + break; + } - switch (eds) { - case 0: - param.eds.eds = false; - param.eds.numstates = 0; - break; - case 1: - param.eds.eds = true; - break; - default: - io::messages.add("Error in EDS block: EDS must be 0 (no EDS) " - "or 1 (EDS)", "In_Parameter", io::message::error); - } - if (param.eds.eds) { - if (param.eds.soft_vdw < 0.0) { - io::messages.add("EDS block: ALPHLJ must be >= 0.", - "In_Parameter", io::message::error); - } - - if (param.eds.soft_crf < 0.0) { - io::messages.add("EDS block: ALPHC must be >= 0.", - "In_Parameter", io::message::error); - } - param.eds.soft_vdw = soft_lj; - param.eds.soft_crf = soft_crf; - if (soft_lj > 0.0 || soft_crf > 0.0) - param.setDevelop("Soft-core EDS is under development."); - - switch (form) { - case 1: { - param.eds.form = simulation::single_s; - // read in 1 s value - param.eds.s.resize(1, 1.0); - _lineStream >> param.eds.s[0]; - //std::cerr << " s[0] = " << param.eds.s[0] << std::endl; - if (param.eds.s[0] <= 0) { - io::messages.add("Error in EDS block: S must be >0", - "In_Parameter", io::message::error); - } - break; + if (!param.eds.eds) { + block.get_final_messages(); + return; } - case 2: { - param.eds.form = simulation::multi_s; - const unsigned int n = param.eds.numstates; - param.eds.s.resize((n * (n - 1)) / 2, 1.0); - for (unsigned int pair = 0; pair < param.eds.s.size(); pair++) { - _lineStream >> param.eds.s[pair]; - if (param.eds.s[pair] <= 0) { - io::messages.add("Error in EDS block: S must be >0", - "In_Parameter", io::message::error); + + param.eds.soft_vdw = soft_lj; + param.eds.soft_crf = soft_crf; + if (soft_lj > 0.0 || soft_crf > 0.0) + param.setDevelop("Soft-core EDS is under development."); + + switch (form) { + case 1: { + param.eds.form = simulation::single_s; + // read in 1 S value + param.eds.s.resize(1, 1.0); + block.get_next_parameter("S[0]", param.eds.s[0], ">0", ""); + break; } - } - break; - } - case 3: { - param.eds.form = simulation::pair_s; - const unsigned int n = param.eds.numstates; - param.eds.s.resize(n - 1, 1.0); - param.eds.pairs.resize(n - 1); - for (unsigned int pair = 0; pair < param.eds.s.size(); pair++) { - _lineStream >> param.eds.pairs[pair].i - >> param.eds.pairs[pair].j - >> param.eds.s[pair]; - if (param.eds.s[pair] <= 0) { - io::messages.add("Error in EDS block: S must be >0", - "In_Parameter", io::message::error); + case 2: { + param.eds.form = simulation::multi_s; + const unsigned int n = param.eds.numstates; + param.eds.s.resize((n * (n - 1)) / 2, 1.0); + for (unsigned int pair = 0; pair < param.eds.s.size(); pair++) { + std::string idx = io::to_string(pair); + block.get_next_parameter("S["+idx+"]", param.eds.s[pair], ">0", ""); + } + break; } - } - break; + case 3: { + param.eds.form = simulation::pair_s; + const unsigned int n = param.eds.numstates; + param.eds.s.resize(n - 1, 1.0); + param.eds.pairs.resize(n - 1); + for (unsigned int pair = 0; pair < param.eds.s.size(); pair++) { + std::string idx = io::to_string(pair); + block.get_next_parameter("i["+idx+"]", param.eds.pairs[pair].i, "", ""); + block.get_next_parameter("j["+idx+"]", param.eds.pairs[pair].j, "", ""); + block.get_next_parameter("S["+idx+"]", param.eds.s[pair], ">0", ""); + } + break; + } + default: + break; } - default: - io::messages.add("Error in EDS block: functional form must be 1 (single s) " - "or 2 (multiple s)", "In_Parameter", io::message::error); - } - if (_lineStream.fail()) { - io::messages.add("Error when reading S from EDS block", - "In_Parameter", io::message::error); - return; - } - - param.eds.eir.resize(param.eds.numstates, 0.0); - for (unsigned int i = 0; i < param.eds.numstates; i++) { - _lineStream >> param.eds.eir[i]; - //std::cerr << "eir = " << param.eds.eir[i] << std::endl; - } - if (_lineStream.fail()) { - io::messages.add("Error when reading EIR from EDS block", - "In_Parameter", io::message::error); - return; - } - - if (param.eds.numstates < 2) { - io::messages.add("Error in EDS block: NUMSTATES must be >=1.", - "In_Parameter", io::message::error); - } - // make sure we simulate at a given temperature (unambiguous kT) - if (!param.multibath.couple) { - io::messages.add("Error in EDS block: EDS requires temperature coupling.", - "In_Parameter", io::message::error); - } - // check whether all baths have the same temperature (unambiguous kT) - for (unsigned int i = 1; i < param.multibath.multibath.size(); i++) { - if (param.multibath.multibath.bath(i).temperature != - param.multibath.multibath.bath(0).temperature) { - io::messages.add("Error in EDS block: all baths must have the same temperature.", - "In_Parameter", io::message::error); + + param.eds.eir.resize(param.eds.numstates, 0.0); + for (unsigned int i = 0; i < param.eds.numstates; i++) { + std::string idx = io::to_string(i); + block.get_next_parameter("EIR["+idx+"]", param.eds.eir[i], "", ""); } - } + + block.get_final_messages(); } - //std::cerr << "eds (at end) = " << eds << ", form = " << form << ", numstates=" << param.eds.numstates; - } } /** * @section LAMBDAS LAMBDAS block - * @verbatim -LAMBDAS -# NTIL off(0), on(1) -# 0: no special treatment of interactions with individual lambda-values -# 1: interactions are treated with special individual lambda-values -# NTLI(1..) interaction type to treat with individual lambda: -# bond(1), angle(2), dihedral(3), improper(4), vdw(5), vdw_soft(6), -# crf(7), crf_soft(8), distanceres(9), distancefield(10), -# dihedralres(11), mass(12) -# NILG1, NILG2 energy groups of interactions that are treated with individual -# lambda values -# ALI, BLI, CLI, DLI, ELI polynomial coefficients linking the individual lambda- -# values to the overall lambda-value -# NTIL - 1 -# NTLI - 7 -# NILG1 NILG2 - 1 3 -END -@endverbatim + * @snippet snippets/snippets.cc LAMBDAS */ void io::In_Parameter::read_LAMBDAS(simulation::Parameter & param, - std::ostream & os) { - DEBUG(8, "read LAMBDAS"); - - std::vector buffer; - std::string s; - - buffer = m_block["LAMBDAS"]; - - if (buffer.size()) { - - block_read.insert("LAMBDAS"); - - int num = buffer.size() - 3; - _lineStream.clear(); - _lineStream.str(concatenate(buffer.begin() + 1, buffer.end() - 1, s)); + std::ostream & os) { + DEBUG(8, "reading LAMBDAS"); + + std::stringstream exampleblock; + // lines starting with 'exampleblock<<"' and ending with '\n";' (spaces don't matter) + // will be used to generate snippets that can be included in the doxygen doc; + // the first line is the tag + exampleblock << "LAMBDAS\n"; + exampleblock << "# NTIL off(0), on(1)\n"; + exampleblock << "# 0: no special treatment of interactions with individual lambda-values\n"; + exampleblock << "# 1: interactions are treated with special individual lambda-values\n"; + exampleblock << "# NTLI(1..) interaction type to treat with individual lambda:\n"; + exampleblock << "# bond(1), angle(2), dihedral(3), improper(4), vdw(5), vdw_soft(6),\n"; + exampleblock << "# crf(7), crf_soft(8), distanceres(9), distancefield(10),\n"; + exampleblock << "# dihedralres(11), mass(12)\n"; + exampleblock << "# NILG1, NILG2 energy groups of interactions that are treated with individual\n"; + exampleblock << "# lambda values\n"; + exampleblock << "# ALI, BLI, CLI, DLI, ELI polynomial coefficients linking the individual lambda-\n"; + exampleblock << "# values to the overall lambda-value\n"; + exampleblock << "# NTIL\n"; + exampleblock << " 1\n"; + exampleblock << "# NTLI NILG1 NILG2 ALI BLI CLI DLI ELI\n"; + exampleblock << " 7 1 3 0 0 1 0 0\n"; + exampleblock << "END\n"; + + + std::string blockname = "LAMBDAS"; + Block block(blockname, exampleblock.str()); + + if (block.read_buffer(m_block[blockname], false) == 0) { + block_read.insert(blockname); + + int num = block.numlines()-3; + + std::string nm; + simulation::interaction_lambda_enum j; + int n1, n2; + double a, b, c, d, e; + block.get_next_parameter("NTIL", nm, "", "on,off,1,0"); + DEBUG(10, "read NTIL " << nm); + + if (nm == "on" || nm == "1") + param.lambdas.individual_lambdas = true; + else if (nm == "off" || nm == "0") { + param.lambdas.individual_lambdas = false; + return; + } - std::string nm; - simulation::interaction_lambda_enum j; - int n1, n2; - double a, b, c, d, e; - _lineStream >> nm; - DEBUG(10, "read NTIL " << nm); + if (param.perturbation.perturbation == false) { + io::messages.add("LAMBDAS block without perturbation is ignored", + "In_Parameter", io::message::warning); + return; + } - if (nm == "on" || nm == "1") - param.lambdas.individual_lambdas = true; - else if (nm == "off" || nm == "0") { - param.lambdas.individual_lambdas = false; - return; - } else { - io::messages.add("illegal value for NTIL in LAMBDAS block (on,off,1,0)", - "In_Parameter", io::message::error); - return; - } + // the full matrices for the energy groups were created and + // filled with a, b, c, e = 0 and d=1 when the FORCE block was read in + // that way, they are also defined if you do not give the LAMBDAS block + // we cannot initialize them earlier, because they depend on the + // energy groups + + int maxnilg = param.force.energy_group.size(); + for (int i = 0; i < num; ++i) { + std::string idx = io::to_string(i); + block.get_next_parameter("NTLI["+idx+"]", nm, "", "1, bond, 2, angle, 3, dihedral, 4, improper, 5, vdw, 6, vdw_soft, 7, crf, 8, crf_soft, 9, distanceres, 10, distancefield, 11, dihedralres, 12, mass"); + block.get_next_parameter("NILG1["+idx+"]", n1, ">0", ""); + block.get_next_parameter("NILG2["+idx+"]", n2, ">0", ""); + block.get_next_parameter("ALI["+idx+"]", a, "", ""); + block.get_next_parameter("BLI["+idx+"]", b, "", ""); + block.get_next_parameter("CLI["+idx+"]", c, "", ""); + block.get_next_parameter("DLI["+idx+"]", d, "", ""); + block.get_next_parameter("ELI["+idx+"]", e, "", ""); + DEBUG(10, "read : " << nm << n1 << n2 << a << b << c << d << e); + + if (n1 > maxnilg || n2 > maxnilg) { + io::messages.add("LAMBDAS block: NILG1 and NILG2 need to be smaller than the number of energy groups", + "In_Parameter", io::message::error); + return; + } - if (param.perturbation.perturbation == false) - io::messages.add("LAMBDAS block without perturbation is ignored", - "In_Parameter", io::message::warning); + if (n2 < n1) { + io::messages.add("only give NILG2 >= NILG1 in LAMBDAS BLOCK", + "In_Parameter", io::message::error); + } - // the full matrices for the energy groups were created and - // filled with a, b, c, e = 0 and d=1 when the FORCE block was read in - // that way, they are also defined if you do not give the LAMBDAS block - // we cannot initialize them earlier, because they depend on the - // energy groups + if (block.error()){ + block.get_final_messages(); + return; + } - int maxnilg = param.force.energy_group.size(); - for (int i = 0; i < num; ++i) { - _lineStream >> nm >> n1 >> n2 >> a >> b >> c >> d >> e; - DEBUG(10, "read : " << nm << n1 << n2 << a << b << c << d << e); + n1--; + n2--; + + if (nm == "bond" || nm == "1") + j = simulation::bond_lambda; + else if (nm == "angle" || nm == "2") + j = simulation::angle_lambda; + else if (nm == "dihedral" || nm == "3") + j = simulation::dihedral_lambda; + else if (nm == "improper" || nm == "4") + j = simulation::improper_lambda; + else if (nm == "vdw" || nm == "5") + j = simulation::lj_lambda; + else if (nm == "vdw_soft" || nm == "6") + j = simulation::lj_softness_lambda; + else if (nm == "crf" || nm == "7") + j = simulation::crf_lambda; + else if (nm == "crf_soft" || nm == "8") + j = simulation::crf_softness_lambda; + else if (nm == "distanceres" || nm == "9") + j = simulation::disres_lambda; + else if (nm == "distancefield" || nm == "10") + j = simulation::disfield_lambda; + else if (nm == "dihedralres" || nm == "11") + j = simulation::dihres_lambda; + else if (nm == "mass" || nm == "12") + j = simulation::mass_lambda; + else { + io::messages.add("unknown lambda type in LAMBDAS block: " + nm, + "In_Parameter", io::message::error); + return; + } - if (_lineStream.fail()) { - io::messages.add("bad line in LAMBDAS block" + s, - "In_Parameter", io::message::error); - return; - } - if (n2 < n1) { - io::messages.add("only give NILG2 >= NILG1 in LAMBDAS BLOCK", - "In_Parameter", io::message::error); - return; - } - if (n1 > maxnilg) { - io::messages.add("NILG1 larger than number of energy groups in FORCE block", - "In_Parameter", io::message::error); - return; - } - if (n2 > maxnilg) { - io::messages.add("NILG2 larger than number of energy groups in FORCE block", - "In_Parameter", io::message::error); - return; - } - n1--; - n2--; - - if (nm == "bond" || nm == "1") - j = simulation::bond_lambda; - else if (nm == "angle" || nm == "2") - j = simulation::angle_lambda; - else if (nm == "dihedral" || nm == "3") - j = simulation::dihedral_lambda; - else if (nm == "improper" || nm == "4") - j = simulation::improper_lambda; - else if (nm == "vdw" || nm == "5") - j = simulation::lj_lambda; - else if (nm == "vdw_soft" || nm == "6") - j = simulation::lj_softness_lambda; - else if (nm == "crf" || nm == "7") - j = simulation::crf_lambda; - else if (nm == "crf_soft" || nm == "8") - j = simulation::crf_softness_lambda; - else if (nm == "distanceres" || nm == "9") - j = simulation::disres_lambda; - else if (nm == "distancefield" || nm == "10") - j = simulation::disfield_lambda; - else if (nm == "dihedralres" || nm == "11") - j = simulation::dihres_lambda; - else if (nm == "mass" || nm == "12") - j = simulation::mass_lambda; - else { - io::messages.add("unknown lambda type in LAMBDAS block: " + nm, - "In_Parameter", io::message::error); - return; - } - - // and now replace the matrix with the numbers we just read in - if (j != simulation::lj_lambda && - j != simulation::lj_softness_lambda && - j != simulation::crf_lambda && - j != simulation::crf_softness_lambda && - n1 != n2) - io::messages.add("NILG1 != NILG2 in LAMBDAS block only allowed for nonbonded interactions", - "In_Parameter", io::message::warning); - - param.lambdas.a[j][n1][n2] = a; - param.lambdas.a[j][n2][n1] = a; - param.lambdas.b[j][n1][n2] = b; - param.lambdas.b[j][n2][n1] = b; - param.lambdas.c[j][n1][n2] = c; - param.lambdas.c[j][n2][n1] = c; - param.lambdas.d[j][n1][n2] = d; - param.lambdas.d[j][n2][n1] = d; - param.lambdas.e[j][n1][n2] = e; - param.lambdas.e[j][n2][n1] = e; + // and now replace the matrix with the numbers we just read in + if (j != simulation::lj_lambda && + j != simulation::lj_softness_lambda && + j != simulation::crf_lambda && + j != simulation::crf_softness_lambda && + n1 != n2) + io::messages.add("NILG1 != NILG2 in LAMBDAS block only allowed for nonbonded interactions", + "In_Parameter", io::message::warning); + + param.lambdas.a[j][n1][n2] = a; + param.lambdas.a[j][n2][n1] = a; + param.lambdas.b[j][n1][n2] = b; + param.lambdas.b[j][n2][n1] = b; + param.lambdas.c[j][n1][n2] = c; + param.lambdas.c[j][n2][n1] = c; + param.lambdas.d[j][n1][n2] = d; + param.lambdas.d[j][n2][n1] = d; + param.lambdas.e[j][n1][n2] = e; + param.lambdas.e[j][n2][n1] = e; + } + block.get_final_messages(); } - } } /** * @section precalclam PRECALCLAM block - * @verbatim -PRECALCLAM -# NRLAM 0 : off -# >1 : precalculating energies for NRLAM extra lambda values -# MINLAM between 0 and 1: minimum lambda value to precalculate energies -# MAXLAM between MINLAM and 1: maximum lambda value to precalculate energies -# NRLAM MINLAM MAXLAM - 100 0.0 1.0 -END -@endverbatim + * @snippet snippets/snippets.cc PRECALCLAM */ void io::In_Parameter::read_PRECALCLAM(simulation::Parameter & param, std::ostream & os) { - DEBUG(8, "read PRECALCLAM"); - std::vector buffer; - std::string s; - - buffer = m_block["PRECALCLAM"]; - - if (buffer.size()) { - - block_read.insert("PRECALCLAM"); - - _lineStream.clear(); - _lineStream.str(concatenate(buffer.begin() + 1, buffer.end() - 1, s)); - -// TODO: make sure that nr_lambdas is an integer - _lineStream >> param.precalclam.nr_lambdas - >> param.precalclam.min_lam - >> param.precalclam.max_lam; - - if (_lineStream.fail()) - io::messages.add("bad line in PRECALCLAM block", "In_Parameter", io::message::error); - - if (param.precalclam.nr_lambdas < 0 ) - io::messages.add("PRECALCLAM block: Negative nr of lambdas is not allowed", - "In_Parameter", io::message::error); - if (param.precalclam.min_lam >= param.precalclam.max_lam) - io::messages.add("PRECALCLAM block: MINLAM should be smaller than MAXLAM", - "In_Parameter", io::message::error); - if (param.perturbation.perturbation == false && param.precalclam.nr_lambdas > 0) - io::messages.add("PRECALCLAM cannot be on without perturbation", - "In_Parameter", io::message::error); - if (param.write.energy == 0 || param.write.free_energy ==0 || - param.write.energy != param.write.free_energy) - io::messages.add("PRECALCLAM requires NTWE=NTWG > 0", + DEBUG(8, "read PRECALCLAM"); + + std::stringstream exampleblock; + // lines starting with 'exampleblock<<"' and ending with '\n";' (spaces don't matter) + // will be used to generate snippets that can be included in the doxygen doc; + // the first line is the tag + exampleblock << "PRECALCLAM\n"; + exampleblock << "# NRLAM 0 : off\n"; + exampleblock << "# >1 : precalculating energies for NRLAM extra lambda values\n"; + exampleblock << "# MINLAM between 0 and 1: minimum lambda value to precalculate energies\n"; + exampleblock << "# MAXLAM between MINLAM and 1: maximum lambda value to precalculate energies\n"; + exampleblock << "# NRLAM MINLAM MAXLAM\n"; + exampleblock << " 100 0.0 1.0\n"; + exampleblock << "END\n"; + + std::string blockname = "PRECALCLAM"; + Block block(blockname, exampleblock.str()); + + if (block.read_buffer(m_block[blockname], false) == 0) { + block_read.insert(blockname); + + block.get_next_parameter("NRLAM", param.precalclam.nr_lambdas, ">=0", ""); + block.get_next_parameter("MINLAM", param.precalclam.min_lam, ">=0 && <=1", ""); + block.get_next_parameter("MAXLAM", param.precalclam.max_lam, ">=0 && <=1", ""); + + if (param.precalclam.min_lam >= param.precalclam.max_lam) + io::messages.add("PRECALCLAM block: MINLAM should be smaller than MAXLAM", "In_Parameter", io::message::error); + + block.get_final_messages(); + } -} //ANITA +} // PRECALCLAM /** * @section nonbonded NONBONDED block - * @verbatim -NONBONDED -# NLRELE 1-3 method to handle electrostatic interactions -# 1 : reaction-field -# 2 : Ewald method -# 3 : P3M method -# APPAK >= 0.0 reaction-field inverse Debye screening length -# RCRF >= 0.0 reaction-field radius -# 0.0 : set to infinity -# EPSRF = 0.0 || > 1.0 reaction-field permittivity -# 0.0 : set to infinity -# NSLFEXCL 0,1 contribution of excluded atoms to reaction field - 0 : contribution turned off - 1 : contribution considered (default) -# NSHAPE -1..10 lattice sum charge-shaping function -# -1 : gaussian -# 0..10 : polynomial -# ASHAPE > 0.0 width of the lattice sum charge-shaping function -# NA2CALC 0,2 controls evaluation of lattice sum A2 term -# 0 : set to zero -# 2 : numerical -# TOLA2 > 0.0 tolerance for numerical A2 evaluation -# EPSLS = 0.0 || > 1.0 lattice sum permittivity (0.0 = tinfoil) -# NKX, NKY, NKZ > 0 maximum absolute Ewald k-vector components -# KCUT > 0.0 Ewald k-space cutoff -# NGX, NGY, NGZ > 0 P3M number of grid points -# NASORD 1..5 order of mesh charge assignment function -# NFDORD 0..5 order of the mesh finite difference operator -# 0 : ik - differentiation -# 1..5 : finite differentiation -# NALIAS > 0 number of mesh alias vectors considered -# NSPORD order of SPME B-spline functions (ignored! promd specific) -# NQEVAL >= 0 controls accuracy reevaluation -# 0 : do not reevaluate -# > 0 : evaluate every NQEVAL steps -# FACCUR >= 0.0 rms force error threshold to recompute influence function -# NRDGRD 0,1 read influence function -# 0 : calculate influence function at simulation start up -# 1 : read influence function from file (not yet implemented) -# NWRGRD 0,1 write influence function -# 0 : do not write -# 1 : write at the end of the simulation (not yet implemented) -# NLRLJ 0,1 controls long-range Lennard-Jones corrections -# 0 : no corrections -# 1 : do corrections (not yet implemented) -# SLVDNS > 0.0 average solvent density for long-range LJ correction (ignored) -# -# NLRELE - 1 -# APPAK RCRF EPSRF NSLFEXCL - 0.0 1.4 61.0 1 -# NSHAPE ASHAPE NA2CLC TOLA2 EPSLS - -1 1.4 2 0.1E-9 0.0 -# NKX NKY NKZ KCUT - 10 10 10 100.0 -# NGX NGY NGZ NASORD NFDORD NALIAS NSPORD - 32 32 32 3 2 3 4 -# NQEVAL FACCUR NRDGRD NWRGDR - 100000 1.6 0 0 -# NLRLJ SLVDNS - 0 33.3 -END -@endverbatim + * @snippet snippets/snippets.cc NONBONDED */ void io::In_Parameter::read_NONBONDED(simulation::Parameter & param, - std::ostream & os) { - DEBUG(8, "read NONBONDED"); - - std::vector buffer; - std::string s; - - buffer = m_block["NONBONDED"]; - - if (buffer.size()) { - block_read.insert("NONBONDED"); - _lineStream.clear(); - _lineStream.str(concatenate(buffer.begin() + 1, buffer.end() - 1, s)); - int method; - int ls_calculate_a2; - _lineStream >> method >> - param.nonbonded.rf_kappa >> param.nonbonded.rf_cutoff >> param.nonbonded.rf_epsilon >> - param.nonbonded.selfterm_excluded_atoms >> - param.nonbonded.ls_charge_shape >> param.nonbonded.ls_charge_shape_width >> - ls_calculate_a2 >> param.nonbonded.ls_a2_tolerance >> - param.nonbonded.ls_epsilon >> - param.nonbonded.ewald_max_k_x >> param.nonbonded.ewald_max_k_y >> - param.nonbonded.ewald_max_k_z >> param.nonbonded.ewald_kspace_cutoff >> - param.nonbonded.p3m_grid_points_x >> param.nonbonded.p3m_grid_points_y >> - param.nonbonded.p3m_grid_points_z >> param.nonbonded.p3m_charge_assignment >> - param.nonbonded.p3m_finite_differences_operator >> param.nonbonded.p3m_mesh_alias >> - param.nonbonded.spme_bspline >> - param.nonbonded.accuracy_evaluation >> param.nonbonded.influence_function_rms_force_error >> - param.nonbonded.influence_function_read >> param.nonbonded.influence_function_write >> - param.nonbonded.lj_correction >> param.nonbonded.lj_solvent_density; - - if (_lineStream.fail()) { - io::messages.add("bad line in NONBONDED block", - "In_Parameter", io::message::error); - } - bool do_ls = false; - switch (method) { - case 0: - param.force.nonbonded_crf = 0; - break; - case 1: - param.nonbonded.method = simulation::el_reaction_field; - param.nonbonded.lserf = false; - break; - case -1: - param.nonbonded.method = simulation::el_reaction_field; - param.nonbonded.lserf = false; - break; - case 2: - param.nonbonded.method = simulation::el_ewald; - param.setDevelop("Ewald sum is under development"); - param.nonbonded.lserf = false; - param.nonbonded.rf_excluded = false; - do_ls = true; - break; - case 3: - param.nonbonded.method = simulation::el_p3m; - param.nonbonded.lserf = false; - param.nonbonded.rf_excluded = false; - do_ls = true; - break; - default: - io::messages.add("NONBONDED block: electrostatic method not implemented", - "In_Parameter", io::message::error); - } - - if (param.nonbonded.selfterm_excluded_atoms < 0 || param.nonbonded.selfterm_excluded_atoms > 1) - io::messages.add("NONBONDED block: Illegal value for NSLFEXCL (1,0)", - "In_Parameter", io::message::error); - - // switch to turn of the contribution of the excluded atoms to the reaction field - if (param.nonbonded.method == simulation::el_reaction_field - && param.nonbonded.selfterm_excluded_atoms == 0) { - param.nonbonded.rf_excluded = false; - io::messages.add("NONBONDED block: contribution of excluded atoms to the reaction field turned off!", - "In_Parameter", io::message::warning); - } - - if (param.nonbonded.method != simulation::el_reaction_field) - param.force.interaction_function = simulation::lj_ls_func; - - if (param.nonbonded.rf_kappa < 0) - io::messages.add("NONBONDED block: Illegal value for APPAK (>=0)", - "In_Parameter", io::message::error); - - if (param.nonbonded.rf_cutoff < 0) - io::messages.add("NONBONDED block: Illegal value for RCRF (>=0.0)", - "In_Parameter", io::message::error); - - if (param.nonbonded.rf_epsilon != 0.0 && param.nonbonded.rf_epsilon < 1.0) - io::messages.add("NONBONDED block: Illegal value for EPSRF (0.0 / >=1.0)", - "In_Parameter", io::message::error); - - if (param.nonbonded.ls_charge_shape < -1 || - param.nonbonded.ls_charge_shape > 10) - io::messages.add("NONBONDED block: Illegal value for NSHAPE (-1..10)", - "In_Parameter", io::message::error); - - if (param.nonbonded.ls_charge_shape_width <= 0.0) - io::messages.add("NONBONDED block: Illegal value for ASHAPE (>0.0)", - "In_Parameter", io::message::error); - - if (do_ls && param.nonbonded.ls_charge_shape_width > param.pairlist.cutoff_short && - fabs(param.nonbonded.ls_charge_shape_width - param.pairlist.cutoff_short) > math::epsilon) - io::messages.add("NONBONDED block: charge width greater than cutoff! (ASHAPE > RCUTP)", - "In_Parameter", io::message::warning); - - - switch (ls_calculate_a2) { - case 0: - param.nonbonded.ls_calculate_a2 = simulation::ls_a2_zero; - break; - case 1: - param.nonbonded.ls_calculate_a2 = simulation::ls_a2t_exact; - break; - case 2: - param.nonbonded.ls_calculate_a2 = simulation::ls_a2_numerical; - break; - case 3: - param.nonbonded.ls_calculate_a2 = simulation::ls_a2t_exact_a2_numerical; - break; - case 4: - param.nonbonded.ls_calculate_a2 = simulation::ls_a2t_exact_a2_numerical; - if (param.nonbonded.method != simulation::el_p3m) { - io::messages.add("NONBONDED block: averaged A2~ calculation needs P3M.", - "In_Parameter", io::message::error); + std::ostream & os) { + DEBUG(8, "reading NONBONDED"); + + std::stringstream exampleblock; + // lines starting with 'exampleblock<<"' and ending with '\n";' (spaces don't matter) + // will be used to generate snippets that can be included in the doxygen doc; + // the first line is the tag + exampleblock << "NONBONDED\n"; + exampleblock << "# NLRELE 1-3 method to handle electrostatic interactions\n"; + exampleblock << "# -1 : reaction-field (LSERF compatibility mode)\n"; + exampleblock << "# 0 : no electrostatic interactions\n"; + exampleblock << "# 1 : reaction-field\n"; + exampleblock << "# 2 : Ewald method\n"; + exampleblock << "# 3 : P3M method\n"; + exampleblock << "# APPAK >= 0.0 reaction-field inverse Debye screening length\n"; + exampleblock << "# RCRF >= 0.0 reaction-field radius\n"; + exampleblock << "# 0.0 : set to infinity\n"; + exampleblock << "# EPSRF = 0.0 || > 1.0 reaction-field permittivity\n"; + exampleblock << "# 0.0 : set to infinity\n"; + exampleblock << "# NSLFEXCL 0,1 contribution of excluded atoms to reaction field\n"; + exampleblock << "# 0 : contribution turned off\n"; + exampleblock << "# 1 : contribution considered (default)\n"; + exampleblock << "# NSHAPE -1..10 lattice sum charge-shaping function\n"; + exampleblock << "# -1 : gaussian\n"; + exampleblock << "# 0..10 : polynomial\n"; + exampleblock << "# ASHAPE > 0.0 width of the lattice sum charge-shaping function\n"; + exampleblock << "# NA2CALC 0..4 controls evaluation of lattice sum A2 term\n"; + exampleblock << "# 0 : A2 = A2~ = 0\n"; + exampleblock << "# 1 : A2~ exact, A2 = A2~\n"; + exampleblock << "# 2 : A2 numerical, A2~ = A2\n"; + exampleblock << "# 3 : A2~ exact from Ewald or from mesh and atom coords, A2 numerical\n"; + exampleblock << "# 4 : A2~ averaged from mesh only, A2 numerical\n"; + exampleblock << "# TOLA2 > 0.0 tolerance for numerical A2 evaluation\n"; + exampleblock << "# EPSLS = 0.0 || > 1.0 lattice sum permittivity (0.0 = tinfoil)\n"; + exampleblock << "# NKX, NKY, NKZ > 0 maximum absolute Ewald k-vector components\n"; + exampleblock << "# KCUT > 0.0 Ewald k-space cutoff\n"; + exampleblock << "# NGX, NGY, NGZ > 0 P3M number of grid points\n"; + exampleblock << "# NASORD 1..5 order of mesh charge assignment function\n"; + exampleblock << "# NFDORD 0..5 order of the mesh finite difference operator\n"; + exampleblock << "# 0 : ik - differentiation\n"; + exampleblock << "# 1..5 : finite differentiation\n"; + exampleblock << "# NALIAS > 0 number of mesh alias vectors considered\n"; + exampleblock << "# NSPORD order of SPME B-spline functions (not available)\n"; + exampleblock << "# NQEVAL >= 0 controls accuracy reevaluation\n"; + exampleblock << "# 0 : do not reevaluate\n"; + exampleblock << "# > 0 : evaluate every NQEVAL steps\n"; + exampleblock << "# FACCUR > 0.0 rms force error threshold to recompute influence function\n"; + exampleblock << "# NRDGRD 0,1 read influence function\n"; + exampleblock << "# 0 : calculate influence function at simulation start up\n"; + exampleblock << "# 1 : read influence function from file (not yet implemented)\n"; + exampleblock << "# NWRGRD 0,1 write influence function\n"; + exampleblock << "# 0 : do not write\n"; + exampleblock << "# 1 : write at the end of the simulation (not yet implemented)\n"; + exampleblock << "# NLRLJ 0,1 controls long-range Lennard-Jones corrections\n"; + exampleblock << "# 0 : no corrections\n"; + exampleblock << "# 1 : do corrections (not yet implemented)\n"; + exampleblock << "# SLVDNS > 0.0 average solvent density for long-range LJ correction (ignored)\n"; + exampleblock << "#\n"; + exampleblock << "# NLRELE\n"; + exampleblock << " 1\n"; + exampleblock << "# APPAK RCRF EPSRF NSLFEXCL\n"; + exampleblock << " 0.0 1.4 61.0 1\n"; + exampleblock << "# NSHAPE ASHAPE NA2CLC TOLA2 EPSLS\n"; + exampleblock << " -1 1.4 2 0.1E-9 0.0\n"; + exampleblock << "# NKX NKY NKZ KCUT\n"; + exampleblock << " 10 10 10 100.0\n"; + exampleblock << "# NGX NGY NGZ NASORD NFDORD NALIAS NSPORD\n"; + exampleblock << " 32 32 32 3 2 3 4\n"; + exampleblock << "# NQEVAL FACCUR NRDGRD NWRGDR\n"; + exampleblock << " 100000 1.6 0 0\n"; + exampleblock << "# NLRLJ SLVDNS\n"; + exampleblock << " 0 33.3\n"; + exampleblock << "END\n"; + + + std::string blockname = "NONBONDED"; + Block block(blockname, exampleblock.str()); + + if (block.read_buffer(m_block[blockname], true) == 0) { + block_read.insert(blockname); + + int method, ls_calculate_a2; + + block.get_next_parameter("NLRELE", method, "", "-1,0,1,2,3"); + block.get_next_parameter("APPAK", param.nonbonded.rf_kappa, ">=0", ""); + block.get_next_parameter("RCRF", param.nonbonded.rf_cutoff, ">=0", ""); + block.get_next_parameter("EPSRF", param.nonbonded.rf_epsilon, ">=1", "0.0"); + block.get_next_parameter("NSLFEXCL", param.nonbonded.selfterm_excluded_atoms, "", "0,1"); + block.get_next_parameter("NSHAPE", param.nonbonded.ls_charge_shape, ">=-1 && <=10", ""); + block.get_next_parameter("ASHAPE", param.nonbonded.ls_charge_shape_width, ">0", ""); + block.get_next_parameter("NA2CLC", ls_calculate_a2, "", "0,1,2,3,4"); + block.get_next_parameter("TOLA2", param.nonbonded.ls_a2_tolerance, ">0.0", ""); + block.get_next_parameter("EPSLS", param.nonbonded.ls_epsilon, ">=1.0", "0.0"); + block.get_next_parameter("NKX", param.nonbonded.ewald_max_k_x, ">0", ""); + block.get_next_parameter("NKY", param.nonbonded.ewald_max_k_y, ">0", ""); + block.get_next_parameter("NKZ", param.nonbonded.ewald_max_k_z, ">0", ""); + block.get_next_parameter("KCUT", param.nonbonded.ewald_kspace_cutoff, ">0.0", ""); + block.get_next_parameter("NGX", param.nonbonded.p3m_grid_points_x, ">0", ""); + block.get_next_parameter("NGY", param.nonbonded.p3m_grid_points_y, ">0", ""); + block.get_next_parameter("NGZ", param.nonbonded.p3m_grid_points_z, ">0", ""); + block.get_next_parameter("NASORD", param.nonbonded.p3m_charge_assignment, "", "1,2,3,4,5"); + block.get_next_parameter("NFDORD", param.nonbonded.p3m_finite_differences_operator, "", "0,1,2,3,4,5"); + block.get_next_parameter("NALIAS", param.nonbonded.p3m_mesh_alias, ">0", ""); + block.get_next_parameter("NSPORD", param.nonbonded.spme_bspline, "", ""); + block.get_next_parameter("NQEVAL", param.nonbonded.accuracy_evaluation, ">=0", ""); + block.get_next_parameter("FACCUR", param.nonbonded.influence_function_rms_force_error, ">0.0", ""); + block.get_next_parameter("NRDGRD", param.nonbonded.influence_function_read, "", "0,1"); + block.get_next_parameter("NWRGRD", param.nonbonded.influence_function_write, "", "0,1"); + block.get_next_parameter("NLRLJ", param.nonbonded.lj_correction, "", "0,1"); + block.get_next_parameter("SLVDNS", param.nonbonded.lj_solvent_density, ">0.0", ""); + + if (block.error()) { + block.get_final_messages(); + return; } - break; - default: - io::messages.add("NONBONDED block: A2 calculation method not implemented", - "In_Parameter", io::message::error); - } - - if (param.nonbonded.ls_epsilon != 0.0 && param.nonbonded.ls_epsilon < 1.0) - io::messages.add("NONBONDED block: Illegal value for EPSLS (0.0 / >=1.0)", - "In_Parameter", io::message::error); - if (param.nonbonded.ewald_max_k_x <= 0 || - param.nonbonded.ewald_max_k_y <= 0 || - param.nonbonded.ewald_max_k_z <= 0) - io::messages.add("NONBONDED block: Illegal value for NKX, NKY or NKZ (>0)", - "In_Parameter", io::message::error); + bool do_ls = false; + switch (method) { + case 0: + param.force.nonbonded_crf = 0; + break; + case 1: + param.nonbonded.method = simulation::el_reaction_field; + param.nonbonded.lserf = false; + break; + case -1: + param.nonbonded.method = simulation::el_reaction_field; + param.nonbonded.lserf = false; + break; + case 2: + param.nonbonded.method = simulation::el_ewald; + param.setDevelop("Ewald sum is under development"); + param.nonbonded.lserf = false; + param.nonbonded.rf_excluded = false; + do_ls = true; + break; + case 3: + param.nonbonded.method = simulation::el_p3m; + param.nonbonded.lserf = false; + param.nonbonded.rf_excluded = false; + do_ls = true; + break; + default: + break; + } - if (param.nonbonded.ewald_kspace_cutoff <= 0.0) - io::messages.add("NONBONDED block: Illegal value for NK2 (>0.0)", - "In_Parameter", io::message::error); + // switch to turn of the contribution of the excluded atoms to the reaction field + if (param.nonbonded.method == simulation::el_reaction_field + && param.nonbonded.selfterm_excluded_atoms == 0) { + param.nonbonded.rf_excluded = false; + io::messages.add("NONBONDED block: contribution of excluded atoms to the reaction field turned off!", + "In_Parameter", io::message::warning); + } - if (param.nonbonded.p3m_grid_points_x <= 0 || - param.nonbonded.p3m_grid_points_y <= 0 || - param.nonbonded.p3m_grid_points_z <= 0) - io::messages.add("NONBONDED block: Illegal value for NGA, NGB or NGC (>0)", - "In_Parameter", io::message::error); + if (param.nonbonded.method != simulation::el_reaction_field) + param.force.interaction_function = simulation::lj_ls_func; + + if (do_ls && param.nonbonded.ls_charge_shape_width > param.pairlist.cutoff_short && + fabs(param.nonbonded.ls_charge_shape_width - param.pairlist.cutoff_short) > math::epsilon) + io::messages.add("NONBONDED block: charge width greater than cutoff! (ASHAPE > RCUTP)", + "In_Parameter", io::message::warning); + + + switch (ls_calculate_a2) { + case 0: + param.nonbonded.ls_calculate_a2 = simulation::ls_a2_zero; + if (param.nonbonded.method == simulation::el_p3m || param.nonbonded.method == simulation::el_ewald) + io::messages.add("NONBONDED block: you are using p3m or ewald but NA2CLC=0.", + "In_Parameter", io::message::warning); + break; + case 1: + param.nonbonded.ls_calculate_a2 = simulation::ls_a2t_exact; + if (param.nonbonded.method != simulation::el_ewald) { + io::messages.add("NONBONDED block: exact A2~ calculation needs Ewald.", + "In_Parameter", io::message::error); + } + break; + case 2: + param.nonbonded.ls_calculate_a2 = simulation::ls_a2_numerical; + break; + case 3: + param.nonbonded.ls_calculate_a2 = simulation::ls_a2t_exact_a2_numerical; + break; + case 4: + param.nonbonded.ls_calculate_a2 = simulation::ls_a2t_exact_a2_numerical; + if (param.nonbonded.method != simulation::el_p3m) { + io::messages.add("NONBONDED block: averaged A2~ calculation needs P3M.", + "In_Parameter", io::message::error); + } + break; + default: + io::messages.add("NONBONDED block: A2 calculation method not implemented", + "In_Parameter", io::message::error); + } - if (param.nonbonded.p3m_grid_points_x % 2 != 0 || + if (param.nonbonded.p3m_grid_points_x % 2 != 0 || param.nonbonded.p3m_grid_points_y % 2 != 0 || param.nonbonded.p3m_grid_points_z % 2 != 0) - io::messages.add("NONBONDED block: Illegal value for NGA, NGB or NGC (even)", - "In_Parameter", io::message::error); - - if (param.nonbonded.p3m_charge_assignment < 1 || - param.nonbonded.p3m_charge_assignment > 5) - io::messages.add("NONBONDED block: Illegal value for NASORD (1..5)", - "In_Parameter", io::message::error); - - if (param.nonbonded.p3m_finite_differences_operator < 0 || - param.nonbonded.p3m_finite_differences_operator > 5) - io::messages.add("NONBONDED block: Illegal value for NFDORD (0..5)", - "In_Parameter", io::message::error); - - if (param.nonbonded.p3m_mesh_alias <= 0) - io::messages.add("NONBONDED block: Illegal value for NALIAS (>0)", - "In_Parameter", io::message::error); - - if (param.nonbonded.accuracy_evaluation < 0) - io::messages.add("NONBONDED block: Illegal value for NQEVAL (>=0)", - "In_Parameter", io::message::error); - - if (param.pcouple.scale != math::pcouple_off - && param.nonbonded.method == simulation::el_p3m - && param.nonbonded.accuracy_evaluation == 0) - io::messages.add("NONBONDED block: Pressure scaling but no quality evaluation of influence function." - " Set NQEVAL > 0.", "In_Parameter", io::message::warning); - - if (param.pcouple.scale == math::pcouple_full_anisotropic && do_ls) { - io::messages.add("NONBONDED block: Full ansiotropic pressure scaling " - "could not be tested yet.", "In_Parameter", io::message::warning); - } + io::messages.add("NONBONDED block: Illegal value for NGA, NGB or NGC (even)", + "In_Parameter", io::message::error); - if (param.nonbonded.influence_function_rms_force_error <= 0.0) - io::messages.add("NONBONDED block: Illegal value for FACCUR (>0.0)", - "In_Parameter", io::message::error); - - if (param.nonbonded.influence_function_read || + if (param.nonbonded.influence_function_read || param.nonbonded.influence_function_write) - io::messages.add("NONBONDED block: Influence function IO not implemented." - " Set NRDGRD and NWRGRD to 0.", - "In_Parameter", io::message::error); - - if (param.nonbonded.lj_correction) - io::messages.add("NONBONDED block: LJ long range correction not implemented." - " Set NLRLJ to 0.", - "In_Parameter", io::message::error); + io::messages.add("NONBONDED block: Influence function IO not implemented." + " Set NRDGRD and NWRGRD to 0.", + "In_Parameter", io::message::error); - if (param.nonbonded.lj_solvent_density <= 0.0) - io::messages.add("NONBONDED block: Illegal value for SLVDNS (>0.0)", - "In_Parameter", io::message::error); + if (param.nonbonded.lj_correction) + io::messages.add("NONBONDED block: LJ long range correction not implemented." + " Set NLRLJ to 0.", + "In_Parameter", io::message::error); - } else { - io::messages.add("no NONBONDED block", "In_Parameter", io::message::error); - return; - } -} + block.get_final_messages(); + } +} // NONBONDED /** * @section sasa SASA block - * @verbatim - SASA - # NTSASA - # 0 : not used (default) - # 1 : use SASA implicit solvent model - # NTVOL - # 0 : not used (default) - # 1 : use VOLUME correction to SASA implicit solvent model (requires NTSASA = 1) - # P_12 > 0, < 1 pair parameter for SASA reduction for first neighbours - # P_13 > 0, < 1 pair parameter for SASA reduction for second neighbours - # P_1X > 0, < 1 pair parameter for SASA reduction for third and higher neighbours - # SIGMAV scaling parameter for volume energy term (kJ.mol^-1.nm^-3) - # RSOLV > 0 radius of solvent molecule for SASA calculation (nm) - # AS1 > 0 an atom with SASA below this contributes to the VOLUME correction (nm^2) - # AS2 > 0 an atom with SASA above this is not considered for the VOLUME correction (nm^2) - # atoms with AS1 < SASA < AS2 have a partial contribution determined by a switching function - # NTSASA NTVOL P_12 P_13 P_1X SIGMAV RSOlV AS1 AS2 - 1 1 0.8875 0.3516 0.3516 -100 0.14 0.01 0.02 - END - @endverbatim + * @snippet snippets/snippets.cc SASA */ void io::In_Parameter::read_SASA(simulation::Parameter & param, std::ostream & os) { - DEBUG(8, "read SASA"); - - std::vector buffer; - - buffer = m_block["SASA"]; - - // if there is no SASA term - if (!buffer.size()) { - return; - } - - block_read.insert("SASA"); - - _lineStream.clear(); - std::string s; - _lineStream.str(concatenate(buffer.begin() + 1, buffer.end() - 1, s)); - - int switch_sasa, switch_volume; - _lineStream >> switch_sasa - >> switch_volume - >> param.sasa.p_12 - >> param.sasa.p_13 - >> param.sasa.p_1x - >> param.sasa.sigma_v - >> param.sasa.r_solv - >> param.sasa.min_cut - >> param.sasa.max_cut; - - if (_lineStream.fail()) { - io::messages.add("bad line in SASA block", "In_Parameter", io::message::error); - } - - switch(switch_sasa) { - case 0: - param.sasa.switch_sasa = false; - break; - case 1: - param.sasa.switch_sasa = true; - break; - default: - io::messages.add("SASA block: NTSASA has to be 0,1","In_Parameter", io::message::error); - param.sasa.switch_sasa = false; - } - - switch(switch_volume) { - case 0: - param.sasa.switch_volume = false; - break; - case 1: - param.sasa.switch_volume = true; - break; - default: - io::messages.add("SASA block: NTSASAVOL has to be 0,1","In_Parameter", io::message::error); - param.sasa.switch_volume = false; - } - - // check that vol not used without sasa - if (!param.sasa.switch_sasa && param.sasa.switch_volume) { - io::messages.add("SASA block: Cannot have NTSASAVOL without NTSASA", - "In_Parameter", io::message::error); - } - - if (param.sasa.p_12 < 0.0 || param.sasa.p_12 > 1.0 || - param.sasa.p_13 < 0.0 || param.sasa.p_13 > 1.0 || - param.sasa.p_1x < 0.0 || param.sasa.p_1x > 1.0) { - io::messages.add("SASA block: Probabilities have to be 0.0..1.0", - "In_Parameter", io::message::error); - } + DEBUG(8, "reading SASA"); + + std::stringstream exampleblock; + // lines starting with 'exampleblock<<"' and ending with '\n";' (spaces don't matter) + // will be used to generate snippets that can be included in the doxygen doc; + // the first line is the tag + exampleblock << "SASA\n"; + exampleblock << "# NTSASA\n"; + exampleblock << "# 0 : not used (default)\n"; + exampleblock << "# 1 : use SASA implicit solvent model\n"; + exampleblock << "# NTVOL\n"; + exampleblock << "# 0 : not used (default)\n"; + exampleblock << "# 1 : use VOLUME correction to SASA implicit solvent model (requires NTSASA = 1)\n"; + exampleblock << "# P_12 >= 0, <= 1 pair parameter for SASA reduction for first neighbours\n"; + exampleblock << "# P_13 >= 0, <= 1 pair parameter for SASA reduction for second neighbours\n"; + exampleblock << "# P_1X >= 0, <= 1 pair parameter for SASA reduction for third and higher neighbours\n"; + exampleblock << "# SIGMAV >0 scaling parameter for volume energy term (kJ.mol^-1.nm^-3)\n"; + exampleblock << "# RSOLV > 0 radius of solvent molecule for SASA calculation (nm)\n"; + exampleblock << "# AS1 > 0 an atom with SASA below this contributes to the VOLUME correction (nm^2)\n"; + exampleblock << "# AS2 > 0 an atom with SASA above this is not considered for the VOLUME correction (nm^2)\n"; + exampleblock << "# atoms with AS1 < SASA < AS2 have a partial contribution determined by a switching function\n"; + exampleblock << "# NTSASA NTVOL P_12 P_13 P_1X SIGMAV RSOlV AS1 AS2\n"; + exampleblock << " 1 1 0.8875 0.3516 0.3516 -100 0.14 0.01 0.02\n"; + exampleblock << "END\n"; + + + std::string blockname = "SASA"; + Block block(blockname, exampleblock.str()); + + if (block.read_buffer(m_block[blockname], false) == 0) { + block_read.insert(blockname); + + int switch_sasa, switch_volume; + block.get_next_parameter("NTSASA", switch_sasa, "", "0,1"); + block.get_next_parameter("NTVOL", switch_volume, "", "0,1"); + block.get_next_parameter("P_12", param.sasa.p_12, ">=0.0 && <=1.0", ""); + block.get_next_parameter("P_13", param.sasa.p_13, ">=0.0 && <=1.0", ""); + block.get_next_parameter("P_1X", param.sasa.p_1x, ">=0.0 && <=1.0", ""); + block.get_next_parameter("SIGMAV", param.sasa.sigma_v, ">0", ""); + block.get_next_parameter("RSOLV", param.sasa.r_solv, ">0", ""); + block.get_next_parameter("AS1", param.sasa.min_cut, ">0", ""); + block.get_next_parameter("AS2", param.sasa.max_cut, ">0", ""); + + switch(switch_sasa) { + case 0: + param.sasa.switch_sasa = false; + break; + case 1: + param.sasa.switch_sasa = true; + break; + default: + param.sasa.switch_sasa = false; + } - if (param.sasa.r_solv <= 0.0) { - io::messages.add("SASA block: RSOLV has to be >0.0", - "In_Parameter", io::message::error); - } + switch(switch_volume) { + case 0: + param.sasa.switch_volume = false; + break; + case 1: + param.sasa.switch_volume = true; + break; + default: + param.sasa.switch_volume = false; + } - // compute and store upper - lower cutoffs - param.sasa.cut_diff = param.sasa.max_cut - param.sasa.min_cut; - if (param.sasa.cut_diff < 0.0 || - param.sasa.max_cut < 0.0 || - param.sasa.min_cut < 0.0) { - io::messages.add("SASA block: Cutoffs are negative or min. is larger than max.", - "In_Parameter", io::message::error); - } + // check that vol not used without sasa + if (!param.sasa.switch_sasa && param.sasa.switch_volume) { + io::messages.add("SASA block: Cannot have NTSASAVOL without NTSASA", + "In_Parameter", io::message::error); + } + // compute and store upper - lower cutoffs + param.sasa.cut_diff = param.sasa.max_cut - param.sasa.min_cut; + if (param.sasa.cut_diff < 0.0 ) { + io::messages.add("SASA block: Cutoffs: min. is larger than max.", + "In_Parameter", io::message::error); + } + block.get_final_messages(); + } } /** * @section localelev LOCALELEV block - * @verbatim -LOCALELEV -# NTLES 0,1 controls the use of local elevation. -# 0 : not used [default] -# 1 : local elevation is applied -# NLEPOT >= 0 number of umbrella potentials applied -# NTLESA 0..2 controls the reading of the potential definition -# 0 : read from input file (not supported) -# 1 : read from startup file -# 2 : read from special file (@lud) -# NTWLE >= 0 write umbrellas to trajectory evert NTWLEth step -# NLEPID[1..NLEPOT] IDs of the umbrella potentials -# NLEPFR[1..NLEPOT] 0,1 freeze the umbrella potential -# 0 : build up -# 1 : freeze -# NTLES NLEPOT NTLESA NTWLE - 1 2 1 0 -# NLEPID NLEPFR - 1 0 - 2 1 -END -@endverbatim + * @snippet snippets/snippets.cc LOCALELEV */ void io::In_Parameter::read_LOCALELEV(simulation::Parameter & param, - std::ostream & os) { - DEBUG(8, "read LOCALELEV"); - - std::vector buffer; - std::string s; - - buffer = m_block["LOCALELEV"]; - - if (buffer.size()) { - block_read.insert("LOCALELEV"); - _lineStream.clear(); - _lineStream.str(concatenate(buffer.begin() + 1, buffer.end() - 1, s)); - int onoff, num, read; - _lineStream >> onoff >> num >> read >> param.localelev.write; - - if (_lineStream.fail()) { - io::messages.add("bad line in LOCALELEV block", - "In_Parameter", io::message::error); - } - - switch (onoff) { - case 0: - param.localelev.localelev = simulation::localelev_off; - break; - case 1: - param.localelev.localelev = simulation::localelev_on; - break; - default: - param.localelev.localelev = simulation::localelev_off; - io::messages.add("LOCALELEV block: Bad value for NTLES (0,1)", - "In_Parameter", io::message::error); - } + std::ostream & os) { + DEBUG(8, "reading LOCALELEV"); + + std::stringstream exampleblock; + // lines starting with 'exampleblock<<"' and ending with '\n";' (spaces don't matter) + // will be used to generate snippets that can be included in the doxygen doc; + // the first line is the tag + exampleblock << "LOCALELEV\n"; + exampleblock << "# NTLES 0,1 controls the use of local elevation.\n"; + exampleblock << "# 0 : not used [default]\n"; + exampleblock << "# 1 : local elevation is applied\n"; + exampleblock << "# NLEPOT >= 0 number of umbrella potentials applied\n"; + exampleblock << "# NTLESA 1..2 controls the reading of the potential definition\n"; + exampleblock << "# 1 : read from startup file\n"; + exampleblock << "# 2 : read from special file (@lud)\n"; + exampleblock << "# NTWLE >= 0 write umbrellas to trajectory every NTWLEth step\n"; + exampleblock << "# NLEPID[1..NLEPOT] IDs of the umbrella potentials\n"; + exampleblock << "# NTLEPFR[1..NLEPOT] 0,1 freeze the umbrella potential\n"; + exampleblock << "# 0 : build up\n"; + exampleblock << "# 1 : freeze\n"; + exampleblock << "# NTLES NLEPOT NTLESA NTWLE\n"; + exampleblock << " 1 2 1 0\n"; + exampleblock << "# NLEPID NLEPFR\n"; + exampleblock << " 1 0\n"; + exampleblock << " 2 1\n"; + exampleblock << "END\n"; + + + std::string blockname = "LOCALELEV"; + Block block(blockname, exampleblock.str()); + + if (block.read_buffer(m_block[blockname], false) == 0) { + block_read.insert(blockname); + + int onoff, num, read; + block.get_next_parameter("NTLES", onoff, "", "0,1"); + block.get_next_parameter("NLEPOT", num, ">=0", ""); + block.get_next_parameter("NTLESA", read, "", "1,2"); + block.get_next_parameter("NTWLE", param.localelev.write, ">=0", ""); + + switch (onoff) { + case 0: + param.localelev.localelev = simulation::localelev_off; + break; + case 1: + param.localelev.localelev = simulation::localelev_on; + break; + default: + param.localelev.localelev = simulation::localelev_off; + } - if (num < 0) { - io::messages.add("LOCALELEV block: Bad value for NLEPOT (>=0)", - "In_Parameter", io::message::error); - return; - } + switch (read) { + case 1: + param.localelev.read = false; + break; + case 2: + param.localelev.read = true; + break; + default: + param.localelev.read = false; + } - switch (read) { - case 1: - param.localelev.read = false; - break; - case 2: - param.localelev.read = true; - break; - default: - param.localelev.read = false; - io::messages.add("LOCALELEV block: Bad value for NTLESA (1,2)", - "In_Parameter", io::message::error); - } + // read the umbrellas + for (int i = 0; i < num; ++i) { + int id, f; + block.get_next_parameter("NLEPID", id, ">=1", ""); + block.get_next_parameter("NTLEPFR", f, "", "0,1"); + if (block.error()) { + block.get_final_messages(); + return; + } - if (param.localelev.write < 0) { - io::messages.add("LOCALELEV block: Bad value for NTWLE (>=0)", - "In_Parameter", io::message::error); - param.localelev.write = 0; - } + bool freeze = (f == 1) ? true : false; + if (param.localelev.umbrellas.find(id) == param.localelev.umbrellas.end()) { + param.localelev.umbrellas[id] = !freeze; + } else { + std::ostringstream msg; + msg << "LOCALELEV block: duplicated umbrella potential ID (" << id << ")"; + io::messages.add(msg.str(), "In_Parameter", io::message::error); + return; + } + } // for umbrellas + block.get_final_messages(); + } // if block +} //LOCALELEV - // read the umbrellas - for (int i = 0; i < num; ++i) { - int id, f; - _lineStream >> id; - if (_lineStream.fail()) { - std::ostringstream msg; - msg << "LOCALELEV block: Bad value for NLEPID[" << i + 1 << "]"; - io::messages.add(msg.str(), "In_Parameter", io::message::error); - return; - } - _lineStream >> f; - if (_lineStream.fail() || (f != 0 && f != 1)) { - std::ostringstream msg; - msg << "LOCALELEV block: Bad value for NLEPFR[" << i + 1 << "] (0,1)"; - io::messages.add(msg.str(), "In_Parameter", io::message::error); - return; - } - - bool freeze = (f == 1) ? true : false; - if (param.localelev.umbrellas.find(id) == param.localelev.umbrellas.end()) { - param.localelev.umbrellas[id] = !freeze; - } else { - std::ostringstream msg; - msg << "LOCALELEV block: duplicated umbrella potential ID (" << id << ")"; - io::messages.add(msg.str(), "In_Parameter", io::message::error); - return; - } - } // for umbrellas - } // if block -} /** * @section bsleusparam BSLEUS block - * @verbatim -BSLEUS -# -# The general settings for the B&S-LEUS algorithm -# BSLEUS: Dow we use B&S-LEUS? -# 0: Don'use it -# 1: Use it -# BUILD: Are we building? -# 0: No -# 1: Yes -# WRITE: >= 0 Do we write the energies and forces of the Umbrella? -# == 0: No -# > 0: Every nth step -# -# BSLEUS BUILD WRITE - 1 1 0 -END -@endverbatim + * @snippet snippets/snippets.cc BSLEUS */ void io::In_Parameter::read_BSLEUS(simulation::Parameter& param, std::ostream& os) { - std::vector buffer; - std::string s; - - buffer = m_block["BSLEUS"]; - - if (buffer.size()) { - block_read.insert("BSLEUS"); - _lineStream.clear(); - _lineStream.str(concatenate(buffer.begin() + 1, buffer.end() - 1, s)); - - int use_bsleus, build, write; - _lineStream >> use_bsleus >> build >> write; - if (_lineStream.fail()){ - io::messages.add("Bad BSLEUS block!", "In_Parameter", io::message::error); - return; - } - - if (use_bsleus == 0 || use_bsleus == 1){ - param.bsleus.bsleus = use_bsleus ? simulation::bsleus_on : - simulation::bsleus_off; - } - else { - io::messages.add("BSLEUS: Bad value for BSLEUS", "In_Parameter", - io::message::error); - return; - } - if (build == 0 || build == 1){ - param.bsleus.building = build ? true : false; - } - else { - io::messages.add("BSLEUS: Bad value for BUILD", "In_Parameter", - io::message::error); - return; - } - /*if (forceConstIncr > 0.0){ - param.bsleus.forceConstantIncrement = forceConstIncr; - } - else { - io::messages.add("BSLEUS: Bad value for MEMKLE", "In_Parameter", - io::message::error); - return; - }*/ - if (write >= 0){ - param.bsleus.write = write; - } - else { - io::messages.add("BSLEUS: Bad value for WRITE", "In_Parameter", - io::message::error); - return; + DEBUG(8, "reading BSLEUS"); + + std::stringstream exampleblock; + // lines starting with 'exampleblock<<"' and ending with '\n";' (spaces don't matter) + // will be used to generate snippets that can be included in the doxygen doc; + // the first line is the tag + exampleblock << "BSLEUS\n"; + exampleblock << "#\n"; + exampleblock << "# The general settings for the B&S-LEUS algorithm\n"; + exampleblock << "# BSLEUS: Dow we use B&S-LEUS?\n"; + exampleblock << "# 0: Don'use it (default)\n"; + exampleblock << "# 1: Use it\n"; + exampleblock << "# BUILD: Are we building?\n"; + exampleblock << "# 0: No\n"; + exampleblock << "# 1: Yes\n"; + exampleblock << "# WRITE: >= 0 Do we write the energies and forces of the Umbrella?\n"; + exampleblock << "# == 0: No\n"; + exampleblock << "# > 0: Every nth step\n"; + exampleblock << "#\n"; + exampleblock << "# BSLEUS BUILD WRITE\n"; + exampleblock << " 1 1 0\n"; + exampleblock << "END\n"; + + std::string blockname = "BSLEUS"; + Block block(blockname, exampleblock.str()); + + if (block.read_buffer(m_block[blockname], false) == 0) { + block_read.insert(blockname); + + int use_bsleus, build; + block.get_next_parameter("BSLEUS", use_bsleus, "", "0,1"); + block.get_next_parameter("BUILD", build, "", "0,1"); + block.get_next_parameter("WRITE", param.bsleus.write, ">=0", ""); + + if (block.error()) { + block.get_final_messages(); + return; + } + + + param.bsleus.bsleus = use_bsleus ? simulation::bsleus_on : + simulation::bsleus_off; + param.bsleus.building = build ? true : false; + + block.get_final_messages(); } - } } /** * @section electric ELECTRIC block - * @verbatim - ELECTRIC -# FIELD 0,1 controls the use of applied electric field. -# 0 : not used [default] -# 1 : electric field is applied -# DIPOLE 0,1 controls the calculation of box dipole. -# 0 : not used [default] -# 1 : box dipole is calculated and written to special trajectory -# CURRENT 0,1 controls the calculation of electric currents. -# 0 : not used [default] -# 1 : electric current is calculated and written to special trajectory -# ELECTRIC FIELD COMPONENTS (EF_x, EF_y, EF_z) -# 0.0 0.0 0.0 -# DIPGRP 0..2 controls the groups considered for box dipole calculation -# 0 : solute only -# 1 : solvent only -# 2 : all -# NTWDIP >= 0 write dipole box every NTWDIPth step -# NCURGRP >=0 number of current groups -# CURGRP [1..NCURGRP] last atom of the group -# FIELD DIPOLE CURRENT - 1 1 1 -# EF_x EF_y EF_z - 0.0 0.0 0.0 -# DIPGRP NTWDIP - 0 1 -# NTWCUR NCURGRP CURGRP[1] CURGRP[2] - 1 2 100 1000 -END -@endverbatim + * @snippet snippets/snippets.cc ELECTRIC */ void io::In_Parameter::read_ELECTRIC(simulation::Parameter & param, - std::ostream & os) { - DEBUG(8, "read ELECTRIC"); - - std::vector buffer; - std::string s; - - buffer = m_block["ELECTRIC"]; - - if (buffer.size()) { - block_read.insert("ELECTRIC"); - _lineStream.clear(); - _lineStream.str(concatenate(buffer.begin() + 1, buffer.end() - 1, s)); - - int field, dipole, current, dipgrp, ncurgrp; - - _lineStream >> field >> dipole >> current >> param.electric.Ef_x - >> param.electric.Ef_y >> param.electric.Ef_z - >> dipgrp >> param.electric.dip_write >> param.electric.cur_write - >> ncurgrp; - - if (_lineStream.fail()) { - io::messages.add("bad line in ELECTRIC block", - "In_Parameter", io::message::error); - return; - } - - switch (field) { - case 0: - param.electric.electric = simulation::electric_off; - param.electric.Ef_x = 0.0; - param.electric.Ef_y = 0.0; - param.electric.Ef_z = 0.0; - break; - case 1: - { - param.electric.electric = simulation::electric_on; - if (param.electric.Ef_x == param.electric.Ef_y && - param.electric.Ef_y == param.electric.Ef_z && - param.electric.Ef_z == 0.0) - io::messages.add("Electric field enabled, but all components are zero", - "In_Parameter", io::message::error); - if (param.nonbonded.method != simulation::el_reaction_field && - param.nonbonded.rf_epsilon != 1.0) - io::messages.add("To use electric field together with Ewald or P3M, eps_rf must be 1.0", - "In_Parameter", io::message::error); - break; - } - default: - param.electric.electric = simulation::electric_off; - param.electric.Ef_x = 0.0; - param.electric.Ef_y = 0.0; - param.electric.Ef_z = 0.0; - io::messages.add("ELECTRIC block: Bad value for FIELD (0,1)", - "In_Parameter", io::message::error); - } - - switch (dipole) { - case 0: - { - param.electric.dipole = false; - param.electric.dip_write = 0; - break; - } - case 1: - { - param.electric.dipole = true; - if (dipgrp < 0 || dipgrp > 2) - io::messages.add("ELECTRIC block: DIPGRP should be within 0..2", - "In_Parameter", io::message::error); - break; - } - default: - { - param.electric.dipole = false; - param.electric.dip_write = 0; - io::messages.add("ELECTRIC block: Bad value for DIPOLE (0,1)", - "In_Parameter", io::message::error); - } - } + std::ostream & os) { + DEBUG(8, "reading ELECTRIC"); + + std::stringstream exampleblock; + // lines starting with 'exampleblock<<"' and ending with '\n";' (spaces don't matter) + // will be used to generate snippets that can be included in the doxygen doc; + // the first line is the tag + exampleblock << "ELECTRIC\n"; + exampleblock << "# FIELD 0,1 controls the use of applied electric field.\n"; + exampleblock << "# 0 : not used [default]\n"; + exampleblock << "# 1 : electric field is applied\n"; + exampleblock << "# DIPOLE 0,1 controls the calculation of box dipole.\n"; + exampleblock << "# 0 : not used [default]\n"; + exampleblock << "# 1 : box dipole is calculated and written to special trajectory\n"; + exampleblock << "# CURRENT 0,1 controls the calculation of electric currents.\n"; + exampleblock << "# 0 : not used [default]\n"; + exampleblock << "# 1 : electric current is calculated and written to special trajectory\n"; + exampleblock << "# ELECTRIC FIELD COMPONENTS (EF_x, EF_y, EF_z)\n"; + exampleblock << "# 0.0 0.0 0.0\n"; + exampleblock << "# DIPGRP 0..2 controls the groups considered for box dipole calculation\n"; + exampleblock << "# 0 : solute only\n"; + exampleblock << "# 1 : solvent only\n"; + exampleblock << "# 2 : all\n"; + exampleblock << "# NTWDIP >= 0 write dipole box every NTWDIPth step\n"; + exampleblock << "# NTWCUR >= 0 write current every NTWDIPth step\n"; + exampleblock << "# NCURGRP >=0 number of current groups\n"; + exampleblock << "# CURGRP [1..NCURGRP] last atom of the group\n"; + exampleblock << "# FIELD DIPOLE CURRENT\n"; + exampleblock << " 1 1 1\n"; + exampleblock << "# EF_x EF_y EF_z\n"; + exampleblock << " 0.0 0.0 0.0\n"; + exampleblock << "# DIPGRP NTWDIP\n"; + exampleblock << " 0 1\n"; + exampleblock << "# NTWCUR NCURGRP CURGRP[1] CURGRP[2]\n"; + exampleblock << " 1 2 100 1000\n"; + exampleblock << "END\n"; + + + std::string blockname = "ELECTRIC"; + Block block(blockname, exampleblock.str()); + + if (block.read_buffer(m_block[blockname], false) == 0) { + block_read.insert(blockname); + + int field, dipole, current, ncurgrp; + block.get_next_parameter("FIELD", field, "", "0,1"); + block.get_next_parameter("DIPOLE", dipole, "", "0,1"); + block.get_next_parameter("CURRENT", current, "", "0,1"); + block.get_next_parameter("EF_x", param.electric.Ef_x, "", ""); + block.get_next_parameter("EF_y", param.electric.Ef_y, "", ""); + block.get_next_parameter("EF_z", param.electric.Ef_z, "", ""); + block.get_next_parameter("DIPGRP", param.electric.dip_groups, "", "0,1,2"); + block.get_next_parameter("NTWDIP", param.electric.dip_write, ">=0", ""); + block.get_next_parameter("NTWCUR", param.electric.cur_write, ">=0", ""); + block.get_next_parameter("NCURGRP", ncurgrp, ">0", ""); + + switch (field) { + case 0: + param.electric.electric = simulation::electric_off; + param.electric.Ef_x = 0.0; + param.electric.Ef_y = 0.0; + param.electric.Ef_z = 0.0; + break; + case 1: + { + param.electric.electric = simulation::electric_on; + if (param.electric.Ef_x == param.electric.Ef_y && + param.electric.Ef_y == param.electric.Ef_z && + param.electric.Ef_z == 0.0) + io::messages.add("Electric field enabled, but all components are zero", + "In_Parameter", io::message::error); + if (param.nonbonded.method != simulation::el_reaction_field && + param.nonbonded.rf_epsilon != 1.0) + io::messages.add("To use electric field together with Ewald or P3M, eps_rf must be 1.0", + "In_Parameter", io::message::error); + break; + } + default: + break; + } - switch (dipgrp) { - case 0: - { - param.electric.dip_groups = 0; - break; - } - case 1: - { - param.electric.dip_groups = 1; - break; - } - case 2: - { - param.electric.dip_groups = 2; - break; - } - default: - { - io::messages.add("ELECTRIC block: DIPGRP should be within 0..2", - "In_Parameter", io::message::error); - break; - } - } + switch (dipole) { + case 0: + { + param.electric.dipole = false; + param.electric.dip_write = 0; + break; + } + case 1: + { + param.electric.dipole = true; + break; + } + default: + break; + } - switch (current) { - case 0: - { - param.electric.current = false; - param.electric.cur_write = 0; - break; - } - case 1: - { - param.electric.current = true; - if (ncurgrp < 0) - io::messages.add("ELECTRIC block: CURGRP should be >0", - "In_Parameter", io::message::error); - param.electric.cur_groups = ncurgrp; - break; - } - default: - { - param.electric.current = false; - param.electric.cur_write = 0; - io::messages.add("ELECTRIC block: Bad value for CURRENT (0,1)", - "In_Parameter", io::message::error); - } - } + switch (current) { + case 0: + { + param.electric.current = false; + param.electric.cur_write = 0; + break; + } + case 1: + { + param.electric.current = true; + param.electric.cur_groups = ncurgrp; + break; + } + default: + break; + } - if (param.electric.current != false) { - // TO READ THE ELECTRIC GROUPS - if (_lineStream.fail() || param.electric.cur_groups == (unsigned int) 0) - io::messages.add("CURRENT enabled, but number of CURRENT (NCURGRP) groups is zero", - "In_Parameter", io::message::error); - else { - unsigned int temp; - for (unsigned int i = 0; i < param.electric.cur_groups; i++) { - _lineStream >> temp; - if (_lineStream.fail()) { - io::messages.add("CURRENT enabled, but CURGRP[i] < or > NCURGRP", - "In_Parameter", io::message::error); - break; - } - param.electric.current_group.push_back(temp); + if (param.electric.current != false) { + // TO READ THE ELECTRIC GROUPS + unsigned int temp; + for (unsigned int i = 0; i < param.electric.cur_groups; i++) { + std::string idx = io::to_string(i); + block.get_next_parameter("CURGRP["+idx+"]", temp, ">0", ""); + if (block.error()) break; + param.electric.current_group.push_back(temp); + } } - } - } - } // if block -} + block.get_final_messages(); + } // if block +} //ELECTRIC /** * @section nemd NEMD block - * @verbatim - NEMD -# NEMD 0,1 controls the use of non-equilibrium molecular dynamics. -# 0 : not used [default] -# 1 : nemd is used -# PROPERTY 0- select property to calculate -# 0 : viscosity -# METHOD 0- select method of NEMD. -# 0 : periodic perturbation method (PPM) -# 1 : internal reservoir method (IRM) -# SLABNUM >=1 number of slabs used in the discretization along z-direction. -# the effective number is 2xSLABNUM due to periodicity -# PERTFRQ >=1 perturbation frequency: apply perturbation every PERTFRQth timestep -# [this flag is ignored by the PPM method, but a value must be provided] -# AMPLI >=0 amplitude of applied field -# [this flag is ignored by the IRM method, but a value must be provided] -# STDYAFT >=0 first STDYAFTth steps do not contribute for accumulated averages -# WRITE >=1 write flux and average velocities to special trajectory every WRITEth timestep -# NEMD PROPERTY METHOD - 1 0 0 -# SLABNUM PERTFRQ AMPLI STDYAFT WRITE - 10 20 10 1000 200 -END -@endverbatim + * @snippet snippets/snippets.cc NEMD */ void io::In_Parameter::read_NEMD(simulation::Parameter & param, - std::ostream & os) { - DEBUG(8, "read NEMD"); - - std::vector buffer; - std::string s; - - buffer = m_block["NEMD"]; - - if (buffer.size()) { - block_read.insert("NEMD"); - _lineStream.clear(); - _lineStream.str(concatenate(buffer.begin() + 1, buffer.end() - 1, s)); - - int nemd, property, method, slabnum, pertfrq, stdyaft, write; - double ampli; - - _lineStream >> nemd >> property >> method >> slabnum >> pertfrq >> ampli >> stdyaft >> write; - - if (_lineStream.fail()) { - io::messages.add("bad line in NEMD block", - "In_Parameter", io::message::error); - return; - } - - - - switch (nemd) { - case 0: - param.nemd.nemd = simulation::nemd_off; - break; - case 1: - { - param.nemd.nemd = simulation::nemd_on; - break; - } - default: - param.nemd.nemd = simulation::nemd_off; - io::messages.add("NEMD block: Bad value for NEMD (0,1)", - "In_Parameter", io::message::error); - } - - switch (property){ - case 0: - param.nemd.property = 0; - break; - default: - io::messages.add("NEMD block: Bad value for PROPERTY, for now only viscosity (0) is available", - "In_Parameter", io::message::error); - } - - - switch (method) { - case 0: - { - param.nemd.method = 0; - if (slabnum <=0 || ampli <=0) - io::messages.add("NEMD block: PPM method used, but found invalid values for SLABNUM and AMPLI", - "In_Parameter", io::message::error); - break; - } - case 1: - { - param.nemd.method = 1; - if (slabnum <=0 || pertfrq <=0) - io::messages.add("NEMD block: IRM method used, but found invalid values for SLABNUM and PERTFRQ", - "In_Parameter", io::message::error); - break; - } - default: - { - io::messages.add("NEMD block: Not a valid method(0)", - "In_Parameter", io::message::error); - - } - } - if (write <0) - io::messages.add("NEMD block: invalid value for WRITE (>=0)", - "In_Parameter", io::message::error); - - param.nemd.slabnum = slabnum; - param.nemd.pertfrq = pertfrq; - param.nemd.ampbath = ampli; - param.nemd.stdyaft = stdyaft; - param.nemd.write = write; - - - + std::ostream & os) { + DEBUG(8, "reading NEMD"); + + std::stringstream exampleblock; + // lines starting with 'exampleblock<<"' and ending with '\n";' (spaces don't matter) + // will be used to generate snippets that can be included in the doxygen doc; + // the first line is the tag + exampleblock << "NEMD\n"; + exampleblock << "# NEMD 0,1 controls the use of non-equilibrium molecular dynamics.\n"; + exampleblock << "# 0 : not used [default]\n"; + exampleblock << "# 1 : nemd is used\n"; + exampleblock << "# PROPERTY 0- select property to calculate\n"; + exampleblock << "# 0 : viscosity\n"; + exampleblock << "# METHOD 0- select method of NEMD.\n"; + exampleblock << "# 0 : periodic perturbation method (PPM)\n"; + exampleblock << "# 1 : internal reservoir method (IRM)\n"; + exampleblock << "# SLABNUM >=1 number of slabs used in the discretization along z-direction.\n"; + exampleblock << "# the effective number is 2xSLABNUM due to periodicity\n"; + exampleblock << "# PERTFRQ >=1 perturbation frequency: apply perturbation every PERTFRQth timestep\n"; + exampleblock << "# [this flag is ignored by the PPM method, but a value must be provided]\n"; + exampleblock << "# AMPLI >=0 amplitude of applied field\n"; + exampleblock << "# [this flag is ignored by the IRM method, but a value must be provided]\n"; + exampleblock << "# STDYAFT >=0 first STDYAFTth steps do not contribute for accumulated averages\n"; + exampleblock << "# WRITE >=1 write flux and average velocities to special trajectory every WRITEth timestep\n"; + exampleblock << "# NEMD PROPERTY METHOD\n"; + exampleblock << " 1 0 0\n"; + exampleblock << "# SLABNUM PERTFRQ AMPLI STDYAFT WRITE\n"; + exampleblock << " 10 20 10 1000 200\n"; + exampleblock << "END\n"; + + std::string blockname = "NEMD"; + Block block(blockname, exampleblock.str()); + + if (block.read_buffer(m_block[blockname], false) == 0) { + block_read.insert(blockname); + param.setDevelop("NEMD is under development."); + + int nemd, method; + block.get_next_parameter("NEMD", nemd, "", "0,1"); + block.get_next_parameter("PROPERTY", param.nemd.property, "", "0"); + block.get_next_parameter("METHOD", method, "", "0,1"); + block.get_next_parameter("SLABNUM", param.nemd.slabnum, ">=0", ""); + block.get_next_parameter("PERTFRQ", param.nemd.pertfrq, ">=0", ""); + block.get_next_parameter("AMPLI", param.nemd.ampbath, ">=0", ""); + block.get_next_parameter("STDYAFT", param.nemd.stdyaft, ">=0", ""); + block.get_next_parameter("WRITE", param.nemd.write, ">=0", ""); + + + if (block.error()) { + block.get_final_messages(); + return; + } - + param.nemd.nemd = nemd ? simulation::nemd_on : simulation::nemd_off; - - } // if block -} + switch (method) { + case 0: + { + param.nemd.method = 0; + if (param.nemd.slabnum <=0 || param.nemd.ampbath <=0) + io::messages.add("NEMD block: PPM method used, but found invalid values for SLABNUM and AMPLI", + "In_Parameter", io::message::error); + break; + } + case 1: + { + param.nemd.method = 1; + if (param.nemd.slabnum <=0 || param.nemd.pertfrq <=0) + io::messages.add("NEMD block: IRM method used, but found invalid values for SLABNUM and PERTFRQ", + "In_Parameter", io::message::error); + break; + } + default: + break; + } + block.get_final_messages(); + } // if block +} // NEMD /** * @section multigradient MULTIGRADIENT block - * @verbatim -MULTIGRADIENT -# NTMGRE 0,1 enable multiple gradients -# 0: disable gradients -# 1: enable gradients -# NTMGRP 0..3 print of curves -# 0: don't print -# 1: plot the curves -# 2: print that values of the curves -# 3: plot and print the curves -# NTMGRN >= 0 number of gradients -# MGRVAR: vairable name to affect -# MGRFRM: functional form of the curve -# 0: linear interpolation between control points -# 1: cubic spline interpolation between control points -# 2: Bezier curve -# 3: Oscillation: A sin[2Pi/T (t - dt)] + b -# Note: MGRNCP is 2. A = MGRCPT[1] T = MGRCPV[1] dt = MGRCPT[2] b = MGRCPV[2] -# MGRNCP >= 2: number of control points -# MGRCPT >= 0: time of the control point -# MGRCPV: value of the control point -# -# NTMGRE NTMGRP - 1 1 -# NTMGRN - 2 -# MGRVAR MGRFRM MGRNCP - TEMP[0] 0 2 -# MGRCPT MGRCPV - 0.0 60.0 - 80.0 300.0 -# MGRVAR MGRFRM MGRNCP - CPOR 2 4 -# MGRCPT MGRCPV - 0.0 2.5E5 - 0.0 2.5E1 - 20.0 0.0 - 80.0 0.0 -END -@endverbatim + * @snippet snippets/snippets.cc MULTIGRADIENT */ void io::In_Parameter::read_MULTIGRADIENT(simulation::Parameter & param, - std::ostream & os) { - DEBUG(8, "read MULTIGRADIENT"); - - std::vector buffer; - std::string s; - - buffer = m_block["MULTIGRADIENT"]; - - if (buffer.size()) { - block_read.insert("MULTIGRADIENT"); - _lineStream.clear(); - _lineStream.str(concatenate(buffer.begin() + 1, buffer.end() - 1, s)); - - int enable, plot, num; - _lineStream >> enable >> plot >> num; - if (_lineStream.fail()) { - io::messages.add("Bad line in MULTIGRADIENT block.", - "In_Parameter", io::message::error); - return; - } - - switch(enable) { - case 0: - param.multigradient.multigradient = false; - break; - case 1: - param.multigradient.multigradient = true; - break; - default: - param.multigradient.multigradient = false; - io::messages.add("MULTIGRADIENT block: NTMGRE must be 0 or 1.", - "In_Parameter", io::message::error); - return; - } - - switch(plot) { - case 0: - param.multigradient.print_graph = false; - param.multigradient.print_curve = false; - break; - case 1: - param.multigradient.print_graph = true; - param.multigradient.print_curve = false; - break; - case 2: - param.multigradient.print_graph = false; - param.multigradient.print_curve = true; - break; - case 3: - param.multigradient.print_graph = true; - param.multigradient.print_curve = true; - break; - default: - param.multigradient.print_graph = false; - param.multigradient.print_curve = false; - io::messages.add("MULTIGRADIENT block: NTMGRP must be 0..3.", - "In_Parameter", io::message::error); - return; - } + std::ostream & os) { + DEBUG(8, "reading MULTIGRADIENT"); + + std::stringstream exampleblock; + // lines starting with 'exampleblock<<"' and ending with '\n";' (spaces don't matter) + // will be used to generate snippets that can be included in the doxygen doc; + // the first line is the tag + exampleblock << "MULTIGRADIENT\n"; + exampleblock << "# NTMGRE 0,1 enable multiple gradients\n"; + exampleblock << "# 0: disable gradients (default)\n"; + exampleblock << "# 1: enable gradients\n"; + exampleblock << "# NTMGRP 0..3 print of curves\n"; + exampleblock << "# 0: don't print\n"; + exampleblock << "# 1: plot the curves\n"; + exampleblock << "# 2: print that values of the curves\n"; + exampleblock << "# 3: plot and print the curves\n"; + exampleblock << "# NTMGRN >= 0 number of gradients\n"; + exampleblock << "# MGRVAR: variable name to affect, available are:\n"; + exampleblock << " TEMP0, CPOR, CDIR, RESO, CXR, COPR\n"; + exampleblock << "# MGRFRM: functional form of the curve\n"; + exampleblock << "# 0: linear interpolation between control points\n"; + exampleblock << "# 1: cubic spline interpolation between control points\n"; + exampleblock << "# 2: Bezier curve\n"; + exampleblock << "# 3: Oscillation: A sin[2Pi/T (t - dt)] + b\n"; + exampleblock << "# Note: MGRNCP is 2. A = MGRCPT[1] T = MGRCPV[1] dt = MGRCPT[2] b = MGRCPV[2]\n"; + exampleblock << "# MGRNCP >= 2: number of control points\n"; + exampleblock << "# MGRCPT >= 0: time of the control point\n"; + exampleblock << "# MGRCPV: value of the control point\n"; + exampleblock << "#\n"; + exampleblock << "# NTMGRE NTMGRP\n"; + exampleblock << " 1 1\n"; + exampleblock << "# NTMGRN\n"; + exampleblock << " 2\n"; + exampleblock << "# MGRVAR MGRFRM MGRNCP\n"; + exampleblock << " TEMP0[0] 0 2\n"; + exampleblock << "# MGRCPT MGRCPV\n"; + exampleblock << " 0.0 60.0\n"; + exampleblock << " 80.0 300.0\n"; + exampleblock << "# MGRVAR MGRFRM MGRNCP\n"; + exampleblock << " CPOR 2 4\n"; + exampleblock << "# MGRCPT MGRCPV\n"; + exampleblock << " 0.0 2.5E5\n"; + exampleblock << " 0.0 2.5E1\n"; + exampleblock << " 20.0 0.0\n"; + exampleblock << " 80.0 0.0\n"; + exampleblock << "END\n"; + + + std::string blockname = "MULTIGRADIENT"; + Block block(blockname, exampleblock.str()); + + if (block.read_buffer(m_block[blockname], false) == 0) { + block_read.insert(blockname); + + int enable, plot, num; + block.get_next_parameter("NTMGRE", enable, "", "0,1"); + block.get_next_parameter("NTMGRP", plot, "", "0,1,2,3"); + block.get_next_parameter("NTMGRN", num, ">=0", ""); + + if (block.error()) { + block.get_final_messages(); + return; + } - if (num < 0) { - io::messages.add("MULTIGRADIENT block: NTMGRN must be >= 0", - "In_Parameter", io::message::error); - return; - } + switch(enable) { + case 0: + param.multigradient.multigradient = false; + break; + case 1: + param.multigradient.multigradient = true; + break; + default: + break; + } - if (num == 0 && param.multigradient.multigradient) { - io::messages.add("MULTIGRADIENT block: NTMGRN must be > 0 for NTMGRE=1", - "In_Parameter", io::message::error); - return; - } + switch(plot) { + case 0: + param.multigradient.print_graph = false; + param.multigradient.print_curve = false; + break; + case 1: + param.multigradient.print_graph = true; + param.multigradient.print_curve = false; + break; + case 2: + param.multigradient.print_graph = false; + param.multigradient.print_curve = true; + break; + case 3: + param.multigradient.print_graph = true; + param.multigradient.print_curve = true; + break; + default: + break; + } - // read the gradient - for(int i = 0; i < num; ++i) { - int funct_form, num_p; - std::string var; - _lineStream >> var >> funct_form >> num_p; - if (_lineStream.fail()) { - io::messages.add("Bad line in MULTIGRADIENT block.", - "In_Parameter", io::message::error); - return; - } + // read the gradient + for(int i = 0; i < num; ++i) { + int funct_form, num_p; + std::string var; + block.get_next_parameter("MGRVAR", var, "", ""); + block.get_next_parameter("MGRFRM", funct_form, "", "0,1,2,3"); + block.get_next_parameter("MGRNCP", num_p, ">=2", ""); + + if (block.error()) { + block.get_final_messages(); + return; + } + std::vector > points; + for(int p = 0; p < num_p; ++p) { + double t, v; + block.get_next_parameter("MGRCPT", t, ">=0", ""); + block.get_next_parameter("MGRCPV", v, "", ""); + if (block.error()) return; + points.push_back(std::pair(t,v)); + } - if (num_p < 2) { - io::messages.add("MULTIGRADIENT block: MGRNCP must be >= 2.", - "In_Parameter", io::message::error); - return; - } - std::vector > points; - for(int p = 0; p < num_p; ++p) { - double t, v; - _lineStream >> t >> v; - if (_lineStream.fail()) { - io::messages.add("Bad line in MULTIGRADIENT block.", - "In_Parameter", io::message::error); - return; - } - points.push_back(std::pair(t,v)); - } - - param.multigradient.variable.push_back(var); - param.multigradient.functional_form.push_back(funct_form); - param.multigradient.control_points.push_back(points); - } // for gradients - } // if block -} + param.multigradient.variable.push_back(var); + param.multigradient.functional_form.push_back(funct_form); + param.multigradient.control_points.push_back(points); + } // for gradients + block.get_final_messages(); + } // if block +} // MULTIGRADIENT /** * @section addecouple ADDECOUPLE block - * @verbatim -ADDECOUPLE -# ADGR >= 0 number of addiabatic decoupling groups -# ADSTART first atom of the addiabatic decoupling group -# ADEND last atom of the addiabatic decoupling group -# SM scaling factor mass -# SV scaling factor potential energy function -# ST scaling factor temperature -# TIR which temperature bath to scale -# 1 translational -# 2 internal-rotatinal -# 3 both -# TMF tau for calculating mean field -# STAD printing average to special trajectory # ADGR - 2 -# ADSTART ADEND SM SV ST TIR - 1 1500 10 1 0 1 - 1501 3000 1 10 1 3 -# TMF STAD - 0.1 1000 -END -@endverbatim + * @snippet snippets/snippets.cc ADDECOUPLE */ void io::In_Parameter::read_ADDECOUPLE(simulation::Parameter & param, - std::ostream & os) { - DEBUG(8, "read ADDECOUPLE"); - - std::vector buffer; - std::string s; - - buffer = m_block["ADDECOUPLE"]; - - if (buffer.size()) { - block_read.insert("ADDECOUPLE"); - _lineStream.clear(); - _lineStream.str(concatenate(buffer.begin() + 1, buffer.end() - 1, s)); - unsigned int adgr, adstart, eg, tg=0, adend, write, tir; - double sm, sv, st, tmf; - _lineStream >> adgr; + std::ostream & os) { + DEBUG(8, "reading ADDECOUPLE"); + + std::stringstream exampleblock; + // lines starting with 'exampleblock<<"' and ending with '\n";' (spaces don't matter) + // will be used to generate snippets that can be included in the doxygen doc; + // the first line is the tag + exampleblock << "ADDECOUPLE\n"; + exampleblock << "# ADGR >= 0 number of adiabatic decoupling groups\n"; + exampleblock << "# ADSTART first atom of the adiabatic decoupling group\n"; + exampleblock << "# ADEND last atom of the adiabatic decoupling group\n"; + exampleblock << "# SM scaling factor mass\n"; + exampleblock << "# SV scaling factor potential energy function\n"; + exampleblock << "# ST scaling factor temperature\n"; + exampleblock << "# TIR which temperature bath to scale\n"; + exampleblock << "# 1 translational\n"; + exampleblock << "# 2 internal-rotatinal\n"; + exampleblock << "# 3 both\n"; + exampleblock << "# TMF tau for calculating mean field\n"; + exampleblock << "# STAD printing average to special trajectory\n"; + exampleblock << "# ADGR\n"; + exampleblock << " 2\n"; + exampleblock << "# ADSTART ADEND SM SV ST TIR\n"; + exampleblock << " 1 1500 10 1 0 1\n"; + exampleblock << " 1501 3000 1 10 1 3\n"; + exampleblock << "# TMF STAD\n"; + exampleblock << " 0.1 1000\n"; + exampleblock << "END\n"; + + std::string blockname = "ADDECOUPLE"; + Block block(blockname, exampleblock.str()); + + if (block.read_buffer(m_block[blockname], false) == 0) { + block_read.insert(blockname); + + unsigned int adstart, eg, tg=0, adend, tir; + double sm, sv, st; + + block.get_next_parameter("ADGR", param.addecouple.adgr, "=>0", ""); + + if (block.error()) { + block.get_final_messages(); + return; + } - param.addecouple.adgr = adgr; + for (unsigned int i = 0; i < param.addecouple.adgr; ++i) { + block.get_next_parameter("ADSTART", adstart, ">=0", ""); + std::string str_adstart = io::to_string(adstart); + block.get_next_parameter("ADEND", adend, ">="+str_adstart, ""); + block.get_next_parameter("SM", sm, ">=0", ""); + block.get_next_parameter("SV", sv, "", ""); + block.get_next_parameter("ST", st, ">=0", ""); + block.get_next_parameter("TIR", tir, "", "1,2,3"); + + if (st != 1 && param.multibath.couple == false) + io::messages.add("ADDECOUPLE block: ST>1, but no temperature scaling", + "In_Parameter", io::message::error); + + //check whether the group is also a temperature group + if (param.multibath.couple) { + int addc_bath_index; + if (param.multibath.multibath.bath_index().size() < param.addecouple.adgr && st != 1) + io::messages.add("ADDECOUPLE block: sT bigger 1, but temperature group and adiabatic decouling group not equivalent", + "In_Parameter", io::message::error); + else { + int check_group = -1; + for (unsigned int bath_i = 0; bath_i < param.multibath.multibath.bath_index().size(); ++bath_i) { + if (bath_i > 0 + && adend - 1 == param.multibath.multibath.bath_index()[bath_i].last_atom + && adstart - 2 == param.multibath.multibath.bath_index()[bath_i - 1].last_atom) { + check_group = 1; + addc_bath_index = bath_i; + tg=bath_i; + } else if (bath_i == 0 + && adend - 1 == param.multibath.multibath.bath_index()[0].last_atom + && adstart == 1) { + check_group = 1; + addc_bath_index = bath_i; + tg=bath_i; + } + } + if (st == 1) + check_group = 1; + if (check_group == -1) + io::messages.add("ADDECOUPLE block: ST bigger 1, but temperature group and adiabatic decouling group not equivalent", + "In_Parameter", io::message::error); + //check whether com and ir are handled "correctly" + else { + if (param.multibath.multibath.bath_index()[addc_bath_index].com_bath + == param.multibath.multibath.bath_index()[addc_bath_index].ir_bath + && tir != 3) + io::messages.add("ADDECOUPLE block: seperate scaling for this temperature group not possible", + "In_Parameter", io::message::error); + else if (st != 1) { + int com_bath = param.multibath.multibath.bath_index()[addc_bath_index].com_bath; + int ir_bath = param.multibath.multibath.bath_index()[addc_bath_index].ir_bath; //scale temperature + if (com_bath == ir_bath && tir == 3) + param.multibath.multibath[ir_bath].temperature *= st; + else if (tir == 1) + param.multibath.multibath[com_bath].temperature *= st; + else if (tir == 2) + param.multibath.multibath[ir_bath].temperature *= st; + else if (tir == 3) { + param.multibath.multibath[com_bath].temperature *= st; + param.multibath.multibath[ir_bath].temperature *= st; + } + else + io::messages.add("ADDECOUPLE block: scaling for this temperature group not possible", + "In_Parameter", io::message::error); + + } + } + } - if (_lineStream.fail()) { - io::messages.add("bad line in ADDECOUPLE block", - "In_Parameter", io::message::error); - } - for (unsigned int i = 0; i < adgr; ++i) { - _lineStream >> adstart >> adend >> sm >> sv >> st >> tir; - if (adstart < 0.0 || adend < adstart) { - io::messages.add("ADDECOUPLE block: illegal value for adstart or adend", - "In_Parameter", io::message::error); - } - if (tir != 1 && tir != 2 && tir != 3) { - io::messages.add("ADDECOUPLE block: illegal value for tir (not 1,2 or 3)", - "In_Parameter", io::message::error); - } - if (st != 1 && param.multibath.couple == false) - io::messages.add("ADDECOUPLE block: sT bigger 1, but no temperature scaling", - "In_Parameter", io::message::error); - //check whether the group is also a temperature group - if (param.multibath.couple) { - int addc_bath_index; - if (param.multibath.multibath.bath_index().size() < adgr && st != 1) - io::messages.add("ADDECOUPLE block: sT bigger 1, but temperature group and adiabatic decouling group not equivalent", - "In_Parameter", io::message::error); - else { - int check_group = -1; - for (unsigned int bath_i = 0; bath_i < param.multibath.multibath.bath_index().size(); ++bath_i) { - if (bath_i > 0 - && adend - 1 == param.multibath.multibath.bath_index()[bath_i].last_atom - && adstart - 2 == param.multibath.multibath.bath_index()[bath_i - 1].last_atom) { - check_group = 1; - addc_bath_index = bath_i; - tg=bath_i; - } else if (bath_i == 0 - && adend - 1 == param.multibath.multibath.bath_index()[0].last_atom - && adstart == 1) { - check_group = 1; - addc_bath_index = bath_i; - tg=bath_i; } - } - if (st == 1) - check_group = 1; - if (check_group == -1) - io::messages.add("ADDECOUPLE block: sT bigger 1, but temperature group and adiabatic decouling group not equivalent", - "In_Parameter", io::message::error); - //check whether com and ir are handled "correctly" - else { - if (param.multibath.multibath.bath_index()[addc_bath_index].com_bath - == param.multibath.multibath.bath_index()[addc_bath_index].ir_bath - && tir != 3) - io::messages.add("ADDECOUPLE block: seperate scaling for this temperature group not possible", - "In_Parameter", io::message::error); - else if (st != 1) { - int com_bath = param.multibath.multibath.bath_index()[addc_bath_index].com_bath; - int ir_bath = param.multibath.multibath.bath_index()[addc_bath_index].ir_bath; //scale temperature - if (com_bath == ir_bath && tir == 3) - param.multibath.multibath[ir_bath].temperature *= st; - else if (tir == 1) - param.multibath.multibath[com_bath].temperature *= st; - else if (tir == 2) - param.multibath.multibath[ir_bath].temperature *= st; - else if (tir == 3) { - param.multibath.multibath[com_bath].temperature *= st; - param.multibath.multibath[ir_bath].temperature *= st; - } - else - io::messages.add("ADDECOUPLE block: scaling for this temperature group not possible", - "In_Parameter", io::message::error); - + //check whether group is also an energy group + int check_group = -1; + if (adstart == 1 && (param.force.energy_group[0] + 1) == adend) { + check_group = 1; + eg=0; } - } + else + for (unsigned int energy_i = 0; energy_i < param.force.energy_group.size() - 1; ++energy_i) { + if (param.force.energy_group[energy_i] + 2 == adstart + && param.force.energy_group[energy_i + 1] + 1 == adend) { + check_group = 1; + eg=i; + } + } + if (check_group == -1) + io::messages.add("ADDECOUPLE block: energy and adiabatic groups are not identical", "In_Parameter", io::message::error); + param.addecouple.add_adc(adstart - 1, adend - 1, sm, sv, st, tir, eg, tg); } - - } - //check whether group is also an energy group - int check_group = -1; - if (adstart == 1 && (param.force.energy_group[0] + 1) == adend){ - check_group = 1; - eg=0; - } - else - for (unsigned int energy_i = 0; energy_i < param.force.energy_group.size() - 1; ++energy_i) { - if (param.force.energy_group[energy_i] + 2 == adstart - && param.force.energy_group[energy_i + 1] + 1 == adend){ - check_group = 1; - eg=i; - } + if (param.addecouple.adgr > 0) { + block.get_next_parameter("TMF", param.addecouple.tmf, ">=0", ""); + block.get_next_parameter("STAD", param.addecouple.write, ">=0", ""); } - if (check_group == -1) - io::messages.add("ADDECOUPLE block: energy and adiabatic groups are not identical", "In_Parameter", io::message::error); - param.addecouple.add_adc(adstart - 1, adend - 1, sm, sv, st, tir, eg, tg); - } - if (adgr > 0) { - _lineStream >> tmf >> write; - if (tmf < 0.0 || write < 0.0) { - io::messages.add("ADDECOUPLE block: illegal value for TMF or STAD", - "In_Parameter", io::message::error); - } - - param.addecouple.tmf = tmf; - param.addecouple.write = write; - } - if (_lineStream.fail()) { - io::messages.add("bad line in ADDECOUPLE block", - "In_Parameter", io::message::error); + block.get_final_messages(); } - } } @@ -5662,10 +4590,10 @@ void io::In_Parameter::read_ADDECOUPLE(simulation::Parameter & param, // two helper data types to simply unsupported block handling enum unsupported_block_type { - ub_unknown, // I know it and know that I don't use it but I have no idea why - ub_renamed, // it was renamed. e.g. from previous versions - ub_promd, // it is a PROMD block. Tell alternative if there is any - ub_g96 // it is a G96 block. Tell alternative if there is any + ub_unknown, // I know it and know that I don't use it but I have no idea why + ub_renamed, // it was renamed. e.g. from previous versions + ub_promd, // it is a PROMD block. Tell alternative if there is any + ub_g96 // it is a G96 block. Tell alternative if there is any }; // give a valid block name as an alternative and it will tell the user to @@ -5673,256 +4601,222 @@ enum unsupported_block_type { struct unsupported_block { - unsupported_block() : - alternative(""), type(ub_unknown) { - } + unsupported_block() : + alternative(""), type(ub_unknown) { + } - unsupported_block(std::string a, unsupported_block_type t) : - alternative(a), type(t) { - } + unsupported_block(std::string a, unsupported_block_type t) : + alternative(a), type(t) { + } - std::string alternative; - unsupported_block_type type; + std::string alternative; + unsupported_block_type type; }; void io::In_Parameter::read_known_unsupported_blocks() { - std::map ub; - // add all those unknown blocks - ub["ANATRAJ"] = unsupported_block("READTRAJ", ub_renamed); - ub["MINIMISE"] = unsupported_block("ENERGYMIN", ub_renamed); - ub["STOCHASTIC"] = unsupported_block("STOCHDYN", ub_renamed); - ub["BOUNDARY"] = unsupported_block("BOUNDCOND", ub_renamed); - ub["THERMOSTAT"] = unsupported_block("MULTIBATH", ub_promd); - ub["TCOUPLE"] = unsupported_block("MULTIBATH", ub_g96); - ub["BAROSTAT"] = unsupported_block("PRESSURESCALE", ub_promd); - ub["VIRIAL"] = unsupported_block("PRESSURESCALE", ub_promd); - ub["PCOUPLE"] = unsupported_block("PRESSURESCALE", ub_g96); - ub["PCOUPLE03"] = unsupported_block("PRESSURESCALE", ub_renamed); - ub["GEOMCONSTRAINT"] = unsupported_block("CONSTRAINT", ub_promd); - ub["SHAKE"] = unsupported_block("CONSTRAINT", ub_g96); - ub["PATHINT"] = unsupported_block("", ub_promd); - ub["NEIGHBOURLIST"] = unsupported_block("PAIRLIST", ub_promd); - ub["PLIST"] = unsupported_block("PAIRLIST", ub_g96); - ub["PLIST03"] = unsupported_block("PAIRLIST", ub_renamed); - ub["LONGRANGE"] = unsupported_block("NONBONDED", ub_g96); - ub["START"] = unsupported_block("INITIALISE", ub_g96); - ub["OVERALLTRANSROT"] = unsupported_block("COMTRANSROT", ub_promd); - ub["CENTREOFMASS"] = unsupported_block("COMTRANSROT", ub_g96); - ub["POSREST"] = unsupported_block("POSITIONRES", ub_g96); - ub["DISTREST"] = unsupported_block("DISTANCERES", ub_g96); - ub["DIHEREST"] = unsupported_block("DIHEDRALRES", ub_g96); - ub["J-VAL"] = unsupported_block("JVALUERES", ub_g96); - ub["J-VAL03"] = unsupported_block("JVALUERES", ub_renamed); - ub["PERTURB"] = unsupported_block("PERTURBATION", ub_g96); - ub["PERTURB03"] = unsupported_block("PERTURBATION", ub_renamed); - ub["UMBRELLA"] = unsupported_block("", ub_promd); - ub["PRINT"] = unsupported_block("PRINTOUT", ub_g96); - ub["WRITE"] = unsupported_block("WRITETRAJ", ub_g96); + std::map ub; + // add all those unknown blocks + ub["ANATRAJ"] = unsupported_block("READTRAJ", ub_renamed); + ub["MINIMISE"] = unsupported_block("ENERGYMIN", ub_renamed); + ub["STOCHASTIC"] = unsupported_block("STOCHDYN", ub_renamed); + ub["BOUNDARY"] = unsupported_block("BOUNDCOND", ub_renamed); + ub["THERMOSTAT"] = unsupported_block("MULTIBATH", ub_promd); + ub["TCOUPLE"] = unsupported_block("MULTIBATH", ub_g96); + ub["BAROSTAT"] = unsupported_block("PRESSURESCALE", ub_promd); + ub["VIRIAL"] = unsupported_block("PRESSURESCALE", ub_promd); + ub["PCOUPLE"] = unsupported_block("PRESSURESCALE", ub_g96); + ub["PCOUPLE03"] = unsupported_block("PRESSURESCALE", ub_renamed); + ub["GEOMCONSTRAINT"] = unsupported_block("CONSTRAINT", ub_promd); + ub["SHAKE"] = unsupported_block("CONSTRAINT", ub_g96); + ub["PATHINT"] = unsupported_block("", ub_promd); + ub["NEIGHBOURLIST"] = unsupported_block("PAIRLIST", ub_promd); + ub["PLIST"] = unsupported_block("PAIRLIST", ub_g96); + ub["PLIST03"] = unsupported_block("PAIRLIST", ub_renamed); + ub["LONGRANGE"] = unsupported_block("NONBONDED", ub_g96); + ub["START"] = unsupported_block("INITIALISE", ub_g96); + ub["OVERALLTRANSROT"] = unsupported_block("COMTRANSROT", ub_promd); + ub["CENTREOFMASS"] = unsupported_block("COMTRANSROT", ub_g96); + ub["POSREST"] = unsupported_block("POSITIONRES", ub_g96); + ub["DISTREST"] = unsupported_block("DISTANCERES", ub_g96); + ub["DIHEREST"] = unsupported_block("DIHEDRALRES", ub_g96); + ub["J-VAL"] = unsupported_block("JVALUERES", ub_g96); + ub["J-VAL03"] = unsupported_block("JVALUERES", ub_renamed); + ub["PERTURB"] = unsupported_block("PERTURBATION", ub_g96); + ub["PERTURB03"] = unsupported_block("PERTURBATION", ub_renamed); + ub["UMBRELLA"] = unsupported_block("", ub_promd); + ub["PRINT"] = unsupported_block("PRINTOUT", ub_g96); + ub["WRITE"] = unsupported_block("WRITETRAJ", ub_g96); #ifdef NDEBUG - ub["DEBUG"] = unsupported_block("--enable-debug at compile time and " - "the @verb argument", ub_promd); + ub["DEBUG"] = unsupported_block("--enable-debug at compile time and " + "the @verb argument", ub_promd); #else - ub["DEBUG"] = unsupported_block("the @verb argument", ub_promd); + ub["DEBUG"] = unsupported_block("the @verb argument", ub_promd); #endif - ub["FOURDIM"] = unsupported_block("", ub_g96); - ub["LOCALELEVATION"] = unsupported_block("LOCALELEV", ub_g96); - ub["SUBMOLECULES"] = unsupported_block("SOLUTEMOLECULES and moved to " - "the topology", ub_renamed); - ub["FORCEFIELD"] = unsupported_block("COVALENTFORM", ub_renamed); - ub["PSCALE"] = unsupported_block("PERSCALE", ub_renamed); - ub["REPLICA03"] = unsupported_block("REPLICA", ub_renamed); - - std::map::const_iterator - it = ub.begin(), - to = ub.end(); - - // loop over unsupported blocks; - for (; it != to; ++it) { - // if it is present - if (m_block[it->first].size()) { - block_read.insert(it->first); - - std::ostringstream msg; - msg << it->first << " block"; - - switch (it->second.type) { - case ub_renamed: - msg << " was renamed to " << it->second.alternative; - break; - case ub_promd: - msg << " is PROMD specific."; - if (it->second.alternative != "") - msg << " Use " << it->second.alternative << " instead."; - break; - case ub_g96: - msg << " is GROMOS96 specific."; - if (it->second.alternative != "") - msg << " Use " << it->second.alternative << " instead."; - break; - default: // don't know what to do. - msg << " is known to be not supported."; - } - - io::messages.add(msg.str(), "In_Parameter", io::message::error); + ub["FOURDIM"] = unsupported_block("", ub_g96); + ub["LOCALELEVATION"] = unsupported_block("LOCALELEV", ub_g96); + ub["SUBMOLECULES"] = unsupported_block("SOLUTEMOLECULES and moved to " + "the topology", ub_renamed); + ub["FORCEFIELD"] = unsupported_block("COVALENTFORM", ub_renamed); + ub["PSCALE"] = unsupported_block("PERSCALE", ub_renamed); + ub["REPLICA03"] = unsupported_block("REPLICA", ub_renamed); + + std::map::const_iterator + it = ub.begin(), + to = ub.end(); + + // loop over unsupported blocks; + for (; it != to; ++it) { + // if it is present + if (m_block[it->first].size()) { + block_read.insert(it->first); + + std::ostringstream msg; + msg << it->first << " block"; + + switch (it->second.type) { + case ub_renamed: + msg << " was renamed to " << it->second.alternative; + break; + case ub_promd: + msg << " is PROMD specific."; + if (it->second.alternative != "") + msg << " Use " << it->second.alternative << " instead."; + break; + case ub_g96: + msg << " is GROMOS96 specific."; + if (it->second.alternative != "") + msg << " Use " << it->second.alternative << " instead."; + break; + default: // don't know what to do. + msg << " is known to be not supported."; + } + + io::messages.add(msg.str(), "In_Parameter", io::message::error); + } } - } } /** * @section qmmmb QMMM block - * @verbatim -QMMM -# NTQMMM 0,1 apply QM/MM -# 0: do not apply QM/MM -# 1: apply QM/MM -# NTQMSW 0 QM software package to use -# 0: MNDO -# 1: Turbomole -# RCUTQ >= 0.0 cutoff for inclusion of MM charge groups -# 0.0: include all atoms -# >0.0: include atoms of charge groups closer than RCUTQ -# to QM zone. -# NTWQMMM >= 0 write QM/MM related data to special trajectory -# 0: do not write -# >0: write every NTWQMMMth step -# -# NTQMMM NTQMSW RCUTQ NTWQMMM - 1 0 0.0 0 -END - -@endverbatim + * @snippet snippets/snippets.cc QMMM + */ void io::In_Parameter::read_QMMM(simulation::Parameter & param, - std::ostream & os) { - DEBUG(8, "read QMMM"); - - std::vector buffer; - std::string s; - - buffer = m_block["QMMM"]; - - if (buffer.size()) { - block_read.insert("QMMM"); - _lineStream.clear(); - _lineStream.str(concatenate(buffer.begin() + 1, buffer.end() - 1, s)); - - int enable, software, write; - double cutoff; - _lineStream >> enable >> software >> cutoff >> write; - if (_lineStream.fail()) { - io::messages.add("Bad line in QMMM block.", - "In_Parameter", io::message::error); - return; - } + std::ostream & os) { + DEBUG(8, "reading QMMM"); + + std::stringstream exampleblock; + // lines starting with 'exampleblock<<"' and ending with '\n";' (spaces don't matter) + // will be used to generate snippets that can be included in the doxygen doc; + // the first line is the tag + exampleblock << "QMMM\n"; + exampleblock << "# NTQMMM 0,1 apply QM/MM\n"; + exampleblock << "# 0: do not apply QM/MM (default)\n"; + exampleblock << "# 1: apply QM/MM\n"; + exampleblock << "# NTQMSW 0 QM software package to use\n"; + exampleblock << "# 0: MNDO (default)\n"; + exampleblock << "# 1: Turbomole\n"; + exampleblock << "# RCUTQ >= 0.0 cutoff for inclusion of MM charge groups\n"; + exampleblock << "# 0.0: include all atoms\n"; + exampleblock << "# >0.0: include atoms of charge groups closer than RCUTQ\n"; + exampleblock << "# to QM zone.\n"; + exampleblock << "# NTWQMMM >= 0 write QM/MM related data to special trajectory\n"; + exampleblock << "# 0: do not write\n"; + exampleblock << "# >0: write every NTWQMMMth step\n"; + exampleblock << "#\n"; + exampleblock << "# NTQMMM NTQMSW RCUTQ NTWQMMM\n"; + exampleblock << " 1 0 0.0 0\n"; + exampleblock << "END\n"; + + + std::string blockname = "QMMM"; + Block block(blockname, exampleblock.str()); + + if (block.read_buffer(m_block[blockname], false) == 0) { + block_read.insert(blockname); + + int enable, software, write; + double cutoff; + block.get_next_parameter("NTQMMM", enable, "", "0,1"); + block.get_next_parameter("NTQMSW", software, "", "0,1"); + block.get_next_parameter("RCUTQ", cutoff, ">=0", ""); + block.get_next_parameter("NTWQMMM", write, ">=0", ""); + + switch(enable) { + case 0: + param.qmmm.qmmm = simulation::qmmm_off; + break; + case 1: + param.qmmm.qmmm = simulation::qmmm_on; + break; + default: + break; + } - switch(enable) { - case 0: - param.qmmm.qmmm = simulation::qmmm_off; - break; - case 1: - param.qmmm.qmmm = simulation::qmmm_on; - break; - default: - param.qmmm.qmmm = simulation::qmmm_off; - io::messages.add("QMMM block: NTQMMM must be 0 or 1.", - "In_Parameter", io::message::error); - return; - } + switch (software) { + case 0: + param.qmmm.software = simulation::qmmm_software_mndo; + break; + case 1: + param.qmmm.software = simulation::qmmm_software_turbomole; + break; + default: + break; + } - switch (software) { - case 0: - param.qmmm.software = simulation::qmmm_software_mndo; - break; - case 1: - param.qmmm.software = simulation::qmmm_software_turbomole; - break; - default: - param.qmmm.software = simulation::qmmm_software_mndo; - io::messages.add("QMMM block: NTQMSW invalid choice of software", - "In_Parameter", io::message::error); - return; - } - - if (cutoff < 0.0) { - io::messages.add("QMMM block: RCUTQ must be >= 0.0", - "In_Parameter", io::message::error); - return; - } - param.qmmm.cutoff = cutoff; + param.qmmm.cutoff = cutoff; + param.qmmm.write = write; - if (write < 0) { - io::messages.add("QMMM block: NTWQMMM must be >= 0", - "In_Parameter", io::message::error); - return; - } - param.qmmm.write = write; - } // if block -} + block.get_final_messages(); + } // if block +} // QMMM /** * @section symres SYMRES block - * @verbatim -SYMRES -# NTSYM 0..2 apply symmetry restraints -# 0: do not apply symmetry restraints -# 1: apply symmetry restraints -# 2: apply symmetry constraints -# CSYM >= 0.0 force constants -# -# NTSYM CSYM - 1 0.0 -END - -@endverbatim + * @snippet snippets/snippets.cc SYMRES */ void io::In_Parameter::read_SYMRES(simulation::Parameter & param, - std::ostream & os) { - DEBUG(8, "read SYMRES"); - - std::vector buffer; - std::string s; - - buffer = m_block["SYMRES"]; - - if (buffer.size()) { - block_read.insert("SYMRES"); - _lineStream.clear(); - _lineStream.str(concatenate(buffer.begin() + 1, buffer.end() - 1, s)); - - int enable; - double fc; - _lineStream >> enable >> fc; - if (_lineStream.fail()) { - io::messages.add("Bad line in SYMRES block.", - "In_Parameter", io::message::error); - return; - } - - switch(enable) { - case 0: - param.symrest.symrest = simulation::xray_symrest_off; - break; - case 1: - param.symrest.symrest = simulation::xray_symrest_ind; - break; - case 2: - param.symrest.symrest = simulation::xray_symrest_constr; - break; - default: - param.symrest.symrest = simulation::xray_symrest_off; - io::messages.add("SYMRES block: NTSYM must be 0..2.", - "In_Parameter", io::message::error); - return; - } - - - if (fc < 0.0) { - io::messages.add("SYMRES block: CSYM must be >= 0.0", - "In_Parameter", io::message::error); - return; - } - param.symrest.force_constant = fc; - - } // if block -} - + std::ostream & os) { + DEBUG(8, "reading SYMRES"); + + std::stringstream exampleblock; + // lines starting with 'exampleblock<<"' and ending with '\n";' (spaces don't matter) + // will be used to generate snippets that can be included in the doxygen doc; + // the first line is the tag + exampleblock << "SYMRES\n"; + exampleblock << "# NTSYM 0..2 apply symmetry restraints\n"; + exampleblock << "# 0: do not apply symmetry restraints (default)\n"; + exampleblock << "# 1: apply symmetry restraints\n"; + exampleblock << "# 2: apply symmetry constraints\n"; + exampleblock << "# CSYM >= 0.0 force constants\n"; + exampleblock << "#\n"; + exampleblock << "# NTSYM CSYM\n"; + exampleblock << " 1 0.0\n"; + exampleblock << "END\n"; + + std::string blockname = "SYMRES"; + Block block(blockname, exampleblock.str()); + + if (block.read_buffer(m_block[blockname], false) == 0) { + block_read.insert(blockname); + + int enable; + block.get_next_parameter("NTSYM", enable, "", "0,1,2"); + block.get_next_parameter("CSYM", param.symrest.force_constant, ">=0", ""); + + switch(enable) { + case 0: + param.symrest.symrest = simulation::xray_symrest_off; + break; + case 1: + param.symrest.symrest = simulation::xray_symrest_ind; + break; + case 2: + param.symrest.symrest = simulation::xray_symrest_constr; + break; + default: + break; + } + block.get_final_messages(); + } // if block +} // SYMRES diff --git a/gromosXX/src/io/parameter/in_parameter.h b/gromosXX/src/io/parameter/in_parameter.h index 652d5631b..d5e93e904 100644 --- a/gromosXX/src/io/parameter/in_parameter.h +++ b/gromosXX/src/io/parameter/in_parameter.h @@ -4,7 +4,7 @@ */ /** * @page input input file format - * + * * @date 28-10-2008 * * - @ref title @@ -95,7 +95,7 @@ namespace io { * Store standard parameters in the simulation. */ void read(simulation::Parameter ¶m, std::ostream & os = std::cout); - + /** * read energymin block. */ @@ -120,7 +120,7 @@ namespace io { * read FORCE block. */ void read_FORCE(simulation::Parameter ¶m, std::ostream & os = std::cout); - + /** * read COVALENTFORM block. */ @@ -145,7 +145,7 @@ namespace io { * read the PRESSURESCALE block. */ void read_PRESSURESCALE(simulation::Parameter ¶m, std::ostream & os = std::cout); - + /** * read the BOUNDCOND block. */ @@ -155,7 +155,7 @@ namespace io { * read the PERTURBATION block. */ void read_PERTURBATION(simulation::Parameter ¶m, std::ostream & os = std::cout); - + /** * read INITIALISE block. */ @@ -170,7 +170,7 @@ namespace io { * read HOOMD block. */ void read_HOOMD(simulation::Parameter ¶m, std::ostream & os = std::cout); - + /** * read PAIRLIST block. */ @@ -195,7 +195,7 @@ namespace io { * read DISTANCEFIELD block. */ void read_DISTANCEFIELD(simulation::Parameter ¶m, std::ostream & os = std::cout); - + /** * read DIHEDRALRES block. */ @@ -259,7 +259,7 @@ namespace io { * read INTEGRATE block. */ void read_INTEGRATE(simulation::Parameter & param, std::ostream & os = std::cout); - + /** * read STOCHDYN block. */ @@ -274,33 +274,33 @@ namespace io { * read MULTISTEP block. */ void read_MULTISTEP(simulation::Parameter & param, std::ostream & os = std::cout); - + /** - * read MONTECARLO block. + * read CHEMICALMONTECARLO block. */ - void read_MONTECARLO(simulation::Parameter & param, std::ostream & os = std::cout); - + void read_CHEMICALMONTECARLO(simulation::Parameter & param, std::ostream & os = std::cout); + /** * read RAND block. */ void read_RAMD(simulation::Parameter & param, std::ostream & os = std::cout); - + /** * read POLARISE block. */ void read_POLARISE(simulation::Parameter ¶m, std::ostream & os = std::cout); - + /** * read RANDOMNUMBERS block. */ void read_RANDOMNUMBERS(simulation::Parameter ¶m, std::ostream & os = std::cout); - + /** * read LAMBDAS block. */ void read_LAMBDAS(simulation::Parameter ¶m, std::ostream & os = std::cout); - /** ANITA + /** * read PRECALCLAM block. */ void read_PRECALCLAM(simulation::Parameter ¶m, std::ostream & os = std::cout); @@ -354,7 +354,7 @@ namespace io { */ void read_SYMRES(simulation::Parameter ¶m, std::ostream & os = std::cout); }; - + } // io #endif diff --git a/gromosXX/src/io/read_special.cc b/gromosXX/src/io/read_special.cc index e2a374ce9..1e2fda466 100644 --- a/gromosXX/src/io/read_special.cc +++ b/gromosXX/src/io/read_special.cc @@ -71,7 +71,7 @@ int io::read_special(io::Argument const & args, ip.quiet = quiet; ip.read(topo, sim, os); - io::messages.add("position restraints specifciation read from " + + io::messages.add("position restraints specification read from " + args["posresspec"] + "\n" + util::frame_text(ip.title), "read special", io::message::notice); } diff --git a/gromosXX/src/io/topology/in_bsleus.cc b/gromosXX/src/io/topology/in_bsleus.cc index 2afd3169e..7b6e409a9 100644 --- a/gromosXX/src/io/topology/in_bsleus.cc +++ b/gromosXX/src/io/topology/in_bsleus.cc @@ -213,8 +213,7 @@ void io::In_BSLEUS::read(topology::Topology &topo, return; } - std::vector::const_iterator it = buffer.begin() + 1, - to = buffer.end() - 1; + std::vector::const_iterator it = buffer.begin() + 1; DEBUG(10, "reading in BSLEUSSUB data"); _lineStream.clear(); _lineStream.str(*it++); diff --git a/gromosXX/src/io/topology/in_dihrest.cc b/gromosXX/src/io/topology/in_dihrest.cc index 665bd4121..ebf9ed3a8 100644 --- a/gromosXX/src/io/topology/in_dihrest.cc +++ b/gromosXX/src/io/topology/in_dihrest.cc @@ -23,288 +23,292 @@ #define SUBMODULE topology static std::set block_read; - -/** - * @section dihedralresspec DIHEDRALRESSPEC block - * This block is for unperturbed dihedrals restraints/constraints. It is read - * from the dihedral restraint specifcation file. - * - * @verbatim -DIHEDRALRESSPEC -# IPLR, JPLR, KPLR, LPLR atom sequence numbers of the atoms defining the -# restrained dihedral i-j-k-l -# WDLR individual dihedral restraint weight factor by which -# the harmonic dihedral restraining term may be multiplied. -# PDLR dihedral angle value (in degrees) at minimum energy of -# of the harmonic dihedral restraining term. -# DELTA deviation of the zero-energy dihedral angle value after -# which the restraint switches to the next periodic -# value. The dihedral angle is put in the interval -# [ PDLR + DELTA - 360 , PDLR + DELTA ] -# IPLR JPLR KPLR LPLR WDLR PDLR DELTA - 1 2 3 4 1.0 120.0 180.0 -END -@endverbatim - * - * @section pertdihresspec PERTDIHRESTSPEC block - * This block is for perturbed dihedral restraints/constraints. It is read from - * the dihedral restraints specification file. - * - * @verbatim -PERTDIHRESSPEC -# IPLR, JPLR, KPLR, LPLR atom sequence numbers of the atoms defining the -# restrained dihedral i-j-k-l -# APDLR dihedral angle value (in degrees) at minimum energy of the harmonic -# dihedral restraining term in state A. -# AWDLR individual dihedral restraint weight factor by which the harmonic -# dihedral restraining term may be multiplied in state A. -# BPDLR as APDLR, but for state B. -# BWDLR as AWDLR, but for state B. -# M hidden restraint parameter m and -# N hidden restraint parameter n of -# hidden restraint prefactor l^n*(1-l)^m. -# DELTA deviation of the zero-energy dihedral angle value after which the -# restraint switches to the next periodic value. The dihedral angle -# is put in the interval -# [ (1-RLAM)*APDLR + RLAM*BPDLR + DELTA - 360 , -# (1-RLAM)*APDLR + RLAM*BPDLR + DELTA ] -# -# IPLR JPLR KPLR LPLR M N DELTA APDLR AWDLR BPDLR BWDLR - 1 2 3 4 2 1 180.0 120.0 1.0 160.0 1.0 -END -@endverbatim - */ void io::In_Dihrest::read(topology::Topology& topo, - simulation::Simulation & sim, - std::ostream & os){ - + simulation::Simulation & sim, + std::ostream & os){ + DEBUG(7, "reading in a dihedral restraints file"); - bool found_restraints=false; - - - std::ostringstream oss; + + std::ostringstream oss; oss << "the dihedral is calculated from the nearest-image\n" << " vectors, you have to make sure that none of the vectors defining it become \n" << " longer than half the box length at any point during the simulations!\n"; io::messages.add(oss.str(), "in_dihedralres", io::message::warning); - + if (!quiet) os << "DIHEDRAL RESTRAINTS\n"; - - std::vector buffer; - - { // DIHEDRALRESSPEC - DEBUG(10, "DIHEDRALRESSPEC block"); - buffer = m_block["DIHEDRALRESSPEC"]; - - if (buffer.size()>0 && buffer.size()<=2){ - io::messages.add("empty DIHEDRALRESSPEC block in dihedral restraints file", - "in_dihedralres", io::message::warning); - } else if (buffer.size()>2) { - - found_restraints=true; - block_read.insert("DIHEDRALRESSPEC"); - - std::vector::const_iterator it = buffer.begin()+1, - to = buffer.end()-1; - - int i, j, k, l; - double delta, phi, w0; + + read_DIHEDRALRESSPEC(topo, sim, os); + read_PERTDIHRESSPEC(topo, sim, os); + + if (!quiet) os << "END\n"; + + if (sim.param().dihrest.dihrest) { + if (block_read.count("DIHEDRALRESSPEC") == 0 + && block_read.count("PERTDIHRESSPEC") == 0) + io::messages.add("DIHEDRAL restraints are on but neither DIHEDRALRESSPEC nor PERTDIHRESSPEC found", + "In_Dihrest", + io::message::error); + } + + for(std::map >::const_iterator + it = m_block.begin(), + to = m_block.end(); + it != to; + ++it){ + + if (block_read.count(it->first) == 0 && it->second.size()){ + io::messages.add("block " + it->first + " not supported!", + "In_Dihrest", + io::message::warning); + } + } + +} + +/** + * @section dihedralresspec DIHEDRALRESSPEC block + * This block is for unperturbed dihedrals restraints/constraints. It is read + * from the dihedral restraint specifcation file. + * @snippet snippets/snippets.cc DIHEDRALRESSPEC + */ + +void io::In_Dihrest::read_DIHEDRALRESSPEC(topology::Topology &topo, + simulation::Simulation &sim, + std::ostream & os) { // DIHEDRALRESSPEC + DEBUG(10, "DIHEDRALRESSPEC block"); + + std::stringstream exampleblock; + // lines starting with 'exampleblock<<"' and ending with '\n";' (spaces don't matter) + // will be used to generate snippets that can be included in the doxygen doc; + // the first line is the tag + exampleblock << "DIHEDRALRESSPEC\n"; + exampleblock << "# IPLR, JPLR, KPLR, LPLR atom sequence numbers of the atoms defining the\n"; + exampleblock << "# restrained dihedral i-j-k-l\n"; + exampleblock << "# WDLR individual dihedral restraint weight factor by which\n"; + exampleblock << "# the harmonic dihedral restraining term may be multiplied.\n"; + exampleblock << "# PDLR dihedral angle value (in degrees) at minimum energy\n"; + exampleblock << "# of the harmonic dihedral restraining term.\n"; + exampleblock << "# DELTA deviation of the zero-energy dihedral angle value after\n"; + exampleblock << "# which the restraint switches to the next periodic\n"; + exampleblock << "# value. The dihedral angle is put in the interval\n"; + exampleblock << "# [ PDLR + DELTA - 360 , PDLR + DELTA ]\n"; + exampleblock << "# IPLR JPLR KPLR LPLR WDLR PDLR DELTA\n"; + exampleblock << " 1 2 3 4 1.0 120.0 180.0\n"; + exampleblock << "END\n"; + + std::string blockname = "DIHEDRALRESSPEC"; + Block block(blockname, exampleblock.str()); + + if (block.read_buffer(m_block[blockname], false) == 0) { + block_read.insert(blockname); DEBUG(10, "reading in DIHREST data"); if (!quiet){ switch(sim.param().dihrest.dihrest){ - case simulation::dihedral_restr_off: - os << "\tDihedral restraints OFF\n"; - // how did you get here? - break; - case simulation::dihedral_restr_inst: - os << "\tDihedral restraints ON\n" - << "\t\t(uniform force constant K)\n"; - break; - case simulation::dihedral_restr_inst_weighted: - os << "\tDihedral restraints ON\n" - << "\t\t(force constant K*w0)\n"; - break; - case simulation::dihedral_constr: - os << "\tDihedral constraints ON\n"; - break; - default: - os << "\tDihedral restraints: ERROR\n"; - io::messages.add("wrong value for method in dihedral restraints block", - "in_dihedral", io::message::error); - return; + case simulation::dihedral_restr_off: + os << "\tDihedral restraints OFF\n"; + // how did you get here? + break; + case simulation::dihedral_restr_inst: + os << "\tDihedral restraints ON\n" + << "\t\t(uniform force constant K)\n"; + break; + case simulation::dihedral_restr_inst_weighted: + os << "\tDihedral restraints ON\n" + << "\t\t(force constant K*w0)\n"; + break; + case simulation::dihedral_constr: + os << "\tDihedral constraints ON\n"; + break; + default: + os << "\tDihedral restraints: ERROR\n"; + io::messages.add("wrong value for method in dihedral restraints block", + "in_dihedral", io::message::error); + return; } } - - if (!quiet){ - os << std::setw(10) << "i" - << std::setw(8) << "j" - << std::setw(8) << "k" - << std::setw(8) << "l" - << std::setw(8) << "delta" - << std::setw(8) << "phi" - << std::setw(8) << "w0" - << "\n"; + if (!quiet){ + os << std::setw(10) << "i" + << std::setw(8) << "j" + << std::setw(8) << "k" + << std::setw(8) << "l" + << std::setw(8) << "w0" + << std::setw(8) << "phi" + << std::setw(8) << "delta" + << "\n"; - os.precision(2); - os.setf(std::ios::fixed, std::ios::floatfield); + os.precision(2); + os.setf(std::ios::fixed, std::ios::floatfield); + } + + int i, j, k, l; + double delta, phi, w0; + + unsigned int num = block.numlines()-2; + for(unsigned int line_number=0; line_number < num; ++line_number){ + DEBUG(11, "\tnr " << line_number); + block.get_next_parameter("IPLR", i, ">0", ""); + block.get_next_parameter("JPLR", j, ">0", ""); + block.get_next_parameter("KPLR", k, ">0", ""); + block.get_next_parameter("LPLR", l, ">0", ""); + block.get_next_parameter("WDLR", w0, ">=0", ""); + block.get_next_parameter("PDLR", phi, "", ""); + block.get_next_parameter("DELTA", delta, "", ""); + + topo.dihedral_restraints().push_back +(topology::dihedral_restraint_struct(i-1, j-1, k-1, l-1, + delta * 2 * math::Pi / 360, phi * 2 * math::Pi / 360, w0)); + + if (!quiet){ + os << std::setw(10) << i + << std::setw(8) << j + << std::setw(8) << k + << std::setw(8) << l + << std::setw(8) << w0 + << std::setw(8) << phi + << std::setw(8) << delta + << "\n"; + } } - - for(int c=0; it != to; ++c, ++it){ - - DEBUG(11, "\tnr " << c); - - _lineStream.clear(); - _lineStream.str(*it); - - _lineStream >> i >> j >> k >> l >> w0 >> phi >> delta; - if(_lineStream.fail()){ - io::messages.add("bad line in DIHREST block", - "In_Dihrest", io::message::error); - } - - topo.dihedral_restraints().push_back - (topology::dihedral_restraint_struct(i-1, j-1, k-1, l-1, - delta * 2 * math::Pi / 360, phi * 2 * math::Pi / 360, w0)); - - if (!quiet){ - os << std::setw(10) << i - << std::setw(8) << j - << std::setw(8) << k - << std::setw(8) << l - << std::setw(8) << delta - << std::setw(8) << phi - << std::setw(8) << w0 - << "\n"; - } - } + block.get_final_messages(); } // if block empty or not there - } // DIHREST - - { // PERTDIHESPEC - DEBUG(10, "PERTDIHRESSPEC block"); - buffer = m_block["PERTDIHRESSPEC"]; - - block_read.insert("PERTDIHRESSPEC"); - - if (buffer.size()>0 && buffer.size()<=2){ - io::messages.add("empty PERTDIHRESSPEC block in dihedral restraints file", - "in_dihedralres", io::message::warning); - } else if (buffer.size()>2) { - found_restraints=true; - +} // DIHREST + + +/** +* @section pertdihresspec PERTDIHRESSPEC block +* This block is for perturbed dihedral restraints/constraints. It is read from +* the dihedral restraints specification file. +* @snippet snippets/snippets.cc PERTDIHRESSPEC +*/ +void io::In_Dihrest::read_PERTDIHRESSPEC(topology::Topology &topo, + simulation::Simulation &sim, + std::ostream & os) { // PERTDIHRESPEC + DEBUG(10, "PERTDIHRESSPEC block"); + + std::stringstream exampleblock; + // lines starting with 'exampleblock<<"' and ending with '\n";' (spaces don't matter) + // will be used to generate snippets that can be included in the doxygen doc; + // the first line is the tag + exampleblock << "PERTDIHRESSPEC\n"; + exampleblock << "# IPLR, JPLR, KPLR, LPLR atom sequence numbers of the atoms defining the\n"; + exampleblock << "# restrained dihedral i-j-k-l\n"; + exampleblock << "# APDLR dihedral angle value (in degrees) at minimum energy of the harmonic\n"; + exampleblock << "# dihedral restraining term in state A.\n"; + exampleblock << "# AWDLR individual dihedral restraint weight factor by which the harmonic\n"; + exampleblock << "# dihedral restraining term may be multiplied in state A.\n"; + exampleblock << "# BPDLR as APDLR, but for state B.\n"; + exampleblock << "# BWDLR as AWDLR, but for state B.\n"; + exampleblock << "# M hidden restraint parameter m and\n"; + exampleblock << "# N hidden restraint parameter n of\n"; + exampleblock << "# hidden restraint prefactor l^n*(1-l)^m.\n"; + exampleblock << "# DELTA deviation of the zero-energy dihedral angle value after which the\n"; + exampleblock << "# restraint switches to the next periodic value. The dihedral angle\n"; + exampleblock << "# is put in the interval\n"; + exampleblock << "# [ (1-RLAM)*APDLR + RLAM*BPDLR + DELTA - 360 ,\n"; + exampleblock << "# (1-RLAM)*APDLR + RLAM*BPDLR + DELTA ]\n"; + exampleblock << "#\n"; + exampleblock << "# IPLR JPLR KPLR LPLR M N DELTA APDLR AWDLR BPDLR BWDLR\n"; + exampleblock << " 1 2 3 4 2 1 180.0 120.0 1.0 160.0 1.0\n"; + exampleblock << "END\n"; + + std::string blockname = "PERTDIHRESSPEC"; + Block block(blockname, exampleblock.str()); + + if (block.read_buffer(m_block[blockname], false) == 0) { + block_read.insert(blockname); + sim.param().perturbation.perturbed_par=true; - std::vector::const_iterator it = buffer.begin()+1, - to = buffer.end()-1; - int i, j, k, l, m, n; - double delta, A_phi, A_w0, B_phi, B_w0; - - DEBUG(10, "reading in perturbed DIHREST (PERTDIHRESSPEC data"); + DEBUG(10, "reading in perturbed DIHREST (PERTDIHRESSPEC data"); - if (!quiet){ - switch(sim.param().dihrest.dihrest){ - case 0: - os << "\tPerturbed Dihedral restraints OFF\n"; - // how did you get here? - break; - case 1: - os << "\tPerturbed Dihedral restraints ON\n" - << "\t\t(using uniform force constant K\n"; - break; - case 2: - os << "\tPerturbed Dihedral restraints ON\n" - << "\t\t(using force constant K*w0)\n"; - break; - case 3: - os << "\tPerturbed Dihedral constraints ON\n"; - break; - default: - os << "\tPerturbed Dihedral restraints ERROR\n"; - io::messages.add("wrong method for dihedral restraints", - "in_dihrest", io::message::error); - return; - } + if (!quiet){ + switch(sim.param().dihrest.dihrest){ + case 0: + os << "\tPerturbed Dihedral restraints OFF\n"; + // how did you get here? + break; + case 1: + os << "\tPerturbed Dihedral restraints ON\n" + << "\t\t(using uniform force constant K\n"; + break; + case 2: + os << "\tPerturbed Dihedral restraints ON\n" + << "\t\t(using force constant K*w0)\n"; + break; + case 3: + os << "\tPerturbed Dihedral constraints ON\n"; + break; + default: + os << "\tPerturbed Dihedral restraints ERROR\n"; + io::messages.add("wrong method for dihedral restraints", + "in_dihrest", io::message::error); + return; } + } - if (!quiet){ - os << std::setw(10) << "i" - << std::setw(8) << "j" - << std::setw(8) << "k" - << std::setw(8) << "l" - << std::setw(8) << "m" - << std::setw(8) << "n" - << std::setw(8) << "delta" - << std::setw(8) << "A_phi" - << std::setw(8) << "A_w0" - << std::setw(8) << "B_phi" - << std::setw(8) << "B_w0" - << "\n"; + if (!quiet){ + os << std::setw(10) << "i" + << std::setw(8) << "j" + << std::setw(8) << "k" + << std::setw(8) << "l" + << std::setw(8) << "m" + << std::setw(8) << "n" + << std::setw(8) << "delta" + << std::setw(8) << "A_phi" + << std::setw(8) << "A_w0" + << std::setw(8) << "B_phi" + << std::setw(8) << "B_w0" + << "\n"; os.precision(2); os.setf(std::ios::fixed, std::ios::floatfield); - } - - for(int c=0; it != to; ++c, ++it){ - - DEBUG(11, "\tnr " << c); - - _lineStream.clear(); - _lineStream.str(*it); - - _lineStream >> i >> j >> k >> l >> m >> n; - _lineStream >> delta >> A_phi >> A_w0 >> B_phi >> B_w0; - - if(_lineStream.fail()){ - io::messages.add("bad line in PERTDIHRESSPEC block", - "In_Dihrest", io::message::error); - } + } + + int i, j, k, l, m, n; + double delta, A_phi, A_w0, B_phi, B_w0; - topo.perturbed_dihedral_restraints().push_back - (topology::perturbed_dihedral_restraint_struct(i-1, j-1, k-1, l-1, m, n, delta * 2 * math::Pi / 360, - A_phi * 2 * math::Pi / 360, A_w0, - B_phi * 2 * math::Pi / 360, B_w0 )); + unsigned int num = block.numlines()-2; + for(unsigned int line_number=0; line_number < num; ++line_number){ + + DEBUG(11, "\tnr " << line_number); + block.get_next_parameter("IPLR", i, ">0", ""); + block.get_next_parameter("JPLR", j, ">0", ""); + block.get_next_parameter("KPLR", k, ">0", ""); + block.get_next_parameter("LPLR", l, ">0", ""); + block.get_next_parameter("M", m, ">0", ""); + block.get_next_parameter("N", n, ">0", ""); + block.get_next_parameter("DELTA", delta, "", ""); + block.get_next_parameter("APDLR", A_phi, "", ""); + block.get_next_parameter("AWDLR", A_w0, ">=0", ""); + block.get_next_parameter("BPDLR", B_phi, "", ""); + block.get_next_parameter("BWDLR", B_w0, ">=0", ""); + + topo.perturbed_dihedral_restraints().push_back +(topology::perturbed_dihedral_restraint_struct(i-1, j-1, k-1, l-1, m, n, delta * 2 * math::Pi / 360, + A_phi * 2 * math::Pi / 360, A_w0, + B_phi * 2 * math::Pi / 360, B_w0 )); if (!quiet){ - os << std::setw(10) << i - << std::setw(8) << j - << std::setw(8) << k - << std::setw(8) << l - << std::setw(8) << m - << std::setw(8) << n - << std::setw(8) << delta - << std::setw(8) << A_phi - << std::setw(8) << A_w0 - << std::setw(8) << B_phi - << std::setw(8) << B_w0 - << "\n"; + os << std::setw(10) << i + << std::setw(8) << j + << std::setw(8) << k + << std::setw(8) << l + << std::setw(8) << m + << std::setw(8) << n + << std::setw(8) << delta + << std::setw(8) << A_phi + << std::setw(8) << A_w0 + << std::setw(8) << B_phi + << std::setw(8) << B_w0 + << "\n"; } - } - - if (!quiet) os << "END\n"; - } - } // PERTDIHRESPEC - - for(std::map >::const_iterator - it = m_block.begin(), - to = m_block.end(); - it != to; - ++it){ - - if (block_read.count(it->first) == 0 && it->second.size()){ - io::messages.add("block " + it->first + " not supported!", - "In_Dihrest", - io::message::warning); - } - } - - if (!found_restraints) { - io::messages.add("no valid restraint block in dihedral restraints file", - "in_dihedralres", io::message::error); + + block.get_final_messages(); } -} +} // PERTDIHRESSPEC diff --git a/gromosXX/src/io/topology/in_dihrest.h b/gromosXX/src/io/topology/in_dihrest.h index dfe3af437..891ee053a 100644 --- a/gromosXX/src/io/topology/in_dihrest.h +++ b/gromosXX/src/io/topology/in_dihrest.h @@ -40,6 +40,13 @@ namespace io { void read(topology::Topology &topo, simulation::Simulation & sim, std::ostream & os = std::cout); + + void read_DIHEDRALRESSPEC(topology::Topology &topo, + simulation::Simulation &sim, + std::ostream & os); + void read_PERTDIHRESSPEC(topology::Topology &topo, + simulation::Simulation &sim, + std::ostream & os); }; } // io diff --git a/gromosXX/src/io/topology/in_distanceres.cc b/gromosXX/src/io/topology/in_distanceres.cc index 4172556a0..b82be8179 100644 --- a/gromosXX/src/io/topology/in_distanceres.cc +++ b/gromosXX/src/io/topology/in_distanceres.cc @@ -24,6 +24,56 @@ static std::set block_read; + +void +io::In_Distanceres::read(topology::Topology& topo, + simulation::Simulation & sim, + std::ostream & os){ + + DEBUG(7, "reading in a distance restraints file"); + + if (!quiet) + os << "DISTANCE RESTRAINTS\n"; + + read_DISTANCERESSPEC(topo, sim, os); + read_PERTDISRESSPEC(topo, sim, os); + read_DFRESSPEC(topo, sim, os); + read_PERTDFRESSPEC(topo, sim, os); + read_MDISRESSPEC(topo, sim, os); + + if (!quiet) os << "END\n"; + + if (sim.param().distanceres.distanceres) { + if (block_read.count("DISTANCERESSPEC") == 0 + && block_read.count("PERTDISRESSPEC") == 0 + && block_read.count("MDISRESSPEC") == 0) + io::messages.add("Distance restraints are on but neither DISTANCERESSPEC nor PERTDISRESSPEC nor MDISRESSPEC found", + "In_Distanceres", + io::message::error); + } + if (sim.param().distancefield.distancefield) { + if (block_read.count("DFRESSPEC") == 0 + && block_read.count("PERTDFRESSPEC") == 0) + io::messages.add("DF restraints on but neither DFRESSPEC nor PERTDFRESSPEC found", + "In_Distanceres", + io::message::error); + } + + for(std::map >::const_iterator + it = m_block.begin(), + to = m_block.end(); + it != to; + ++it){ + + if (block_read.count(it->first) == 0 && it->second.size()){ + io::messages.add(" block " + it->first + " not supported!", + "In_Distanceres", + io::message::warning); + } + } + +} + /** * @section distanceresspec DISTANCERESSPEC block * The DISTANCERESSPEC block is read from the distance restraints specification @@ -50,156 +100,53 @@ static std::set block_read; * - rah = dim: full harmonic distance restraint * - rah = dim + 1: half harmonic attractive distance restraint * - * @verbatim -DISTANCERESSPEC -# DISH DISC - 0.1 0.153 -# i j k l type i j k l type r0 w0 rah - 1 0 0 0 0 10 12 11 13 3 0.2 1.0 0 -END -@endverbatim - * @sa util::virtual_type util::Virtual_Atom - * - * @section pertdisresspec PERTDISRESSPEC block - * The PERTDISRESSPEC block is read from the distance restraints specification - * file and used for perturbed distance restraints and hidden - * restraints. - * - * The format is very similar to the @ref distanceresspec with the difference that - * one may give values for the A and the B state. The two variables \c n and - * \c m are the parameters for the hidden restraints. - * - * See: - * - M. Christen, A.-P.E. Kunz, W.F. van Gunsteren, Sampling of rare events - * using hidden restraints, J. Phys. Chem. B 110 (2006) 8488-8498 - * - * @verbatim -PERTDISRESSPEC -# DISH DISC - 0.1 0.153 -# i j k l type i j k l type n m A_r0 A_w0 B_r0 B_w0 rah - 1 0 0 0 0 10 12 11 13 3 1 1 0.2 1.0 0.5 2.0 0 -END -@endverbatim + * @todo add documentation for further rah values for restraining only x,y,z or combinations * - * @section mdisresspec MDISRESSPEC block - * The MDISRESSPEC block is read from the distance restraints specification - * file and used for EDS restraints. - * - * The format is very similar to the @ref distanceresspec with the difference that - * one may give values for multipde states. - * @verbatim -MDISRESSPEC -# DISH DISC - 0.1 0.153 -# N: number of eds states (3 in this example) -# i j k l type i j k l type r0[1 ... N] w0[1 ... N] rah - 1 0 0 0 0 10 12 11 13 3 0.2 0.2 0.2 1.0 0.0 0.0 0 - 5 0 0 0 0 10 12 11 13 3 0.2 0.2 0.2 0.0 1.0 0.0 0 - 8 0 0 0 0 10 12 11 13 3 0.2 0.2 0.2 0.0 0.0 1.0 0 -END -@endverbatim - * - * @section dfresspec DFRESSPEC block - * The DFRESSPEC block is read from the distance restraints specification - * file and used for distancefield restraints. - * - * See: - * - A. de Ruiter and C. Oostenbrink, Protein-ligand binding from distancefield - * distances and Hamiltonian replica exchange simulations, J. Chem. Theory - * Comp. 9 (2013) 883 - 892, doi: 10.1021/ct300967a - * - *@verbatim -DFRESSPEC -# DISH H-C bond length for virtual atoms -# DISC C-C bond length for virtual atoms -# PROTEINATOMS > 0 last atom of the host -# K >= 0.0 Force constant -# r0 >=0 zero energy distance -# TYPE_I Virtual atom type for interaction site I -# NUM_I Number of atoms defining interaction site I -# ATOM_I[0..NUM_I] Index numbers of atoms defining interaction site I -# TYPE_J Virtual atom type for interaction site J -# NUM_J Number of atoms defining interaction site J -# ATOM_J[0..NUM_J] Index numbers of atoms defining interaction site J -# DISH DISC - 0.1 0.153 -# PROTEINATOMS K r0 - 1190 500 0.0 -# TYPE_I NUM_I ATOM_I[0] .. ATOM_I[NUM_I] - -1 7 16 190 249 312 486 632 1208 -# TYPE_J NUM_J ATOM_J[0] .. ATOM_J[NUM_J] - -1 2 1194 1203 -END -@endverbatim - * - * @section pertdfresspec PERTDFRESSPEC block - * The PERTDFRESSPEC block is read from the distance restraints specification - * file and used for perturbed distancefield restraints. - * - * See: - * - A. de Ruiter and C. Oostenbrink, Protein-ligand binding from distancefield - * distances and Hamiltonian replica exchange simulations, J. Chem. Theory - * Comp. 9 (2013) 883 - 892, doi: 10.1021/ct300967a - * - *@verbatim -PERTDFRESSPEC -# DISH H-C bond length for virtual atoms -# DISC C-C bond length for virtual atoms -# PROTEINATOMS > 0 last atom of the host -# A_r0 >=0 reference distance for state A -# B_r0 >=0 reference distance for state B -# K_A >= 0 force constant state A -# K_B >= 0 force constant state B -# n >= 0 hidden restraint parameter n -# m >= 0 hidden restraint parameter m -# TYPE_I Virtual atom type for interaction site I -# NUM_I Number of atoms defining interaction site I -# ATOM_I[0..NUM_I] Index numbers of atoms defining interaction site I -# TYPE_J Virtual atom type for interaction site J -# NUM_J Number of atoms defining interaction site J -# ATOM_J[0..NUM_J] Index numbers of atoms defining interaction site J -# DISH DISC - 0.1 0.153 -# PROTEINATOMS A_r0 K_A B_r0 K_B n m - 1190 4.5 500 0.0 500 0 0 -# TYPE_I NUM_I ATOM_I[0] .. ATOM_I[NUM_I] - -1 7 16 190 249 312 486 632 1208 -# TYPE_J NUM_J ATOM_J[0] .. ATOM_J[NUM_J] - -1 2 1194 1203 -END -@endverbatim + * @snippet snippets/snippets.cc DISTANCERESSPEC + * @sa util::virtual_type util::Virtual_Atom */ -void -io::In_Distanceres::read(topology::Topology& topo, - simulation::Simulation & sim, - std::ostream & os){ - - DEBUG(7, "reading in a distance restraints file"); +void io::In_Distanceres::read_DISTANCERESSPEC(topology::Topology &topo, + simulation::Simulation &sim, + std::ostream & os) { // DISTANCERES + DEBUG(10, "DISTANCERESSPEC block"); - if (!quiet) - os << "DISTANCE RESTRAINTS\n"; - - std::vector buffer; - - { // DISTANCERES - DEBUG(10, "DISTANCERESSPEC block"); - buffer = m_block["DISTANCERESSPEC"]; - block_read.insert("DISTANCERESSPEC"); - if (buffer.size()<=2){ - io::messages.add("no or empty DISTANCERESSPEC block in distance restraints file", - "in_distanceres", io::message::warning); - } - else{ - std::vector::const_iterator it = buffer.begin()+1, - to = buffer.end()-1; - - double dish,disc; - bool nr_atoms=true; - - DEBUG(10, "reading in DISTANCERES data"); - - if (!quiet) { + std::stringstream exampleblock; + // lines starting with 'exampleblock<<"' and ending with '\n";' (spaces don't matter) + // will be used to generate snippets that can be included in the doxygen doc; + // the first line is the tag + exampleblock << "DISTANCERESSPEC\n"; + exampleblock << "# DISH, DISC carbon-hydrogen/carbon-carbon distance\n"; + exampleblock << "# i,j,k,l atoms comprising the virtual atom (put 0 if less than four atoms in use)\n"; + exampleblock << "# type virtual atom type\n"; + exampleblock << "# r0, w0 target distance and force constant weighting factor\n"; + exampleblock << "# rah form and dimension of the potential\n"; + exampleblock << "# full harmonic:\n"; + exampleblock << "# 0: x,y,z\n"; + exampleblock << "# 10: x,y\n"; + exampleblock << "# 20: x,z\n"; + exampleblock << "# 30: y,z\n"; + exampleblock << "# 40: x\n"; + exampleblock << "# 50: y\n"; + exampleblock << "# 60: z\n"; + exampleblock << "# subtract or add 1 from these numbers to select a half harmonic\n"; + exampleblock << "# repulsive or attractive potential\n"; + exampleblock << "# DISH DISC\n"; + exampleblock << " 0.1 0.153\n"; + exampleblock << "# i j k l type i j k l type r0 w0 rah\n"; + exampleblock << " 1 0 0 0 0 10 12 11 13 3 0.2 1.0 0\n"; + exampleblock << "END\n"; + + std::string blockname = "DISTANCERESSPEC"; + Block block(blockname, exampleblock.str()); + + if (block.read_buffer(m_block[blockname], false) == 0) { + block_read.insert(blockname); + + double dish,disc; + + DEBUG(10, "reading in DISTANCERES data"); + + if (!quiet) { switch (sim.param().distanceres.distanceres) { case 0: os << "\tDistance restraints OFF\n"; @@ -224,683 +171,677 @@ io::In_Distanceres::read(topology::Topology& topo, default: os << "\tDistance restraints ERROR\n"; } + } + + block.get_next_parameter("DISH", dish, ">0", ""); + block.get_next_parameter("DISC", disc, ">0", ""); + + if (!quiet){ + os << std::setw(10) << "DISH" + << std::setw(10) << "DISC" + << "\n" + << std::setw(10)<< dish + << std::setw(10)<< disc + << "\n"; + + os << std::setw(10) << "i" + << std::setw(8) << "j" + << std::setw(8) << "k" + << std::setw(8) << "l" + << std::setw(5) << "type" + << std::setw(10) << "i" + << std::setw(8) << "j" + << std::setw(8) << "k" + << std::setw(8) << "l" + << std::setw(5) << "type" + << std::setw(8) << "r0" + << std::setw(8) << "w0" + << std::setw(4) << "rah" + << "\n"; } - - _lineStream.clear(); - _lineStream.str(*it); - - - _lineStream >> dish >> disc; - - if(_lineStream.fail()){ - std::ostringstream msg; - msg << "bad line in DISTANCERESSPEC block: failed to read in DISH and DISC" << std::endl; - io::messages.add(msg.str(), - "In_Distanceres", - io::message::error); + unsigned int num = block.numlines()-3; + for(unsigned int line_number=0; line_number < num; line_number++){ + + DEBUG(11, "\tnr " << line_number); + + int type1, type2; + std::vector atom1, atom2; + double r0,w0; + int rah; + + for(unsigned int i = 0; i < io::In_Distanceres::MAX_ATOMS; i++) { + unsigned int atom; + std::string str_i = io::to_string(i); + block.get_next_parameter("ATOM["+str_i+"]", atom, ">=0", ""); + if (atom > topo.num_atoms()) { + std::ostringstream msg; + msg << blockname << " block: atom number out of range: " << atom << ", last atom is "<< topo.num_atoms(); + io::messages.add(msg.str(), "In_Distanceres", io::message::error); + } + + // -1 because we directly convert to array indices + if (atom > 0) atom1.push_back(atom - 1); } - - - ++it; - - if (!quiet){ - os << std::setw(10) << "DISH" - << std::setw(10) << "DISC" - << "\n" - << std::setw(10)<< dish - << std::setw(10)<< disc - << "\n"; - - os << std::setw(10) << "i" - << std::setw(8) << "j" - << std::setw(8) << "k" - << std::setw(8) << "l" - << std::setw(5) << "type" - << std::setw(10) << "i" - << std::setw(8) << "j" - << std::setw(8) << "k" - << std::setw(8) << "l" - << std::setw(5) << "type" - << std::setw(8) << "r0" - << std::setw(8) << "w0" - << std::setw(4) << "rah" - << "\n"; + block.get_next_parameter("TYPE", type1, "", "-2,-1,0,1,2,3,4,5,6,7"); + + for(unsigned int i = 0; i < io::In_Distanceres::MAX_ATOMS; i++) { + unsigned int atom; + std::string str_i = io::to_string(i); + block.get_next_parameter("ATOM["+str_i+"]", atom, ">=0", ""); + if (atom > topo.num_atoms()) { + std::ostringstream msg; + msg << blockname << " block: atom number out of range: " << atom << ", last atom is "<< topo.num_atoms(); + io::messages.add(msg.str(), "In_Distanceres", io::message::error); + } + + // -1 because we directly convert to array indices + if (atom > 0) atom2.push_back(atom - 1); } - - for(unsigned int line_number=2; it != to; ++line_number, ++it){ - - DEBUG(11, "\tnr " << line_number - 2); - - int type1, type2; - std::vector atom1, atom2; - double r0,w0; - int rah; - - _lineStream.clear(); - _lineStream.str(*it); - - for(unsigned int i = 0; i < io::In_Distanceres::MAX_ATOMS; i++) { - int atom; - _lineStream >> atom; - // -1 because we directly convert to array indices - if (atom > 0) atom1.push_back(atom - 1); - else if (atom <0){ - std::ostringstream msg; - msg << "COM and COG type not possible for more than " - << io::In_Distanceres::MAX_ATOMS << " atoms" << std::endl; - io::messages.add(msg.str(), - "In_Distanceres", - io::message::error); - nr_atoms=false; - } - } - _lineStream >> type1; - - for(unsigned int i = 0; i < io::In_Distanceres::MAX_ATOMS; i++) { - int atom; - _lineStream >> atom; - if (atom > 0) atom2.push_back(atom - 1); - else if (atom <0){ - std::ostringstream msg; - msg << "COM and COG type not possible for more than " - << io::In_Distanceres::MAX_ATOMS << " atoms" << std::endl; - io::messages.add(msg.str(), - "In_Distanceres", - io::message::error); - nr_atoms=false; + block.get_next_parameter("TYPE", type2, "", "-2,-1,0,1,2,3,4,5,6,7"); + + block.get_next_parameter("R0", r0, ">=0", ""); + block.get_next_parameter("W0", w0, ">=0", ""); + block.get_next_parameter("RAH", rah, "", ""); + + // g++ 3.2 fix + if(!block.error()){ + util::virtual_type t1 = util::virtual_type(type1); + util::virtual_type t2 = util::virtual_type(type2); + + util::Virtual_Atom v1(t1, atom1, dish, disc); + util::Virtual_Atom v2(t2, atom2, dish, disc); + + topo.distance_restraints().push_back + (topology::distance_restraint_struct(v1,v2,r0,w0,rah)); + + if (!quiet){ + for(unsigned int i = 0; i < io::In_Distanceres::MAX_ATOMS; i++) { + // the first element has the width 10, if i is bigger then the number of atoms + // specified, just print 0. + os << std::setw(i == 0 ? 10 : 8) << (i < atom1.size() ? atom1[i]+1 : 0); } - - } - _lineStream >> type2; - - _lineStream >> r0>> w0 >> rah; - - - if(_lineStream.fail()){ - std::ostringstream msg; - msg << "bad line in DISTANCERESSPEC block: " << line_number << std::endl - << " " << *it; - io::messages.add(msg.str(), - "In_Distanceres", - io::message::error); - } - - // g++ 3.2 fix - if( nr_atoms){ - util::virtual_type t1 = util::virtual_type(type1); - util::virtual_type t2 = util::virtual_type(type2); - - util::Virtual_Atom v1(t1, atom1, dish, disc); - util::Virtual_Atom v2(t2, atom2, dish, disc); - - - topo.distance_restraints().push_back - (topology::distance_restraint_struct(v1,v2,r0,w0,rah)); - - if (!quiet){ - for(unsigned int i = 0; i < io::In_Distanceres::MAX_ATOMS; i++) { - // the first element has the width 10, if i is bigger then the number of atoms - // specified, just print 0. - os << std::setw(i == 0 ? 10 : 8) << (i < atom1.size() ? atom1[i]+1 : 0); - } - os << std::setw(5) << type1; - - for(unsigned int i = 0; i < io::In_Distanceres::MAX_ATOMS; i++) { - os << std::setw(i == 0 ? 10 : 8) << (i < atom2.size() ? atom2[i]+1 : 0); - } - os << std::setw(5) << type2 - << std::setw(8) << r0 - << std::setw(8) << w0 - << std::setw(4) << rah - << "\n"; + os << std::setw(5) << type1; + + for(unsigned int i = 0; i < io::In_Distanceres::MAX_ATOMS; i++) { + os << std::setw(i == 0 ? 10 : 8) << (i < atom2.size() ? atom2[i]+1 : 0); } - } + os << std::setw(5) << type2 + << std::setw(8) << r0 + << std::setw(8) << w0 + << std::setw(4) << rah + << "\n"; + } } + } // for restraints + block.get_final_messages(); + } // if block content +} // DISTANCERES + +/** + * @section pertdisresspec PERTDISRESSPEC block + * The PERTDISRESSPEC block is read from the distance restraints specification + * file and used for perturbed distance restraints and hidden + * restraints. + * + * The format is very similar to the @ref distanceresspec with the difference that + * one may give values for the A and the B state. The two variables \c n and + * \c m are the parameters for the hidden restraints. + * + * See: + * - M. Christen, A.-P.E. Kunz, W.F. van Gunsteren, Sampling of rare events + * using hidden restraints, J. Phys. Chem. B 110 (2006) 8488-8498 + * + * @snippet snippets/snippets.cc PERTDISRESSPEC + */ +void io::In_Distanceres::read_PERTDISRESSPEC(topology::Topology &topo, + simulation::Simulation &sim, + std::ostream & os) { // PERTDISRESPEC + DEBUG(10, "PERTDISRESSPEC block"); + + std::stringstream exampleblock; + // lines starting with 'exampleblock<<"' and ending with '\n";' (spaces don't matter) + // will be used to generate snippets that can be included in the doxygen doc; + // the first line is the tag + exampleblock << "PERTDISRESSPEC\n"; + exampleblock << "# DISH DISC\n"; + exampleblock << " 0.1 0.153\n"; + exampleblock << "# i j k l type i j k l type n m A_r0 A_w0 B_r0 B_w0 rah\n"; + exampleblock << " 1 0 0 0 0 10 12 11 13 3 1 1 0.2 1.0 0.5 2.0 0\n"; + exampleblock << "END\n"; + + + std::string blockname = "PERTDISRESSPEC"; + Block block(blockname, exampleblock.str()); + + if (block.read_buffer(m_block[blockname], false) == 0) { + block_read.insert(blockname); + + if (!sim.param().perturbation.perturbation) { + io::messages.add("Perturbation is off but found a "+blockname+" block", + "in_distanceres", io::message::warning); + return; } - - } // DISTANCERES - - { // PERTDISRESPEC DISTANCERES - DEBUG(10, "PERTDISRESSPEC block"); - buffer = m_block["PERTDISRESSPEC"]; - - block_read.insert("PERTDISRESSPEC"); - - // we don't have a PERTDISRESSPEC block - if (!buffer.size()){ - } - // check whether there is s.th. in the block - else if (buffer.size()<=2){ - io::messages.add("empty PERTDISRESSPEC block in distance restraints file", - "in_distanceres", io::message::warning); - } - else{ - sim.param().perturbation.perturbed_par=true; - std::vector::const_iterator it = buffer.begin()+1, - to = buffer.end()-1; - - double dish, disc; - bool nr_atoms=true; - - DEBUG(10, "reading in DISTANCERES (PERTDISRESSPEC) data"); - - if (!quiet){ - switch(sim.param().distanceres.distanceres){ - case 0: - os << "\tPerturbed Distance restraints OFF\n"; - // how did you get here? - break; - case 1: - os << "\tPerturbed Distance restraints ON\n"; - break; - case -1: - os << "\tPerturbed Distance restraints ON\n" + sim.param().perturbation.perturbed_par=true; + + DEBUG(10, "reading in DISTANCERES (PERTDISRESSPEC) data"); + + if (!quiet){ + switch(sim.param().distanceres.distanceres){ + case 0: + os << "\tPerturbed Distance restraints OFF\n"; + // how did you get here? + break; + case 1: + os << "\tPerturbed Distance restraints ON\n"; + break; + case -1: + os << "\tPerturbed Distance restraints ON\n" << "\t\ttime-averaging ON\n"; - break; - case 2: - os << "\tPerturbed Distance restraints ON\n" - << "\t\t(using force constant K*w0)\n"; - break; - case -2: - os << "\tPerturbed Distance restraints ON\n" + break; + case 2: + os << "\tPerturbed Distance restraints ON\n" + << "\t\t(using force constant K*w0)\n"; + break; + case -2: + os << "\tPerturbed Distance restraints ON\n" << "\t\ttime-averaging ON\n" - << "\t\t(using force constant K*w0)\n"; - break; - default: - os << "\tPerturbed Distance restraints ERROR\n"; - } - } - - _lineStream.clear(); - _lineStream.str(*it); - - _lineStream >> dish >> disc ; - - if(_lineStream.fail()){ - std::ostringstream msg; - msg << "bad line in PERTDISRESSPEC block: failed to read in DISH and DISC" << std::endl; - io::messages.add(msg.str(), - "In_Distanceres", - io::message::error); + << "\t\t(using force constant K*w0)\n"; + break; + default: + os << "\tPerturbed Distance restraints ERROR\n"; + } + } + + double dish, disc; + block.get_next_parameter("DISH", dish, ">0", ""); + block.get_next_parameter("DISC", disc, ">0", ""); + + if (!quiet){ + os << std::setw(10) << "DISH" + << std::setw(10) << "DISC" + << "\n" + << std::setw(10)<< dish + << std::setw(10)<< disc + << "\n"; + + os << std::setw(10) << "i" + << std::setw(8) << "j" + << std::setw(8) << "k" + << std::setw(8) << "l" + << std::setw(5) << "type" + << std::setw(10) << "i" + << std::setw(8) << "j" + << std::setw(8) << "k" + << std::setw(8) << "l" + << std::setw(5) << "type" + << std::setw(5) << "n" + << std::setw(5) << "m" + << std::setw(8) << "A_r0" + << std::setw(8) << "A_w0" + << std::setw(8) << "B_r0" + << std::setw(8) << "B_w0" + << std::setw(4) << "rah" + << "\n"; + } + + unsigned int num = block.numlines()-3; + for(unsigned int line_number=0; line_number < num; ++line_number){ + + DEBUG(11, "\tnr " << line_number-2); + + int type1, type2; + int n,m; + std::vector atom1, atom2; + double A_r0, B_r0, A_w0, B_w0; + int rah; + + for(unsigned int i = 0; i < io::In_Distanceres::MAX_ATOMS; i++) { + unsigned int atom; + std::string str_atom = io::to_string(i); + block.get_next_parameter("ATOM["+str_atom+"]", atom, ">=0", ""); + if (atom > topo.num_atoms()) { + std::ostringstream msg; + msg << blockname << " block: atom number out of range: " << atom << ", last atom is "<< topo.num_atoms(); + io::messages.add(msg.str(), "In_Distanceres", io::message::error); + } + + if (atom > 0) atom1.push_back(atom - 1); } - - ++it; - if (!quiet){ - os << std::setw(10) << "DISH" - << std::setw(10) << "DISC" - << "\n" - << std::setw(10)<< dish - << std::setw(10)<< disc - << "\n"; - - os << std::setw(10) << "i" - << std::setw(8) << "j" - << std::setw(8) << "k" - << std::setw(8) << "l" - << std::setw(5) << "type" - << std::setw(10) << "i" - << std::setw(8) << "j" - << std::setw(8) << "k" - << std::setw(8) << "l" - << std::setw(5) << "type" - << std::setw(5) << "n" - << std::setw(5) << "m" - << std::setw(8) << "A_r0" - << std::setw(8) << "A_w0" - << std::setw(8) << "B_r0" - << std::setw(8) << "B_w0" - << std::setw(4) << "rah" - << "\n"; + block.get_next_parameter("TYPE", type1, "", "-2,-1,0,1,2,3,4,5,6,7"); + + for(unsigned int i = 0; i < io::In_Distanceres::MAX_ATOMS; i++) { + unsigned int atom; + std::string str_atom = io::to_string(i); + block.get_next_parameter("ATOM["+str_atom+"]", atom, ">=0", ""); + if (atom > topo.num_atoms()) { + std::ostringstream msg; + msg << blockname << " block: atom number out of range: " << atom << ", last atom is "<< topo.num_atoms(); + io::messages.add(msg.str(), "In_Distanceres", io::message::error); + } + + if (atom > 0) atom2.push_back(atom - 1); } - - for(unsigned int line_number=0; it != to; ++line_number, ++it){ - - DEBUG(11, "\tnr " << line_number-2); - - int type1, type2; - int n,m; - std::vector atom1, atom2; - double A_r0, B_r0,A_w0, B_w0; - int rah; - - _lineStream.clear(); - _lineStream.str(*it); - - for(unsigned int i = 0; i < io::In_Distanceres::MAX_ATOMS; i++) { - int atom; - _lineStream >> atom; - if (atom > 0) atom1.push_back(atom - 1); - else if (atom <0){ - std::ostringstream msg; - msg << "COM and COG type not possible for more than " - << io::In_Distanceres::MAX_ATOMS << " atoms" << std::endl; - io::messages.add(msg.str(), - "In_Distanceres", - io::message::error); - nr_atoms=false; - + block.get_next_parameter("TYPE", type2, "", "-2,-1,0,1,2,3,4,5,6,7"); + + block.get_next_parameter("N", n, "", ""); + block.get_next_parameter("M", m, "", ""); + block.get_next_parameter("A_R0", A_r0, ">=0", ""); + block.get_next_parameter("A_W0", A_w0, ">=0", ""); + block.get_next_parameter("B_R0", B_r0, ">=0", ""); + block.get_next_parameter("B_W0", B_w0, ">=0", ""); + block.get_next_parameter("RAH", rah, "", ""); + + + if( !block.error()){ + util::virtual_type t1 = util::virtual_type(type1); + util::virtual_type t2 = util::virtual_type(type2); + + util::Virtual_Atom v1(t1, atom1, dish, disc); + util::Virtual_Atom v2(t2, atom2, dish, disc); + + topo.perturbed_distance_restraints().push_back + (topology::perturbed_distance_restraint_struct(v1,v2,n,m,A_r0,B_r0,A_w0,B_w0, rah)); + + if (!quiet){ + for(unsigned int i = 0; i < io::In_Distanceres::MAX_ATOMS; i++) { + os << std::setw(i == 0 ? 10 : 8) << (i < atom1.size() ? atom1[i]+1 : 0); } - } - _lineStream >> type1; - - for(unsigned int i = 0; i < io::In_Distanceres::MAX_ATOMS; i++) { - int atom; - _lineStream >> atom; - if (atom > 0) atom2.push_back(atom - 1); - else if (atom <0){ - std::ostringstream msg; - msg << "COM and COG type not possible for more than " - << io::In_Distanceres::MAX_ATOMS << " atoms" << std::endl; - io::messages.add(msg.str(), - "In_Distanceres", - io::message::error); - nr_atoms=false; - + os << std::setw(5) << type1; + + for(unsigned int i = 0; i < io::In_Distanceres::MAX_ATOMS; i++) { + os << std::setw(i == 0 ? 10 : 8) << (i < atom2.size() ? atom2[i]+1 : 0); } - } - - _lineStream >> type2; - _lineStream >> n >> m >> A_r0 >> A_w0 >> B_r0 >> B_w0 >> rah; - - if(_lineStream.fail()){ - std::ostringstream msg; - msg << "bad line in PERTDISRESSPEC block: " << line_number << std::endl - << " " << *it; - io::messages.add(msg.str(), - "In_Distanceres", - io::message::error); - } - if( nr_atoms){ - util::virtual_type t1 = util::virtual_type(type1); - util::virtual_type t2 = util::virtual_type(type2); - - util::Virtual_Atom v1(t1, atom1, dish, disc); - util::Virtual_Atom v2(t2, atom2, dish, disc); - - topo.perturbed_distance_restraints().push_back - (topology::perturbed_distance_restraint_struct(v1,v2,n,m,A_r0,B_r0,A_w0,B_w0, rah)); - - if (!quiet){ - for(unsigned int i = 0; i < io::In_Distanceres::MAX_ATOMS; i++) { - os << std::setw(i == 0 ? 10 : 8) << (i < atom1.size() ? atom1[i]+1 : 0); - } - os << std::setw(5) << type1; - - for(unsigned int i = 0; i < io::In_Distanceres::MAX_ATOMS; i++) { - os << std::setw(i == 0 ? 10 : 8) << (i < atom2.size() ? atom2[i]+1 : 0); - } - os << std::setw(5) << type2 - << std::setw(5) << n - << std::setw(5) << m - << std::setw(8) << A_r0 - << std::setw(8) << A_w0 - << std::setw(8) << B_r0 - << std::setw(8) << B_w0 - << std::setw(8) << rah - << "\n"; - } + os << std::setw(5) << type2 + << std::setw(5) << n + << std::setw(5) << m + << std::setw(8) << A_r0 + << std::setw(8) << A_w0 + << std::setw(8) << B_r0 + << std::setw(8) << B_w0 + << std::setw(8) << rah + << "\n"; } } - - }//PERTDISRESPEC DISTANCERES - - //if (!quiet) os << "END\n"; - + } + block.get_final_messages(); } +}//PERTDISRESPEC - { // DISTANCEFIELD RES - DEBUG(10, "DFRESSPEC block"); - std::vector buffer; - std::string s; +/** + * @section dfresspec DFRESSPEC block + * The DFRESSPEC block is read from the distance restraints specification + * file and used for distancefield restraints. + * + * See: + * - A. de Ruiter and C. Oostenbrink, Protein-ligand binding from distancefield + * distances and Hamiltonian replica exchange simulations, J. Chem. Theory + * Comp. 9 (2013) 883 - 892, doi: 10.1021/ct300967a + * + * @snippet snippets/snippets.cc DFRESSPEC + */ +void io::In_Distanceres::read_DFRESSPEC(topology::Topology &topo, + simulation::Simulation &sim, + std::ostream & os) { // DISTANCEFIELD RES + DEBUG(10, "DFRESSPEC block"); + + std::stringstream exampleblock; + // lines starting with 'exampleblock<<"' and ending with '\n";' (spaces don't matter) + // will be used to generate snippets that can be included in the doxygen doc; + // the first line is the tag + exampleblock << "DFRESSPEC\n"; + exampleblock << "# DISH H-C bond length for virtual atoms\n"; + exampleblock << "# DISC C-C bond length for virtual atoms\n"; + exampleblock << "# PROTEINATOMS > 0 last atom of the host\n"; + exampleblock << "# K >= 0.0 Force constant\n"; + exampleblock << "# r0 >=0 zero energy distance\n"; + exampleblock << "# TYPE_I Virtual atom type for interaction site I\n"; + exampleblock << "# NUM_I Number of atoms defining interaction site I\n"; + exampleblock << "# ATOM_I[0..NUM_I] Index numbers of atoms defining interaction site I\n"; + exampleblock << "# TYPE_J Virtual atom type for interaction site J\n"; + exampleblock << "# NUM_J Number of atoms defining interaction site J\n"; + exampleblock << "# ATOM_J[0..NUM_J] Index numbers of atoms defining interaction site J\n"; + exampleblock << "# DISH DISC\n"; + exampleblock << " 0.1 0.153\n"; + exampleblock << "# PROTEINATOMS K r0\n"; + exampleblock << " 1190 500 0.0\n"; + exampleblock << "# TYPE_I NUM_I ATOM_I[0] .. ATOM_I[NUM_I]\n"; + exampleblock << " -1 7 16 190 249 312 486 632 1208\n"; + exampleblock << "# TYPE_J NUM_J ATOM_J[0] .. ATOM_J[NUM_J]\n"; + exampleblock << " -1 2 1194 1203\n"; + exampleblock << "END\n"; + + std::string blockname = "DFRESSPEC"; + Block block(blockname, exampleblock.str()); + + if (block.read_buffer(m_block[blockname], false) == 0) { + block_read.insert(blockname); + + DEBUG(10, "reading in DFRES data"); - buffer = m_block["DFRESSPEC"]; - block_read.insert("DFRESSPEC"); - if(!buffer.size()){ - if(sim.param().distancefield.distancefield && - !sim.param().perturbation.perturbation) - // only need to warn if it was expected - io::messages.add("no DFRESSPEC block in distance restraints file", - "in_distanceres", io::message::warning); + if (!quiet) { + switch (sim.param().distancefield.distancefield) { + case 0: + os << "\tDistancefield restraints OFF\n"; + io::messages.add("Distancefield is off but found a "+blockname+" block", + "in_distanceres", io::message::warning); + return; + case 1: + os << "\tDistancefield restraints ON\n"; + break; + default: + os << "\tDistancefield restraints ERROR\n"; } - else if (buffer.size()<=2){ - io::messages.add("empty DFRESSPEC block in distance restraints file", - "in_distanceres", io::message::warning); } - else{ - - DEBUG(10, "reading in DFRES data"); - - if (!quiet) { - switch (sim.param().distancefield.distancefield) { - case 0: - os << "\tDistancefield restraints OFF\n"; - // how did you get here? - break; - case 1: - os << "\tDistancefield restraints ON\n"; - break; - default: - os << "\tDistancefield restraints ERROR\n"; - } - } - - _lineStream.clear(); - _lineStream.str(concatenate(buffer.begin() + 1, buffer.end() - 1, s)); - - double dish,disc; - _lineStream >> dish >> disc; - - if(_lineStream.fail()){ - std::ostringstream msg; - msg << "bad line in DFRESSPEC block: failed to read in DISH and DISC" << std::endl; - io::messages.add(msg.str(), - "In_Distanceres", - io::message::error); - } - - /* if (!quiet){ - os << std::setw(10) << "DISH" - << std::setw(10) << "DISC" - << "\n" - << std::setw(10)<< dish - << std::setw(10)<< disc - << "\n"; - } - */ - int vtype_i, vtype_j, num, atom; - std::vector atomi, atomj; - - topo.disfield_restraints().on = true; - - _lineStream >> topo.disfield_restraints().proteinatoms; - topo.disfield_restraints().proteinatoms--; - - _lineStream >> topo.disfield_restraints().K - >> topo.disfield_restraints().r0; - - if (topo.disfield_restraints().proteinatoms < 0) { - io::messages.add("DFRESSPEC block: PROTEINATOMS must be >= 0.", - "In_Distanceres", io::message::error); - } - if (topo.disfield_restraints().K < 0.0) { - io::messages.add("DFRESSPEC block: K must be >= 0.0.", - "In_Distanceres", io::message::error); - } - if (topo.disfield_restraints().r0 < 0.0) { - io::messages.add("DFRESSPEC block: r0 must be >= 0.0.", - "In_Distanceres", io::message::error); - } - - _lineStream >> vtype_i - >> num; - - for(int i=0; i< num; i++){ - _lineStream >> atom; - if (atom < 0 ) { - io::messages.add("DFRESSPEC block: ATOM_I must be >= 0.", - "In_Distanceres", io::message::error); - } - atomi.push_back(atom-1); - } - _lineStream >> vtype_j - >> num; - - for(int i=0; i< num; i++){ - _lineStream >> atom; - if (atom < 0 ) { - io::messages.add("DFRESSPEC block: ATOM_J must be >= 0.", - "In_Distancres", io::message::error); - } - atomj.push_back(atom-1); + + double dish,disc; + block.get_next_parameter("DISH", dish, ">0", ""); + block.get_next_parameter("DISC", disc, ">0", ""); + + if (!quiet){ + os << std::setw(10) << "DISH" + << std::setw(10) << "DISC" + << "\n" + << std::setw(10)<< dish + << std::setw(10)<< disc + << "\n"; + } + + int vtype_i, vtype_j; + unsigned int num, atom; + std::vector atomi, atomj; + + topo.disfield_restraints().on = true; + + block.get_next_parameter("PROTEINATOMS", topo.disfield_restraints().proteinatoms, ">=0", ""); + if (topo.disfield_restraints().proteinatoms > topo.num_solute_atoms()) { + std::ostringstream msg; + msg << blockname << " block: PROTEINATOMS out of range: " + << topo.disfield_restraints().proteinatoms + << ", last solute atom is "<< topo.num_solute_atoms(); + io::messages.add(msg.str(), "In_Distanceres", io::message::error); + } + topo.disfield_restraints().proteinatoms--; + block.get_next_parameter("K", topo.disfield_restraints().K, ">=0", ""); + block.get_next_parameter("r0", topo.disfield_restraints().r0, ">=0", ""); + + block.get_next_parameter("TYPE_I", vtype_i, "", ""); + block.get_next_parameter("NUM_I", num, ">0", ""); + for(unsigned int i=0; i< num; i++){ + block.get_next_parameter("ATOM", atom, ">0", ""); + if (atom > topo.num_atoms()) { + std::ostringstream msg; + msg << blockname << " block: atom number out of range: " << atom << ", last atom is "<< topo.num_atoms(); + io::messages.add(msg.str(), "In_Distanceres", io::message::error); } - - if(_lineStream.fail()){ - std::ostringstream msg; - msg << "bad line in DFRESSPEC block: " << std::endl; - io::messages.add(msg.str(), - "In_Distanceres", - io::message::error); + atomi.push_back(atom-1); + } + block.get_next_parameter("TYPE_J", vtype_j, "", ""); + block.get_next_parameter("NUM_J", num, ">0", ""); + for(unsigned int i=0; i< num; i++){ + block.get_next_parameter("ATOM", atom, ">0", ""); + if (atom > topo.num_atoms()) { + std::ostringstream msg; + msg << blockname << " block: atom number out of range: " << atom << ", last atom is "<< topo.num_atoms(); + io::messages.add(msg.str(), "In_Distanceres", io::message::error); } - + atomj.push_back(atom-1); + } + + if (!block.error()) { util::virtual_type t1 = util::virtual_type(vtype_i); util::virtual_type t2 = util::virtual_type(vtype_j); - + util::Virtual_Atom v1(t1, atomi, dish, disc); util::Virtual_Atom v2(t2, atomj, dish, disc); - - topo.disfield_restraints().v1 = v1; - topo.disfield_restraints().v2 = v2; - + + topo.disfield_restraints().v1 = v1; + topo.disfield_restraints().v2 = v2; } - - } // DISTANCEFIELD - - { // PERTDFRESPEC DISTANCERES - DEBUG(10, "PERTDFRESSPEC block"); - - std::vector buffer; - std::string s; - - buffer = m_block["PERTDFRESSPEC"]; - block_read.insert("PERTDFRESSPEC"); - - // check whether there is s.th. in the block - if(!buffer.size()){ - // this is only bad if no DFRESSPEC block was specified either - // you may be doing a perturbation but not a perturbed disfield - if(sim.param().distancefield.distancefield && - sim.param().perturbation.perturbation && - !topo.disfield_restraints().on){ - io::messages.add("no (PERT)DFRESSPEC block in distance restraints file", - "in_distanceres", io::message::warning); - } + + block.get_final_messages(); + } + +} // DISTANCEFIELD + +/** + * @section pertdfresspec PERTDFRESSPEC block + * The PERTDFRESSPEC block is read from the distance restraints specification + * file and used for perturbed distancefield restraints. + * + * See: + * - A. de Ruiter and C. Oostenbrink, Protein-ligand binding from distancefield + * distances and Hamiltonian replica exchange simulations, J. Chem. Theory + * Comp. 9 (2013) 883 - 892, doi: 10.1021/ct300967a + * + * @snippet snippets/snippets.cc PERTDFRESSPEC + */ +void io::In_Distanceres::read_PERTDFRESSPEC(topology::Topology &topo, + simulation::Simulation &sim, + std::ostream & os) { // PERTDFRESPEC DISTANCERES + DEBUG(10, "PERTDFRESSPEC block"); + + std::stringstream exampleblock; + // lines starting with 'exampleblock<<"' and ending with '\n";' (spaces don't matter) + // will be used to generate snippets that can be included in the doxygen doc; + // the first line is the tag + exampleblock << "PERTDFRESSPEC\n"; + exampleblock << "# DISH H-C bond length for virtual atoms\n"; + exampleblock << "# DISC C-C bond length for virtual atoms\n"; + exampleblock << "# PROTEINATOMS > 0 last atom of the host\n"; + exampleblock << "# A_r0 >=0 reference distance for state A\n"; + exampleblock << "# B_r0 >=0 reference distance for state B\n"; + exampleblock << "# K_A >= 0 force constant state A\n"; + exampleblock << "# K_B >= 0 force constant state B\n"; + exampleblock << "# n >= 0 hidden restraint parameter n\n"; + exampleblock << "# m >= 0 hidden restraint parameter m\n"; + exampleblock << "# TYPE_I Virtual atom type for interaction site I\n"; + exampleblock << "# NUM_I Number of atoms defining interaction site I\n"; + exampleblock << "# ATOM_I[0..NUM_I] Index numbers of atoms defining interaction site I\n"; + exampleblock << "# TYPE_J Virtual atom type for interaction site J\n"; + exampleblock << "# NUM_J Number of atoms defining interaction site J\n"; + exampleblock << "# ATOM_J[0..NUM_J] Index numbers of atoms defining interaction site J\n"; + exampleblock << "# DISH DISC\n"; + exampleblock << " 0.1 0.153\n"; + exampleblock << "# PROTEINATOMS A_r0 K_A B_r0 K_B n m\n"; + exampleblock << " 1190 4.5 500 0.0 500 0 0\n"; + exampleblock << "# TYPE_I NUM_I ATOM_I[0] .. ATOM_I[NUM_I]\n"; + exampleblock << " -1 7 16 190 249 312 486 632 1208\n"; + exampleblock << "# TYPE_J NUM_J ATOM_J[0] .. ATOM_J[NUM_J]\n"; + exampleblock << " -1 2 1194 1203\n"; + exampleblock << "END\n"; + + std::string blockname = "PERTDFRESSPEC"; + Block block(blockname, exampleblock.str()); + + if (block.read_buffer(m_block[blockname], false) == 0) { + block_read.insert(blockname); + + DEBUG(10, "reading in DISTANCERES (PERTDFRESSPEC) data"); + + if (!quiet){ + switch(sim.param().distancefield.distancefield * sim.param().perturbation.perturbation){ + case 0: + os << "\tPerturbed Distancefield restraints OFF\n"; + io::messages.add("No perturbation or no distancefield, but found a "+blockname+" block", + "in_distanceres", io::message::warning); + return; + case 1: + os << "\tPerturbed Distancefield restraints ON\n"; + break; + default: + os << "\tPerturbed Distancefield restraints ERROR\n"; } - else if (buffer.size()<=2){ - io::messages.add("empty PERTDFRESSPEC block in distance restraints file", - "in_distanceres", io::message::warning); } - else{ - - DEBUG(10, "reading in DISTANCERES (PERTDFRESSPEC) data"); - sim.param().perturbation.perturbed_par=true; - - if (!quiet){ - switch(sim.param().distancefield.distancefield * sim.param().perturbation.perturbation){ - case 0: - os << "\tPerturbed Distancefield restraints OFF\n"; - // how did you get here? - break; - case 1: - os << "\tPerturbed Distancefield restraints ON\n"; - break; - default: - os << "\tPerturbed Distancefield restraints ERROR\n"; - } - } - - _lineStream.clear(); - _lineStream.str(concatenate(buffer.begin() + 1, buffer.end() - 1, s)); - - double dish,disc; - _lineStream >> dish >> disc; - - if(_lineStream.fail()){ - std::ostringstream msg; - msg << "bad line in PERTDFRESSPEC block: failed to read in DISH and DISC" << std::endl; - io::messages.add(msg.str(), - "In_Distanceres", - io::message::error); - } - -/* if (!quiet){ - os << std::setw(10) << "DISH" - << std::setw(10) << "DISC" - << "\n" - << std::setw(10)<< dish - << std::setw(10)<< disc - << "\n"; - } -*/ - int vtype_i, vtype_j, num, atom; - std::vector atomi, atomj; - - topo.perturbed_disfield_restraints().on = true; - - _lineStream >> topo.perturbed_disfield_restraints().proteinatoms; - topo.perturbed_disfield_restraints().proteinatoms--; - - _lineStream >> topo.perturbed_disfield_restraints().A_r0 - >> topo.perturbed_disfield_restraints().K_A - >> topo.perturbed_disfield_restraints().B_r0 - >> topo.perturbed_disfield_restraints().K_B - >> topo.perturbed_disfield_restraints().n - >> topo.perturbed_disfield_restraints().m; - - if (topo.perturbed_disfield_restraints().proteinatoms < 0) { - io::messages.add("PERTDFRESSPEC block: PROTEINATOMS must be >= 0.", - "In_Distanceres", io::message::error); - } - if (topo.perturbed_disfield_restraints().K_A < 0.0 || - topo.perturbed_disfield_restraints().K_B < 0.0) { - io::messages.add("PERTDFRESSPEC block: K must be >= 0.0.", - "In_Distanceres", io::message::error); - } - if (topo.perturbed_disfield_restraints().A_r0 < 0.0 || - topo.perturbed_disfield_restraints().B_r0 < 0.0) { - io::messages.add("PERTDFRESSPEC block: r0 must be >= 0.0.", - "In_Distanceres", io::message::error); - } + sim.param().perturbation.perturbed_par=true; + double dish,disc; + block.get_next_parameter("DISH", dish, ">0", ""); + block.get_next_parameter("DISC", disc, ">0", ""); - _lineStream >> vtype_i - >> num; + if (!quiet){ + os << std::setw(10) << "DISH" + << std::setw(10) << "DISC" + << "\n" + << std::setw(10)<< dish + << std::setw(10)<< disc + << "\n"; + } - for(int i=0; i< num; i++){ - _lineStream >> atom; - if (atom < 0 ) { - io::messages.add("PERTDFRESSPEC block: ATOM_I must be >= 0.", - "In_Distanceres", io::message::error); - } - atomi.push_back(atom-1); - } - _lineStream >> vtype_j - >> num; - - for(int i=0; i< num; i++){ - _lineStream >> atom; - if (atom < 0 ) { - io::messages.add("PERTDFRESSPEC block: ATOM_J must be >= 0.", - "In_Distancres", io::message::error); - } - atomj.push_back(atom-1); + int vtype_i, vtype_j; + unsigned int num, atom; + std::vector atomi, atomj; + + topo.perturbed_disfield_restraints().on = true; + + block.get_next_parameter("PROTEINATOMS", topo.perturbed_disfield_restraints().proteinatoms, ">=0", ""); + if (topo.perturbed_disfield_restraints().proteinatoms > topo.num_solute_atoms()) { + std::ostringstream msg; + msg << blockname << " block: PROTEINATOMS out of range: " + << topo.perturbed_disfield_restraints().proteinatoms + << ", last solute atom is "<< topo.num_solute_atoms(); + io::messages.add(msg.str(), "In_Distanceres", io::message::error); + } + topo.perturbed_disfield_restraints().proteinatoms--; + block.get_next_parameter("A_r0", topo.perturbed_disfield_restraints().A_r0, ">=0", ""); + block.get_next_parameter("K_A", topo.perturbed_disfield_restraints().K_A, ">=0", ""); + block.get_next_parameter("B_r0", topo.perturbed_disfield_restraints().B_r0, ">=0", ""); + block.get_next_parameter("K_B", topo.perturbed_disfield_restraints().K_B, ">=0", ""); + block.get_next_parameter("n", topo.perturbed_disfield_restraints().n, ">=0", ""); + block.get_next_parameter("m", topo.perturbed_disfield_restraints().m, ">=0", ""); + + block.get_next_parameter("TYPE_I", vtype_i, "", ""); + block.get_next_parameter("NUM_I", num, ">0", ""); + for(unsigned int i=0; i< num; i++){ + block.get_next_parameter("ATOM", atom, ">0", ""); + if (atom > topo.num_atoms()) { + std::ostringstream msg; + msg << blockname << " block: atom number out of range: " << atom << ", last atom is "<< topo.num_atoms(); + io::messages.add(msg.str(), "In_Distanceres", io::message::error); } - - if(_lineStream.fail()){ - std::ostringstream msg; - msg << "bad line in PERTDFRESSPEC block: " << std::endl; - io::messages.add(msg.str(), "In_Distanceres", - io::message::error); + atomi.push_back(atom-1); + } + block.get_next_parameter("TYPE_J", vtype_j, "", ""); + block.get_next_parameter("NUM_J", num, ">0", ""); + for(unsigned int i=0; i< num; i++){ + block.get_next_parameter("ATOM", atom, ">0", ""); + if (atom > topo.num_atoms()) { + std::ostringstream msg; + msg << blockname << " block: atom number out of range: " << atom << ", last atom is "<< topo.num_atoms(); + io::messages.add(msg.str(), "In_Distanceres", io::message::error); } + atomj.push_back(atom-1); + } + if (!block.error()) { util::virtual_type t1 = util::virtual_type(vtype_i); util::virtual_type t2 = util::virtual_type(vtype_j); - + util::Virtual_Atom v1(t1, atomi, dish, disc); util::Virtual_Atom v2(t2, atomj, dish, disc); - + topo.perturbed_disfield_restraints().v1 = v1; topo.perturbed_disfield_restraints().v2 = v2; - - } - - }//PERTDFRESPEC DISTANCERES - - - { // EDSDISTANCERES - DEBUG(10, "MDISRESSPEC block"); - buffer = m_block["MDISRESSPEC"]; - block_read.insert("MDISRESSPEC"); - if (buffer.size()<=2){ - io::messages.add("no or empty MDISRESSPEC block in distance restraints file", - "in_distanceres", io::message::warning); } - else{ - if (!sim.param().eds.eds){ + block.get_final_messages(); + } +}//PERTDFRESPEC DISTANCERES + + +/** + * @section mdisresspec MDISRESSPEC block + * The MDISRESSPEC block is read from the distance restraints specification + * file and used for EDS restraints. + * + * The format is very similar to the @ref distanceresspec with the difference that + * one may give values for multipde states. + * @snippet snippets/snippets.cc MDISRESSPEC + */ +void io::In_Distanceres::read_MDISRESSPEC(topology::Topology &topo, + simulation::Simulation &sim, + std::ostream & os) { // MDISRESSPEC + DEBUG(10, "MDISRESSPEC block"); + + std::stringstream exampleblock; + // lines starting with 'exampleblock<<"' and ending with '\n";' (spaces don't matter) + // will be used to generate snippets that can be included in the doxygen doc; + // the first line is the tag + exampleblock << "MDISRESSPEC\n"; + exampleblock << "# DISH DISC\n"; + exampleblock << " 0.1 0.153\n"; + exampleblock << "# N: number of eds states (3 in this example)\n"; + exampleblock << "# i j k l type i j k l type r0[1 ... N] w0[1 ... N] rah\n"; + exampleblock << " 1 0 0 0 0 10 12 11 13 3 0.2 0.2 0.2 1.0 0.0 0.0 0\n"; + exampleblock << " 5 0 0 0 0 10 12 11 13 3 0.2 0.2 0.2 0.0 1.0 0.0 0\n"; + exampleblock << " 8 0 0 0 0 10 12 11 13 3 0.2 0.2 0.2 0.0 0.0 1.0 0\n"; + exampleblock << "END\n"; + + std::string blockname = "MDISRESSPEC"; + Block block(blockname, exampleblock.str()); + + if (block.read_buffer(m_block[blockname], false) == 0) { + block_read.insert(blockname); + + if (!sim.param().eds.eds){ io::messages.add("MDISRESSPEC block given but EDS not turned on!", "in_distanceres", io::message::error); - } - if(sim.param().distanceres.distanceres < 0){ + return; + } + + if (sim.param().distanceres.distanceres < 0){ io::messages.add("eds perturbed distance restraints not compatible with time averaging!", "in_distanceres", io::message::error); - } - std::vector::const_iterator it = buffer.begin()+1, - to = buffer.end()-1; - - double dish,disc; - bool nr_atoms=true; - - sim.param().perturbation.perturbed_par=true; - - DEBUG(10, "reading in MDISRESSPEC data"); - - if (!quiet){ - - switch(sim.param().distanceres.distanceres){ - case 0: - os << "\tEDS distance restraints OFF\n"; - // how did you get here? - break; - case 1: - os << "\tEDS distance restraints ON\n"; - - break; - case 2: - os << "\tEDS distance restraints ON\n" - << "\t\t(using force constant K*w0)\n"; - break; - default: - os << "\tEDS distance restraints ERROR\n"; - } - } - - - _lineStream.clear(); - _lineStream.str(*it); - - _lineStream >> dish >> disc; - - if(_lineStream.fail()){ - std::ostringstream msg; - msg << "bad line in MDISRESSPEC block: failed to read in DISH and DISC" << std::endl; - io::messages.add(msg.str(), - "In_Distanceres", - io::message::error); - } - ++it; - - const unsigned int numstates = sim.param().eds.numstates; - - if (!quiet){ - os << std::setw(10) << "DISH" - << std::setw(10) << "DISC" - << "\n" - << std::setw(10)<< dish - << std::setw(10)<< disc - << "\n"; - - os << std::setw(10) << "i" - << std::setw(8) << "j" - << std::setw(8) << "k" - << std::setw(8) << "l" - << std::setw(5) << "type" - << std::setw(10) << "i" - << std::setw(8) << "j" - << std::setw(8) << "k" + } + + sim.param().perturbation.perturbed_par=true; + + DEBUG(10, "reading in MDISRESSPEC data"); + + if (!quiet){ + switch(sim.param().distanceres.distanceres){ + case 0: + os << "\tEDS distance restraints OFF\n"; + // how did you get here? + break; + case 1: + os << "\tEDS distance restraints ON\n"; + + break; + case 2: + os << "\tEDS distance restraints ON\n" + << "\t\t(using force constant K*w0)\n"; + break; + default: + os << "\tEDS distance restraints ERROR\n"; + } + } + + double dish,disc; + block.get_next_parameter("DISH", dish, ">0", ""); + block.get_next_parameter("DISC", disc, ">0", ""); + + const unsigned int numstates = sim.param().eds.numstates; + + if (!quiet){ + os << std::setw(10) << "DISH" + << std::setw(10) << "DISC" + << "\n" + << std::setw(10)<< dish + << std::setw(10)<< disc + << "\n"; + + os << std::setw(10) << "i" + << std::setw(8) << "j" + << std::setw(8) << "k" + << std::setw(8) << "l" + << std::setw(5) << "type" + << std::setw(10) << "i" + << std::setw(8) << "j" + << std::setw(8) << "k" << std::setw(8) << "l" << std::setw(5) << "type"; - + os << "\t" << std::setw(12) << "r0["; for(unsigned int i = 0; i < numstates; i++){ os << std::setw(8) << i+1; @@ -910,131 +851,100 @@ io::In_Distanceres::read(topology::Topology& topo, os << std::setw(10) << i+1; } os << "] "; - - os << std::setw(4) << "rah" - << "\n"; - } - - for(unsigned int line_number=2; it != to; ++line_number, ++it){ - - DEBUG(11, "\tnr " << line_number - 2); - - int type1, type2; - std::vector atom1, atom2; - std::vector r0(numstates),w0(numstates); - int rah; - - _lineStream.clear(); - _lineStream.str(*it); - - for(unsigned int i = 0; i < io::In_Distanceres::MAX_ATOMS; i++) { - int atom; - _lineStream >> atom; - // -1 because we directly convert to array indices - if (atom > 0) atom1.push_back(atom - 1); - else if (atom <0){ - std::ostringstream msg; - msg << "COM and COG type not possible for more than " - << io::In_Distanceres::MAX_ATOMS << " atoms" << std::endl; - io::messages.add(msg.str(), - "In_Distanceres", - io::message::error); - nr_atoms=false; - - } - } - _lineStream >> type1; - - for(unsigned int i = 0; i < io::In_Distanceres::MAX_ATOMS; i++) { - int atom; - _lineStream >> atom; - if (atom > 0) atom2.push_back(atom - 1); - else if (atom <0){ - std::ostringstream msg; - msg << "COM and COG type not possible for more than " - << io::In_Distanceres::MAX_ATOMS << " atoms" << std::endl; - io::messages.add(msg.str(), - "In_Distanceres", - io::message::error); - nr_atoms=false; - - } - } - _lineStream >> type2; - - for(unsigned int i = 0; i < numstates; i++){ - _lineStream >> r0[i]; + + os << std::setw(4) << "rah" + << "\n"; + } + + unsigned int num = block.numlines()-3; + for(unsigned int line_number=0; line_number < num; line_number++){ + + DEBUG(11, "\tnr " << line_number - 2); + + int type1, type2; + std::vector atom1, atom2; + std::vector r0(numstates),w0(numstates); + int rah; + + for(unsigned int i = 0; i < io::In_Distanceres::MAX_ATOMS; i++) { + unsigned int atom; + std::string str_atom = io::to_string(i); + block.get_next_parameter("ATOM["+str_atom+"]", atom, ">=0", ""); + if (atom > topo.num_atoms()) { + std::ostringstream msg; + msg << blockname << " block: atom number out of range: " << atom << ", last atom is "<< topo.num_atoms(); + io::messages.add(msg.str(), "In_Distanceres", io::message::error); } - for(unsigned int i = 0; i < numstates; i++){ - _lineStream >> w0[i]; + + // -1 because we directly convert to array indices + if (atom > 0) atom1.push_back(atom - 1); + } + block.get_next_parameter("TYPE", type1, "", "-2,-1,0,1,2,3,4,5,6,7"); + + for(unsigned int i = 0; i < io::In_Distanceres::MAX_ATOMS; i++) { + unsigned int atom; + std::string str_atom = io::to_string(i); + block.get_next_parameter("ATOM["+str_atom+"]", atom, ">=0", ""); + if (atom > topo.num_atoms()) { + std::ostringstream msg; + msg << blockname << " block: atom number out of range: " << atom << ", last atom is "<< topo.num_atoms(); + io::messages.add(msg.str(), "In_Distanceres", io::message::error); } - _lineStream >> rah; - - - if(_lineStream.fail()){ - std::ostringstream msg; - msg << "bad line in MDISRESSPEC block: " << line_number << std::endl - << " " << *it; - io::messages.add(msg.str(), - "In_Distanceres", - io::message::error); - } - - // g++ 3.2 fix - if( nr_atoms){ - util::virtual_type t1 = util::virtual_type(type1); - util::virtual_type t2 = util::virtual_type(type2); - - util::Virtual_Atom v1(t1, atom1, dish, disc); - util::Virtual_Atom v2(t2, atom2, dish, disc); - - topo.eds_distance_restraints().push_back - (topology::eds_distance_restraint_struct(v1,v2,r0,w0,rah)); - - if (!quiet){ - for(unsigned int i = 0; i < io::In_Distanceres::MAX_ATOMS; i++) { - // the first element has the width 10, if i is bigger then the number of atoms - // specified, just print 0. - os << std::setw(i == 0 ? 10 : 8) << (i < atom1.size() ? atom1[i]+1 : 0); - } - os << std::setw(5) << type1; - - for(unsigned int i = 0; i < io::In_Distanceres::MAX_ATOMS; i++) { - os << std::setw(i == 0 ? 10 : 8) << (i < atom2.size() ? atom2[i]+1 : 0); - } - os << std::setw(5) << type2; - os << "\t" << std::setw(12) << " "; - for(unsigned int i = 0; i < numstates; i++){ - os << std::setw(8) << r0[i]; - } - os << std::setw(12) << " "; - for(unsigned int i = 0; i < numstates; i++){ - os << std::setw(10) << w0[i]; - } - os << " "; - - os << std::setw(4) << rah << "\n"; - - } + + // -1 because we directly convert to array indices + if (atom > 0) atom2.push_back(atom - 1); + } + block.get_next_parameter("TYPE", type2, "", "-2,-1,0,1,2,3,4,5,6,7"); + + for(unsigned int i = 0; i < numstates; i++){ + std::string str_i = io::to_string(i); + block.get_next_parameter("r0["+str_i+"]", r0[i], ">=0", ""); + } + for(unsigned int i = 0; i < numstates; i++){ + std::string str_i = io::to_string(i); + block.get_next_parameter("w0["+str_i+"]", w0[i], ">=0", ""); + } + block.get_next_parameter("RAH", rah, "", ""); + + // g++ 3.2 fix + if(!block.error()){ + util::virtual_type t1 = util::virtual_type(type1); + util::virtual_type t2 = util::virtual_type(type2); + + util::Virtual_Atom v1(t1, atom1, dish, disc); + util::Virtual_Atom v2(t2, atom2, dish, disc); + + topo.eds_distance_restraints().push_back + (topology::eds_distance_restraint_struct(v1,v2,r0,w0,rah)); + + if (!quiet){ + for(unsigned int i = 0; i < io::In_Distanceres::MAX_ATOMS; i++) { + // the first element has the width 10, if i is bigger then the number of atoms + // specified, just print 0. + os << std::setw(i == 0 ? 10 : 8) << (i < atom1.size() ? atom1[i]+1 : 0); + } + os << std::setw(5) << type1; + + for(unsigned int i = 0; i < io::In_Distanceres::MAX_ATOMS; i++) { + os << std::setw(i == 0 ? 10 : 8) << (i < atom2.size() ? atom2[i]+1 : 0); + } + os << std::setw(5) << type2; + os << "\t" << std::setw(12) << " "; + for(unsigned int i = 0; i < numstates; i++){ + os << std::setw(8) << r0[i]; + } + os << std::setw(12) << " "; + for(unsigned int i = 0; i < numstates; i++){ + os << std::setw(10) << w0[i]; + } + os << " "; + + os << std::setw(4) << rah << "\n"; + } } - } - if (!quiet) os << "END\n"; - } // EDSDISTANCERES - - for(std::map >::const_iterator - it = m_block.begin(), - to = m_block.end(); - it != to; - ++it){ - - if (block_read.count(it->first) == 0 && it->second.size()){ - io::messages.add("block " + it->first + " not supported!", - "In_Distanceres", - io::message::warning); - } + block.get_final_messages(); } - -} +} // MDISRESSPEC diff --git a/gromosXX/src/io/topology/in_distanceres.h b/gromosXX/src/io/topology/in_distanceres.h index f19b39001..3e9315cfb 100644 --- a/gromosXX/src/io/topology/in_distanceres.h +++ b/gromosXX/src/io/topology/in_distanceres.h @@ -6,7 +6,7 @@ * @page disres distance restraints format * @date 28-10-2008 * - * A distance restraints specifcation file may contain the following blocks: + * A distance restraints specification file may contain the following blocks: * - @ref title * - @ref distanceresspec * - @ref pertdisresspec @@ -43,6 +43,16 @@ namespace io { void read(topology::Topology &topo, simulation::Simulation & sim, std::ostream & os = std::cout); + + /** + * read distance restraint specification block. + */ + void read_DISTANCERESSPEC(topology::Topology &topo, simulation::Simulation &sim, std::ostream & os = std::cout); + void read_PERTDISRESSPEC(topology::Topology &topo, simulation::Simulation &sim, std::ostream & os = std::cout); + void read_DFRESSPEC(topology::Topology &topo, simulation::Simulation &sim, std::ostream & os = std::cout); + void read_PERTDFRESSPEC(topology::Topology &topo, simulation::Simulation &sim, std::ostream & os = std::cout); + void read_MDISRESSPEC(topology::Topology &topo, simulation::Simulation &sim, std::ostream & os = std::cout); + /** * Maximum number of atoms that can be specified to define a virtual atom */ diff --git a/gromosXX/src/io/topology/in_perturbation.cc b/gromosXX/src/io/topology/in_perturbation.cc index a4aa86c0e..1042a5d36 100644 --- a/gromosXX/src/io/topology/in_perturbation.cc +++ b/gromosXX/src/io/topology/in_perturbation.cc @@ -293,17 +293,28 @@ io::In_Perturbation::read(topology::Topology &topo, "In_Perturbation", io::message::error); } - if (!quiet) + if (!quiet){ os << "\n\t\tbonds : " - << unsigned(topo.solute().bonds().size()) - << "\n\t\tperturbed bonds : " - << unsigned(topo.perturbed_solute().bonds().size()) - << "\n\t\tdistance constraints : " - << unsigned(topo.solute().distance_constraints().size()) - << "\n\t\tperturbed distance constraints : " - << unsigned(topo.perturbed_solute().distance_constraints().size()) - << "\n\n" - << "\tEND\n"; + << unsigned(topo.solute().bonds().size()) + << "\n\t\tperturbed bonds : " + << unsigned(topo.perturbed_solute().bonds().size()) + << "\n\t\tdistance constraints : " + << unsigned(topo.solute().distance_constraints().size()) + << "\n\t\tperturbed distance constraints : " + << unsigned(topo.perturbed_solute().distance_constraints().size()) + << "\n\n"; + + //write a warning if we do perturbed constraints and PRECALCLAM + if(topo.perturbed_solute().distance_constraints().size() + && param.precalclam.nr_lambdas) { + os << "\tWARNING: Perturbed distance constraints in combination with\n\t\t precalculated lambdas will give a contribution to energy\n\t\t derivatives, but not to the energies. Use in BAR or reweighting\n\t\t in extended TI will be inappropriate\n\n"; + + io::messages.add("Perturbed SHAKE in combination with precalculated\n lambdas only contributes to derivatives not energies", "In_Perturbation", io::message::warning); + } + + os << "\tEND\n"; + } + } // if block present } // loop over H/non H blocks @@ -1235,8 +1246,9 @@ io::In_Perturbation::read(topology::Topology &topo, int num, n; _lineStream >> num; ++it; - - int seq, res, a_iac, b_iac; + + int seq; + unsigned int res, a_iac, b_iac; double a_mass, b_mass, a_charge, b_charge; double lj_soft, crf_soft; std::string name; diff --git a/gromosXX/src/io/topology/in_perturbation.h b/gromosXX/src/io/topology/in_perturbation.h index 6137844e1..53c8616fc 100644 --- a/gromosXX/src/io/topology/in_perturbation.h +++ b/gromosXX/src/io/topology/in_perturbation.h @@ -100,8 +100,10 @@ Perturbed soft bonds PERTBONDSOFT # number of perturbed soft bonds 2 -# type: 0 .. bond type with K=0 -# ALB: softness parameter, 0 .. no softness +# type: 0 .. bond type with the same equilibrium length as the other state +# but force constant K=0 +# ALB: softness parameter, +# 0 .. no softness # atom(i) atom(j) bond_type(A) bond_type(B) ALB 4 6 15 0 1000 6 12 0 25 1000 @@ -135,13 +137,15 @@ END @endverbatim @section pertbondanglesoft PERTANGLESOFT block -Perturbed bond angles +Soft perturbed bond angles @verbatim PERTANGLESOFT # number of perturbed soft bond angles 2 -# type: 0 .. angle type with K=0 -# ALA: softness parameter, 0 .. no softness +# type: 0 .. angle type with the same equilibrium value +# as the type of the other state but force constant 0 +# ALA: softness parameter +# 0 .. no softness # atom(i) atom(j) atom(k) type(A) type(B) ALA 4 6 12 0 7 4 3 8 10 26 0 4 @@ -178,8 +182,10 @@ Perturbed soft improper (harmonic) dihedrals PERTIMPROPERDIHSOFT # number of perturbed soft improper dihedrals 2 -# type: 0 .. imp. dih. angle type with K=0 -# ALI: softness parameter, 0 .. no softness +# type: 0 .. imp. dih. angle type with the same equilibrium value +# as the type of the other state but force constant 0 +# ALI: softness parameter, +# 0 .. no softness # atom(i) atom(j) atom(k) atom(l) type(A) type(B) ALI 12 13 10 6 1 0 4 18 19 13 16 0 2 4 diff --git a/gromosXX/src/io/topology/in_rdc.cc b/gromosXX/src/io/topology/in_rdc.cc index 49c1e1475..b4234a21f 100644 --- a/gromosXX/src/io/topology/in_rdc.cc +++ b/gromosXX/src/io/topology/in_rdc.cc @@ -23,6 +23,97 @@ using namespace std; +// three structs, local to this file +struct mf_struct{ + math::VArray cart_coords; + math::VArray cart_vels; + vector masses; +}; + +struct t_struct{ + vector a; + vector vels; + vector masses; +}; + +struct sh_struct{ + vector clm; + vector vels; + vector masses; +}; + +double generate_boltzmann_velocities(math::RandomGenerator* rng, const double temp, const double mass) { + const double sd = sqrt(math::k_Boltzmann * temp / mass); + rng->stddev(sd); + return rng->get_gauss(); +} + +// FIXME +// the following validity test is highly inelegant and misses some invalid a, +// but at least all the rejected ones *are* invalid. +bool a_is_valid(double a1, double a2, double a3, double a4, double a5){ + + a1 = 2.0/3.0*(a1+.5); + a2 = 2.0/3.0*(a2+.5); + a3 = 2.0/3.0*a3; + a4 = 2.0/3.0*a4; + a5 = 2.0/3.0*a5; + + if(a1 < 0.0 || a1 > 1.5) return false; + if(a2 < 0.0 || a2 > 1.5) return false; + if(a3 < -0.5 || a3 > 0.5) return false; + if(a4 < -0.5 || a4 > 0.5) return false; + if(a5 < -0.5 || a5 > 0.5) return false; + + if(a3 > sqrt(a1)*sqrt(a2) || a3 < -sqrt(a1)*sqrt(a2)) return false; + +// if(pow(Axx + 0.5 ,2) + pow(Ayy + 0.5 ,2) + 2* pow(Axy ,2) + 2* pow(Axz ,2) + 2* pow(Ayz ,2) > 2.25) return false; + if(pow(a1, 2) + pow(a2, 2) + 2* pow(a3, 2) + 2* pow(a4, 2) + 2* pow(a5, 2) > 1.0) return false; + + return true; +} + +math::VArray create_points_on_sphere(const unsigned int N){ + if (N<5) { + io::messages.add("Please choose a number of at least 5 magnetic field vectors, to describe general alignment", "In_RDC", io::message::critical); + } + math::VArray coordinates; + switch(N){ + case 5:{ //FIXME, this is not a good distribution + coordinates.push_back(math::Vec( 0, 0, 1)); + coordinates.push_back(math::Vec( 1, 0, 0)); + coordinates.push_back(math::Vec(-0.5, cos(M_PI/6.0), 0)); + coordinates.push_back(math::Vec(-0.5,-cos(M_PI/6.0), 0)); + coordinates.push_back(math::Vec( 0, 0, -1)); + break; + } + case 6:{ + coordinates.push_back(math::Vec( 1, 0, 0)); + coordinates.push_back(math::Vec( 0, 1, 0)); + coordinates.push_back(math::Vec( 0, 0, 1)); + coordinates.push_back(math::Vec(-1, 0, 0)); + coordinates.push_back(math::Vec( 0,-1, 0)); + coordinates.push_back(math::Vec( 0, 0,-1)); + break; + } + default:{ + const double s = 3.6/sqrt(N); + const double dz = 2.0/N; + double longitude = 0.0; + double z = 1.0 - dz/2.0; + for (unsigned int i=0; i masses; -}; - -struct t_struct{ - vector a; - vector vels; - vector masses; -}; - -struct sh_struct{ - vector clm; - vector vels; - vector masses; -}; - -double generate_boltzmann_velocities(math::RandomGenerator* rng, const double temp, const double mass) { - const double sd = sqrt(math::k_Boltzmann * temp / mass); - rng->stddev(sd); - return rng->get_gauss(); -} - -// FIXME -// the following validity test is highly inelegant and misses some invalid a, -// but at least all the rejected ones *are* invalid. -bool a_is_valid(double a1, double a2, double a3, double a4, double a5){ - - a1 = 2.0/3.0*(a1+.5); - a2 = 2.0/3.0*(a2+.5); - a3 = 2.0/3.0*a3; - a4 = 2.0/3.0*a4; - a5 = 2.0/3.0*a5; - - if(a1 < 0.0 || a1 > 1.5) return false; - if(a2 < 0.0 || a2 > 1.5) return false; - if(a3 < -0.5 || a3 > 0.5) return false; - if(a4 < -0.5 || a4 > 0.5) return false; - if(a5 < -0.5 || a5 > 0.5) return false; - - if(a3 > sqrt(a1)*sqrt(a2) || a3 < -sqrt(a1)*sqrt(a2)) return false; - -// if(pow(Axx + 0.5 ,2) + pow(Ayy + 0.5 ,2) + 2* pow(Axy ,2) + 2* pow(Axz ,2) + 2* pow(Ayz ,2) > 2.25) return false; - if(pow(a1, 2) + pow(a2, 2) + 2* pow(a3, 2) + 2* pow(a4, 2) + 2* pow(a5, 2) > 1.0) return false; - - return true; -} - -math::VArray create_points_on_sphere(const unsigned int N){ - if (N<5) { - io::messages.add("Please choose a number of at least 5 magnetic field vectors, to describe general alignment", "In_RDC", io::message::critical); - } - math::VArray coordinates; - switch(N){ - case 5:{ //FIXME, this is not a good distribution - coordinates.push_back(math::Vec( 0, 0, 1)); - coordinates.push_back(math::Vec( 1, 0, 0)); - coordinates.push_back(math::Vec(-0.5, cos(M_PI/6.0), 0)); - coordinates.push_back(math::Vec(-0.5,-cos(M_PI/6.0), 0)); - coordinates.push_back(math::Vec( 0, 0, -1)); - break; - } - case 6:{ - coordinates.push_back(math::Vec( 1, 0, 0)); - coordinates.push_back(math::Vec( 0, 1, 0)); - coordinates.push_back(math::Vec( 0, 0, 1)); - coordinates.push_back(math::Vec(-1, 0, 0)); - coordinates.push_back(math::Vec( 0,-1, 0)); - coordinates.push_back(math::Vec( 0, 0,-1)); - break; - } - default:{ - const double s = 3.6/sqrt(N); - const double dz = 2.0/N; - double longitude = 0.0; - double z = 1.0 - dz/2.0; - for (unsigned int i=0; i occurrence_count(n_rdc, 0); - for (int i=0; i const & buffer, std::vector term) { return false; } -void -io::In_Topology::read(topology::Topology& topo, +template +bool check_type(int num, std::vector term) { + + for (typename std::vector::const_iterator + it = term.begin(), + to = term.end(); + it != to; + ++it) { + + if (int(it->type) >= num) { + std::cout << "ERROR:\tused type " << it->type + 1 + << " larger than max type (" << num << ")" + << std::endl; + + return false; + } + } + return true; +} + +void io::In_Topology::read(topology::Topology& topo, simulation::Parameter ¶m, std::ostream & os) { @@ -79,1732 +98,1739 @@ io::In_Topology::read(topology::Topology& topo, std::vector buffer; std::vector::const_iterator it; - std::string bond_bname = "BONDTYPE"; - block_read.insert("BONDTYPE"); - if (param.force.bond == 2) { - if (m_block["HARMBONDTYPE"].size()) { - bond_bname = "HARMBONDTYPE"; - block_read.insert("HARMBONDTYPE"); - } - } - if (param.force.bond == 0 && - m_block["BONDTYPE"].size() == 0 && - m_block["HARMBONDTYPE"].size() > 0) { - bond_bname = "HARMBONDTYPE"; - block_read.insert("HARMBONDTYPE"); - } + // allow only BONDSTRETCHTYPE or one or both of the other two + if (m_block.count("HARMBONDTYPE") + m_block.count("BONDTYPE") != 0 && m_block.count("BONDSTRETCHTYPE") != 0) + io::messages.add("Topology should contain either a BONDSTRETCHTYPE block or BONDTYPE/HARMBONDTYPE", + "In_Topology", io::message::error); - if (m_block["BONDSTRETCHTYPE"].size()) { - bond_bname = "BONDSTRETCHTYPE"; - block_read.insert("BONDSTRETCHTYPE"); - } + // allow only BONDANGLEBENDTYPE or one or both of the other two + if (m_block.count("HARMBONDANGLETYPE") + m_block.count("BONDANGLETYPE") != 0 && m_block.count("BONDANGLEBENDTYPE") != 0) + io::messages.add("Topology should contain either a BONDANGLEBENDTYPE block or BONDANGLETYPE/HARMBONDANGLETYPE", + "In_Topology", io::message::error); - std::string angle_bname = "BONDANGLETYPE"; - block_read.insert("BONDANGLETYPE"); - // no automatic conversion for angles! - if (param.force.angle == 2) { - angle_bname = "HARMBONDANGLETYPE"; - block_read.insert("HARMBONDANGLETYPE"); - } - if (m_block["BONDANGLEBENDTYPE"].size()) { - angle_bname = "BONDANGLEBENDTYPE"; - block_read.insert("BONDANGLEBENDTYPE"); - } + read_bond_types(topo, param, os); + read_bondangle_types(topo, param, os); + read_dihedral_types(topo, param, os); - std::string dihedral_bname = "DIHEDRALTYPE"; - block_read.insert("DIHEDRALTYPE"); - if (m_block["TORSDIHEDRALTYPE"].size()) { - dihedral_bname = "TORSDIHEDRALTYPE"; - block_read.insert("TORSDIHEDRALTYPE"); - } + read_block_IMPDIHEDRALTYPE(topo, param, os); - block_read.insert("IMPDIHEDRALTYPE"); + read_block_TYPE(topo, param, os); + read_block_PHYSICALCONSTANTS(topo, param, os); - { - buffer = m_block["TYPE"]; - if (buffer.size()) { - block_read.insert("TYPE"); - if (buffer.size() != 3) { - io::messages.add("Bad line in TYPE block", - "InTopology", io::message::error); - } + if (param.system.npm) { - _lineStream.clear(); - _lineStream.str(buffer[1]); - std::string s; - _lineStream >> s; + read_block_RESNAME(topo, param, os); + read_block_ATOMTYPENAME(topo, param, os); + read_block_SOLUTEATOM(topo, param, os); - if (_lineStream.fail()) - io::messages.add("Bad line in TYPE block", - "InTopology", io::message::error); + // os << "time after SOLUTEATOM: " << util::now() - start << std::endl; - if (s.length() > MAX_NAME) { - std::ostringstream msg; - msg << "Error in TYPE block: type " << s - << " is too long (> " << MAX_NAME << " characters)."; - io::messages.add(msg.str(), "InTopology", io::message::error); + { //scale mass for adiabatic decoupling + if (param.addecouple.adgr > 0) { + double sm = 1; + int adc_index; + int num = topo.num_solute_atoms(); + for (int n = 0; n < num; ++n) { + sm = 1; + adc_index = param.addecouple.check_index_adc(n); + if (adc_index != -1) { + sm = param.addecouple.adc_index()[adc_index].sm; + } + topo.mass()(n) *= sm; + } } + }//adiabatic decoupling + read_block_SOLUTEPOLARISATION(topo, param, os); + read_block_CGSOLUTE(topo, param, os); + read_block_LJEXCEPTIONS(topo, param, os); + read_block_BONDH(topo, param, os); + read_block_BOND(topo, param, os); + read_block_BONDDP(topo, param, os); - std::transform(s.begin(), s.end(), s.begin(), tolower); - - if (s == "atomistic") { - if (!quiet) - os << "\tatomistic topology\n"; - - if (param.force.interaction_function != simulation::lj_crf_func && - param.force.interaction_function != simulation::pol_lj_crf_func) { - io::messages.add("wrong interaction function selected for atomistic topology", - "InTopology", io::message::error); - } - } else if (s == "coarse-grained") { - if (!quiet) - os << "\tcoarse-grained topology\n"; - - if (param.force.interaction_function != simulation::cgrain_func) { - io::messages.add("wrong interaction function selected for coarse-grained topology", - "InTopology", io::message::error); + { // check the bonds + if (param.force.bond) { + if (!check_type(num_solute_bondtypes, topo.solute().bonds()) || + !check_type(num_solute_bondtypes, topo.solute().cgbonds())) { + io::messages.add("Illegal bond type in BOND(H) or BONDDP block" + "(type not defined in topology file)", + "In_Topology", io::message::error); } - } else { - io::messages.add("TYPE block: unknown topology type", - "InTopology", io::message::error); - } - } else { - if (!quiet) { - os << "\tunknown topology type (atomistic / coarse-grained)\n"; - if (param.force.interaction_function == simulation::lj_crf_func || - param.force.interaction_function == simulation::pol_lj_crf_func || - param.force.interaction_function == simulation::pol_off_lj_crf_func) - os << "\tusing atomistic parameters\n"; - else if (param.force.interaction_function == simulation::cgrain_func) - os << "\tusing coarse-grained parameters\n"; - else - os << "\tunknown interaction function selected!\n"; } } - } - - { // PHYSICALCONSTANTS - buffer = m_block["PHYSICALCONSTANTS"]; - if (buffer.size()) { - block_read.insert("PHYSICALCONSTANTS"); - std::string s; - _lineStream.clear(); - _lineStream.str(concatenate(buffer.begin() + 1, - buffer.end() - 1, s)); - double four_pi_eps0_i; - _lineStream >> four_pi_eps0_i >> math::h_bar >> math::spd_l >> math::k_Boltzmann; - math::eps0_i = four_pi_eps0_i * 4.0 * math::Pi; - math::four_pi_eps_i = four_pi_eps0_i / param.nonbonded.epsilon; + read_block_CONSTRAINT(topo, param, os); - if (_lineStream.fail()) - io::messages.add("Bad line in PHYSICALCONSTANTS block", - "InTopology", io::message::error); - } else { - io::messages.add("no PHYSICALCONSTANTS block in topology", - "InTopology", io::message::error); + // check the bonds in constraints + if (!check_type(num_solute_bondtypes, topo.solute().distance_constraints())) { + io::messages.add("Illegal bond type in CONSTRAINT block", + "In_Topology", io::message::error); } + read_block_BONDANGLEH(topo, param, os); + read_block_BONDANGLE(topo, param, os); - } + // os << "time after BONDANGLE: " << util::now() - start << std::endl; - if (param.system.npm) { + // check the angles + if (param.force.angle) { + if (!check_type(num_solute_angletypes, topo.solute().angles())) { + io::messages.add("Illegal bond angle type in BONDANGLE(H) block", + "In_Topology", io::message::error); + } + } - { // RESNAME - if (!quiet) - os << "\tRESNAME\n\t"; + read_block_IMPDIHEDRAL(topo, param, os); + read_block_IMPDIHEDRALH(topo, param, os); - DEBUG(10, "RESNAME block"); - buffer = m_block["RESNAME"]; - block_read.insert("RESNAME"); - it = buffer.begin() + 1; - int n, num; - _lineStream.clear(); - _lineStream.str(*it); - _lineStream >> num; - ++it; + // check the impropers + if (!check_type(num_solute_impropertypes, topo.solute().improper_dihedrals())) { + io::messages.add("Illegal improper dihedral type in IMPDIHEDRAL(H) block", + "In_Topology", io::message::error); + } - if (!quiet && num > 10) { - for (n = 0; n < 10; ++n) - os << std::setw(8) << n + 1; - os << "\n\t"; - } + read_block_DIHEDRAL(topo, param, os); + read_block_DIHEDRALH(topo, param, os); - for (n = 0; it != buffer.end() - 1; ++it, ++n) { - std::string s; - _lineStream.clear(); - _lineStream.str(*it); - _lineStream >> s; + // check the dihedrals + if (!check_type(num_solute_dihedraltypes, topo.solute().dihedrals())) { + io::messages.add("Illegal dihedral type in DIHEDRAL(H) block", + "In_Topology", io::message::error); + } - if (!quiet) { - if (n && ((n) % 10) == 0) os << std::setw(10) << n << "\n\t"; - os << std::setw(8) << s; - } + read_block_CROSSDIHEDRAL(topo, param, os); + read_block_CROSSDIHEDRALH(topo, param, os); - if (s.length() > MAX_NAME) { - std::ostringstream msg; - msg << "Error in RESNAME block: residue name " << s - << " is too long (> " << MAX_NAME << " characters)."; - io::messages.add(msg.str(), "InTopology", io::message::error); - } + // check the crossdihedrals + if (m_block["CROSSDIHEDRALH"].size() && !m_block["TORSDIHEDRALTYPE"].size()) { + io::messages.add("TORSDIHEDRALTYPE block must be specified to use crossdihedrals", + "In_Topology", io::message::error); + } + + if (!check_type(num_solute_dihedraltypes, topo.solute().crossdihedrals())) { + io::messages.add("Illegal crossdihedral type in CROSSDIHEDRAL(H) block", + "In_Topology", io::message::error); + } - topo.residue_names().push_back(s); - } + read_block_VIRTUALGRAIN(topo, param, os); - if (n != num) { - io::messages.add("Error in RESNAME block: n!=num.", - "InTopology", io::message::error); - } + // add the solute molecules (should be done before solvate ;-) - if (!quiet) - os << "\n\tEND\n"; + read_block_SOLUTEMOLECULES(topo, param, os); + if (topo.molecules().size() == 0) { + topo.molecules().push_back(0); + topo.molecules().push_back(topo.num_solute_atoms()); + } - } // RESNAME + // solutemolecules check + if (topo.molecules().back() + != topo.num_solute_atoms()) { - { // ATOMTYPENAME - if (!quiet) - os << "\tATOMTYPENAME\n\t"; + std::cout << "ERROR: Solute molecules wrong\n" + << "\tlast atom in SOLUTEMOLECULES block = " << topo.molecules().back() + << "\n\tlast atom in topology = " << topo.num_solute_atoms() + << std::endl; - DEBUG(10, "ATOMTYPENAME block"); - buffer = m_block["ATOMTYPENAME"]; - block_read.insert("ATOMTYPENAME"); - it = buffer.begin() + 1; - int n, num; - _lineStream.clear(); - _lineStream.str(*it); - _lineStream >> num; - ++it; - - topo.set_num_atomtype(num); + io::messages.add("Error in SOLUTEMOLECULES block: " + "last solute molecule has to end with last solute atom", + "In_Topology", io::message::error); + } - if (!quiet) - os << "\t" << num << " atom types\n"; + topo.num_solute_molecules() = topo.molecules().size() - 1; - for (n = 0; it != buffer.end() - 1; ++it, ++n) { - std::string s; - _lineStream.clear(); - _lineStream.str(*it); - _lineStream >> s; - if (s.length() > MAX_NAME) { - std::ostringstream msg; - msg << "Error in ATOMTYPENAME block: type " << s - << " is too long (> " << MAX_NAME << " characters)."; - io::messages.add(msg.str(), "InTopology", io::message::error); - } + read_block_TEMPERATUREGROUPS(topo, param, os); - if (topo.atom_names().find(s) == topo.atom_names().end()) { // not found - topo.atom_names()[s] = n; - } else { // found - std::ostringstream msg; - msg << "Error in ATOMTYPENAME block: atom type name " << s - << " used more than once."; - io::messages.add(msg.str(), "InTopology", io::message::error); - } - } + if (topo.temperature_groups().size() == 0) { + topo.temperature_groups().push_back(0); + topo.temperature_groups().push_back(topo.num_solute_atoms()); + } - if (n != num) { - io::messages.add("Error in ATOMTYPENAME block: n!=num.", - "InTopology", io::message::error); - } + // temperature groups check + if (topo.temperature_groups().back() + != topo.num_solute_atoms()) { - if (!quiet) - os << "\tEND\n"; + std::cout << "ERROR: temperature groups wrong\n" + << "\tlast atom in TEMPERATUREGROUPS block = " << topo.temperature_groups().back() + << "\n\tlast atom in topology = " << topo.num_solute_atoms() + << std::endl; - } // ATOMTYPENAME + io::messages.add("Error in TEMPERATUREGROUPS block: " + "last temperature group has to end with last solute atom", + "In_Topology", io::message::error); + } + topo.num_solute_temperature_groups() = topo.temperature_groups().size() - 1; - // os << "time after RESNAME: " << util::now() - start << std::endl; - { // SOLUTEATOM - DEBUG(10, "SOLUTEATOM block"); - buffer = m_block["SOLUTEATOM"]; - block_read.insert("SOLUTEATOM"); - - it = buffer.begin() + 1; - _lineStream.clear(); - _lineStream.str(*it); - int num, n; - _lineStream >> num; - topo.resize(num); - - if (!quiet) - os << "\tSOLUTEATOM\n\t" - << "\tnumber of atoms : " << num; - - // put the rest of the block into a single stream - ++it; - - // std::string soluteAtoms; - // concatenate(it, buffer.end()-1, soluteAtoms); - - // _lineStream.clear(); - // _lineStream.str(soluteAtoms); - - // os << "\ntime after concatenate: " << util::now() - start << std::endl; - - int a_nr, r_nr, t, cg, n_ex, a_ex; - double m, q; - std::string s; - topology::excl_cont_t::value_type ex; - topology::excl_cont_t::value_type ex14; - - for (n = 0; n < num; ++n) { - - _lineStream.clear(); - _lineStream.str(*it); - ++it; - - _lineStream >> a_nr >> r_nr >> s >> t >> m >> q >> cg; - - if (a_nr != n + 1) { - io::messages.add("Error in SOLUTEATOM block: atom number not sequential.", - "InTopology", io::message::error); - } - - if (r_nr > int(topo.residue_names().size()) || r_nr < 1) { - io::messages.add("Error in SOLUTEATOM block: residue number out of range.", - "InTopology", io::message::error); - } - - if (s.length() > MAX_NAME) { - std::ostringstream msg; - msg << "Error in SOLUTEATOM block: atom name " << s - << " is too long (> " << MAX_NAME << " characters)."; - io::messages.add(msg.str(), "InTopology", io::message::error); - } + read_block_PRESSUREGROUPS(topo, param, os); + if (topo.pressure_groups().size() == 0) { + topo.pressure_groups().push_back(0); + topo.pressure_groups().push_back(topo.num_solute_atoms()); + } - if (t < 1) { - io::messages.add("Error in SOLUTEATOM block: iac < 1.", - "InTopology", io::message::error); - } - - if (t > topo.num_atomtype()) { - io::messages.add("Error in SOLUTEATOM block: iac > number of atom types.", - "InTopology", io::message::error); - } + // pressure groups check + if (topo.pressure_groups().back() + != topo.num_solute_atoms()) { - if (m <= 0) { - io::messages.add("Error in SOLUTEATOM block: mass < 0.", - "InTopology", io::message::error); - } + std::cout << "ERROR: pressure groups wrong\n" + << "\tlast atom in PRESSUREGROUPS block = " << topo.pressure_groups().back() + << "\n\tlast atom in topology = " << topo.num_solute_atoms() + << std::endl; - if (cg != 0 && cg != 1) { - io::messages.add("Error in SOLUTEATOM block: cg = 0 / 1.", - "InTopology", io::message::error); - } + io::messages.add("Error in PRESSUREGROUPS block: " + "last pressure group has to end with last solute atom", + "In_Topology", io::message::error); + } - if (!(_lineStream >> n_ex)) { - if (_lineStream.eof()) { - _lineStream.clear(); - _lineStream.str(*it); - ++it; - _lineStream >> n_ex; - } else { - io::messages.add("Error in SOLUTEATOM block: number of exclusions " - "could not be read.", - "InTopology", io::message::error); - } - } + topo.num_solute_pressure_groups() = topo.pressure_groups().size() - 1; - if (n_ex < 0) { - io::messages.add("Error in SOLUTEATOM block: number of exclusions < 0.", - "InTopology", io::message::error); - } + { // PATHINTSPEC + buffer = m_block["PATHINTSPEC"]; + if (buffer.size()) { + block_read.insert("PATHINTSPEC"); + io::messages.add("md++ does not support path-integral simulations (PATHINTSPEC block).", + "InTopology", io::message::warning); + } + } + } // npm != 0 - // exclusions - ex.clear(); - for (int i = 0; i < n_ex; ++i) { - if (!(_lineStream >> a_ex)) { - if (_lineStream.eof()) { - _lineStream.clear(); - _lineStream.str(*it); - ++it; - _lineStream >> a_ex; - } else { - io::messages.add("Error in SOLUTEATOM block: exclusion " - "could not be read.", - "InTopology", io::message::error); - } - } + { // SOLVENTATOM and SOLVENTCONSTR + // give it a number (SOLVENTATOM1, SOLVENTATOM2) for multiple + // solvents... + read_SOLVENT_blocks(topo, param, os); + // solvent atoms have been read into s + } - if (a_ex <= a_nr) - io::messages.add("Error in SOLUTEATOM block: exclusions only to " - "larger atom numbers.", - "InTopology", io::message::error); + // add the solvent to the topology + if (!quiet) + os << "\n\t\tadding " << param.system.nsm + << " solvents."; - ex.insert(a_ex - 1); - } + // if (param.system.nsm) + topo.solvate(0, param.system.nsm); - // 1,4 - pairs - if (!(_lineStream >> n_ex)) { - if (_lineStream.eof()) { - _lineStream.clear(); - _lineStream.str(*it); - ++it; - _lineStream >> n_ex; - } else { - io::messages.add("Error in SOLUTEATOM block: number of 1,4 - exclusion " - "could not be read.", - "InTopology", io::message::error); - } - } + if (!quiet) + os << "\n\tEND\n"; - if (n_ex < 0) { - io::messages.add("Error in SOLUTEATOM block: number of 1,4 exclusions < 0.", - "InTopology", io::message::error); - } + {// SASAPARAMETER + if (param.sasa.switch_sasa) { // if SASA is switched on - ex14.clear(); - for (int i = 0; i < n_ex; ++i) { - if (!(_lineStream >> a_ex)) { - if (_lineStream.eof()) { - _lineStream.clear(); - _lineStream.str(*it); - ++it; - _lineStream >> a_ex; - } else { - io::messages.add("Error in SOLUTEATOM block: 1,4 - exclusion " - "could not be read.", - "InTopology", io::message::error); - } - } + read_sasa_parameter(topo, topo.sasa_parameter()); - if (a_ex <= a_nr) - io::messages.add("Error in SOLUTEATOM block: 1,4 - exclusions only to " - "larger atom numbers.", - "InTopology", io::message::error); + if (!quiet) { + os << "\tSASAPARAMETERS\n\t\tSASA is switched on\n\t\tN_sasa_atoms :\t" + << topo.sasa_parameter().size() << "\n\t\tp_12 :\t\t" << param.sasa.p_12 + << "\n\t\tp_13 :\t\t" << param.sasa.p_13 << "\n\t\tp_1x :\t\t" << param.sasa.p_1x + << "\n\t\tR_solv :\t" << param.sasa.r_solv << std::endl; - ex14.insert(a_ex - 1); + if (param.sasa.switch_volume) { + os << "\t\tVOL is switched on\n\t\tsigma_vol :\t" << param.sasa.sigma_v << std::endl; } - - if (_lineStream.fail()) - io::messages.add("bad line in SOLUTEATOM block", - "In_Topology", - io::message::critical); - - topo.add_solute_atom(s, r_nr - 1, t - 1, m, q, cg, ex, ex14); + os << "\tEND\n"; } - if (!quiet) - os << "\n\tEND\n"; + } + // SASAPARAMETER + } - } // SOLUTEATOM - // os << "time after SOLUTEATOM: " << util::now() - start << std::endl; - { //scale mass for adiabatic decoupling - if (param.addecouple.adgr > 0) { - double sm = 1; - int adc_index; - int num = topo.num_solute_atoms(); - for (int n = 0; n < num; ++n) { - sm = 1; - adc_index = param.addecouple.check_index_adc(n); - if (adc_index != -1) { - sm = param.addecouple.adc_index()[adc_index].sm; - } - topo.mass()(n) *= sm; - } - } - }//adiabatic decoupling + // set lambda (new and old one, yes it looks strange...) + topo.lambda(param.perturbation.lambda); + topo.lambda(param.perturbation.lambda); - { // SOLUTEPOLARISATION - DEBUG(10, "SOLUTEPOLARISATION block"); - buffer.clear(); - buffer = m_block["SOLUTEPOLARISATION"]; + topo.lambda_exp(param.perturbation.lambda_exponent); - if (buffer.size()) { - block_read.insert("SOLUTEPOLARISATION"); - if (!quiet) - os << "\tSOLUTEPOLARISATION\n" - << "\t\tblock present\n" - << "\tEND\n"; - it = buffer.begin() + 1; + //================================================== + // CHECKING + //================================================== - _lineStream.clear(); - _lineStream.str(*it); + // solute molecule check + if (topo.molecules().back() + != topo.num_atoms()) { - int num, n; - _lineStream >> num; - ++it; + io::messages.add("Error in SOLUTEMOLECULE / solvation block: " + "last solute molecule has to end with last atom", + "In_Topology", io::message::error); + } - for (n = 0; it != buffer.end() - 1; ++it, ++n) { - int i, j, k; - double polarisability, coscharge, damping_level, damping_power, gamma; - _lineStream.clear(); - _lineStream.str(*it); - _lineStream >> i >> polarisability >> coscharge >> damping_level - >> damping_power >> gamma >> j >> k; - if (_lineStream.fail() || !_lineStream.eof()) { - io::messages.add("Bad line in SOLUTEPOLARISATION block", - "In_Topology", io::message::error); - } + // temperature group check + if (topo.temperature_groups().back() + != topo.num_atoms()) { - if (i > int(topo.num_solute_atoms()) || i < 1) { - io::messages.add("Atom number out of range in SOLUTEPOLARISATION block", - "In_Topology", io::message::error); - } else if (gamma != 0.0 && (j < 1 || k < 1 || j > int(topo.num_solute_atoms()) - || k > int(topo.num_solute_atoms()) || i == k || i == j || k == j)) { - io::messages.add("Atom number for off atom out of range in SOLUTEPOLARISATION block", - "In_Topology", io::message::error); - } else { - DEBUG(10, "\tpolarisable atom: " << i); - topo.polarisability()[i - 1] = polarisability / math::four_pi_eps_i; - topo.coscharge()[i - 1] = coscharge; - topo.damping_level()[i - 1] = damping_level * sqrt(math::four_pi_eps_i); - topo.damping_power()[i - 1] = damping_power; - topo.is_polarisable()[i - 1] = bool(polarisability > 0.0); - if (param.polarise.cos == 2) { - topo.gamma()[i - 1] = 2 * gamma; - topo.gamma_j()[i - 1] = j - 1; - topo.gamma_k()[i - 1] = k - 1; - } + io::messages.add("Error in TEMPERATUREGROUPS / solvation block: " + "last temperature group has to end with last atom", + "In_Topology", io::message::error); + } - } - } + // pressure group check + if (topo.pressure_groups().back() + != topo.num_atoms()) { - if (n != num) { - io::messages.add("Wrong number of polarisable atoms in SOLUTEPOLARISATION block", - "In_Topology", io::message::error); - } - } - } // SOLUTEPOLARISATION + io::messages.add("Error in PRESSUREGROUPS / solvation block: " + "last pressure group has to end with last atom", + "In_Topology", io::message::error); + } - { // CGSOLUTE - DEBUG(10, "CGSOLUTE block"); + // chargegroup check (starts with 0) + if (topo.chargegroups()[topo.num_solute_chargegroups()] != int(topo.num_solute_atoms())) { + io::messages.add("Error: last solute atom has to be end of chargegroup", + "In_Topology", + io::message::error); + os << "ERROR:" + << "\tsolute cg : " << topo.num_solute_chargegroups() << "\n" + << "\tsolute atoms : " << topo.num_solute_atoms() << "\n" + << "\tlast cg : " << topo.chargegroups()[topo.num_solute_chargegroups()] << "\n"; + } - if (!quiet) - os << "\tCGSOLUTE\n"; + if (!quiet) + os << "\tSOLUTE [sub]molecules: " + << unsigned(topo.molecules().size()) - param.system.nsm - 1 << "\n"; - buffer.clear(); - buffer = m_block["CGSOLUTE"]; - if (buffer.size()) { - block_read.insert("CGSOLUTE"); - it = buffer.begin() + 1; + DEBUG(10, "molecules().size: " << unsigned(topo.molecules().size()) + << " nsm : " << param.system.nsm); - _lineStream.clear(); - _lineStream.str(*it); + if (!quiet) + os << "\tSOLUTE temperature groups: " + << unsigned(topo.temperature_groups().size()) - param.system.nsm - 1 << "\n"; - int num, n; - _lineStream >> num; - ++it; - os << "\t\tnumber of ranges: " << num << "\n"; + DEBUG(10, "temperature_groups().size: " << unsigned(topo.temperature_groups().size())); - for (n = 0; it != buffer.end() - 1; ++it, ++n) { - int cg_begin, cg_end, cg_fac; - _lineStream.clear(); - _lineStream.str(*it); - _lineStream >> cg_begin >> cg_end >> cg_fac; - - if (_lineStream.fail() || !_lineStream.eof()) { - io::messages.add("Bad line in CGSOLUTE block", - "In_Topology", io::message::error); - } + if (!quiet) + os << "\tSOLUTE pressure groups: " + << unsigned(topo.pressure_groups().size()) - param.system.nsm - 1 << "\n"; - if ((cg_begin > int(topo.num_solute_atoms()) || cg_begin < 1) - || (cg_end > int(topo.num_solute_atoms()) || cg_end < 1) - || (cg_begin > cg_end)) { - io::messages.add("Sequence number out of range in CGSOLUTE block", - "In_Topology", io::message::error); - } else if (cg_fac < 1) { - io::messages.add("CG factor out of range in CGSOLUTE block", - "In_Topology", io::message::error); - } else { - DEBUG(10, "\tcoarse grained range: " << cg_begin << " " << cg_end); - DEBUG(10, "\tcoarse grained factor: " << cg_fac); - os << "\t\trange: " << cg_begin << " " << cg_end << "\n" - << "\t\tcoarse grained factor: " << cg_fac << "\n"; - for (unsigned int i = (cg_begin - 1); i < unsigned(cg_end); ++i) { - topo.is_coarse_grained()[i] = true; - topo.cg_factor()[i] = cg_fac; - } - } - } - os << "\tEND\n"; + DEBUG(10, "pressure_groups().size: " << unsigned(topo.pressure_groups().size())); - if (n != num) { - io::messages.add("Wrong number of ranges in CGSOLUTE block", - "In_Topology", io::message::error); - } - } - } // CGSOLUTE + // energy group check + if (param.force.energy_group.size() == 0) { + param.force.energy_group.push_back(topo.num_atoms() - 1); + } - { // LJEXCEPTIONS - DEBUG(10, "LJEXCEPTIONS block"); - buffer.clear(); - buffer = m_block["LJEXCEPTIONS"]; + if (param.force.energy_group.back() > topo.num_atoms() - 1) { + io::messages.add("Error in FORCE block: " + "last energy group has to end with last atom", + "In_Topology", io::message::error); + } else if (param.force.energy_group.back() < topo.num_atoms() - 1) { + param.force.energy_group.push_back(topo.num_atoms() - 1); + io::messages.add("FORCE block: " + "added an additional energy group", + "In_Topology", io::message::warning); + } - if (buffer.size()) { - block_read.insert("LJEXCEPTIONS"); - it = buffer.begin() + 1; + // and add them + DEBUG(10, "adding energy groups : " << param.force.energy_group.size()); + unsigned int atom = 0; + for (unsigned int i = 0; i < param.force.energy_group.size(); ++i) { + assert(param.force.energy_group.size() > i); + topo.energy_groups().push_back(param.force.energy_group[i]); + DEBUG(10, "energy group " << i << " start = " << atom << " end = " << param.force.energy_group[i]); + for (; atom <= param.force.energy_group[i]; ++atom) { + topo.atom_energy_group().push_back(i); + // DEBUG(11, "atom " << atom << ": " << i); + } + } - _lineStream.clear(); - _lineStream.str(*it); + // Now that we have the energy groups, we initialize the + // LAMBDAS parameters that depend on them. + int maxnilg = param.force.energy_group.size(); + std::vector< double > one(maxnilg, 1.0); + std::vector< double > zero(maxnilg, 0.0); + for (unsigned int i = 0; i < param.lambdas.a.size(); i++) { + // check whether we have to resize the lambdas arrays + int lam_size = param.lambdas.a[i].size(); + if (lam_size < maxnilg) { + param.lambdas.a[i].insert(param.lambdas.a[i].end(), maxnilg - lam_size, zero); + lam_size = param.lambdas.b[i].size(); + param.lambdas.b[i].insert(param.lambdas.b[i].end(), maxnilg - lam_size, zero); + lam_size = param.lambdas.c[i].size(); + param.lambdas.c[i].insert(param.lambdas.c[i].end(), maxnilg - lam_size, zero); + lam_size = param.lambdas.d[i].size(); + param.lambdas.d[i].insert(param.lambdas.d[i].end(), maxnilg - lam_size, one); + lam_size = param.lambdas.e[i].size(); + param.lambdas.e[i].insert(param.lambdas.e[i].end(), maxnilg - lam_size, zero); + for (unsigned int j = 0; j < param.lambdas.a[i].size(); j++) { + lam_size = param.lambdas.a[i][j].size(); + param.lambdas.a[i][j].insert(param.lambdas.a[i][j].end(), maxnilg - lam_size, 0.0); + lam_size = param.lambdas.b[i][j].size(); + param.lambdas.b[i][j].insert(param.lambdas.b[i][j].end(), maxnilg - lam_size, 0.0); + lam_size = param.lambdas.c[i][j].size(); + param.lambdas.c[i][j].insert(param.lambdas.c[i][j].end(), maxnilg - lam_size, 0.0); + lam_size = param.lambdas.d[i][j].size(); + param.lambdas.d[i][j].insert(param.lambdas.d[i][j].end(), maxnilg - lam_size, 1.0); + lam_size = param.lambdas.e[i][j].size(); + param.lambdas.e[i][j].insert(param.lambdas.e[i][j].end(), maxnilg - lam_size, 0.0); + } + } // do resize lambdas arrays + } - int num, n; - _lineStream >> num; - ++it; - if (_lineStream.fail() || !_lineStream.eof()) { - io::messages.add("Bad line in LJEXCEPTIONS block", - "In_Topology", io::message::error); - } else { - if (!quiet) { - os << "\tLJEXCEPTIONS\n" - << "\t\t" << num << " Lennard-Jones exceptions.\n" - << "\tEND\n"; - } - } + DEBUG(10, "multibath?"); + if (!param.multibath.found_multibath && param.multibath.found_tcouple) { + if (!quiet) + os << "\tparsing a (deprecated) TCOUPLE block into the new " + << "MULTIBATH format.\n"; - for (n = 0; it != buffer.end() - 1; ++it, ++n) { - int i, j; - double c6, c12; - _lineStream.clear(); - _lineStream.str(*it); - _lineStream >> i >> j >> c12 >> c6; + util::parse_TCOUPLE(param, topo); + } - if (_lineStream.fail() || !_lineStream.eof()) { - io::messages.add("Bad line in LJEXCEPTIONS block", - "In_Topology", io::message::error); - } + // additional known blocks not read in with this routine + if (m_block["LJPARAMETERS"].size()) { + block_read.insert("LJPARAMETERS"); + } + if (m_block["CGPARAMETERS"].size()) { + block_read.insert("CGPARAMETERS"); + } - if (i > int(topo.num_solute_atoms()) || i < 1 || - j > int(topo.num_solute_atoms()) || j < 1) { - io::messages.add("Atom number out of range in LJEXCEPTIONS block", - "In_Topology", io::message::error); - } else { - i--; - j--; - if (i > j) - std::swap(i, j); - topo.lj_exceptions().push_back(topology::lj_exception_struct(i, j, c6, c12)); - topo.all_exclusion(i).insert(j); - } - } + // warn for unread input data + for(std::map >::const_iterator + it = m_block.begin(), to = m_block.end(); it != to; ++it){ + if (block_read.count(it->first) == 0 && it->second.size()){ + io::messages.add("block " + it->first + " unknown and not read in!", + "In_Topology", io::message::warning); + } + } - if (n != num) { - io::messages.add("Wrong number of lines in LJEXCEPTIONS block", + if (!quiet) + os << "END\n"; + + DEBUG(10, "topology read"); +} + + +void io::In_Topology::read_bond_types(topology::Topology& topo, + simulation::Parameter ¶m, + std::ostream & os) { + + DEBUG(10, "reading bond types"); + if (m_block["BONDSTRETCHTYPE"].size()) { + io::messages.add("Reading bond types from BONDSTRETCHTYPE block", + "In_Topology::bondtype", io::message::notice); + read_block_BONDSTRETCHTYPE(topo, param, os); + } else if (m_block["HARMBONDTYPE"].size() && m_block["BONDTYPE"].size()) { + io::messages.add("Reading bond types from HARMBONDTYPE and BONDTYPE block", + "In_Topology::bondtype", io::message::notice); + read_block_BONDTYPE(topo, param, os); + read_block_HARMBONDTYPE(topo, param, os); + + // require that the blocks have the same length + if (topo.bond_types_harm().size() != topo.bond_types_quart().size()) + io::messages.add("BONDTYPE and HARMBONDTYPE blocks contain different numbers of bond types", "In_Topology", io::message::error); + + //check consistency of bond lengths + for (unsigned int i=0; i< topo.bond_types_harm().size(); i++) { + double rh=topo.bond_types_harm()[i].r0, r=topo.bond_types_quart()[i].r0; + if (rh != r) { + std::ostringstream msg; + msg << "Bond lengths in BONDTYPE and HARMBONDTYPE differ (" << r << " vs. " << rh << ")."; + io::messages.add(msg.str(), "InTopology", io::message::warning); } } - } // LJEXCEPTION + } else if (m_block["HARMBONDTYPE"].size()) { + io::messages.add("Reading bond types from HARMBONDTYPE block", + "In_Topology::bondtype", io::message::notice); + if (param.force.bond == 1) + io::messages.add("Found only bond types with harmonic force constants (HARMBONDTYPE) but NTBBH=0\n" + "\tCalculating quartic force constants from the harmonic ones.", + "In_Topology", io::message::warning); - { // BONDH - DEBUG(10, "BONDH block"); + read_block_HARMBONDTYPE(topo, param, os); - if (!quiet) - os << "\tBOND"; + // calculate the quartic ones + for (unsigned int i=0; i< topo.bond_types_harm().size(); i++) { + double kh=topo.bond_types_harm()[i].K; + double r=topo.bond_types_harm()[i].r0; + double k=kh/(2*r*r); + topo.bond_types_quart().push_back(interaction::bond_type_struct(k, r)); + } - buffer.clear(); - buffer = m_block["BONDH"]; - if (buffer.size()) { - block_read.insert("BONDH"); - it = buffer.begin() + 1; + } else if (m_block["BONDTYPE"].size()) { + io::messages.add("Reading bond types from BONDTYPE block", + "In_Topology::bondtype", io::message::notice); + if (param.force.bond == 2) + io::messages.add("Found only bond types with quartic force constants (BONDTYPE) but NTBBH=1\n" + "\tCalculating harmonic force constants from the quartic ones.", + "In_Topology", io::message::warning); - _lineStream.clear(); - _lineStream.str(*it); + read_block_BONDTYPE(topo, param, os); - int num, n; - _lineStream >> num; - ++it; + // calculate the harmonic ones + for (unsigned int i=0; i< topo.bond_types_quart().size(); i++) { + double k=topo.bond_types_quart()[i].K; + double r=topo.bond_types_quart()[i].r0; + double kh=k*2*r*r; + topo.bond_types_harm().push_back(interaction::bond_type_struct(kh, r)); + } - if (!quiet) { - if (param.constraint.ntc == 2 || param.constraint.ntc == 3) { - os << "\n\t\t" - << num - << " bonds from BONDH block added to CONSTRAINT"; - } else - os << "\n\t\tbonds containing hydrogens : " - << num; - } + } else { + io::messages.add("Found no bond type parameters (BONDSTRETCHTYPE, BONDTYPE or HARMBONDTYPE block) in the topology.", + "In_Topology", io::message::error); + } - for (n = 0; it != buffer.end() - 1; ++it, ++n) { - int i, j, t; - _lineStream.clear(); - _lineStream.str(*it); - _lineStream >> i >> j >> t; + // check consistency: bond_types_quart and bond_types_harm have to be the same + for (unsigned int i=0; i< topo.bond_types_harm().size(); i++) { + double kh=topo.bond_types_harm()[i].K, k=topo.bond_types_quart()[i].K; + double r=topo.bond_types_harm()[i].r0; + double calc_kh = k * 2.0 * r*r; + if (fabs(kh - calc_kh) / kh > 1.0e-4) { + std::ostringstream msg; + msg << "harmonic and quartic force constant do not match (CHB!=CB*2*B0*B0): " << std::endl + << "\tCHB = " << kh << ", CB*2*B0*B0 = " << calc_kh + << " |CHB-CB*2*B0*B0| = " << fabs(kh - calc_kh) << std::endl; + io::messages.add(msg.str(), "InTopology", io::message::warning); + } + } - if (_lineStream.fail() || !_lineStream.eof()) { - io::messages.add("Bad line in BONDH block", - "In_Topology", io::message::error); - } + num_solute_bondtypes = topo.bond_types_quart().size(); - if (i > int(topo.num_solute_atoms()) || j > int(topo.num_solute_atoms()) || - i < 1 || j < 1) { - io::messages.add("Atom number out of range in BONDH block", - "In_Topology", io::message::error); - } - - if (t < 1) { - io::messages.add("Error in BONDH block: bond type < 1", - "In_Topology", io::message::error); - } + // add solvent constraints as bond types + std::string blockname = "SOLVENTCONSTR"; + Block block(blockname); + if (block.read_buffer(m_block[blockname], false) == 0) { + block_read.insert(blockname); + unsigned int num; + block.get_next_parameter("NCONS", num, ">=0", ""); - if (param.constraint.ntc == 2 || param.constraint.ntc == 3) { - topo.solute().distance_constraints(). - push_back(topology::two_body_term_struct(i - 1, j - 1, t - 1)); - } else - topo.solute().bonds(). - push_back(topology::two_body_term_struct(i - 1, j - 1, t - 1)); + int ic, jc; + double b0; + for (unsigned int i=0; i=1", ""); + block.get_next_parameter("JCONS", jc, ">=1", ""); + block.get_next_parameter("CONS", b0, ">=0", ""); - } + if (block.error()) break; - if (n != num) { - io::messages.add("Wrong number of bonds in BONDH block", - "In_Topology", io::message::error); - } + topo.bond_types_harm().push_back(interaction::bond_type_struct(0, b0)); + topo.bond_types_quart().push_back(interaction::bond_type_struct(0, b0)); + } + + block.get_final_messages(false); + } +} + +void io::In_Topology::read_bondangle_types(topology::Topology& topo, + simulation::Parameter ¶m, + std::ostream & os) { + + // avoid "block not read" messages + block_read.insert("BONDANGLEBENDTYPE"); + block_read.insert("BONDANGLETYPE"); + block_read.insert("HARMBONDANGLETYPE"); + + // read BONDANGLEBENDTYPE, or, if it does not exist, any other bond angle + // type blocks that exist + if (m_block["BONDANGLEBENDTYPE"].size()) { + io::messages.add("Reading angle types from BONDANGLEBENDTYPE block", + "In_Topology::angletype", io::message::notice); + read_block_BONDANGLEBENDTYPE(topo, param, os); + } else { + if (m_block["BONDANGLETYPE"].size()) { + io::messages.add("Reading angle types from BONDANGLETYPE block", + "In_Topology::angletype", io::message::notice); + read_block_BONDANGLETYPE(topo, param, os); + } + if (m_block["HARMBONDANGLETYPE"].size()) { + io::messages.add("Reading angle types from HARMBONDANGLETYPE block", + "In_Topology::angletype", io::message::notice); + read_block_HARMBONDANGLETYPE(topo, param, os); + } + } + + // now check if we have the ones that we need + if (param.force.angle == 2) { + // harmonic potential + if (!m_block["HARMBONDANGLETYPE"].size() && !m_block["BONDANGLEBENDTYPE"].size()) { + io::messages.add("Harmonic angle potential requested (NTBAH=1) but " + "no BONDANGLEBENDTYPE or HARMBONDANGLETYPE block found.", + "In_Topology", io::message::error); + } + } else if (param.force.angle == 1) { + // cosine harmonic potential + if (!m_block["BONDANGLETYPE"].size() && !m_block["BONDANGLEBENDTYPE"].size()) { + io::messages.add("Cosine armonic angle potential requested (NTBAH=0) but " + "no BONDANGLEBENDTYPE or BONDANGLETYPE block found.", + "In_Topology", io::message::error); } + } - } // BONDH + // either both lists have the same length or one of them has size 0: + num_solute_angletypes = topo.angle_types_cosharm().size(); + if (num_solute_angletypes == 0) num_solute_angletypes = topo.angle_types_harm().size(); - { // BOND - DEBUG(10, "BOND block"); - buffer = m_block["BOND"]; +} - if (buffer.size()) { - block_read.insert("BOND"); - it = buffer.begin() + 1; - _lineStream.clear(); - _lineStream.str(*it); - int num, n; - _lineStream >> num; - ++it; +void io::In_Topology::read_dihedral_types(topology::Topology& topo, + simulation::Parameter ¶m, + std::ostream & os) { - if (!quiet) { - if (param.constraint.ntc == 3) { - os << "\n\t\t" - << num - << " bonds from BOND block added to CONSTRAINT"; - } else - os << "\n\t\tbonds not containing hydrogens : " - << num; - } + // avoid "block not read" messages + block_read.insert("TORSDIHEDRALTYPE"); + block_read.insert("DIHEDRALTYPE"); - for (n = 0; it != buffer.end() - 1; ++it, ++n) { - int i, j, t; + if (m_block["TORSDIHEDRALTYPE"].size()) { + io::messages.add("Reading angle types from TORSDIHEDRALTYPE block", + "In_Topology::dihedraltype", io::message::notice); + read_block_TORSDIHEDRALTYPE(topo, param, os); + } else if (m_block["DIHEDRALTYPE"].size()) { + if (param.force.dihedral == 1) { + io::messages.add("DIHEDRALTYPE block can not be used with NTBDN=0 (COVALENTFORM block).", + "In_Topology", io::message::error); + } + io::messages.add("Reading angle types from DIHEDRALTYPE block", + "In_Topology::dihedraltype", io::message::notice); + read_block_DIHEDRALTYPE(topo, param, os); + } else { + io::messages.add("Either TORSDIHEDRALTYPE or DIHEDRALTYPE block must be present.", + "In_Topology", io::message::error); + } + num_solute_dihedraltypes=topo.dihedral_types().size(); +} - _lineStream.clear(); - _lineStream.str(*it); - _lineStream >> i >> j >> t; +void io::In_Topology::read_block_BONDSTRETCHTYPE(topology::Topology &topo, + simulation::Parameter ¶m, std::ostream & os) { - if (_lineStream.fail() || !_lineStream.eof()) { - io::messages.add("Bad line in BOND block", - "In_Topology", io::message::error); - } + std::string blockname = "BONDSTRETCHTYPE"; + Block block(blockname); - if (i > int(topo.num_solute_atoms()) || j > int(topo.num_solute_atoms()) || - i < 1 || j < 1) { - io::messages.add("Atom number out of range in BOND block", - "In_Topology", io::message::error); - } - - if (t < 1) { - io::messages.add("Error in BOND block: bond type < 1", - "In_Topology", io::message::error); - } + if (block.read_buffer(m_block[blockname], false) == 0) { + DEBUG(7, "reading in "+blockname+" block"); - if (param.constraint.ntc == 3) { - topo.solute().distance_constraints(). - push_back(topology::two_body_term_struct(i - 1, j - 1, t - 1)); - } else - topo.solute().bonds(). - push_back(topology::two_body_term_struct(i - 1, j - 1, t - 1)); - } + block_read.insert(blockname); - if (n != num) { - io::messages.add("Wrong number of bonds in BOND block", - "In_Topology", io::message::error); - } + int num; + double k, kh, r; + block.get_next_parameter("NBTY", num, ">=0", ""); + + if (num<=0 || block.error() ) return; + + for (int i=0; i=0", ""); + block.get_next_parameter("kh", kh, ">=0", ""); + block.get_next_parameter("r", r, ">=0", ""); + if (block.error()) { + std::string linenumber=io::to_string(num+1); + io::messages.add("Bad values in line "+linenumber+" in "+blockname+" block", + "In_Topology", + io::message::error); + break; // TODO: should we break here or rather just set k and r to 0 and loop through everything? + } else { + topo.bond_types_harm().push_back(interaction::bond_type_struct(kh, r)); + topo.bond_types_quart().push_back(interaction::bond_type_struct(k, r)); } + } - if (!quiet) - os << "\n\tEND\n"; + block.get_final_messages(false); + } - } // BOND +} - { // BONDDP - DEBUG(10, "BONDDP block"); +void io::In_Topology::read_block_BONDTYPE(topology::Topology& topo, + simulation::Parameter ¶m, std::ostream & os) { - if (!quiet) - os << "\tBONDDP"; + std::string blockname = "BONDTYPE"; + Block block(blockname); - buffer.clear(); - buffer = m_block["BONDDP"]; - if (buffer.size()) { - block_read.insert("BONDDP"); - it = buffer.begin() + 1; + if (block.read_buffer(m_block[blockname], false) == 0) { + DEBUG(7, "reading in "+blockname+" block"); - _lineStream.clear(); - _lineStream.str(*it); + block_read.insert(blockname); - int num, n; - _lineStream >> num; - ++it; + int num; + double k, r; + block.get_next_parameter("NBTY", num, ">=0", ""); - if (!quiet) { - os << "\n\t\tspecial bonds to dipole particles : " - << num; - } + if (num<=0 || block.error() ) return; - for (n = 0; it != buffer.end() - 1; ++it, ++n) { - int i, j, t; - _lineStream.clear(); - _lineStream.str(*it); - _lineStream >> i >> j >> t; + for (int i=0; i=0", ""); + block.get_next_parameter("r", r, ">=0", ""); + if (block.error()) { + std::string linenumber=io::to_string(num+1); + io::messages.add("Bad values in line "+linenumber+" in "+blockname+" block", + "In_Topology", + io::message::error); + break; // TODO: should we break here or rather just set k and r to 0 and loop through everything? + } else { + topo.bond_types_quart().push_back(interaction::bond_type_struct(k, r)); + } + } - if (_lineStream.fail() || !_lineStream.eof()) { - io::messages.add("Bad line in BONDDP block", - "In_Topology", io::message::error); - } + block.get_final_messages(false); + } +} - if (i > int(topo.num_solute_atoms()) || j > int(topo.num_solute_atoms()) || - i < 1 || j < 1) { - io::messages.add("Atom number out of range in BONDDP block", - "In_Topology", io::message::error); - } - - if (t < 1) { - io::messages.add("Error in BONDDP block: bond type < 1", - "In_Topology", io::message::error); - } +void io::In_Topology::read_block_HARMBONDTYPE(topology::Topology& topo, + simulation::Parameter ¶m, std::ostream & os) { - topo.solute().cgbonds(). - push_back(topology::two_body_term_struct(i - 1, j - 1, t - 1)); - } + std::string blockname = "HARMBONDTYPE"; + Block block(blockname); - if (n != num) { - io::messages.add("Wrong number of bonds in BONDDP block", - "In_Topology", io::message::error); - } + if (block.read_buffer(m_block[blockname], false) == 0) { + DEBUG(7, "reading in "+blockname+" block"); + + block_read.insert(blockname); + + int num; + double kh, r; + block.get_next_parameter("NBTY", num, ">=0", ""); + + if (num<=0 || block.error() ) return; + + for (int i=0; i=0", ""); + block.get_next_parameter("r", r, ">=0", ""); + if (block.error()) { + std::string linenumber=io::to_string(num+1); + io::messages.add("Bad values in line "+linenumber+" in "+blockname+" block", + "In_Topology", + io::message::error); + break; // TODO: should we break here or rather just set k and r to 0 and loop through everything? + } else { + topo.bond_types_harm().push_back(interaction::bond_type_struct(kh, r)); } + } - if (!quiet) - os << "\n\tEND\n"; + block.get_final_messages(false); + } +} - } // BONDDP +void io::In_Topology::read_block_BONDANGLEBENDTYPE(topology::Topology &topo, + simulation::Parameter ¶m, std::ostream & os) { - { // check the bonds + std::string blockname = "BONDANGLEBENDTYPE"; + Block block(blockname); - if (param.force.bond) { - if (!check_type(m_block[bond_bname], topo.solute().bonds()) || - !check_type(m_block[bond_bname], topo.solute().cgbonds())) { - io::messages.add("Illegal bond type in BOND(H) or BONDDP block (type not in " - + bond_bname + ")", - "In_Topology", io::message::error); - } + if (block.read_buffer(m_block[blockname], false) == 0) { + DEBUG(7, "reading in "+blockname+" block"); + + block_read.insert(blockname); + + int num; + double kcosh, kh, theta; + block.get_next_parameter("NTTY", num, ">=0", ""); + + if (num<=0 || block.error() ) return; + + for (int i=0; i=0", ""); + block.get_next_parameter("CHT", kh, ">=0", ""); + block.get_next_parameter("T0", theta, "", ""); + if (block.error()) { + std::string linenumber=io::to_string(num+1); + io::messages.add("Bad values in line "+linenumber+" in "+blockname+" block", + "In_Topology", + io::message::error); + break; + } else { + topo.angle_types_harm().push_back(interaction::angle_type_struct(kh * (180.0 * 180.0 / (math::Pi * math::Pi)), + theta * math::Pi / 180.0)); + topo.angle_types_cosharm().push_back(interaction::angle_type_struct(kcosh, cos(theta * math::Pi / 180.0))); } } - { // CONSTRAINT - DEBUG(10, "CONSTRAINT block"); - buffer = m_block["CONSTRAINT"]; + block.get_final_messages(false); + } - if (buffer.size() && param.constraint.ntc != 1) { - block_read.insert("CONSTRAINT"); +} - it = buffer.begin() + 1; - _lineStream.clear(); - _lineStream.str(*it); - int num, n; - _lineStream >> num; - ++it; +void io::In_Topology::read_block_BONDANGLETYPE(topology::Topology &topo, + simulation::Parameter ¶m, std::ostream & os) { - if (!quiet) - os << "\tCONSTRAINT\n\t\t" - << num - << " bonds in CONSTRAINT block." - << "\n\t\ttotal of constraint bonds : " - << num + unsigned(topo.solute().distance_constraints().size()) - << "\n\tEND\n"; + std::string blockname = "BONDANGLETYPE"; + Block block(blockname); + + if (block.read_buffer(m_block[blockname], false) == 0) { + DEBUG(7, "reading in "+blockname+" block"); + + block_read.insert(blockname); + + int num; + double kcosh, theta; + block.get_next_parameter("NTTY", num, ">=0", ""); - for (n = 0; it != buffer.end() - 1; ++it, ++n) { - int i, j, t; + if (num<=0 || block.error() ) return; - _lineStream.clear(); - _lineStream.str(*it); - _lineStream >> i >> j >> t; + for (int i=0; i=0", ""); + block.get_next_parameter("T0", theta, "", ""); + if (block.error()) { + std::string linenumber=io::to_string(num+1); + io::messages.add("Bad values in line "+linenumber+" in "+blockname+" block", + "In_Topology", + io::message::error); + break; + } else { + topo.angle_types_cosharm().push_back(interaction::angle_type_struct(kcosh, cos(theta * math::Pi / 180.0))); + } + } - if (_lineStream.fail() || !_lineStream.eof()) { - io::messages.add("Bad line in CONSTRAINT block", - "In_Topology", io::message::error); - } + block.get_final_messages(false); + } - if (i > int(topo.num_solute_atoms()) || j > int(topo.num_solute_atoms()) || - i < 1 || j < 1) { - io::messages.add("Atom number out of range in CONSTRAINT block", - "In_Topology", io::message::error); - } - - if (t < 1) { - io::messages.add("Error in CONSTRAINT block: bond type < 1", - "In_Topology", io::message::error); - } +} - topo.solute().distance_constraints(). - push_back(topology::two_body_term_struct(i - 1, j - 1, t - 1)); - } +void io::In_Topology::read_block_HARMBONDANGLETYPE(topology::Topology &topo, + simulation::Parameter ¶m, std::ostream & os) { - if (n != num) { - io::messages.add("Wrong number of bonds in CONSTRAINT block", - "In_Topology", io::message::error); - } - } + std::string blockname = "HARMBONDANGLETYPE"; + Block block(blockname); - } // CONSTRAINT + if (block.read_buffer(m_block[blockname], false) == 0) { + DEBUG(7, "reading in "+blockname+" block"); - // check the bonds in constraints - if (!check_type(m_block[bond_bname], topo.solute().distance_constraints())) { - io::messages.add("Illegal bond type in " + bond_bname + " block", - "In_Topology", io::message::error); - } + block_read.insert(blockname); - { // BONDANGLEH + int num; + double kh, theta; + block.get_next_parameter("NTTY", num, ">=0", ""); - if (!quiet) - os << "\tBONDANGLE"; + if (num<=0 || block.error() ) return; - DEBUG(10, "BONDANGLEH block"); - buffer.clear(); - buffer = m_block["BONDANGLEH"]; + for (int i=0; i=0", ""); + block.get_next_parameter("T0", theta, "", ""); + if (block.error()) { + std::string linenumber=io::to_string(num+1); + io::messages.add("Bad values in line "+linenumber+" in "+blockname+" block", + "In_Topology", + io::message::error); + break; + } else { + topo.angle_types_harm().push_back(interaction::angle_type_struct(kh * (180.0 * 180.0 / (math::Pi * math::Pi)), + theta * math::Pi / 180.0)); + } + } - if (buffer.size()) { - block_read.insert("BONDANGLEH"); + block.get_final_messages(false); + } - it = buffer.begin() + 1; +} - _lineStream.clear(); - _lineStream.str(*it); +void io::In_Topology::read_block_TORSDIHEDRALTYPE(topology::Topology &topo, + simulation::Parameter ¶m, std::ostream & os) { + // dihedrals in degrees + std::string blockname = "TORSDIHEDRALTYPE"; + Block block(blockname); - int num, n; - _lineStream >> num; - ++it; + if (block.read_buffer(m_block[blockname], false) == 0) { + DEBUG(7, "reading in "+blockname+" block"); - if (!quiet) - os << "\n\t\tbondangles containing hydrogens : " << num; + block_read.insert(blockname); - for (n = 0; it != buffer.end() - 1; ++it, ++n) { - int i, j, k, t; - _lineStream.clear(); - _lineStream.str(*it); - _lineStream >> i >> j >> k >> t; + int num, m; + double k, pdl; + bool asymmetric=false; + block.get_next_parameter("NPTY", num, ">=0", ""); - if (_lineStream.fail() || !_lineStream.eof()) { - io::messages.add("Bad line in BONDANGLEH block", - "In_Topology", io::message::error); - } + if (num<=0 || block.error() ) return; - if (i > int(topo.num_solute_atoms()) || j > int(topo.num_solute_atoms()) || - k > int(topo.num_solute_atoms()) || - i < 1 || j < 1 || k < 1) { - io::messages.add("Atom number out of range in BONDANGLEH block", - "In_Topology", io::message::error); - } - - if (t < 1) { - io::messages.add("Error in BONDANGLE block: bond angle type < 1", - "In_Topology", io::message::error); + for (int i=0; i=0", ""); + block.get_next_parameter("PD", pdl, "", ""); + block.get_next_parameter("NP", m, ">0", ""); + if (param.force.dihedral == 2) { + if (pdl != 0 && pdl != 180) + io::messages.add("TORSDIHEDRALTYPE block: dihedral neither 0 nor 180, this is not allowed if NTBDN=1 (COVALENTFORM block)", "In_Topology", + io::message::error); + } else if (param.force.dihedral == 1) { + if (pdl!=0 || pdl!=180) { + asymmetric=true; } + } + if (block.error()) { + std::string linenumber=io::to_string(num+1); + io::messages.add("Bad values in line "+linenumber+" in "+blockname+" block", + "In_Topology", + io::message::error); + break; + } else { + topo.dihedral_types().push_back(interaction::dihedral_type_struct(k, cos(pdl * math::Pi / 180.0), pdl * math::Pi / 180.0, m)); + } + } + if (!asymmetric) + io::messages.add("TORSDIHEDRALTYPE block contains no values different from 0 or 180, you could also use NTBDN=1 (COVALENTFORM block)", "In_Topology", + io::message::notice); - topo.solute().angles(). - push_back(topology::three_body_term_struct(i - 1, j - 1, k - 1, t - 1)); - } + block.get_final_messages(false); + } - if (n != num) { - io::messages.add("Wrong number of bonds in BONDANGLEH block", - "In_Topology", io::message::error); - } - } +} - } // BONDANGLEH +void io::In_Topology::read_block_DIHEDRALTYPE(topology::Topology &topo, + simulation::Parameter ¶m, std::ostream & os) { + // dihedrals as cos(theta) + std::string blockname = "DIHEDRALTYPE"; + Block block(blockname); - { // BONDANGLE - DEBUG(10, "BONDANGLE block"); - buffer = m_block["BONDANGLE"]; + if (block.read_buffer(m_block[blockname], false) == 0) { + DEBUG(7, "reading in "+blockname+" block"); - if (buffer.size()) { - block_read.insert("BONDANGLE"); + block_read.insert(blockname); - it = buffer.begin() + 1; - _lineStream.clear(); - _lineStream.str(*it); - int num, n; - _lineStream >> num; - ++it; + int num, m; + double k, pd; + block.get_next_parameter("NPTY", num, ">=0", ""); - if (!quiet) - os << "\n\t\tbondangles not containing hydrogens : " << num; + if (num<=0 || block.error() ) return; - for (n = 0; it != buffer.end() - 1; ++it, ++n) { - int i, j, k, t; + for (int i=0; i=0", ""); + block.get_next_parameter("PD", pd, "", "1, -1"); + block.get_next_parameter("NP", m, ">0", ""); + if (block.error()) { + std::string linenumber=io::to_string(num+1); + io::messages.add("Bad values in line "+linenumber+" in "+blockname+" block", + "In_Topology", + io::message::error); + break; + } else { + topo.dihedral_types().push_back(interaction::dihedral_type_struct(k, pd, acos(pd), m)); + } + } - _lineStream.clear(); - _lineStream.str(*it); - _lineStream >> i >> j >> k >> t; + block.get_final_messages(false); + } - if (_lineStream.fail() || !_lineStream.eof()) { - io::messages.add("Bad line in BONDANGLE block", - "In_Topology", io::message::error); - } +} +void io::In_Topology::read_block_IMPDIHEDRALTYPE(topology::Topology &topo, + simulation::Parameter ¶m, std::ostream & os) { + std::string blockname = "IMPDIHEDRALTYPE"; + Block block(blockname); - if (i > int(topo.num_solute_atoms()) || j > int(topo.num_solute_atoms()) || - k > int(topo.num_solute_atoms()) || - i < 1 || j < 1 || k < 1) { - io::messages.add("Atom number out of range in BONDANGLE block", - "In_Topology", io::message::error); - } - - if (t < 1) { - io::messages.add("Error in BONDANGLEH block: bond angle type < 1", - "In_Topology", io::message::error); - } + if (block.read_buffer(m_block[blockname], false) == 0) { + DEBUG(7, "reading in "+blockname+" block"); - topo.solute().angles(). - push_back(topology::three_body_term_struct(i - 1, j - 1, k - 1, t - 1)); - } + block_read.insert(blockname); - if (n != num) { - io::messages.add("Wrong number of bonds in BONDANGLE block", - "In_Topology", io::message::error); - } + int num; + double k, q0; + block.get_next_parameter("NQTY", num, ">=0", ""); + + if (num<=0 || block.error() ) return; + + for (int i=0; i=0", ""); + block.get_next_parameter("Q0", q0, "", ""); + if (block.error()) { + std::string linenumber=io::to_string(num+1); + io::messages.add("Bad values in line "+linenumber+" in "+blockname+" block", + "In_Topology", + io::message::error); + break; + } else { + topo.impdihedral_types().push_back(interaction::improper_dihedral_type_struct(k * 180 * 180 / math::Pi / math::Pi, + q0 * math::Pi / 180.0)); } + } - if (!quiet) - os << "\n\tEND\n"; + num_solute_impropertypes=topo.impdihedral_types().size(); + block.get_final_messages(false); + } - } // BONDANGLE +} - // os << "time after BONDANGLE: " << util::now() - start << std::endl; +void io::In_Topology +::read_lj_parameter(std::vector > + & lj_parameter, + std::ostream & os) { + std::vector buffer; + std::vector::const_iterator it; - // check the angles - if (!check_type(m_block[angle_bname], topo.solute().angles())) { - io::messages.add("Illegal bond angle type in BONDANGLE(H) block", - "In_Topology", io::message::error); + { // LJPARAMETERS + + DEBUG(10, "LJPARAMETERS block"); + + buffer = m_block["LJPARAMETERS"]; + if (!buffer.size()) { + io::messages.add("No LJPARAMETERS block found in topology!", + "In_Topology", + io::message::error); + return; } - { // IMPFAL - DEBUG(10, "IMPDIHEDRAL block"); - buffer = m_block["IMPDIHEDRAL"]; + int num, n; - if (!quiet) - os << "\tIMPDIHEDRAL"; + it = buffer.begin() + 1; + _lineStream.clear(); + _lineStream.str(*it); + _lineStream >> num; - if (buffer.size()) { - block_read.insert("IMPDIHEDRAL"); + // calculate the matrix size from: x = n*(n+1)/2 + unsigned int sz = unsigned(sqrt(double((8 * num + 1) - 1)) / 2); - it = buffer.begin() + 1; - _lineStream.clear(); - _lineStream.str(*it); - int num, n; - _lineStream >> num; - ++it; + lj_parameter.resize(sz); + std::vector< std::vector >::iterator + lj_it = lj_parameter.begin(), + lj_to = lj_parameter.end(); - if (!quiet) - os << "\n\t\timproper dihedrals not containing hydrogens : " - << num; + for (; lj_it != lj_to; ++lj_it) + lj_it->resize(sz); - for (n = 0; it != buffer.end() - 1; ++it, ++n) { - int i, j, k, l, t; + ++it; - _lineStream.clear(); - _lineStream.str(*it); - _lineStream >> i >> j >> k >> l >> t; + for (n = 0; it != buffer.end() - 1; ++it, ++n) { - if (_lineStream.fail() || !_lineStream.eof()) { - io::messages.add("Bad line in IMPDIHEDRAL block", - "In_Topology", io::message::error); - } + interaction::lj_parameter_struct s; + int i, j; - if (i > int(topo.num_solute_atoms()) || j > int(topo.num_solute_atoms()) || - k > int(topo.num_solute_atoms()) || l > int(topo.num_solute_atoms()) || - i < 1 || j < 1 || k < 1 || l < 1) { - io::messages.add("Atom number out of range in IMPDIHEDRAL block", - "In_Topology", io::message::error); - } - - if (t < 1) { - io::messages.add("Error in IMPDIHEDRAL block: improper dihedral type < 1", - "In_Topology", io::message::error); - } + _lineStream.clear(); + _lineStream.str(*it); - topo.solute().improper_dihedrals(). - push_back(topology::four_body_term_struct(i - 1, j - 1, k - 1, l - 1, t - 1)); - } + _lineStream >> i >> j >> s.c12 >> s.c6 >> s.cs12 >> s.cs6; - if (n != num) { - io::messages.add("Wrong number of bonds in IMPDIHEDRAL block", - "In_Topology", io::message::error); - } - } + --i; + --j; - } // IMPDIHEDRAL + if (_lineStream.fail() ) + io::messages.add("bad line in LJPARAMETERS block", "In_Topology", + io::message::error); - { // IMPDIHEDRALH - DEBUG(10, "IMPDIHEDRALH block"); - buffer.clear(); - buffer = m_block["IMPDIHEDRALH"]; + if (i >= int(sz) || j >= int(sz)) { + DEBUG(7, "wrong iac in LJPARAMETERS: i=" << i << " j=" << j + << " sz=" << sz); + io::messages.add("wrong integer atom code in LJPARAMETERS block", + "In_Topology", + io::message::error); + } - if (buffer.size()) { - block_read.insert("IMPDIHEDRALH"); + lj_parameter[i][j] = s; + lj_parameter[j][i] = s; + + } - it = buffer.begin() + 1; + if (num != n) { + io::messages.add("Reading the LJPARAMETERS failed (n != num)", + "InTopology", + io::message::error); + } + } // LJPARAMETER - _lineStream.clear(); - _lineStream.str(*it); +} - int num, n; - _lineStream >> num; - ++it; +void io::In_Topology +::read_cg_parameter(std::vector > + & cg_parameter, + std::ostream & os) { + std::vector buffer; + std::vector::const_iterator it; - if (!quiet) - os << "\n\t\timproper dihedrals containing hydrogens : " - << num; + { // CGPARAMETERS - for (n = 0; it != buffer.end() - 1; ++it, ++n) { - int i, j, k, l, t; - _lineStream.clear(); - _lineStream.str(*it); - _lineStream >> i >> j >> k >> l >> t; + DEBUG(10, "CGPARAMETERS block"); + buffer = m_block["CGPARAMETERS"]; + if (!buffer.size()) { + io::messages.add("No CGPARAMETERS block found in topology!", + "In_Topology", + io::message::error); + return; + } - if (_lineStream.fail() || !_lineStream.eof()) { - io::messages.add("Bad line in IMPDIHEDRALH block", - "In_Topology", io::message::error); - } + int num, n; - if (i > int(topo.num_solute_atoms()) || j > int(topo.num_solute_atoms()) || - k > int(topo.num_solute_atoms()) || l > int(topo.num_solute_atoms()) || - i < 1 || j < 1 || k < 1 || l < 1) { - io::messages.add("Atom number out of range in IMPDIHEDRALH block", - "In_Topology", io::message::error); - } - - if (t < 1) { - io::messages.add("Error in IMPDIHEDRALH block: improper dihedral type < 1", - "In_Topology", io::message::error); - } + it = buffer.begin() + 1; + _lineStream.clear(); + _lineStream.str(*it); + _lineStream >> num; - topo.solute().improper_dihedrals(). - push_back(topology::four_body_term_struct(i - 1, j - 1, k - 1, l - 1, t - 1)); - } + // calculate the matrix size from: x = n*(n+1)/2 + unsigned int sz = unsigned(sqrt(double((8 * num + 1) - 1)) / 2); - if (n != num) { - io::messages.add("Wrong number of bonds in IMPDIHEDRALH block", - "In_Topology", io::message::error); - } - } + cg_parameter.resize(sz); + std::vector< std::vector >::iterator + cg_it = cg_parameter.begin(), + cg_to = cg_parameter.end(); - if (!quiet) - os << "\n\tEND\n"; + for (; cg_it != cg_to; ++cg_it) + cg_it->resize(sz); - } // IMPDIHEDRALH + ++it; - // check the imporopers - if (!check_type(m_block["IMPDIHEDRALTYPE"], topo.solute().improper_dihedrals())) { - io::messages.add("Illegal improper dihedral type in IMPDIHEDRAL(H) block", - "In_Topology", io::message::error); - } + for (n = 0; it != buffer.end() - 1; ++it, ++n) { - { // DIHEDRAL - DEBUG(10, "DIHEDRAL block"); - buffer = m_block["DIHEDRAL"]; + interaction::lj_parameter_struct s; + int i, j; - if (!quiet) - os << "\tDIHEDRAL"; + _lineStream.clear(); + _lineStream.str(*it); - if (buffer.size()) { - block_read.insert("DIHEDRAL"); + _lineStream >> i >> j >> s.c12 >> s.c6; - it = buffer.begin() + 1; - _lineStream.clear(); - _lineStream.str(*it); - int num, n; - _lineStream >> num; - ++it; + --i; + --j; - if (!quiet) - os << "\n\t\tdihedrals not containing hydrogens : " - << num; + if (_lineStream.fail() || !_lineStream.eof()) + io::messages.add("bad line in CGPARAMETERS block", "In_Topology", + io::message::error); - for (n = 0; it != buffer.end() - 1; ++it, ++n) { - int i, j, k, l, t; + if (i >= int(sz) || j >= int(sz)) { + DEBUG(7, "wrong iac in CGPARAMETERS: i=" << i << " j=" << j + << " sz=" << sz); + io::messages.add("wrong integer atom code in CGPARAMETERS block", + "In_Topology", + io::message::error); + break; + } - _lineStream.clear(); - _lineStream.str(*it); - _lineStream >> i >> j >> k >> l >> t; + // no different 1,4 interactions + s.cs6 = s.c6; + s.cs12 = s.c12; - if (_lineStream.fail() || !_lineStream.eof()) { - io::messages.add("Bad line in DIHEDRAL block", - "In_Topology", io::message::error); - } + cg_parameter[i][j] = s; + cg_parameter[j][i] = s; - if (i > int(topo.num_solute_atoms()) || j > int(topo.num_solute_atoms()) || - k > int(topo.num_solute_atoms()) || l > int(topo.num_solute_atoms()) || - i < 1 || j < 1 || k < 1 || l < 1) { - io::messages.add("Atom number out of range in DIHEDRAL block", - "In_Topology", io::message::error); - } - - if (t < 1) { - io::messages.add("Error in DIHEDRAL block: dihedral type < 1", - "In_Topology", io::message::error); - } + } - topo.solute().dihedrals(). - push_back(topology::four_body_term_struct(i - 1, j - 1, k - 1, l - 1, t - 1)); - } + if (num != n) { + io::messages.add("Reading the CGPARAMETERS failed (n != num)", + "InTopology", + io::message::error); + } - if (n != num) { - io::messages.add("Wrong number of bonds in DIHEDRAL block", - "In_Topology", io::message::error); - } - } + } // CGPARAMETER +} - } // DIHEDRAL +void io::In_Topology:: +read_sasa_parameter(topology::Topology & topo, std::vector + & sasa_parameter) { + std::vector buffer; + std::vector::const_iterator it; + { // SASAPARAMETERS - { // DIHEDRALH - DEBUG(10, "DIHEDRALH block"); - buffer.clear(); - buffer = m_block["DIHEDRALH"]; - if (buffer.size()) { - block_read.insert("DIHEDRALH"); + buffer = m_block["SASAPARAMETERS"]; + block_read.insert("SASAPARAMETERS"); + // if no SASA block is present + if (!buffer.size()) { + io::messages.add("No SASAPARAMETERS block found in topology!", + "In_Topology", io::message::error); + return; + } - it = buffer.begin() + 1; + unsigned int num; // number of sasa atoms; - _lineStream.clear(); - _lineStream.str(*it); + it = buffer.begin() + 1; + _lineStream.clear(); + _lineStream.str(*it); + _lineStream >> num; // reads in number of sasa atoms + ++it; + DEBUG(1, "Number of sasa atoms : " << num); - int num, n; - _lineStream >> num; - ++it; + for (; it != buffer.end() - 1; ++it) { - if (!quiet) - os << "\n\t\tdihedrals containing hydrogens : " - << num; + topology::sasa_parameter_struct s; - for (n = 0; it != buffer.end() - 1; ++it, ++n) { - int i, j, k, l, t; - _lineStream.clear(); - _lineStream.str(*it); - _lineStream >> i >> j >> k >> l >> t; + _lineStream.clear(); + _lineStream.str(*it); - if (_lineStream.fail() || !_lineStream.eof()) { - io::messages.add("Bad line in DIHEDRALH block", - "In_Topology", io::message::error); - } + int atom; + _lineStream >> atom >> s.r >> s.p >> s.sigma; - if (i > int(topo.num_solute_atoms()) || j > int(topo.num_solute_atoms()) || - k > int(topo.num_solute_atoms()) || l > int(topo.num_solute_atoms()) || - i < 1 || j < 1 || k < 1 || l < 1) { - io::messages.add("Atom number out of range in DIHEDRALH block", - "In_Topology", io::message::error); - } - - if (t < 1) { - io::messages.add("Error in DIHEDRALH block: dihedral type < 1", - "In_Topology", io::message::error); - } + if (_lineStream.fail() || !_lineStream.eof()) + io::messages.add("bad line in SASAPARAMETERS block", + "In_Topology", io::message::error); - topo.solute().dihedrals(). - push_back(topology::four_body_term_struct(i - 1, j - 1, k - 1, l - 1, t - 1)); - } + if (atom < 0 || atom > int(topo.num_solute_atoms())) + io::messages.add("atom out of range in SASAPARAMETERS block", + "In_Topology", io::message::error); + s.atom = atom - 1; // convert human atom numbers to internal atom numbers - if (n != num) { - io::messages.add("Wrong number of bonds in DIHEDRALH block", - "In_Topology", io::message::error); - } + if (s.r < 0) { + DEBUG(7, "negative radius in SASAPARAMETERS: r = " << s.r); + io::messages.add("negative radius in SASAPARAMETERS block", + "In_Topology", io::message::error); } - if (!quiet) - os << "\n\tEND\n"; + if (s.p < 0) { + DEBUG(7, "negative probability in SASAPARAMETERS: r = " << s.p); + io::messages.add("negative probability in SASAPARAMETERS block", + "In_Topology", io::message::error); + } - } // DIHEDRALH + sasa_parameter.push_back(s); + } - // check the dihedrals - if (!check_type(m_block[dihedral_bname], topo.solute().dihedrals())) { - io::messages.add("Illegal dihedral type in DIHEDRAL(H) block", - "In_Topology", io::message::error); + if (num != sasa_parameter.size()) { + io::messages.add("Number of SASAPARAMETERS not equal to number of sasa atoms", + "InTopology", io::message::error); } + } // SASAPARAMETERS +} - { // CROSSDIHEDRAL - DEBUG(10, "CROSSDIHEDRAL block"); - buffer = m_block["CROSSDIHEDRAL"]; - if (!quiet) - os << "\tCROSSDIHEDRAL"; +void io::In_Topology::read_block_TYPE(topology::Topology& topo, + simulation::Parameter ¶m, + std::ostream & os) { //TYPE - if (buffer.size()) { - block_read.insert("CROSSDIHEDRAL"); + std::vector buffer = m_block["TYPE"]; + if (buffer.size()) { + block_read.insert("TYPE"); + if (buffer.size() != 3) { + io::messages.add("Bad line in TYPE block", + "InTopology", io::message::error); + } - it = buffer.begin() + 1; - _lineStream.clear(); - _lineStream.str(*it); - int num, n; - _lineStream >> num; - ++it; + _lineStream.clear(); + _lineStream.str(buffer[1]); + std::string s; + _lineStream >> s; - if (!quiet) - os << "\n\t\tcrossdihedrals not containing hydrogens : " - << num; + if (_lineStream.fail()) + io::messages.add("Bad line in TYPE block", + "InTopology", io::message::error); - for (n = 0; it != buffer.end() - 1; ++it, ++n) { - int a, b, c, d, e, f, g, h, t; + if (s.length() > MAX_NAME) { + std::ostringstream msg; + msg << "Error in TYPE block: type " << s + << " is too long (> " << MAX_NAME << " characters)."; + io::messages.add(msg.str(), "InTopology", io::message::error); + } - _lineStream.clear(); - _lineStream.str(*it); - _lineStream >> a >> b >> c >> d >> e >> f >> g >> h >> t; - if (_lineStream.fail() || !_lineStream.eof()) { - io::messages.add("Bad line in CROSSDIHEDRAL block", - "In_Topology", io::message::error); - } + std::transform(s.begin(), s.end(), s.begin(), tolower); - if (a > int(topo.num_solute_atoms()) || b > int(topo.num_solute_atoms()) || - c > int(topo.num_solute_atoms()) || d > int(topo.num_solute_atoms()) || - e > int(topo.num_solute_atoms()) || f > int(topo.num_solute_atoms()) || - g > int(topo.num_solute_atoms()) || h > int(topo.num_solute_atoms()) || - a < 1 || b < 1 || c < 1 || d < 1 || e < 1 || f < 1 || g < 1 || h < 1) { - io::messages.add("Atom number out of range in CROSSDIHEDRAL block", - "In_Topology", io::message::error); - } - - if (t < 1) { - io::messages.add("Error in CROSSDIHEDRAL block: cross dihedral type < 1", - "In_Topology", io::message::error); - } + if (s == "atomistic") { + if (!quiet) + os << "\tatomistic topology\n"; - topo.solute().crossdihedrals(). - push_back(topology::eight_body_term_struct(a - 1, b - 1, c - 1, d - 1, e - 1, - f - 1, g - 1, h - 1, t - 1)); + if (param.force.interaction_function != simulation::lj_crf_func && + param.force.interaction_function != simulation::pol_lj_crf_func) { + io::messages.add("wrong interaction function selected for atomistic topology", + "InTopology", io::message::error); } + } else if (s == "coarse-grained") { + if (!quiet) + os << "\tcoarse-grained topology\n"; - if (n != num) { - io::messages.add("Wrong number of bonds in CROSSDIHEDRAL block", - "In_Topology", io::message::error); + if (param.force.interaction_function != simulation::cgrain_func) { + io::messages.add("wrong interaction function selected for coarse-grained topology", + "InTopology", io::message::error); } + } else { + io::messages.add("TYPE block: unknown topology type", + "InTopology", io::message::error); + } + } else { + if (!quiet) { + os << "\tunknown topology type (atomistic / coarse-grained)\n"; + if (param.force.interaction_function == simulation::lj_crf_func || + param.force.interaction_function == simulation::pol_lj_crf_func || + param.force.interaction_function == simulation::pol_off_lj_crf_func) + os << "\tusing atomistic parameters\n"; + else if (param.force.interaction_function == simulation::cgrain_func) + os << "\tusing coarse-grained parameters\n"; + else + os << "\tunknown interaction function selected!\n"; } + } +} //TYPE - } // CROSSDIHEDRAL - { // CROSSDIHEDRALH - DEBUG(10, "CROSSDIHEDRALH block"); - buffer.clear(); - buffer = m_block["CROSSDIHEDRALH"]; - if (buffer.size()) { - block_read.insert("CROSSDIHEDRALH"); - it = buffer.begin() + 1; +void io::In_Topology::read_block_PHYSICALCONSTANTS(topology::Topology& topo, + simulation::Parameter ¶m, std::ostream & os) { // PHYSICALCONSTANTS + std::vector buffer = m_block["PHYSICALCONSTANTS"]; + if (buffer.size()) { + block_read.insert("PHYSICALCONSTANTS"); + std::string s; + _lineStream.clear(); + _lineStream.str(concatenate(buffer.begin() + 1, + buffer.end() - 1, s)); + double four_pi_eps0_i; - _lineStream.clear(); - _lineStream.str(*it); + _lineStream >> four_pi_eps0_i >> math::h_bar >> math::spd_l >> math::k_Boltzmann; + math::eps0_i = four_pi_eps0_i * 4.0 * math::Pi; + math::four_pi_eps_i = four_pi_eps0_i / param.nonbonded.epsilon; - int num, n; - _lineStream >> num; - ++it; + if (_lineStream.fail()) + io::messages.add("Bad line in PHYSICALCONSTANTS block", + "InTopology", io::message::error); + } else { + io::messages.add("no PHYSICALCONSTANTS block in topology", + "InTopology", io::message::error); + } - if (!quiet) - os << "\n\t\tcrossdihedrals containing hydrogens : " - << num; +} // PHYSICALCONSTANTS - for (n = 0; it != buffer.end() - 1; ++it, ++n) { - int a, b, c, d, e, f, g, h, t; - _lineStream.clear(); - _lineStream.str(*it); - _lineStream >> a >> b >> c >> d >> e >> f >> g >> h >> t; +void io::In_Topology::read_block_RESNAME(topology::Topology& topo, + simulation::Parameter ¶m, std::ostream & os) { // RESNAME + if (!quiet) + os << "\tRESNAME\n\t"; - if (_lineStream.fail() || !_lineStream.eof()) { - io::messages.add("Bad line in CROSSDIHEDRALH block", - "In_Topology", io::message::error); - } + DEBUG(10, "RESNAME block"); + std::vector buffer = m_block["RESNAME"]; + block_read.insert("RESNAME"); + std::vector::const_iterator it = buffer.begin() + 1; + int n, num; + _lineStream.clear(); + _lineStream.str(*it); + _lineStream >> num; + ++it; - if (a > int(topo.num_solute_atoms()) || b > int(topo.num_solute_atoms()) || - c > int(topo.num_solute_atoms()) || d > int(topo.num_solute_atoms()) || - e > int(topo.num_solute_atoms()) || f > int(topo.num_solute_atoms()) || - g > int(topo.num_solute_atoms()) || h > int(topo.num_solute_atoms()) || - a < 1 || b < 1 || c < 1 || d < 1 || e < 1 || f < 1 || g < 1 || h < 1) { - io::messages.add("Atom number out of range in CROSSDIHEDRALH block", - "In_Topology", io::message::error); - } - - if (t < 1) { - io::messages.add("Error in CROSSDIHEDRALH block: cross dihedral type < 1", - "In_Topology", io::message::error); - } + if (!quiet && num > 10) { + for (n = 0; n < 10; ++n) + os << std::setw(8) << n + 1; + os << "\n\t"; + } - topo.solute().crossdihedrals(). - push_back(topology::eight_body_term_struct(a - 1, b - 1, c - 1, d - 1, e - 1, - f - 1, g - 1, h - 1, t - 1)); + for (n = 0; it != buffer.end() - 1; ++it, ++n) { + std::string s; + _lineStream.clear(); + _lineStream.str(*it); + _lineStream >> s; + + if (!quiet) { + if (n && ((n) % 10) == 0) os << std::setw(10) << n << "\n\t"; + os << std::setw(8) << s; } - if (n != num) { - io::messages.add("Wrong number of bonds in CROSSDIHEDRALH block", - "In_Topology", io::message::error); + if (s.length() > MAX_NAME) { + std::ostringstream msg; + msg << "Error in RESNAME block: residue name " << s + << " is too long (> " << MAX_NAME << " characters)."; + io::messages.add(msg.str(), "InTopology", io::message::error); } + + topo.residue_names().push_back(s); + } + + if (n != num) { + io::messages.add("Error in RESNAME block: n!=num.", + "InTopology", io::message::error); } if (!quiet) os << "\n\tEND\n"; - } // CROSSDIHEDRALH +} // RESNAME - // check the crossdihedrals - if ((m_block["CROSSDIHEDRALH"]).size() && dihedral_bname != "TORSDIHEDRALTYPE") { - io::messages.add("TORSDIHEDRALTYPE block must be specified to use crossdihedrals", - "In_Topology", io::message::error); - } - if (!check_type(m_block[dihedral_bname], topo.solute().crossdihedrals())) { - io::messages.add("Illegal crossdihedral type in CROSSDIHEDRAL(H) block", - "In_Topology", io::message::error); - } +void io::In_Topology::read_block_ATOMTYPENAME(topology::Topology& topo, + simulation::Parameter ¶m, std::ostream & os) { // ATOMTYPENAME + if (!quiet) + os << "\tATOMTYPENAME\n\t"; - { // VIRTUALGRAIN - DEBUG(10, "VIRTUALGRAIN block"); - buffer.clear(); - buffer = m_block["VIRTUALGRAIN"]; - if (buffer.size()) { - block_read.insert("VIRTUALGRAIN"); + DEBUG(10, "ATOMTYPENAME block"); + std::vector buffer = m_block["ATOMTYPENAME"]; + block_read.insert("ATOMTYPENAME"); + std::vector::const_iterator it = buffer.begin() + 1; + int n, num; + _lineStream.clear(); + _lineStream.str(*it); + _lineStream >> num; + ++it; + + topo.set_num_atomtype(num); - it = buffer.begin() + 1; + if (!quiet) + os << "\t" << num << " atom types\n"; + for (n = 0; it != buffer.end() - 1; ++it, ++n) { + std::string s; _lineStream.clear(); _lineStream.str(*it); + _lineStream >> s; - int num, n; - _lineStream >> num; - ++it; - - if (!quiet) - os << "\tVIRTUALGRAIN\n\t\tVirtual Grains : " - << num; + if (s.length() > MAX_NAME) { + std::ostringstream msg; + msg << "Error in ATOMTYPENAME block: type " << s + << " is too long (> " << MAX_NAME << " characters)."; + io::messages.add(msg.str(), "InTopology", io::message::error); + } - for (n = 0; it != buffer.end() - 1; ++it, ++n) { - _lineStream.clear(); - _lineStream.str(*it); + if (topo.atom_names().find(s) == topo.atom_names().end()) { // not found + topo.atom_names()[s] = n; + } else { // found + std::ostringstream msg; + msg << "Error in ATOMTYPENAME block: atom type name " << s + << " used more than once."; + io::messages.add(msg.str(), "InTopology", io::message::error); + } + } - // number of real atoms to define virtual atom - int index, i, q; - _lineStream >> index >> i; + if (n != num) { + io::messages.add("Error in ATOMTYPENAME block: n!=num.", + "InTopology", io::message::error); + } - std::vector cog; + if (!quiet) + os << "\tEND\n"; - for (int j = 0; j < i; ++j) { - _lineStream >> q; - cog.push_back(q - 1); - } +} // ATOMTYPENAME - if (_lineStream.fail() || !_lineStream.eof()) { - io::messages.add("Bad line in VIRTUALGRAIN block", - "In_Topology", io::message::error); - } +void io::In_Topology::read_block_SOLUTEATOM(topology::Topology& topo, + simulation::Parameter ¶m, std::ostream & os) { // SOLUTEATOM + DEBUG(10, "SOLUTEATOM block"); + std::vector buffer = m_block["SOLUTEATOM"]; + block_read.insert("SOLUTEATOM"); - topo.virtual_grains(). - push_back(topology::virtual_grain_struct(index - 1, - util::Virtual_Atom(util::va_cog, cog))); - } + std::vector::const_iterator it = buffer.begin() + 1; + _lineStream.clear(); + _lineStream.str(*it); + int num, n; + _lineStream >> num; + topo.resize(num); - if (n != num) { - io::messages.add("Wrong number of elements in VIRTUALGRAIN block", - "In_Topology", io::message::error); - } + if (!quiet) + os << "\tSOLUTEATOM\n\t" + << "\tnumber of atoms : " << num; - if (!quiet) - os << "\n\tEND\n"; - } + // put the rest of the block into a single stream + ++it; - } // VIRTUALGRAIN + // std::string soluteAtoms; + // concatenate(it, buffer.end()-1, soluteAtoms); - // add the solute molecules (should be done before solvate ;-) + // _lineStream.clear(); + // _lineStream.str(soluteAtoms); - { // SOLUTEMOLECULES - DEBUG(10, "read SOLUTEMOLECULES"); + // os << "\ntime after concatenate: " << util::now() - start << std::endl; - buffer.clear(); + int a_nr, r_nr, t, cg, n_ex, a_ex; + double m, q; std::string s; + topology::excl_cont_t::value_type ex; + topology::excl_cont_t::value_type ex14; - buffer = m_block["SOLUTEMOLECULES"]; + for (n = 0; n < num; ++n) { - if (!buffer.size()) { - io::messages.add("no SOLUTEMOLECULES block in topology", - "In_Topology", io::message::error); - } else { - block_read.insert("SOLUTEMOLECULES"); _lineStream.clear(); - _lineStream.str(concatenate(buffer.begin() + 1, buffer.end() - 1, s)); - - int num; + _lineStream.str(*it); + ++it; - _lineStream >> num; + _lineStream >> a_nr >> r_nr >> s >> t >> m >> q >> cg; - if (num < 0) { - io::messages.add("negative number of SOLUTEMOLECULES is not allowed", - "In_Topology", io::message::error); + if (a_nr != n + 1) { + io::messages.add("Error in SOLUTEATOM block: atom number not sequential.", + "InTopology", io::message::error); } - unsigned int m; - unsigned int old_m = 0; - - for (int i = 0; i < num; ++i) { - _lineStream >> m; - topo.molecules().push_back(m); - DEBUG(11, "add submol " << m); - if (m < old_m) { - io::messages.add("wrong order in SOLUTEMOLECULES block", - "In_Topology", io::message::error); - break; - } - old_m = m; + if (r_nr > int(topo.residue_names().size()) || r_nr < 1) { + io::messages.add("Error in SOLUTEATOM block: residue number out of range.", + "InTopology", io::message::error); } - if (_lineStream.fail()) - io::messages.add("bad line in SOLUTEMOLECULES block", - "In_Topology", io::message::error); - } - } // SOLUTEMOLECULES - - if (topo.molecules().size() == 0) { - topo.molecules().push_back(0); - topo.molecules().push_back(topo.num_solute_atoms()); - } + if (s.length() > MAX_NAME) { + std::ostringstream msg; + msg << "Error in SOLUTEATOM block: atom name " << s + << " is too long (> " << MAX_NAME << " characters)."; + io::messages.add(msg.str(), "InTopology", io::message::error); + } - // solutemolecules check - if (topo.molecules().back() - != topo.num_solute_atoms()) { - std::cout << "ERROR: Solute molecules wrong\n" - << "\tlast atom in SOLUTEMOLECULES block = " << topo.molecules().back() - << "\n\tlast atom in topology = " << topo.num_solute_atoms() - << std::endl; + if (t < 1) { + io::messages.add("Error in SOLUTEATOM block: iac < 1.", + "InTopology", io::message::error); + } - io::messages.add("Error in SOLUTEMOLECULES block: " - "last solute molecule has to end with last solute atom", - "In_Topology", io::message::error); - } + if (t > topo.num_atomtype()) { + io::messages.add("Error in SOLUTEATOM block: iac > number of atom types.", + "InTopology", io::message::error); + } - topo.num_solute_molecules() = topo.molecules().size() - 1; + if (m <= 0) { + io::messages.add("Error in SOLUTEATOM block: mass < 0.", + "InTopology", io::message::error); + } - { // TEMPERATUREGROUPS - DEBUG(10, "read TEMPERATUREGROUPS"); + if (cg != 0 && cg != 1) { + io::messages.add("Error in SOLUTEATOM block: cg = 0 / 1.", + "InTopology", io::message::error); + } - buffer.clear(); - std::string s; + if (!(_lineStream >> n_ex)) { + if (_lineStream.eof()) { + _lineStream.clear(); + _lineStream.str(*it); + ++it; + _lineStream >> n_ex; + } else { + io::messages.add("Error in SOLUTEATOM block: number of exclusions " + "could not be read.", + "InTopology", io::message::error); + } + } - buffer = m_block["TEMPERATUREGROUPS"]; + if (n_ex < 0) { + io::messages.add("Error in SOLUTEATOM block: number of exclusions < 0.", + "InTopology", io::message::error); + } - if (!buffer.size()) { - io::messages.add("no TEMPERATUREGROUPS block in topology", - "In_Topology", io::message::error); - } else { - block_read.insert("TEMPERATUREGROUPS"); - _lineStream.clear(); - _lineStream.str(concatenate(buffer.begin() + 1, buffer.end() - 1, s)); + // exclusions + ex.clear(); + for (int i = 0; i < n_ex; ++i) { + if (!(_lineStream >> a_ex)) { + if (_lineStream.eof()) { + _lineStream.clear(); + _lineStream.str(*it); + ++it; + _lineStream >> a_ex; + } else { + io::messages.add("Error in SOLUTEATOM block: exclusion " + "could not be read.", + "InTopology", io::message::error); + } + } - int num; + if (a_ex <= a_nr) + io::messages.add("Error in SOLUTEATOM block: exclusions only to " + "larger atom numbers.", + "InTopology", io::message::error); - _lineStream >> num; + ex.insert(a_ex - 1); + } - if (num < 0) { - io::messages.add("negative number of TEMPERATUREGROUPS is not allowed", - "In_Topology", io::message::error); + // 1,4 - pairs + if (!(_lineStream >> n_ex)) { + if (_lineStream.eof()) { + _lineStream.clear(); + _lineStream.str(*it); + ++it; + _lineStream >> n_ex; + } else { + io::messages.add("Error in SOLUTEATOM block: number of 1,4 - exclusion " + "could not be read.", + "InTopology", io::message::error); + } } - unsigned int m; - unsigned int old_m = 0; + if (n_ex < 0) { + io::messages.add("Error in SOLUTEATOM block: number of 1,4 exclusions < 0.", + "InTopology", io::message::error); + } - for (int i = 0; i < num; ++i) { - _lineStream >> m; - topo.temperature_groups().push_back(m); - DEBUG(11, "add temperature group " << m); - if (m < old_m) { - io::messages.add("wrong order in TEMPERATUREGROUPS block", - "In_Topology", io::message::error); - break; + ex14.clear(); + for (int i = 0; i < n_ex; ++i) { + if (!(_lineStream >> a_ex)) { + if (_lineStream.eof()) { + _lineStream.clear(); + _lineStream.str(*it); + ++it; + _lineStream >> a_ex; + } else { + io::messages.add("Error in SOLUTEATOM block: 1,4 - exclusion " + "could not be read.", + "InTopology", io::message::error); + } } - old_m = m; + + if (a_ex <= a_nr) + io::messages.add("Error in SOLUTEATOM block: 1,4 - exclusions only to " + "larger atom numbers.", + "InTopology", io::message::error); + + ex14.insert(a_ex - 1); } if (_lineStream.fail()) - io::messages.add("bad line in TEMPERATUREGROUPS block", - "In_Topology", io::message::error); + io::messages.add("bad line in SOLUTEATOM block", + "In_Topology", + io::message::critical); + + topo.add_solute_atom(s, r_nr - 1, t - 1, m, q, cg, ex, ex14); } - } // TEMPERATUREGROUPS + if (!quiet) + os << "\n\tEND\n"; - if (topo.temperature_groups().size() == 0) { - topo.temperature_groups().push_back(0); - topo.temperature_groups().push_back(topo.num_solute_atoms()); - } +} // SOLUTEATOM - // temperature groups check - if (topo.temperature_groups().back() - != topo.num_solute_atoms()) { - std::cout << "ERROR: temperature groups wrong\n" - << "\tlast atom in TEMPERATUREGROUPS block = " << topo.temperature_groups().back() - << "\n\tlast atom in topology = " << topo.num_solute_atoms() - << std::endl; +void io::In_Topology::read_block_SOLUTEPOLARISATION(topology::Topology& topo, + simulation::Parameter ¶m, std::ostream & os) + { // SOLUTEPOLARISATION + DEBUG(10, "SOLUTEPOLARISATION block"); + std::vector buffer = m_block["SOLUTEPOLARISATION"]; - io::messages.add("Error in TEMPERATUREGROUPS block: " - "last temperature group has to end with last solute atom", - "In_Topology", io::message::error); - } + if (buffer.size()) { + block_read.insert("SOLUTEPOLARISATION"); + if (!quiet) + os << "\tSOLUTEPOLARISATION\n" + << "\t\tblock present\n" + << "\tEND\n"; + std::vector::const_iterator it = buffer.begin() + 1; + + _lineStream.clear(); + _lineStream.str(*it); + + int num, n; + _lineStream >> num; + ++it; + + for (n = 0; it != buffer.end() - 1; ++it, ++n) { + int i, j, k; + double polarisability, coscharge, damping_level, damping_power, gamma; + _lineStream.clear(); + _lineStream.str(*it); + _lineStream >> i >> polarisability >> coscharge >> damping_level + >> damping_power >> gamma >> j >> k; + if (_lineStream.fail() || !_lineStream.eof()) { + io::messages.add("Bad line in SOLUTEPOLARISATION block", + "In_Topology", io::message::error); + } + + if (i > int(topo.num_solute_atoms()) || i < 1) { + io::messages.add("Atom number out of range in SOLUTEPOLARISATION block", + "In_Topology", io::message::error); + } else if (gamma != 0.0 && (j < 1 || k < 1 || j > int(topo.num_solute_atoms()) + || k > int(topo.num_solute_atoms()) || i == k || i == j || k == j)) { + io::messages.add("Atom number for off atom out of range in SOLUTEPOLARISATION block", + "In_Topology", io::message::error); + } else { + DEBUG(10, "\tpolarisable atom: " << i); + topo.polarisability()[i - 1] = polarisability / math::four_pi_eps_i; + topo.coscharge()[i - 1] = coscharge; + topo.damping_level()[i - 1] = damping_level * sqrt(math::four_pi_eps_i); + topo.damping_power()[i - 1] = damping_power; + topo.is_polarisable()[i - 1] = bool(polarisability > 0.0); + if (param.polarise.cos == 2) { + topo.gamma()[i - 1] = 2 * gamma; + topo.gamma_j()[i - 1] = j - 1; + topo.gamma_k()[i - 1] = k - 1; + } - topo.num_solute_temperature_groups() = topo.temperature_groups().size() - 1; + } + } - { // PRESSUREGROUPS - DEBUG(10, "read PRESSUREGROUPS"); + if (n != num) { + io::messages.add("Wrong number of polarisable atoms in SOLUTEPOLARISATION block", + "In_Topology", io::message::error); + } + } +} // SOLUTEPOLARISATION - buffer.clear(); - std::string s; +void io::In_Topology::read_block_CGSOLUTE(topology::Topology& topo, + simulation::Parameter ¶m, std::ostream & os) + { // CGSOLUTE + DEBUG(10, "CGSOLUTE block"); + + if (!quiet) + os << "\tCGSOLUTE\n"; - buffer = m_block["PRESSUREGROUPS"]; + std::vector buffer = m_block["CGSOLUTE"]; + if (buffer.size()) { + block_read.insert("CGSOLUTE"); + std::vector::const_iterator it = buffer.begin() + 1; - if (!buffer.size()) { - io::messages.add("no PRESSUREGROUPS block in topology", - "In_Topology", io::message::error); - } else { - block_read.insert("PRESSUREGROUPS"); _lineStream.clear(); - _lineStream.str(concatenate(buffer.begin() + 1, buffer.end() - 1, s)); - - int num; + _lineStream.str(*it); + int num, n; _lineStream >> num; + ++it; + os << "\t\tnumber of ranges: " << num << "\n"; - if (num < 0) { - io::messages.add("negative number of PRESSUREGROUPS is not allowed", - "In_Topology", io::message::error); - } + for (n = 0; it != buffer.end() - 1; ++it, ++n) { + int cg_begin, cg_end, cg_fac; + _lineStream.clear(); + _lineStream.str(*it); + _lineStream >> cg_begin >> cg_end >> cg_fac; - unsigned int m; - unsigned int old_m = 0; + if (_lineStream.fail() || !_lineStream.eof()) { + io::messages.add("Bad line in CGSOLUTE block", + "In_Topology", io::message::error); + } - for (int i = 0; i < num; ++i) { - _lineStream >> m; - topo.pressure_groups().push_back(m); - DEBUG(11, "add pressure group " << m); - if (m < old_m) { - io::messages.add("wrong order in PRESSUREGROUPS block", + if ((cg_begin > int(topo.num_solute_atoms()) || cg_begin < 1) + || (cg_end > int(topo.num_solute_atoms()) || cg_end < 1) + || (cg_begin > cg_end)) { + io::messages.add("Sequence number out of range in CGSOLUTE block", "In_Topology", io::message::error); - break; + } else if (cg_fac < 1) { + io::messages.add("CG factor out of range in CGSOLUTE block", + "In_Topology", io::message::error); + } else { + DEBUG(10, "\tcoarse grained range: " << cg_begin << " " << cg_end); + DEBUG(10, "\tcoarse grained factor: " << cg_fac); + os << "\t\trange: " << cg_begin << " " << cg_end << "\n" + << "\t\tcoarse grained factor: " << cg_fac << "\n"; + for (unsigned int i = (cg_begin - 1); i < unsigned(cg_end); ++i) { + topo.is_coarse_grained()[i] = true; + topo.cg_factor()[i] = cg_fac; + } } - old_m = m; } + os << "\tEND\n"; - if (_lineStream.fail()) - io::messages.add("bad line in PRESSUREGROUPS block", - "In_Topology", io::message::error); + if (n != num) { + io::messages.add("Wrong number of ranges in CGSOLUTE block", + "In_Topology", io::message::error); + } } - } // PRESSUREGROUPS - - if (topo.pressure_groups().size() == 0) { - topo.pressure_groups().push_back(0); - topo.pressure_groups().push_back(topo.num_solute_atoms()); - } - - // pressure groups check - if (topo.pressure_groups().back() - != topo.num_solute_atoms()) { - - std::cout << "ERROR: pressure groups wrong\n" - << "\tlast atom in PRESSUREGROUPS block = " << topo.pressure_groups().back() - << "\n\tlast atom in topology = " << topo.num_solute_atoms() - << std::endl; +} // CGSOLUTE - io::messages.add("Error in PRESSUREGROUPS block: " - "last pressure group has to end with last solute atom", - "In_Topology", io::message::error); - } - topo.num_solute_pressure_groups() = topo.pressure_groups().size() - 1; +void io::In_Topology::read_block_LJEXCEPTIONS(topology::Topology& topo, + simulation::Parameter ¶m, std::ostream & os) + { // LJEXCEPTIONS + DEBUG(10, "LJEXCEPTIONS block"); + std::vector buffer = m_block["LJEXCEPTIONS"]; - { // PATHINTSPEC - buffer = m_block["PATHINTSPEC"]; if (buffer.size()) { - block_read.insert("PATHINTSPEC"); - io::messages.add("md++ does not support path-integral simulations (PATHINTSPEC block).", - "InTopology", io::message::warning); - } - } - } // npm != 0 - - { // SOLVENTATOM and SOLVENTCONSTR - // give it a number (SOLVENTATOM1, SOLVENTATOM2) for multiple - // solvents... - DEBUG(10, "SOLVENTATOM block"); - buffer = m_block["SOLVENTATOM"]; - - if (!quiet) - os << "\tSOLVENT"; - - if (buffer.size()) { - block_read.insert("SOLVENTATOM"); - - unsigned int res_nr = unsigned(topo.residue_names().size()); - - topo.residue_names().push_back("SOLV"); - - it = buffer.begin() + 1; - _lineStream.clear(); - _lineStream.str(*it); - int num, n; - _lineStream >> num; - ++it; - - if (!quiet) - os << "\n\t\tatoms : " << num; - - topology::Solvent s; - - std::string name; - int i, iac; - double mass, charge; - //adiabatic decoupling - int adc_index = 0; - double sm = 1; - int total_nr = topo.num_solute_atoms() - 1; - + block_read.insert("LJEXCEPTIONS"); + std::vector::const_iterator it = buffer.begin() + 1; - for (n = 0; it != buffer.end() - 1; ++it, ++n) { _lineStream.clear(); _lineStream.str(*it); - sm = 1; - total_nr++; - adc_index = param.addecouple.check_index_adc(total_nr); - if (adc_index != -1) { - sm = param.addecouple.adc_index()[adc_index].sm; - } - _lineStream >> i >> name >> iac >> mass >> charge; - mass *= sm; + int num, n; + _lineStream >> num; + ++it; if (_lineStream.fail() || !_lineStream.eof()) { - io::messages.add("Bad line in SOLVENTATOM block", + io::messages.add("Bad line in LJEXCEPTIONS block", "In_Topology", io::message::error); + } else { + if (!quiet) { + os << "\tLJEXCEPTIONS\n" + << "\t\t" << num << " Lennard-Jones exceptions.\n" + << "\tEND\n"; + } } - if (name.length() > MAX_NAME) { - std::ostringstream msg; - msg << "Error in SOLVENTATOM block: name " << name - << " is too long (> " << MAX_NAME << " characters)."; - io::messages.add(msg.str(), "InTopology", io::message::error); - } + for (n = 0; it != buffer.end() - 1; ++it, ++n) { + int i, j; + double c6, c12; + _lineStream.clear(); + _lineStream.str(*it); + _lineStream >> i >> j >> c12 >> c6; - s.add_atom(name, res_nr, iac - 1, mass, charge); - } + if (_lineStream.fail() || !_lineStream.eof()) { + io::messages.add("Bad line in LJEXCEPTIONS block", + "In_Topology", io::message::error); + } - if (n != num) { - io::messages.add("Error in SOLVENTATOM block (num != n)", - "In_Topology", io::message::error); + if (i > int(topo.num_solute_atoms()) || i < 1 || + j > int(topo.num_solute_atoms()) || j < 1) { + io::messages.add("Atom number out of range in LJEXCEPTIONS block", + "In_Topology", io::message::error); + } else { + i--; + j--; + if (i > j) + std::swap(i, j); + topo.lj_exceptions().push_back(topology::lj_exception_struct(i, j, c6, c12)); + topo.all_exclusion(i).insert(j); + } + } + + if (n != num) { + io::messages.add("Wrong number of lines in LJEXCEPTIONS block", + "In_Topology", io::message::error); + } } +} // LJEXCEPTION - // end SOLVENTATOM +void io::In_Topology::read_block_BONDH(topology::Topology& topo, + simulation::Parameter ¶m, std::ostream & os) + { // BONDH + DEBUG(10, "BONDH block"); - DEBUG(10, "SOLVENTPOLARISATION block"); + if (!quiet) + os << "\tBOND"; - buffer.clear(); - buffer = m_block["SOLVENTPOLARISATION"]; + std::vector buffer = m_block["BONDH"]; if (buffer.size()) { - block_read.insert("SOLVENTPOLARISATION"); - if (!quiet) - os << "\n\t\tpolarisation parameters present"; - it = buffer.begin() + 1; + block_read.insert("BONDH"); + std::vector::const_iterator it = buffer.begin() + 1; _lineStream.clear(); _lineStream.str(*it); @@ -1813,1134 +1839,1093 @@ io::In_Topology::read(topology::Topology& topo, _lineStream >> num; ++it; + if (!quiet) { + if (param.constraint.ntc == 2 || param.constraint.ntc == 3) { + os << "\n\t\t" + << num + << " bonds from BONDH block added to CONSTRAINT"; + } else + os << "\n\t\tbonds containing hydrogens : " + << num; + } + for (n = 0; it != buffer.end() - 1; ++it, ++n) { - int i, j, k; - double polarisability, coscharge, damping_level, damping_power, gamma; + int i, j, t; _lineStream.clear(); _lineStream.str(*it); - _lineStream >> i >> polarisability >> coscharge >> damping_level - >> damping_power >> gamma >> j >> k; + _lineStream >> i >> j >> t; if (_lineStream.fail() || !_lineStream.eof()) { - io::messages.add("Bad line in SOLVENTPOLARISATION block", + io::messages.add("Bad line in BONDH block", "In_Topology", io::message::error); } - if (i > int(s.num_atoms()) || i < 1) { - io::messages.add("Atom number out of range in SOLVENTPOLARISATION block", + if (i > int(topo.num_solute_atoms()) || j > int(topo.num_solute_atoms()) || + i < 1 || j < 1) { + io::messages.add("Atom number out of range in BONDH block", "In_Topology", io::message::error); - } else if (gamma != 0.0 && (j < 1 || k < 1 || j > int(s.num_atoms()) - || k > int(s.num_atoms()) || i == k || i == j || k == j)) { - io::messages.add("Atom number for off atom out of range in SOLVENTPOLARISATION block", + } + + if (t < 1) { + io::messages.add("Error in BONDH block: bond type < 1", "In_Topology", io::message::error); - } else { - DEBUG(10, "\tpolarisable atom: " << i); + } - s.atoms()[i - 1].polarisability = polarisability / math::four_pi_eps_i; - s.atoms()[i - 1].coscharge = coscharge; - s.atoms()[i - 1].damping_level = damping_level * sqrt(math::four_pi_eps_i); - s.atoms()[i - 1].damping_power = damping_power; - if (param.polarise.cos == 2) { - s.atoms()[i - 1].gamma = 2 * gamma; - s.atoms()[i - 1].gamma_j = j - 1; - s.atoms()[i - 1].gamma_k = k - 1; - } + if (param.constraint.ntc == 2 || param.constraint.ntc == 3) { + topo.solute().distance_constraints(). + push_back(topology::two_body_term_struct(i - 1, j - 1, t - 1)); + } else + topo.solute().bonds(). + push_back(topology::two_body_term_struct(i - 1, j - 1, t - 1)); - } } if (n != num) { - io::messages.add("Wrong number of polarisable atoms in SOLVENTPOLARISATION block", + io::messages.add("Wrong number of bonds in BONDH block", "In_Topology", io::message::error); } } - // solvent atoms have been read into s - //-------------------------------------------------- - // lookup the number of bond types - // add additional ones for the solvent constraints - { - // this does not seem to do anything outside this block? MP - std::vector b; - std::ostringstream os; - read_harmonic_bonds(b, os); - } + } // BONDH - //-------------------------------------------------- +void io::In_Topology::read_block_BOND(topology::Topology& topo, + simulation::Parameter ¶m, std::ostream & os) + { // BOND + DEBUG(10, "BOND block"); + std::vector buffer = m_block["BOND"]; - // now read the solvent constraints - buffer = m_block["SOLVENTCONSTR"]; - if (!buffer.size()) { - io::messages.add("no SOLVENTCONST (block missing).", - "In_Topology", io::message::notice); - } else { - block_read.insert("SOLVENTCONSTR"); + if (buffer.size()) { + block_read.insert("BOND"); - it = buffer.begin() + 1; + std::vector::const_iterator it = buffer.begin() + 1; _lineStream.clear(); _lineStream.str(*it); - + int num, n; _lineStream >> num; ++it; - if (!quiet) - os << "\n\t\tconstraints : " << num; - - int j; - double b0; + if (!quiet) { + if (param.constraint.ntc == 3) { + os << "\n\t\t" + << num + << " bonds from BOND block added to CONSTRAINT"; + } else + os << "\n\t\tbonds not containing hydrogens : " + << num; + } for (n = 0; it != buffer.end() - 1; ++it, ++n) { + int i, j, t; + _lineStream.clear(); _lineStream.str(*it); - - _lineStream >> i >> j >> b0; + _lineStream >> i >> j >> t; if (_lineStream.fail() || !_lineStream.eof()) { - io::messages.add("Bad line in SOLVENTCONSTR block", + io::messages.add("Bad line in BOND block", "In_Topology", io::message::error); } - // the solvent (distance constraints) bond types - s.add_distance_constraint - (topology::two_body_term_struct(i - 1, j - 1, num_solute_bondtypes + n)); + if (i > int(topo.num_solute_atoms()) || j > int(topo.num_solute_atoms()) || + i < 1 || j < 1) { + io::messages.add("Atom number out of range in BOND block", + "In_Topology", io::message::error); + } + + if (t < 1) { + io::messages.add("Error in BOND block: bond type < 1", + "In_Topology", io::message::error); + } + + if (param.constraint.ntc == 3) { + topo.solute().distance_constraints(). + push_back(topology::two_body_term_struct(i - 1, j - 1, t - 1)); + } else + topo.solute().bonds(). + push_back(topology::two_body_term_struct(i - 1, j - 1, t - 1)); } if (n != num) { - io::messages.add("Error in SOLVENTCONSTR block (num != n)", + io::messages.add("Wrong number of bonds in BOND block", "In_Topology", io::message::error); } } - topo.add_solvent(s); - } else { - io::messages.add("no solvent topology specified", - "In_Topology", io::message::warning); - } - } // SOLVENTCONSTR - // add the solvent to the topology - if (!quiet) - os << "\n\t\tadding " << param.system.nsm - << " solvents."; - - // if (param.system.nsm) - topo.solvate(0, param.system.nsm); - - if (!quiet) - os << "\n\tEND\n"; - - {// SASAPARAMETER - if (param.sasa.switch_sasa) { // if SASA is switched on - - read_sasa_parameter(topo, topo.sasa_parameter()); - - if (!quiet) { - os << "\tSASAPARAMETERS\n\t\tSASA is switched on\n\t\tN_sasa_atoms :\t" - << topo.sasa_parameter().size() << "\n\t\tp_12 :\t\t" << param.sasa.p_12 - << "\n\t\tp_13 :\t\t" << param.sasa.p_13 << "\n\t\tp_1x :\t\t" << param.sasa.p_1x - << "\n\t\tR_solv :\t" << param.sasa.r_solv << std::endl; - - if (param.sasa.switch_volume) { - os << "\t\tVOL is switched on\n\t\tsigma_vol :\t" << param.sasa.sigma_v << std::endl; - } - os << "\tEND\n"; - } - } - // SASAPARAMETER - } + if (!quiet) + os << "\n\tEND\n"; - // set lambda (new and old one, yes it looks strange...) - topo.lambda(param.perturbation.lambda); - topo.lambda(param.perturbation.lambda); +} // BOND - topo.lambda_exp(param.perturbation.lambda_exponent); +void io::In_Topology::read_block_BONDDP(topology::Topology& topo, + simulation::Parameter ¶m, std::ostream & os) { // BONDDP + DEBUG(10, "BONDDP block"); - //================================================== - // CHECKING - //================================================== + if (!quiet) + os << "\tBONDDP"; - // solute molecule check - if (topo.molecules().back() - != topo.num_atoms()) { + std::vector buffer = m_block["BONDDP"]; + if (buffer.size()) { + block_read.insert("BONDDP"); + std::vector::const_iterator it = buffer.begin() + 1; - io::messages.add("Error in SOLUTEMOLECULE / solvation block: " - "last solute molecule has to end with last atom", - "In_Topology", io::message::error); - } + _lineStream.clear(); + _lineStream.str(*it); - // temperature group check - if (topo.temperature_groups().back() - != topo.num_atoms()) { + int num, n; + _lineStream >> num; + ++it; - io::messages.add("Error in TEMPERATUREGROUPS / solvation block: " - "last temperature group has to end with last atom", - "In_Topology", io::message::error); - } + if (!quiet) { + os << "\n\t\tspecial bonds to dipole particles : " + << num; + } - // pressure group check - if (topo.pressure_groups().back() - != topo.num_atoms()) { + for (n = 0; it != buffer.end() - 1; ++it, ++n) { + int i, j, t; + _lineStream.clear(); + _lineStream.str(*it); + _lineStream >> i >> j >> t; - io::messages.add("Error in PRESSUREGROUPS / solvation block: " - "last pressure group has to end with last atom", - "In_Topology", io::message::error); - } + if (_lineStream.fail() || !_lineStream.eof()) { + io::messages.add("Bad line in BONDDP block", + "In_Topology", io::message::error); + } - // chargegroup check (starts with 0) - if (topo.chargegroups()[topo.num_solute_chargegroups()] != int(topo.num_solute_atoms())) { - io::messages.add("Error: last solute atom has to be end of chargegroup", - "In_Topology", - io::message::error); - os << "ERROR:" - << "\tsolute cg : " << topo.num_solute_chargegroups() << "\n" - << "\tsolute atoms : " << topo.num_solute_atoms() << "\n" - << "\tlast cg : " << topo.chargegroups()[topo.num_solute_chargegroups()] << "\n"; - } + if (i > int(topo.num_solute_atoms()) || j > int(topo.num_solute_atoms()) || + i < 1 || j < 1) { + io::messages.add("Atom number out of range in BONDDP block", + "In_Topology", io::message::error); + } - if (!quiet) - os << "\tSOLUTE [sub]molecules: " - << unsigned(topo.molecules().size()) - param.system.nsm - 1 << "\n"; + if (t < 1) { + io::messages.add("Error in BONDDP block: bond type < 1", + "In_Topology", io::message::error); + } - DEBUG(10, "molecules().size: " << unsigned(topo.molecules().size()) - << " nsm : " << param.system.nsm); + topo.solute().cgbonds(). + push_back(topology::two_body_term_struct(i - 1, j - 1, t - 1)); + } - if (!quiet) - os << "\tSOLUTE temperature groups: " - << unsigned(topo.temperature_groups().size()) - param.system.nsm - 1 << "\n"; + if (n != num) { + io::messages.add("Wrong number of bonds in BONDDP block", + "In_Topology", io::message::error); + } + } - DEBUG(10, "temperature_groups().size: " << unsigned(topo.temperature_groups().size())); + if (!quiet) + os << "\n\tEND\n"; - if (!quiet) - os << "\tSOLUTE pressure groups: " - << unsigned(topo.pressure_groups().size()) - param.system.nsm - 1 << "\n"; +} // BONDDP - DEBUG(10, "pressure_groups().size: " << unsigned(topo.pressure_groups().size())); +void io::In_Topology::read_block_CONSTRAINT(topology::Topology& topo, + simulation::Parameter ¶m, std::ostream & os) { // CONSTRAINT + DEBUG(10, "CONSTRAINT block"); + std::vector buffer = m_block["CONSTRAINT"]; - // energy group check - if (param.force.energy_group.size() == 0) { - param.force.energy_group.push_back(topo.num_atoms() - 1); - } + if (buffer.size() && param.constraint.ntc > 1) { + block_read.insert("CONSTRAINT"); - if (param.force.energy_group.back() > topo.num_atoms() - 1) { - io::messages.add("Error in FORCE block: " - "last energy group has to end with last atom", - "In_Topology", io::message::error); - } else if (param.force.energy_group.back() < topo.num_atoms() - 1) { - param.force.energy_group.push_back(topo.num_atoms() - 1); - io::messages.add("FORCE block: " - "added an additional energy group", - "In_Topology", io::message::warning); - } + std::vector::const_iterator it = buffer.begin() + 1; + _lineStream.clear(); + _lineStream.str(*it); + int num, n; + _lineStream >> num; + ++it; - // and add them - DEBUG(10, "adding energy groups : " << param.force.energy_group.size()); - unsigned int atom = 0; - for (unsigned int i = 0; i < param.force.energy_group.size(); ++i) { - assert(param.force.energy_group.size() > i); - topo.energy_groups().push_back(param.force.energy_group[i]); - DEBUG(10, "energy group " << i << " start = " << atom << " end = " << param.force.energy_group[i]); - for (; atom <= param.force.energy_group[i]; ++atom) { - topo.atom_energy_group().push_back(i); - // DEBUG(11, "atom " << atom << ": " << i); - } - } + if (!quiet) + os << "\tCONSTRAINT\n\t\t" + << num + << " bonds in CONSTRAINT block." + << "\n\t\ttotal of constraint bonds : " + << num + unsigned(topo.solute().distance_constraints().size()) + << "\n\tEND\n"; - // Now that we have the energy groups, we initialize the - // LAMBDAS parameters that depend on them. - int maxnilg = param.force.energy_group.size(); - std::vector< double > one(maxnilg, 1.0); - std::vector< double > zero(maxnilg, 0.0); - for (unsigned int i = 0; i < param.lambdas.a.size(); i++) { - // check whether we have to resize the lambdas arrays - int lam_size = param.lambdas.a[i].size(); - if (lam_size < maxnilg) { - param.lambdas.a[i].insert(param.lambdas.a[i].end(), maxnilg - lam_size, zero); - lam_size = param.lambdas.b[i].size(); - param.lambdas.b[i].insert(param.lambdas.b[i].end(), maxnilg - lam_size, zero); - lam_size = param.lambdas.c[i].size(); - param.lambdas.c[i].insert(param.lambdas.c[i].end(), maxnilg - lam_size, zero); - lam_size = param.lambdas.d[i].size(); - param.lambdas.d[i].insert(param.lambdas.d[i].end(), maxnilg - lam_size, one); - lam_size = param.lambdas.e[i].size(); - param.lambdas.e[i].insert(param.lambdas.e[i].end(), maxnilg - lam_size, zero); - for (unsigned int j = 0; j < param.lambdas.a[i].size(); j++) { - lam_size = param.lambdas.a[i][j].size(); - param.lambdas.a[i][j].insert(param.lambdas.a[i][j].end(), maxnilg - lam_size, 0.0); - lam_size = param.lambdas.b[i][j].size(); - param.lambdas.b[i][j].insert(param.lambdas.b[i][j].end(), maxnilg - lam_size, 0.0); - lam_size = param.lambdas.c[i][j].size(); - param.lambdas.c[i][j].insert(param.lambdas.c[i][j].end(), maxnilg - lam_size, 0.0); - lam_size = param.lambdas.d[i][j].size(); - param.lambdas.d[i][j].insert(param.lambdas.d[i][j].end(), maxnilg - lam_size, 1.0); - lam_size = param.lambdas.e[i][j].size(); - param.lambdas.e[i][j].insert(param.lambdas.e[i][j].end(), maxnilg - lam_size, 0.0); + for (n = 0; it != buffer.end() - 1; ++it, ++n) { + int i, j, t; + + _lineStream.clear(); + _lineStream.str(*it); + _lineStream >> i >> j >> t; + + if (_lineStream.fail() || !_lineStream.eof()) { + io::messages.add("Bad line in CONSTRAINT block", + "In_Topology", io::message::error); + } + + if (i > int(topo.num_solute_atoms()) || j > int(topo.num_solute_atoms()) || + i < 1 || j < 1) { + io::messages.add("Atom number out of range in CONSTRAINT block", + "In_Topology", io::message::error); + } + + if (t < 1) { + io::messages.add("Error in CONSTRAINT block: bond type < 1", + "In_Topology", io::message::error); + } + + topo.solute().distance_constraints(). + push_back(topology::two_body_term_struct(i - 1, j - 1, t - 1)); + } + + if (n != num) { + io::messages.add("Wrong number of bonds in CONSTRAINT block", + "In_Topology", io::message::error); + } + } else if (buffer.size()) { + block_read.insert("CONSTRAINT"); } - } // do resize lambdas arrays - } - DEBUG(10, "multibath?"); - if (!param.multibath.found_multibath && param.multibath.found_tcouple) { - if (!quiet) - os << "\tparsing a (deprecated) TCOUPLE block into the new " - << "MULTIBATH format.\n"; +} // CONSTRAINT - util::parse_TCOUPLE(param, topo); - } +void io::In_Topology::read_block_BONDANGLEH(topology::Topology& topo, + simulation::Parameter ¶m, std::ostream & os) { // BONDANGLEH - // additional known blocks not read in with this routine - if (m_block["LJPARAMETERS"].size()) { - block_read.insert("LJPARAMETERS"); - } - if (m_block["CGPARAMETERS"].size()) { - block_read.insert("CGPARAMETERS"); - } + if (!quiet) + os << "\tBONDANGLE"; - // warn for unread input data - for(std::map >::const_iterator - it = m_block.begin(), to = m_block.end(); it != to; ++it){ - if (block_read.count(it->first) == 0 && it->second.size()){ - io::messages.add("block " + it->first + " unknown and not read in!", - "In_Topology", io::message::warning); - } - } + DEBUG(10, "BONDANGLEH block"); + std::vector buffer = m_block["BONDANGLEH"]; - // store number of bond/angle/improper types - { - std::vector b; - std::vector a; - std::vector im; - std::ostringstream os; - read_harmonic_bonds(b, os); - read_harm_angles(a,os); - read_improper_dihedrals(im,os); - topo.set_num_bondtype(b.size()); - topo.set_num_angletype(a.size()); - topo.set_num_impropertype(im.size()); - } + if (buffer.size()) { + block_read.insert("BONDANGLEH"); - if (!quiet) - os << "END\n"; + std::vector::const_iterator it = buffer.begin() + 1; - DEBUG(10, "topology read"); -} + _lineStream.clear(); + _lineStream.str(*it); -void io::In_Topology -::read_harmonic_bonds(std::vector &b, - std::ostream & os) { - DEBUG(8, "read_harmonic_bonds"); - DEBUG(10, "(HARM)BONDTYPE block"); + int num, n; + _lineStream >> num; + ++it; - std::vector buffer; - std::vector::const_iterator it; + if (!quiet) + os << "\n\t\tbondangles containing hydrogens : " << num; - buffer = m_block["HARMBONDTYPE"]; - if (buffer.size()) { - DEBUG(7, "reading in a DIRK (HARMBONDTYPE) block)"); - io::messages.add("harmonic bond force constants from HARMBONDTYPE block", - "In_Topology::bondtype", io::message::notice); + for (n = 0; it != buffer.end() - 1; ++it, ++n) { + int i, j, k, t; + _lineStream.clear(); + _lineStream.str(*it); + _lineStream >> i >> j >> k >> t; - int num, n = 0; - it = buffer.begin() + 1; - _lineStream.clear(); - _lineStream.str(*it); - _lineStream >> num; - ++it; - for (; it != buffer.end() - 1; ++it, ++n) { - double k, r; - _lineStream.clear(); - _lineStream.str(*it); - _lineStream >> k >> r; + if (_lineStream.fail() || !_lineStream.eof()) { + io::messages.add("Bad line in BONDANGLEH block", + "In_Topology", io::message::error); + } - if (_lineStream.fail() || !_lineStream.eof()) { - io::messages.add("bad line in HARMBONDTYPE block", - "In_Topology", - io::message::error); - k = 0; - r = 0; + if (i > int(topo.num_solute_atoms()) || j > int(topo.num_solute_atoms()) || + k > int(topo.num_solute_atoms()) || + i < 1 || j < 1 || k < 1) { + io::messages.add("Atom number out of range in BONDANGLEH block", + "In_Topology", io::message::error); + } + + if (t < 1) { + io::messages.add("Error in BONDANGLE block: bond angle type < 1", + "In_Topology", io::message::error); + } + + topo.solute().angles(). + push_back(topology::three_body_term_struct(i - 1, j - 1, k - 1, t - 1)); + } + + if (n != num) { + io::messages.add("Wrong number of bonds in BONDANGLEH block", + "In_Topology", io::message::error); + } } - // and add... - b.push_back(interaction::bond_type_struct(k, r)); - } +} // BONDANGLEH - if (num != n) - io::messages.add("not enough bond types in HARMBONDTYPE block", - "In_Topology", - io::message::error); - } else if (m_block["BONDTYPE"].size()) { - buffer = m_block["BONDTYPE"]; - _lineStream.clear(); - _lineStream.str(buffer[1]); - unsigned int num_types; - _lineStream >> num_types; - if (_lineStream.fail()) { - io::messages.add("bad line in BONDSTRETCHTYPE block: number of types", - "In_Topology", io::message::error); - } +void io::In_Topology::read_block_BONDANGLE(topology::Topology& topo, + simulation::Parameter ¶m, std::ostream & os) { // BONDANGLE + DEBUG(10, "BONDANGLE block"); + std::vector buffer = m_block["BONDANGLE"]; - // 1. BONDTYPE 2. number of types - for (it = buffer.begin() + 2; - it != buffer.end() - 1; ++it) { + if (buffer.size()) { + block_read.insert("BONDANGLE"); - double k, r; - _lineStream.clear(); - _lineStream.str(*it); + std::vector::const_iterator it = buffer.begin() + 1; + _lineStream.clear(); + _lineStream.str(*it); + int num, n; + _lineStream >> num; + ++it; - _lineStream >> k >> r; + if (!quiet) + os << "\n\t\tbondangles not containing hydrogens : " << num; - if (_lineStream.fail()) { - os << *it << std::endl; - io::messages.add("bad line in BONDTYPE block!", - "In_Topology", - io::message::error); - } - if (!_lineStream.eof()) { - os << *it << std::endl; - io::messages.add("eof not reached in BONDTYPE block", - "InTopology", io::message::warning); - } + for (n = 0; it != buffer.end() - 1; ++it, ++n) { + int i, j, k, t; - // we are reading into harmonic bond term, so convert k - k *= 2 * r * r; - DEBUG(10, "\t\tbond type k: " << k << ", r: " << r << "\n"); - // and add... - b.push_back(interaction::bond_type_struct(k, r)); - } - if (b.size() != num_types) { - io::messages.add("BONDTYPE block: number of types does not " - "correspond with number of lines", - "In_Topology", io::message::error); - } - } else if (m_block["BONDSTRETCHTYPE"].size()) { - // read in the new block - buffer = m_block["BONDSTRETCHTYPE"]; - _lineStream.clear(); - _lineStream.str(buffer[1]); - unsigned int num_types; - _lineStream >> num_types; - if (_lineStream.fail()) { - io::messages.add("bad line in BONDSTRETCHTYPE block: number of types", - "In_Topology", io::message::error); - } + _lineStream.clear(); + _lineStream.str(*it); + _lineStream >> i >> j >> k >> t; - // we are reading into harmonic bond term, so only read the harmonic force constant (kh) - // 1. BONDTYPE 2. number of types - for (it = buffer.begin() + 2; - it != buffer.end() - 1; ++it) { - double k, kh, r; - _lineStream.clear(); - _lineStream.str(*it); + if (_lineStream.fail() || !_lineStream.eof()) { + io::messages.add("Bad line in BONDANGLE block", + "In_Topology", io::message::error); + } + + if (i > int(topo.num_solute_atoms()) || j > int(topo.num_solute_atoms()) || + k > int(topo.num_solute_atoms()) || + i < 1 || j < 1 || k < 1) { + io::messages.add("Atom number out of range in BONDANGLE block", + "In_Topology", io::message::error); + } - _lineStream >> k >> kh >> r; + if (t < 1) { + io::messages.add("Error in BONDANGLEH block: bond angle type < 1", + "In_Topology", io::message::error); + } - if (_lineStream.fail()) { - os << *it << std::endl; - io::messages.add("bad line in BONDSTRETCHTYPE block!", - "In_Topology", - io::message::error); - } - if (!_lineStream.eof()) { - os << *it << std::endl; - io::messages.add("eof not reached in BONDSTRETCHTYPE block", - "InTopology", io::message::warning); - } - // check for consistency, allow 0.01% error - double calc_kh = k * 2.0 * r*r; - if (fabs(kh - calc_kh) / kh > 1.0e-4) { - std::ostringstream msg; - msg << "harmonic and quartic force constant do not match (CHB!=CB*2*B0*B0): " << std::endl - << "CHB = " << kh << ", CB*2*B0*B0 = " << calc_kh - << " |CHB-CB*2*B0*B0| = " << fabs(kh - calc_kh) << std::endl; - io::messages.add(msg.str(), "InTopology", io::message::warning); + topo.solute().angles(). + push_back(topology::three_body_term_struct(i - 1, j - 1, k - 1, t - 1)); + } + + if (n != num) { + io::messages.add("Wrong number of bonds in BONDANGLE block", + "In_Topology", io::message::error); + } } - // and add r and the harmonic force constant - b.push_back(interaction::bond_type_struct(kh, r)); - } - if (b.size() != num_types) { - io::messages.add("BONDSTRETCHTYPE block: number of types does not " - "correspond with number of lines", - "In_Topology", io::message::error); - } + if (!quiet) + os << "\n\tEND\n"; - } else { - io::messages.add("either BONDTYPE, BONDSTRETCHTYPE or HARMBONDTYPE block must be present!", - "In_Topology", - io::message::error); - } +} // BONDANGLE - // also add the solvent constraints to the bond types... - // (if there is one) - num_solute_bondtypes = b.size(); +void io::In_Topology::read_block_IMPDIHEDRAL(topology::Topology& topo, + simulation::Parameter ¶m, std::ostream & os) { // IMPDIHEDRAL + DEBUG(10, "IMPDIHEDRAL block"); + std::vector buffer = m_block["IMPDIHEDRAL"]; - buffer = m_block["SOLVENTCONSTR"]; - if (buffer.size()) { + if (!quiet) + os << "\tIMPDIHEDRAL"; - it = buffer.begin() + 1; - _lineStream.clear(); - _lineStream.str(*it); + if (buffer.size()) { + block_read.insert("IMPDIHEDRAL"); - int num; - _lineStream >> num; - ++it; + std::vector::const_iterator it = buffer.begin() + 1; + _lineStream.clear(); + _lineStream.str(*it); + int num, n; + _lineStream >> num; + ++it; - int i, j, n; - double b0; + if (!quiet) + os << "\n\t\timproper dihedrals not containing hydrogens : " + << num; - for (n = 0; it != buffer.end() - 1; ++it, ++n) { - _lineStream.clear(); - _lineStream.str(*it); + for (n = 0; it != buffer.end() - 1; ++it, ++n) { + int i, j, k, l, t; - _lineStream >> i >> j >> b0; + _lineStream.clear(); + _lineStream.str(*it); + _lineStream >> i >> j >> k >> l >> t; - if (_lineStream.fail() || !_lineStream.eof()) { - io::messages.add("Bad line in SOLVENTCONSTR block", - "In_Topology", io::message::error); + if (_lineStream.fail() || !_lineStream.eof()) { + io::messages.add("Bad line in IMPDIHEDRAL block", + "In_Topology", io::message::error); + } + + if (i > int(topo.num_solute_atoms()) || j > int(topo.num_solute_atoms()) || + k > int(topo.num_solute_atoms()) || l > int(topo.num_solute_atoms()) || + i < 1 || j < 1 || k < 1 || l < 1) { + io::messages.add("Atom number out of range in IMPDIHEDRAL block", + "In_Topology", io::message::error); + } + + if (t < 1) { + io::messages.add("Error in IMPDIHEDRAL block: improper dihedral type < 1", + "In_Topology", io::message::error); + } + + topo.solute().improper_dihedrals(). + push_back(topology::four_body_term_struct(i - 1, j - 1, k - 1, l - 1, t - 1)); + } + + if (n != num) { + io::messages.add("Wrong number of bonds in IMPDIHEDRAL block", + "In_Topology", io::message::error); + } } - // the solvent (distance constraints) bond types - b.push_back(interaction::bond_type_struct(0, b0)); - // (K is set to 0.0) - } + } // IMPDIHEDRAL +void io::In_Topology::read_block_IMPDIHEDRALH(topology::Topology& topo, + simulation::Parameter ¶m, std::ostream & os) { // IMPDIHEDRALH + DEBUG(10, "IMPDIHEDRALH block"); + std::vector buffer = m_block["IMPDIHEDRALH"]; - if (n != num) { - io::messages.add("Error in SOLVENTCONSTR block (num != n)", - "In_Topology", io::message::error); + if (buffer.size()) { + block_read.insert("IMPDIHEDRALH"); + + std::vector::const_iterator it = buffer.begin() + 1; + + _lineStream.clear(); + _lineStream.str(*it); - } - } + int num, n; + _lineStream >> num; + ++it; -} + if (!quiet) + os << "\n\t\timproper dihedrals containing hydrogens : " + << num; -void io::In_Topology -::read_g96_bonds(std::vector &b, - std::ostream & os) { - DEBUG(8, "read_g96_bonds"); - DEBUG(10, "BONDTYPE block"); + for (n = 0; it != buffer.end() - 1; ++it, ++n) { + int i, j, k, l, t; + _lineStream.clear(); + _lineStream.str(*it); + _lineStream >> i >> j >> k >> l >> t; - std::vector buffer; - std::vector::const_iterator it; - if (m_block["BONDTYPE"].size()) { - buffer = m_block["BONDTYPE"]; + if (_lineStream.fail() || !_lineStream.eof()) { + io::messages.add("Bad line in IMPDIHEDRALH block", + "In_Topology", io::message::error); + } - // 1. BONDTYPE 2. number of types - for (it = buffer.begin() + 2; - it != buffer.end() - 1; ++it) { + if (i > int(topo.num_solute_atoms()) || j > int(topo.num_solute_atoms()) || + k > int(topo.num_solute_atoms()) || l > int(topo.num_solute_atoms()) || + i < 1 || j < 1 || k < 1 || l < 1) { + io::messages.add("Atom number out of range in IMPDIHEDRALH block", + "In_Topology", io::message::error); + } - double k, r; - _lineStream.clear(); - _lineStream.str(*it); + if (t < 1) { + io::messages.add("Error in IMPDIHEDRALH block: improper dihedral type < 1", + "In_Topology", io::message::error); + } - _lineStream >> k >> r; + topo.solute().improper_dihedrals(). + push_back(topology::four_body_term_struct(i - 1, j - 1, k - 1, l - 1, t - 1)); + } - if (_lineStream.fail()) { - os << *it << std::endl; - io::messages.add("bad line in BONDTYPE block!", - "In_Topology", - io::message::error); - } - if (!_lineStream.eof()) { - os << *it << std::endl; - io::messages.add("eof not reached in BONDTYPE block", - "InTopology", io::message::warning); + if (n != num) { + io::messages.add("Wrong number of bonds in IMPDIHEDRALH block", + "In_Topology", io::message::error); + } } - // and add... - b.push_back(interaction::bond_type_struct(k, r)); - } - } else if (m_block["BONDSTRETCHTYPE"].size()) { - // read in the new block - buffer = m_block["BONDSTRETCHTYPE"]; - // we are reading into quartic bond term, so only read the quartic force constant (k) - // 1. BONDTYPE 2. number of types - for (it = buffer.begin() + 2; - it != buffer.end() - 1; ++it) { - double k, kh, r; - _lineStream.clear(); - _lineStream.str(*it); + if (!quiet) + os << "\n\tEND\n"; - _lineStream >> k >> kh >> r; + } // IMPDIHEDRALH +void io::In_Topology::read_block_DIHEDRAL(topology::Topology& topo, + simulation::Parameter ¶m, std::ostream & os) { // DIHEDRAL + DEBUG(10, "DIHEDRAL block"); + std::vector buffer = m_block["DIHEDRAL"]; - if (_lineStream.fail()) { - os << *it << std::endl; - io::messages.add("bad line in BONDSTRETCHTYPE block!", - "In_Topology", - io::message::error); - } - if (!_lineStream.eof()) { - os << *it << std::endl; - io::messages.add("eof not reached in BONDSTRETCHTYPE block", - "InTopology", io::message::warning); - } - // check for consistency - if (kh != k * 2 * r * r) { - os << "\tWarning: harmonic and quartic force constant do not match\n" - << "\t" << *it << std::endl; - io::messages.add("harmonic and quartic force constant do not match (CHB!=CB*2*B0*B0)", - "InTopology", io::message::warning); - } - // and add r and the quartic force constant - b.push_back(interaction::bond_type_struct(k, r)); - } - } else { - io::messages.add("either BONDTYPE or BONDSTRETCHTYPE block must be present!", - "In_Topology", - io::message::error); - } + if (!quiet) + os << "\tDIHEDRAL"; - num_solute_bondtypes = b.size(); + if (buffer.size()) { + block_read.insert("DIHEDRAL"); - // also add the solvent constraints to the bond types... - // (if there is one) - buffer = m_block["SOLVENTCONSTR"]; - if (buffer.size()) { + std::vector::const_iterator it = buffer.begin() + 1; + _lineStream.clear(); + _lineStream.str(*it); + int num, n; + _lineStream >> num; + ++it; - it = buffer.begin() + 1; - _lineStream.clear(); - _lineStream.str(*it); + if (!quiet) + os << "\n\t\tdihedrals not containing hydrogens : " + << num; - int num; - _lineStream >> num; - ++it; + for (n = 0; it != buffer.end() - 1; ++it, ++n) { + int i, j, k, l, t; - int i, j, n; - double b0; + _lineStream.clear(); + _lineStream.str(*it); + _lineStream >> i >> j >> k >> l >> t; - for (n = 0; it != buffer.end() - 1; ++it, ++n) { - _lineStream.clear(); - _lineStream.str(*it); + if (_lineStream.fail() || !_lineStream.eof()) { + io::messages.add("Bad line in DIHEDRAL block", + "In_Topology", io::message::error); + } - _lineStream >> i >> j >> b0; + if (i > int(topo.num_solute_atoms()) || j > int(topo.num_solute_atoms()) || + k > int(topo.num_solute_atoms()) || l > int(topo.num_solute_atoms()) || + i < 1 || j < 1 || k < 1 || l < 1) { + io::messages.add("Atom number out of range in DIHEDRAL block", + "In_Topology", io::message::error); + } - if (_lineStream.fail() || !_lineStream.eof()) { - io::messages.add("Bad line in SOLVENTCONSTR block", - "In_Topology", io::message::error); - } + if (t < 1) { + io::messages.add("Error in DIHEDRAL block: dihedral type < 1", + "In_Topology", io::message::error); + } - // the solvent (distance constraints) bond types - // (K is set to 0.0) - b.push_back(interaction::bond_type_struct(0, b0)); - } + topo.solute().dihedrals(). + push_back(topology::four_body_term_struct(i - 1, j - 1, k - 1, l - 1, t - 1)); + } - if (n != num) { - io::messages.add("Error in SOLVENTCONSTR block (num != n)", - "In_Topology", io::message::error); - } - } + if (n != num) { + io::messages.add("Wrong number of bonds in DIHEDRAL block", + "In_Topology", io::message::error); + } + } -} + } // DIHEDRAL +void io::In_Topology::read_block_DIHEDRALH(topology::Topology& topo, + simulation::Parameter ¶m, std::ostream & os) { // DIHEDRALH + DEBUG(10, "DIHEDRALH block"); -void io::In_Topology -::read_angles(std::vector &b, - std::ostream & os) { + std::vector buffer = m_block["DIHEDRALH"]; + if (buffer.size()) { + block_read.insert("DIHEDRALH"); - std::vector buffer; - std::vector::const_iterator it; + std::vector::const_iterator it = buffer.begin() + 1; - if (m_block["BONDANGLEBENDTYPE"].size()) { - DEBUG(10, "BONDANGLEBENDTYPE block"); - buffer = m_block["BONDANGLEBENDTYPE"]; - // 1. BONDTYPE 2. number of types - for (it = buffer.begin() + 2; - it != buffer.end() - 1; ++it) { + _lineStream.clear(); + _lineStream.str(*it); - double k, kh, cos0; - _lineStream.clear(); - _lineStream.str(*it); + int num, n; + _lineStream >> num; + ++it; - _lineStream >> k >> kh >> cos0; + if (!quiet) + os << "\n\t\tdihedrals containing hydrogens : " + << num; - if (_lineStream.fail()) { - os << *it << std::endl; - io::messages.add("bad line in BONDANGLEBENDTYPE block", "In_Topology", - io::message::error); - } - if (!_lineStream.eof()) { - os << *it << std::endl; - io::messages.add("eof not reached in BONDANGLEBENDTYPE block", - "InTopology", io::message::warning); - } + for (n = 0; it != buffer.end() - 1; ++it, ++n) { + int i, j, k, l, t; + _lineStream.clear(); + _lineStream.str(*it); + _lineStream >> i >> j >> k >> l >> t; - // and add (force constant based on a potential harmonic in the angle cosine) - b.push_back(interaction::angle_type_struct(k, cos(cos0 * 2 * math::Pi / 360.0))); - } - } else if (m_block["BONDANGLETYPE"].size()) { - DEBUG(10, "BONDANGLETYPE block"); - buffer = m_block["BONDANGLETYPE"]; + if (_lineStream.fail() || !_lineStream.eof()) { + io::messages.add("Bad line in DIHEDRALH block", + "In_Topology", io::message::error); + } - // 1. BONDTYPE 2. number of types - for (it = buffer.begin() + 2; - it != buffer.end() - 1; ++it) { + if (i > int(topo.num_solute_atoms()) || j > int(topo.num_solute_atoms()) || + k > int(topo.num_solute_atoms()) || l > int(topo.num_solute_atoms()) || + i < 1 || j < 1 || k < 1 || l < 1) { + io::messages.add("Atom number out of range in DIHEDRALH block", + "In_Topology", io::message::error); + } - double k, cos0; - _lineStream.clear(); - _lineStream.str(*it); + if (t < 1) { + io::messages.add("Error in DIHEDRALH block: dihedral type < 1", + "In_Topology", io::message::error); + } - _lineStream >> k >> cos0; + topo.solute().dihedrals(). + push_back(topology::four_body_term_struct(i - 1, j - 1, k - 1, l - 1, t - 1)); + } - if (_lineStream.fail()) { - os << *it << std::endl; - io::messages.add("bad line in BONDANGLETYPE block", "In_Topology", - io::message::error); - } - if (!_lineStream.eof()) { - os << *it << std::endl; - io::messages.add("eof not reached in BONDANGLETYPE block", - "InTopology", io::message::warning); + if (n != num) { + io::messages.add("Wrong number of bonds in DIHEDRALH block", + "In_Topology", io::message::error); + } } - // and add... - b.push_back(interaction::angle_type_struct(k, cos(cos0 * 2 * math::Pi / 360.0))); - } - } else { - io::messages.add("either BONDANGLEBENDTYPE or BONDANGLETYPE block must be present", - "In_Topology", io::message::error); - } + if (!quiet) + os << "\n\tEND\n"; -} + } // DIHEDRALH +void io::In_Topology::read_block_CROSSDIHEDRAL(topology::Topology& topo, + simulation::Parameter ¶m, std::ostream & os) { // CROSSDIHEDRAL + DEBUG(10, "CROSSDIHEDRAL block"); + std::vector buffer = m_block["CROSSDIHEDRAL"]; -void io::In_Topology -::read_harm_angles(std::vector &b, - std::ostream & os) { - std::vector buffer; - std::vector::const_iterator it; - if (m_block["BONDANGLEBENDTYPE"].size()) { - DEBUG(10, "BONDANGLEBENDTYPE block"); - buffer = m_block["BONDANGLEBENDTYPE"]; - // 1. BONDTYPE 2. number of types - for (it = buffer.begin() + 2; - it != buffer.end() - 1; ++it) { + if (!quiet) + os << "\tCROSSDIHEDRAL"; - double k, kh, cos0; - _lineStream.clear(); - _lineStream.str(*it); + if (buffer.size()) { + block_read.insert("CROSSDIHEDRAL"); - _lineStream >> k >> kh >> cos0; + std::vector::const_iterator it = buffer.begin() + 1; + _lineStream.clear(); + _lineStream.str(*it); + int num, n; + _lineStream >> num; + ++it; - if (_lineStream.fail()) { - os << *it << std::endl; - io::messages.add("bad line in BONDANGLEBENDTYPE block", "In_Topology", - io::message::error); - } - if (!_lineStream.eof()) { - os << *it << std::endl; - io::messages.add("eof not reached in BONDANGLEBENDTYPE block", - "InTopology", io::message::warning); - } + if (!quiet) + os << "\n\t\tcrossdihedrals not containing hydrogens : " + << num; - // and add (force constant based on a potential harmonic in the angle cosine) - b.push_back(interaction::angle_type_struct(kh * (180.0 * 180.0 / (math::Pi * math::Pi)), - cos0 * 2 * math::Pi / 360.0)); - } - } else if (m_block["HARMBONDANGLETYPE"].size()) { - DEBUG(10, "HARMBONDANGLETYPE block"); + for (n = 0; it != buffer.end() - 1; ++it, ++n) { + int a, b, c, d, e, f, g, h, t; - buffer = m_block["HARMBONDANGLETYPE"]; + _lineStream.clear(); + _lineStream.str(*it); + _lineStream >> a >> b >> c >> d >> e >> f >> g >> h >> t; - if (buffer.size() == 0) { - io::messages.add("HARMBONDANGLETYPE block not found!", "In_Topology", - io::message::error); - return; - } + if (_lineStream.fail() || !_lineStream.eof()) { + io::messages.add("Bad line in CROSSDIHEDRAL block", + "In_Topology", io::message::error); + } - // 1. BONDANGLETYPE 2. number of types - for (it = buffer.begin() + 2; - it != buffer.end() - 1; ++it) { + if (a > int(topo.num_solute_atoms()) || b > int(topo.num_solute_atoms()) || + c > int(topo.num_solute_atoms()) || d > int(topo.num_solute_atoms()) || + e > int(topo.num_solute_atoms()) || f > int(topo.num_solute_atoms()) || + g > int(topo.num_solute_atoms()) || h > int(topo.num_solute_atoms()) || + a < 1 || b < 1 || c < 1 || d < 1 || e < 1 || f < 1 || g < 1 || h < 1) { + io::messages.add("Atom number out of range in CROSSDIHEDRAL block", + "In_Topology", io::message::error); + } - double k, theta; - _lineStream.clear(); - _lineStream.str(*it); + if (t < 1) { + io::messages.add("Error in CROSSDIHEDRAL block: cross dihedral type < 1", + "In_Topology", io::message::error); + } - _lineStream >> k >> theta; + topo.solute().crossdihedrals(). + push_back(topology::eight_body_term_struct(a - 1, b - 1, c - 1, d - 1, e - 1, + f - 1, g - 1, h - 1, t - 1)); + } - if (_lineStream.fail()) { - os << *it << std::endl; - io::messages.add("bad line in HARMBONDANGLETYPE block", "In_Topology", - io::message::error); - } - if (!_lineStream.eof()) { - os << *it << std::endl; - io::messages.add("eof not reached in HARMBONDANGLETYPE block", - "InTopology", io::message::warning); + if (n != num) { + io::messages.add("Wrong number of bonds in CROSSDIHEDRAL block", + "In_Topology", io::message::error); + } } - // and add... - b.push_back(interaction::angle_type_struct(k * (180.0 * 180.0 / (math::Pi * math::Pi)), - theta * math::Pi / 180.0)); - } - } else { - io::messages.add("either BONDANGLEBENDTYPE or HARMBONDANGLETYPE block must be present", - "In_Topology", io::message::error); - } + } // CROSSDIHEDRAL +void io::In_Topology::read_block_CROSSDIHEDRALH(topology::Topology& topo, + simulation::Parameter ¶m, std::ostream & os) { // CROSSDIHEDRALH + DEBUG(10, "CROSSDIHEDRALH block"); + + std::vector buffer = m_block["CROSSDIHEDRALH"]; + if (buffer.size()) { + block_read.insert("CROSSDIHEDRALH"); + + std::vector::const_iterator it = buffer.begin() + 1; + + _lineStream.clear(); + _lineStream.str(*it); + + int num, n; + _lineStream >> num; + ++it; -} + if (!quiet) + os << "\n\t\tcrossdihedrals containing hydrogens : " + << num; -void io::In_Topology -::read_improper_dihedrals(std::vector &i, - std::ostream & os) { + for (n = 0; it != buffer.end() - 1; ++it, ++n) { + int a, b, c, d, e, f, g, h, t; + _lineStream.clear(); + _lineStream.str(*it); + _lineStream >> a >> b >> c >> d >> e >> f >> g >> h >> t; - DEBUG(10, "IMPDIHEDRALTYPE block"); + if (_lineStream.fail() || !_lineStream.eof()) { + io::messages.add("Bad line in CROSSDIHEDRALH block", + "In_Topology", io::message::error); + } - std::vector buffer; - std::vector::const_iterator it; + if (a > int(topo.num_solute_atoms()) || b > int(topo.num_solute_atoms()) || + c > int(topo.num_solute_atoms()) || d > int(topo.num_solute_atoms()) || + e > int(topo.num_solute_atoms()) || f > int(topo.num_solute_atoms()) || + g > int(topo.num_solute_atoms()) || h > int(topo.num_solute_atoms()) || + a < 1 || b < 1 || c < 1 || d < 1 || e < 1 || f < 1 || g < 1 || h < 1) { + io::messages.add("Atom number out of range in CROSSDIHEDRALH block", + "In_Topology", io::message::error); + } - buffer = m_block["IMPDIHEDRALTYPE"]; + if (t < 1) { + io::messages.add("Error in CROSSDIHEDRALH block: cross dihedral type < 1", + "In_Topology", io::message::error); + } - if (buffer.size() == 0) { - io::messages.add("IMPDIHEDRALTYPE block not found!", "In_Topology", - io::message::error); - return; - } + topo.solute().crossdihedrals(). + push_back(topology::eight_body_term_struct(a - 1, b - 1, c - 1, d - 1, e - 1, + f - 1, g - 1, h - 1, t - 1)); + } - // 1. IMPDIHEDRALTYPE 2. number of types - for (it = buffer.begin() + 2; - it != buffer.end() - 1; ++it) { + if (n != num) { + io::messages.add("Wrong number of bonds in CROSSDIHEDRALH block", + "In_Topology", io::message::error); + } + } - double k, q0; - _lineStream.clear(); - _lineStream.str(*it); + if (!quiet) + os << "\n\tEND\n"; - _lineStream >> k >> q0; +} // CROSSDIHEDRALH - if (_lineStream.fail()) { - os << *it << std::endl; - io::messages.add("bad line in IMPDIHEDRALTYPE block", "In_Topology", - io::message::error); - } - if (!_lineStream.eof()) { - os << *it << std::endl; - io::messages.add("eof not reached in IMPDIHEDRALTYPE block", - "InTopology", io::message::warning); - } +void io::In_Topology::read_block_VIRTUALGRAIN(topology::Topology& topo, + simulation::Parameter ¶m, std::ostream & os) { // VIRTUALGRAIN + DEBUG(10, "VIRTUALGRAIN block"); - // and add... - i.push_back(interaction::improper_dihedral_type_struct(k * 180 * 180 / math::Pi / math::Pi, - q0 * math::Pi / 180.0)); - } + std::vector buffer = m_block["VIRTUALGRAIN"]; + if (buffer.size()) { + block_read.insert("VIRTUALGRAIN"); -} + std::vector::const_iterator it = buffer.begin() + 1; -void io::In_Topology -::read_dihedrals(std::vector &d, - std::ostream & os) { - if (m_block["TORSDIHEDRALTYPE"].size()) { - DEBUG(10, "TORSDIHEDRALTYPE block"); + _lineStream.clear(); + _lineStream.str(*it); + + int num, n; + _lineStream >> num; + ++it; - DEBUG(10, "TORSDIHEDRALTYPE block"); + if (!quiet) + os << "\tVIRTUALGRAIN\n\t\tVirtual Grains : " + << num; - std::vector buffer; - std::vector::const_iterator it; + for (n = 0; it != buffer.end() - 1; ++it, ++n) { + _lineStream.clear(); + _lineStream.str(*it); - buffer = m_block["TORSDIHEDRALTYPE"]; + // number of real atoms to define virtual atom + int index, i, q; + _lineStream >> index >> i; - if (buffer.size() == 0) { - io::messages.add("TORSDIHEDRALTYPE block not found!", "In_Topology", - io::message::error); - return; - } + std::vector cog; - // 1. DIHEDRALTYPE 2. number of types - for (it = buffer.begin() + 2; - it != buffer.end() - 1; ++it) { + for (int j = 0; j < i; ++j) { + _lineStream >> q; + cog.push_back(q - 1); + } - double k, pdl; - int m; + if (_lineStream.fail() || !_lineStream.eof()) { + io::messages.add("Bad line in VIRTUALGRAIN block", + "In_Topology", io::message::error); + } - _lineStream.clear(); - _lineStream.str(*it); + topo.virtual_grains(). + push_back(topology::virtual_grain_struct(index - 1, + util::Virtual_Atom(util::va_cog, cog))); + } - _lineStream >> k >> pdl >> m; + if (n != num) { + io::messages.add("Wrong number of elements in VIRTUALGRAIN block", + "In_Topology", io::message::error); + } - if (_lineStream.fail()) { - os << *it << std::endl; - io::messages.add("bad line in TORSDIHEDRALTYPE block", "In_Topology", - io::message::error); - } - if (!_lineStream.eof()) { - os << *it << std::endl; - io::messages.add("eof not reached in TORSDIHEDRALTYPE block", - "InTopology", io::message::warning); + if (!quiet) + os << "\n\tEND\n"; } - // and add... +} // VIRTUALGRAIN - d.push_back(interaction::dihedral_type_struct(k, cos(pdl * math::Pi / 180.0), pdl * math::Pi / 180.0, m)); - } - } else if (m_block["DIHEDRALTYPE"].size()) { - DEBUG(10, "DIHEDRALTYPE block"); +void io::In_Topology::read_block_SOLUTEMOLECULES(topology::Topology& topo, + simulation::Parameter ¶m, std::ostream & os) { // SOLUTEMOLECULES + DEBUG(10, "read SOLUTEMOLECULES"); - std::vector buffer; - std::vector::const_iterator it; + std::string s; - buffer = m_block["DIHEDRALTYPE"]; + std::vector buffer = m_block["SOLUTEMOLECULES"]; - if (buffer.size() == 0) { - io::messages.add("DIHEDRALTYPE block not found!", "In_Topology", - io::message::error); - return; - } + if (!buffer.size()) { + io::messages.add("no SOLUTEMOLECULES block in topology", + "In_Topology", io::message::error); + } else { + block_read.insert("SOLUTEMOLECULES"); + _lineStream.clear(); + _lineStream.str(concatenate(buffer.begin() + 1, buffer.end() - 1, s)); - // 1. DIHEDRALTYPE 2. number of types - for (it = buffer.begin() + 2; - it != buffer.end() - 1; ++it) { + int num; - double k, pd; - int m; + _lineStream >> num; - _lineStream.clear(); - _lineStream.str(*it); + if (num < 0) { + io::messages.add("negative number of SOLUTEMOLECULES is not allowed", + "In_Topology", io::message::error); + } - _lineStream >> k >> pd >> m; + unsigned int m; + unsigned int old_m = 0; - if (_lineStream.fail()) { - os << *it << std::endl; - io::messages.add("bad line in DIHEDRALTYPE block", "In_Topology", - io::message::error); - } - if (!_lineStream.eof()) { - os << *it << std::endl; - io::messages.add("eof not reached in DIHEDRALTYPE block", - "InTopology", io::message::warning); + for (int i = 0; i < num; ++i) { + _lineStream >> m; + topo.molecules().push_back(m); + DEBUG(11, "add submol " << m); + if (m < old_m) { + io::messages.add("wrong order in SOLUTEMOLECULES block", + "In_Topology", io::message::error); + break; + } + old_m = m; + } + + if (_lineStream.fail()) + io::messages.add("bad line in SOLUTEMOLECULES block", + "In_Topology", io::message::error); } + } // SOLUTEMOLECULES +void io::In_Topology::read_block_TEMPERATUREGROUPS(topology::Topology& topo, + simulation::Parameter ¶m, std::ostream & os) { // TEMPERATUREGROUPS + DEBUG(10, "read TEMPERATUREGROUPS"); - // and add... - d.push_back(interaction::dihedral_type_struct(k, pd, acos(pd), m)); - } - } else { - // complain that we need a block - io::messages.add("either TORSDIHEDRALTYPE or DIHEDRALTYPE block must be present", "In_Topology", - io::message::error); - } -} + std::string s; -void io::In_Topology -::read_lj_parameter(std::vector > - & lj_parameter, - std::ostream & os) { - std::vector buffer; - std::vector::const_iterator it; + std::vector buffer = m_block["TEMPERATUREGROUPS"]; - { // LJPARAMETERS + if (!buffer.size()) { + io::messages.add("no TEMPERATUREGROUPS block in topology", + "In_Topology", io::message::error); + } else { + block_read.insert("TEMPERATUREGROUPS"); + _lineStream.clear(); + _lineStream.str(concatenate(buffer.begin() + 1, buffer.end() - 1, s)); - DEBUG(10, "LJPARAMETERS block"); + int num; - buffer = m_block["LJPARAMETERS"]; - if (!buffer.size()) { - io::messages.add("No LJPARAMETERS block found in topology!", - "In_Topology", - io::message::error); - return; - } + _lineStream >> num; - int num, n; + if (num < 0) { + io::messages.add("negative number of TEMPERATUREGROUPS is not allowed", + "In_Topology", io::message::error); + } - it = buffer.begin() + 1; - _lineStream.clear(); - _lineStream.str(*it); - _lineStream >> num; + unsigned int m; + unsigned int old_m = 0; - // calculate the matrix size from: x = n*(n+1)/2 - unsigned int sz = unsigned(sqrt(double((8 * num + 1) - 1)) / 2); + for (int i = 0; i < num; ++i) { + _lineStream >> m; + topo.temperature_groups().push_back(m); + DEBUG(11, "add temperature group " << m); + if (m < old_m) { + io::messages.add("wrong order in TEMPERATUREGROUPS block", + "In_Topology", io::message::error); + break; + } + old_m = m; + } - lj_parameter.resize(sz); - std::vector< std::vector >::iterator - lj_it = lj_parameter.begin(), - lj_to = lj_parameter.end(); + if (_lineStream.fail()) + io::messages.add("bad line in TEMPERATUREGROUPS block", + "In_Topology", io::message::error); + } + } // TEMPERATUREGROUPS - for (; lj_it != lj_to; ++lj_it) - lj_it->resize(sz); +void io::In_Topology::read_block_PRESSUREGROUPS(topology::Topology& topo, + simulation::Parameter ¶m, std::ostream & os) { // PRESSUREGROUPS + DEBUG(10, "read PRESSUREGROUPS"); - ++it; + std::string s; - for (n = 0; it != buffer.end() - 1; ++it, ++n) { + std::vector buffer = m_block["PRESSUREGROUPS"]; - interaction::lj_parameter_struct s; - int i, j; + if (!buffer.size()) { + io::messages.add("no PRESSUREGROUPS block in topology", + "In_Topology", io::message::error); + } else { + block_read.insert("PRESSUREGROUPS"); + _lineStream.clear(); + _lineStream.str(concatenate(buffer.begin() + 1, buffer.end() - 1, s)); - _lineStream.clear(); - _lineStream.str(*it); + int num; - _lineStream >> i >> j >> s.c12 >> s.c6 >> s.cs12 >> s.cs6; + _lineStream >> num; - --i; - --j; + if (num < 0) { + io::messages.add("negative number of PRESSUREGROUPS is not allowed", + "In_Topology", io::message::error); + } - if (_lineStream.fail() ) - io::messages.add("bad line in LJPARAMETERS block", "In_Topology", - io::message::error); + unsigned int m; + unsigned int old_m = 0; - if (i >= int(sz) || j >= int(sz)) { - DEBUG(7, "wrong iac in LJPARAMETERS: i=" << i << " j=" << j - << " sz=" << sz); - io::messages.add("wrong integer atom code in LJPARAMETERS block", - "In_Topology", - io::message::error); + for (int i = 0; i < num; ++i) { + _lineStream >> m; + topo.pressure_groups().push_back(m); + DEBUG(11, "add pressure group " << m); + if (m < old_m) { + io::messages.add("wrong order in PRESSUREGROUPS block", + "In_Topology", io::message::error); + break; + } + old_m = m; + } + + if (_lineStream.fail()) + io::messages.add("bad line in PRESSUREGROUPS block", + "In_Topology", io::message::error); } +} // PRESSUREGROUPS - lj_parameter[i][j] = s; - lj_parameter[j][i] = s; - } - if (num != n) { - io::messages.add("Reading the LJPARAMETERS failed (n != num)", - "InTopology", - io::message::error); - } - } // LJPARAMETER +void io::In_Topology::read_SOLVENT_blocks(topology::Topology& topo, + simulation::Parameter ¶m, std::ostream & os) { + DEBUG(10, "SOLVENTATOM block"); + std::vector buffer = m_block["SOLVENTATOM"]; -} + if (!quiet) + os << "\tSOLVENT"; -void io::In_Topology -::read_cg_parameter(std::vector > - & cg_parameter, - std::ostream & os) { - std::vector buffer; - std::vector::const_iterator it; + if (buffer.size()) { + block_read.insert("SOLVENTATOM"); - { // CGPARAMETERS - DEBUG(10, "CGPARAMETERS block"); + unsigned int res_nr = unsigned(topo.residue_names().size()); - buffer = m_block["CGPARAMETERS"]; - if (!buffer.size()) { - io::messages.add("No CGPARAMETERS block found in topology!", - "In_Topology", - io::message::error); - return; - } + topo.residue_names().push_back("SOLV"); - int num, n; + std::vector::const_iterator it = buffer.begin() + 1; + _lineStream.clear(); + _lineStream.str(*it); + int num, n; + _lineStream >> num; + ++it; - it = buffer.begin() + 1; - _lineStream.clear(); - _lineStream.str(*it); - _lineStream >> num; + if (!quiet) + os << "\n\t\tatoms : " << num; - // calculate the matrix size from: x = n*(n+1)/2 - unsigned int sz = unsigned(sqrt(double((8 * num + 1) - 1)) / 2); + topology::Solvent s; - cg_parameter.resize(sz); - std::vector< std::vector >::iterator - cg_it = cg_parameter.begin(), - cg_to = cg_parameter.end(); + std::string name; + int i, iac; + double mass, charge; + //adiabatic decoupling + int adc_index = 0; + double sm = 1; + int total_nr = topo.num_solute_atoms() - 1; - for (; cg_it != cg_to; ++cg_it) - cg_it->resize(sz); - ++it; + for (n = 0; it != buffer.end() - 1; ++it, ++n) { + _lineStream.clear(); + _lineStream.str(*it); + sm = 1; + total_nr++; + adc_index = param.addecouple.check_index_adc(total_nr); + if (adc_index != -1) { + sm = param.addecouple.adc_index()[adc_index].sm; + } + _lineStream >> i >> name >> iac >> mass >> charge; + mass *= sm; - for (n = 0; it != buffer.end() - 1; ++it, ++n) { + if (_lineStream.fail() || !_lineStream.eof()) { + io::messages.add("Bad line in SOLVENTATOM block", + "In_Topology", io::message::error); + } - interaction::lj_parameter_struct s; - int i, j; + if (name.length() > MAX_NAME) { + std::ostringstream msg; + msg << "Error in SOLVENTATOM block: name " << name + << " is too long (> " << MAX_NAME << " characters)."; + io::messages.add(msg.str(), "InTopology", io::message::error); + } - _lineStream.clear(); - _lineStream.str(*it); + s.add_atom(name, res_nr, iac - 1, mass, charge); + } - _lineStream >> i >> j >> s.c12 >> s.c6; + if (n != num) { + io::messages.add("Error in SOLVENTATOM block (num != n)", + "In_Topology", io::message::error); + } + read_block_SOLVENTPOLARISATION(topo, param, os, s); + read_block_SOLVENTCONSTR(topo, param, os, s); - --i; - --j; + topo.add_solvent(s); - if (_lineStream.fail() || !_lineStream.eof()) - io::messages.add("bad line in CGPARAMETERS block", "In_Topology", - io::message::error); + } else { + io::messages.add("no solvent topology specified", + "In_Topology", io::message::warning); + } - if (i >= int(sz) || j >= int(sz)) { - DEBUG(7, "wrong iac in CGPARAMETERS: i=" << i << " j=" << j - << " sz=" << sz); - io::messages.add("wrong integer atom code in CGPARAMETERS block", - "In_Topology", - io::message::error); - break; - } +} // end SOLVENTATOM - // no different 1,4 interactions - s.cs6 = s.c6; - s.cs12 = s.c12; +void io::In_Topology::read_block_SOLVENTPOLARISATION(topology::Topology& topo, + simulation::Parameter ¶m, std::ostream & os, topology::Solvent &s) { + DEBUG(10, "SOLVENTPOLARISATION block"); - cg_parameter[i][j] = s; - cg_parameter[j][i] = s; + std::vector buffer = m_block["SOLVENTPOLARISATION"]; + if (buffer.size()) { + block_read.insert("SOLVENTPOLARISATION"); + if (!quiet) + os << "\n\t\tpolarisation parameters present"; + std::vector::const_iterator it = buffer.begin() + 1; - } + _lineStream.clear(); + _lineStream.str(*it); - if (num != n) { - io::messages.add("Reading the CGPARAMETERS failed (n != num)", - "InTopology", - io::message::error); - } + int num, n; + _lineStream >> num; + ++it; - } // CGPARAMETER -} + for (n = 0; it != buffer.end() - 1; ++it, ++n) { + int i, j, k; + double polarisability, coscharge, damping_level, damping_power, gamma; + _lineStream.clear(); + _lineStream.str(*it); + _lineStream >> i >> polarisability >> coscharge >> damping_level + >> damping_power >> gamma >> j >> k; -void io::In_Topology:: -read_sasa_parameter(topology::Topology & topo, std::vector - & sasa_parameter) { - std::vector buffer; - std::vector::const_iterator it; - { // SASAPARAMETERS + if (_lineStream.fail() || !_lineStream.eof()) { + io::messages.add("Bad line in SOLVENTPOLARISATION block", + "In_Topology", io::message::error); + } - buffer = m_block["SASAPARAMETERS"]; - block_read.insert("SASAPARAMETERS"); - // if no SASA block is present - if (!buffer.size()) { - io::messages.add("No SASAPARAMETERS block found in topology!", - "In_Topology", io::message::error); - return; - } + if (i > int(s.num_atoms()) || i < 1) { + io::messages.add("Atom number out of range in SOLVENTPOLARISATION block", + "In_Topology", io::message::error); + } else if (gamma != 0.0 && (j < 1 || k < 1 || j > int(s.num_atoms()) + || k > int(s.num_atoms()) || i == k || i == j || k == j)) { + io::messages.add("Atom number for off atom out of range in SOLVENTPOLARISATION block", + "In_Topology", io::message::error); + } else { + DEBUG(10, "\tpolarisable atom: " << i); - unsigned int num; // number of sasa atoms; + s.atoms()[i - 1].polarisability = polarisability / math::four_pi_eps_i; + s.atoms()[i - 1].coscharge = coscharge; + s.atoms()[i - 1].damping_level = damping_level * sqrt(math::four_pi_eps_i); + s.atoms()[i - 1].damping_power = damping_power; + if (param.polarise.cos == 2) { + s.atoms()[i - 1].gamma = 2 * gamma; + s.atoms()[i - 1].gamma_j = j - 1; + s.atoms()[i - 1].gamma_k = k - 1; + } - it = buffer.begin() + 1; - _lineStream.clear(); - _lineStream.str(*it); - _lineStream >> num; // reads in number of sasa atoms - ++it; - DEBUG(1, "Number of sasa atoms : " << num); + } + } - for (; it != buffer.end() - 1; ++it) { + if (n != num) { + io::messages.add("Wrong number of polarisable atoms in SOLVENTPOLARISATION block", + "In_Topology", io::message::error); + } + } - topology::sasa_parameter_struct s; +} // SOLVENTPOLARISATION - _lineStream.clear(); - _lineStream.str(*it); +void io::In_Topology::read_block_SOLVENTCONSTR(topology::Topology& topo, + simulation::Parameter ¶m, std::ostream & os, topology::Solvent &s) { + std::vector buffer = m_block["SOLVENTCONSTR"]; + if (!buffer.size()) { + io::messages.add("no SOLVENTCONST (block missing).", + "In_Topology", io::message::notice); + } else { + block_read.insert("SOLVENTCONSTR"); - int atom; - _lineStream >> atom >> s.r >> s.p >> s.sigma; + std::vector::const_iterator it = buffer.begin() + 1; + _lineStream.clear(); + _lineStream.str(*it); - if (_lineStream.fail() || !_lineStream.eof()) - io::messages.add("bad line in SASAPARAMETERS block", - "In_Topology", io::message::error); - - if (atom < 0 || atom > int(topo.num_solute_atoms())) - io::messages.add("atom out of range in SASAPARAMETERS block", - "In_Topology", io::message::error); - s.atom = atom - 1; // convert human atom numbers to internal atom numbers + int i, j, n, num; + _lineStream >> num; + ++it; - if (s.r < 0) { - DEBUG(7, "negative radius in SASAPARAMETERS: r = " << s.r); - io::messages.add("negative radius in SASAPARAMETERS block", - "In_Topology", io::message::error); - } + if (!quiet) + os << "\n\t\tconstraints : " << num; - if (s.p < 0) { - DEBUG(7, "negative probability in SASAPARAMETERS: r = " << s.p); - io::messages.add("negative probability in SASAPARAMETERS block", - "In_Topology", io::message::error); - } + double b0; - sasa_parameter.push_back(s); - } + for (n = 0; it != buffer.end() - 1; ++it, ++n) { + _lineStream.clear(); + _lineStream.str(*it); - if (num != sasa_parameter.size()) { - io::messages.add("Number of SASAPARAMETERS not equal to number of sasa atoms", - "InTopology", io::message::error); - } - } // SASAPARAMETERS -} + _lineStream >> i >> j >> b0; + + if (_lineStream.fail() || !_lineStream.eof()) { + io::messages.add("Bad line in SOLVENTCONSTR block", + "In_Topology", io::message::error); + } + // the solvent (distance constraints) bond types + s.add_distance_constraint + (topology::two_body_term_struct(i - 1, j - 1, num_solute_bondtypes + n)); + } + if (n != num) { + io::messages.add("Error in SOLVENTCONSTR block (num != n)", + "In_Topology", io::message::error); + } + } +} // SOLVENTCONSTR diff --git a/gromosXX/src/io/topology/in_topology.h b/gromosXX/src/io/topology/in_topology.h index 9cb0fb84b..c14f1aa1d 100644 --- a/gromosXX/src/io/topology/in_topology.h +++ b/gromosXX/src/io/topology/in_topology.h @@ -29,7 +29,7 @@ namespace io { * destructor */ virtual ~In_Topology() {} - + /** * Constructor. */ @@ -46,47 +46,112 @@ namespace io { void read(topology::Topology &topo, simulation::Parameter ¶m, std::ostream & os = std::cout); - /** - * Read in the harmonic bond parameter. + /** + * Read topology blocks + */ + void read_block_TYPE(topology::Topology& topo, + simulation::Parameter ¶m, std::ostream & os); + void read_block_PHYSICALCONSTANTS(topology::Topology& topo, + simulation::Parameter ¶m, std::ostream & os); + void read_block_RESNAME(topology::Topology& topo, + simulation::Parameter ¶m, std::ostream & os); + void read_block_ATOMTYPENAME(topology::Topology& topo, + simulation::Parameter ¶m, std::ostream & os); + void read_block_SOLUTEATOM(topology::Topology& topo, + simulation::Parameter ¶m, std::ostream & os); + void read_block_SOLUTEPOLARISATION(topology::Topology& topo, + simulation::Parameter ¶m, std::ostream & os); + void read_block_CGSOLUTE(topology::Topology& topo, + simulation::Parameter ¶m, std::ostream & os); + void read_block_LJEXCEPTIONS(topology::Topology& topo, + simulation::Parameter ¶m, std::ostream & os); + void read_block_BONDH(topology::Topology& topo, + simulation::Parameter ¶m, std::ostream & os); + void read_block_BOND(topology::Topology& topo, + simulation::Parameter ¶m, std::ostream & os); + void read_block_BONDDP(topology::Topology& topo, + simulation::Parameter ¶m, std::ostream & os); + void read_block_CONSTRAINT(topology::Topology& topo, + simulation::Parameter ¶m, std::ostream & os); + void read_block_BONDANGLEH(topology::Topology& topo, + simulation::Parameter ¶m, std::ostream & os); + void read_block_BONDANGLE(topology::Topology& topo, + simulation::Parameter ¶m, std::ostream & os); + void read_block_IMPDIHEDRAL(topology::Topology& topo, + simulation::Parameter ¶m, std::ostream & os); + void read_block_IMPDIHEDRALH(topology::Topology& topo, + simulation::Parameter ¶m, std::ostream & os); + void read_block_DIHEDRAL(topology::Topology& topo, + simulation::Parameter ¶m, std::ostream & os); + void read_block_DIHEDRALH(topology::Topology& topo, + simulation::Parameter ¶m, std::ostream & os); + void read_block_CROSSDIHEDRAL(topology::Topology& topo, + simulation::Parameter ¶m, std::ostream & os); + void read_block_CROSSDIHEDRALH(topology::Topology& topo, + simulation::Parameter ¶m, std::ostream & os); + void read_block_VIRTUALGRAIN(topology::Topology& topo, + simulation::Parameter ¶m, std::ostream & os); + void read_block_SOLUTEMOLECULES(topology::Topology& topo, + simulation::Parameter ¶m, std::ostream & os); + void read_block_TEMPERATUREGROUPS(topology::Topology& topo, + simulation::Parameter ¶m, std::ostream & os); + void read_block_PRESSUREGROUPS(topology::Topology& topo, + simulation::Parameter ¶m, std::ostream & os); + + void read_SOLVENT_blocks(topology::Topology& topo, + simulation::Parameter ¶m, std::ostream & os); + void read_block_SOLVENTPOLARISATION(topology::Topology& topo, + simulation::Parameter ¶m, std::ostream & os, topology::Solvent &s); + void read_block_SOLVENTCONSTR(topology::Topology& topo, + simulation::Parameter ¶m, std::ostream & os, topology::Solvent &s); + + void read_block_BONDSTRETCHTYPE(topology::Topology& topo, + simulation::Parameter ¶m, std::ostream & os); + void read_block_BONDTYPE(topology::Topology& topo, + simulation::Parameter ¶m, std::ostream & os); + void read_block_HARMBONDTYPE(topology::Topology& topo, + simulation::Parameter ¶m, std::ostream & os); + + void read_block_BONDANGLEBENDTYPE(topology::Topology& topo, + simulation::Parameter ¶m, std::ostream & os); + void read_block_BONDANGLETYPE(topology::Topology& topo, + simulation::Parameter ¶m, std::ostream & os); + void read_block_HARMBONDANGLETYPE(topology::Topology& topo, + simulation::Parameter ¶m, std::ostream & os); + + void read_block_DIHEDRALTYPE(topology::Topology& topo, + simulation::Parameter ¶m, std::ostream & os); + void read_block_TORSDIHEDRALTYPE(topology::Topology& topo, + simulation::Parameter ¶m, std::ostream & os); + void read_block_IMPDIHEDRALTYPE(topology::Topology& topo, + simulation::Parameter ¶m, std::ostream & os); + + /** + * Read in the bond parameters. */ - virtual void read_harmonic_bonds(std::vector &b, - std::ostream & os = std::cout); - - /** - * Read in the quartic bond parameter. - */ - virtual void read_g96_bonds(std::vector &b, - std::ostream & os = std::cout); - - /** - * Read in the bond angle parameter. - */ - virtual void read_angles(std::vector &a, - std::ostream & os = std::cout); + void read_bond_types(topology::Topology& topo, + simulation::Parameter ¶m, + std::ostream & os); /** - * Read in the harmonic bond angle parameter. - */ - virtual void read_harm_angles(std::vector &a, - std::ostream & os = std::cout); + * Read in the bond angle parameters. + */ + void read_bondangle_types(topology::Topology& topo, + simulation::Parameter ¶m, + std::ostream & os); - /** - * Read in the improper dihedral parameter. - */ - virtual void read_improper_dihedrals(std::vector &i, - std::ostream & os = std::cout); + /** + * Read in the dihedral angle parameters. + */ + void read_dihedral_types(topology::Topology& topo, + simulation::Parameter ¶m, + std::ostream & os); - /** - * Read in the dihedral parameter. - */ - virtual void read_dihedrals(std::vector &d, - std::ostream & os = std::cout); - /** * Read in the nonbonded interaction types (lennard-jones). */ virtual void read_lj_parameter(std::vector > + > & lj_parameter, std::ostream & os = std::cout); @@ -94,7 +159,7 @@ namespace io { * Read in the nonbonded interaction types (lennard-jones). */ virtual void read_cg_parameter(std::vector > + > & cg_parameter, std::ostream & os = std::cout); @@ -104,17 +169,29 @@ namespace io { virtual void read_sasa_parameter(topology::Topology & topo, std::vector & sasa_parameter); - + /** * length of strings allowed */ static const unsigned int MAX_NAME = 5; - + private: /** * solute bond types */ int num_solute_bondtypes; + /** + * solute angle types + */ + int num_solute_angletypes; + /** + * solute angle types + */ + int num_solute_dihedraltypes; + /** + * solute angle types + */ + int num_solute_impropertypes; }; diff --git a/gromosXX/src/simulation/parameter.h b/gromosXX/src/simulation/parameter.h index b9c132601..702747f80 100644 --- a/gromosXX/src/simulation/parameter.h +++ b/gromosXX/src/simulation/parameter.h @@ -53,7 +53,7 @@ namespace simulation }; /** - * @enum replica_exchange_interruptor + * @enum replica_exchange_interruptor_enum * mode switcher * of replica exchange */ @@ -72,7 +72,7 @@ namespace simulation replica_exchange_resolution = 2 }; /** - * @enum rep_ex_energy_interruptor + * @enum rep_ex_energy_interruptor_enum * mode switcher * of the energy */ @@ -943,9 +943,9 @@ namespace simulation * - couple false (no temperature coupling) * - found multibath false * - found tcouple false - * - nosehoover 0 (weak coupling) + * - algorithm 0 (weak coupling) */ - multibath_struct() : couple(false), found_multibath(false), found_tcouple(false), nosehoover(0) {} + multibath_struct() : couple(false), found_multibath(false), found_tcouple(false), algorithm(0) {} /** * do temperature coupling? @@ -998,12 +998,12 @@ namespace simulation */ bool found_tcouple; /** - * Nose-Hoover? + * algorithm? * 0 : berendsen * 1 : Nose-Hoover * >1 : Nose-Hoover-Chains */ - int nosehoover; + int algorithm; } /** temperature coupling parameters */ multibath; @@ -2263,10 +2263,10 @@ namespace simulation * Default values: * - num_T 0 * - num_l 0 - * - temperature + * - temperature \ * - scale (false) - * - lambda - * - dt + * - lambda \ + * - dt \ * - trials 0 * - equilibrate 0 * - cont 0 @@ -2510,7 +2510,7 @@ namespace simulation /** * calculate nr_lambdas extra lambda points */ - int nr_lambdas; + unsigned int nr_lambdas; /** * starting from lambda */ @@ -2664,7 +2664,7 @@ namespace simulation * - damp, no damping of polarisability * - output cospositions every 'write'th block to special trajectory */ - polarise_struct() : cos(0), minfield(2.5), efield_site(ef_atom), + polarise_struct() : cos(0), minfield(37.3), efield_site(ef_atom), damp(false), write(0) {} /** @@ -3063,7 +3063,7 @@ namespace simulation /** * number of addiabatic decoupling groups */ - int adgr; + unsigned int adgr; struct adc_struct { diff --git a/gromosXX/src/topology/core/body_term.h b/gromosXX/src/topology/core/body_term.h index ef7ff39ed..e204a7096 100644 --- a/gromosXX/src/topology/core/body_term.h +++ b/gromosXX/src/topology/core/body_term.h @@ -565,7 +565,7 @@ namespace topology { disfield_restraint_struct(bool on, util::Virtual_Atom v1, util::Virtual_Atom v2, double r0, double K, - int proteinatoms) + unsigned int proteinatoms) : on(on), v1(v1), v2(v2), r0(r0), K(K), proteinatoms(proteinatoms) { } @@ -592,7 +592,7 @@ namespace topology { /** * last atom of the protein atoms */ - int proteinatoms; + unsigned int proteinatoms; }; /** @@ -604,7 +604,7 @@ namespace topology { */ perturbed_disfield_restraint_struct() {on=false;} perturbed_disfield_restraint_struct(bool on, util::Virtual_Atom v1, - util::Virtual_Atom v2, int proteinatoms, + util::Virtual_Atom v2, unsigned int proteinatoms, double A_r0, double B_r0, double K_A, double K_B, int n, int m) : on(on), v1(v1), v2(v2), proteinatoms(proteinatoms), @@ -625,7 +625,7 @@ namespace topology { /** * last atom of the protein atoms */ - int proteinatoms; + unsigned int proteinatoms; /** * restraint distance A. */ diff --git a/gromosXX/src/topology/topology.cc b/gromosXX/src/topology/topology.cc index df528264a..dc6719ab6 100644 --- a/gromosXX/src/topology/topology.cc +++ b/gromosXX/src/topology/topology.cc @@ -48,6 +48,7 @@ m_num_solute_chargegroups(0), m_num_solute_molecules(0), m_num_solute_temperature_groups(0), m_num_solute_pressure_groups(0), +m_rottrans_last_atom(0), m_multicell_topo(NULL), m_polarisability(0), m_coscharge(0), @@ -64,8 +65,7 @@ m_sasa_volume_tot(0.0), m_sasa_first_neighbour(), m_sasa_second_neighbour(), m_sasa_third_neighbour(), -m_sasa_higher_neighbour(), -m_rottrans_last_atom(0) { +m_sasa_higher_neighbour() { m_chargegroup.push_back(0); m_molecule.push_back(0); m_temperature_group.push_back(0); @@ -93,6 +93,30 @@ topology::Topology::Topology(topology::Topology const & topo, int mul_solute, in const int num_solute = topo.num_solute_atoms(); //assert(num_solute >= 0 && topo.m_is_perturbed.size() == unsigned(num_solute)); + m_bond_types_harm = topo.bond_types_harm(); + m_bond_types_quart = topo.bond_types_quart(); + m_angle_types_harm = topo.angle_types_harm(); + m_angle_types_cosharm = topo.angle_types_cosharm(); + m_dihedral_types = topo.dihedral_types(); + m_impdihedral_types = topo.impdihedral_types(); + std::vector m_bond_types_quart(); + + /** + * store all available angle types with harmonic/cosine harmonic force constant + */ + std::vector m_angle_types_harm; + std::vector m_angle_types_cosharm; + + /** + * store all available dihedral types + */ + std::vector m_dihedral_types; + + /** + * store all available improper dihedral types + */ + std::vector m_impdihedral_types; + m_is_perturbed.clear(); m_is_eds_perturbed.clear(); m_is_polarisable.clear(); @@ -118,7 +142,7 @@ topology::Topology::Topology(topology::Topology const & topo, int mul_solute, in m_stochastic.clear(); m_lj_exceptions.clear(); - DEBUG(10, "solute chargegrous = " << topo.num_solute_chargegroups()); + DEBUG(10, "solute chargegroups = " << topo.num_solute_chargegroups()); m_num_solute_chargegroups = topo.num_solute_chargegroups() * mul_solute; m_num_solute_molecules = topo.num_solute_molecules() * mul_solute; @@ -1130,9 +1154,6 @@ calculate_constraint_dof(simulation::Multibath &multibath, if (position_constraints) { DEBUG(6, "position contraints dof"); - std::vector::const_iterator - it = position_restraints().begin(), - to = position_restraints().end(); topology::Temperaturegroup_Iterator tmpit = temperature_group_begin(), tmpto = temperature_group_end(); diff --git a/gromosXX/src/topology/topology.h b/gromosXX/src/topology/topology.h index 5590e7d50..5e45e3d88 100644 --- a/gromosXX/src/topology/topology.h +++ b/gromosXX/src/topology/topology.h @@ -13,6 +13,7 @@ #include "perturbed_solute.h" #include "sd.h" #include "exclusions.h" +#include "../interaction/interaction_types.h" namespace simulation { @@ -45,7 +46,7 @@ namespace topology * can multiply topologies */ explicit Topology(Topology const & topo, int mul_solute = 1, int mul_solvent = -1); - + /** * Destructor */ @@ -55,7 +56,7 @@ namespace topology * integer atom code accessor. */ int iac(unsigned int const i)const {assert(i < m_iac.size()); return m_iac[i];} - + /** * masses accessor */ @@ -84,36 +85,36 @@ namespace topology * mass of atom i */ double inverse_mass(int i)const { return m_inverse_mass(i); } - + /** * charge accessor */ math::SArray &charge() {return m_charge;} - + /** * charge const accessor */ math::SArray const & charge()const{return m_charge;} - + /** * charge accessor */ double charge(int i)const { return m_charge(i); } - + /** * calculates the square of the sum of the charges * * @f[S^2 = (\sum_{i=1}^{N_q}\,q_i)@f] */ double squared_sum_charges() const; - + /** * calculates the sum of the squared charges * * @f[\tilde{S}^2 = \sum_{i=1}^{N_q}\,q_i^2@f] */ double sum_squared_charges() const; - + /** * polarisation charge accessor */ @@ -133,7 +134,7 @@ namespace topology * polarisability const accessor */ double polarisability(int i)const {return m_polarisability(i);} - + /** * polarisability damping E0 accessor */ @@ -143,7 +144,7 @@ namespace topology * polarisability damping E0 const accessor */ double damping_level(int i)const {return m_damping_level(i);} - + /** * polarisability damping p accessor */ @@ -197,7 +198,7 @@ namespace topology * total coarse grain factor */ double & tot_cg_factor() {return m_tot_cg_factor;} - + /** * stochastic dynamics const accessor */ @@ -217,7 +218,7 @@ namespace topology * perturbed solute accessor. */ Perturbed_Solute & perturbed_solute() {return m_perturbed_solute;} - + /** * eds-perturbed solute accessor. */ @@ -232,27 +233,27 @@ namespace topology * const perturbed solute accessor. */ Perturbed_Solute const & perturbed_solute()const{return m_perturbed_solute;} - + /** * const eds-perturbed solute accessor. */ EDS_Perturbed_Solute const & eds_perturbed_solute()const{return m_eds_perturbed_solute;} - + /** * number of atom types. */ int num_atomtype()const {return m_num_atomtype;} - + /** * set number of atom types. */ void set_num_atomtype(int num) {m_num_atomtype = num;} - + /** * number of solvents. */ unsigned int num_solvents()const {return unsigned(m_num_solvent_molecules.size());} - + /** * number of bond types. */ @@ -313,7 +314,7 @@ namespace topology * @param num_molecules the number of solvent molecules to add. */ void resolvate(unsigned int solv, unsigned int num_molecules); - + /** * set the capacity of solute atoms */ @@ -341,7 +342,7 @@ namespace topology assert(i < m_num_solvent_molecules.size()); return m_num_solvent_molecules[i]; } - + /** * get the number of solvent atoms. */ @@ -357,7 +358,7 @@ namespace topology double mass, double charge, bool chargegroup, topology::excl_cont_t::value_type exclusions, topology::excl_cont_t::value_type one_four_pairs); - + /** * residue names. */ @@ -376,6 +377,34 @@ namespace topology */ std::map const & atom_names()const {return m_atom_name;} + /** + * bond types + */ + std::vector & bond_types_harm() {return m_bond_types_harm;} + std::vector & bond_types_quart() {return m_bond_types_quart;} + std::vector const & bond_types_harm() const {return m_bond_types_harm;} + std::vector const & bond_types_quart() const {return m_bond_types_quart;} + + /** + * bond angle types + */ + std::vector & angle_types_harm() {return m_angle_types_harm;} + std::vector & angle_types_cosharm() {return m_angle_types_cosharm;} + std::vector const & angle_types_harm() const {return m_angle_types_harm;} + std::vector const & angle_types_cosharm() const {return m_angle_types_cosharm;} + + /** + * dihedral angle types + */ + std::vector & dihedral_types() {return m_dihedral_types;} + std::vector const & dihedral_types() const {return m_dihedral_types;} + + /** + * improper dihedral angle types + */ + std::vector & impdihedral_types() {return m_impdihedral_types;} + std::vector const & impdihedral_types() const {return m_impdihedral_types;} + /** * all exclusions for atom i. Exclusions, 1,4 interactions and Lennard-Jones exceptions */ @@ -419,7 +448,7 @@ namespace topology * exclusions */ excl_cont_t & exclusion() {return m_exclusion;} - + /** * 1,4 pairs of atom i. */ @@ -428,16 +457,16 @@ namespace topology return m_one_four_pair[i]; } /** - * 1,4 pairs + * 1,4 pairs */ excl_cont_t & one_four_pair(){return m_one_four_pair;} - + /** * chargegroup accessor. */ std::vector const & chargegroups()const { return m_chargegroup; } - - int chargegroup(int i)const + + int chargegroup(int i)const { assert(int(m_chargegroup.size()) > i); return m_chargegroup[i]; @@ -462,7 +491,7 @@ namespace topology * the number of solute (sub)molecules */ unsigned int & num_solute_molecules() {return m_num_solute_molecules;} - + /** * the number of solute temperature groups (const) */ @@ -472,7 +501,7 @@ namespace topology * the number of solute temperature groups */ unsigned int & num_solute_temperature_groups() {return m_num_solute_temperature_groups;} - + /** * the number of solute pressure groups (const) */ @@ -539,8 +568,8 @@ namespace topology * end of temperature groups iterator */ Temperaturegroup_Iterator temperature_group_end()const{ - return Temperaturegroup_Iterator(m_temperature_group.end()-1);} - + return Temperaturegroup_Iterator(m_temperature_group.end()-1);} + /** * the pressure groups */ @@ -558,8 +587,8 @@ namespace topology * end of pressure groups iterator */ Pressuregroup_Iterator pressure_group_end()const{ - return Pressuregroup_Iterator(m_pressure_group.end()-1);} - + return Pressuregroup_Iterator(m_pressure_group.end()-1);} + /** * const energy group accessor. */ @@ -583,7 +612,7 @@ namespace topology std::vector & atom_energy_group(){ return m_atom_energy_group; } - + /** * energy group of atom accessor */ @@ -598,7 +627,7 @@ namespace topology void calculate_constraint_dof(simulation::Multibath & mb, bool rottrans_constraints, bool position_constraints)const; - + /** * check state */ @@ -608,7 +637,7 @@ namespace topology * return lambda */ double lambda()const {return m_lambda;} - + /** * return lambda (Bcast lambda to slaves) */ @@ -623,7 +652,7 @@ namespace topology * old lambda */ double old_lambda()const { return m_old_lambda; } - + /** * return nlam (exponent to lambda) */ @@ -639,35 +668,35 @@ namespace topology */ bool is_perturbed(unsigned int const i)const { if (i >= num_solute_atoms()) return false; - - assert(i < m_is_perturbed.size()); + + assert(i < m_is_perturbed.size()); return m_is_perturbed[i]; } /** * is the atom perturbed? */ std::vector & is_perturbed() { return m_is_perturbed;} - + /** * is the atom eds-perturbed? */ bool is_eds_perturbed(unsigned int const i)const { if (i >= num_solute_atoms()) return false; - - assert(i < m_is_eds_perturbed.size()); + + assert(i < m_is_eds_perturbed.size()); return m_is_eds_perturbed[i]; } /** * is the atom eds-perturbed? */ std::vector & is_eds_perturbed() { return m_is_eds_perturbed;} - + /** * is the atom polarisable? */ bool is_polarisable(unsigned int const i)const { - - assert(i < m_is_polarisable.size()); + + assert(i < m_is_polarisable.size()); return m_is_polarisable[i]; } /** @@ -687,7 +716,7 @@ namespace topology * is the atom coarse-grained? */ std::vector & is_coarse_grained() { return m_is_coarse_grained;} - + /** * recalculate lambda dependent properties. */ @@ -724,16 +753,16 @@ namespace topology * (so that they do not have to be recalculated for every interaction. */ //std::vector & lambda_prime() { return m_lambda_prime; } - + /** * d lambda prime / d lambda derivative. * (to store the d Energy / d lambda derivative in one energy class as - * sum d E / d lambda prime * d lambda prime / d lambda + * sum d E / d lambda prime * d lambda prime / d lambda * for all lambda prime). */ - //std::vector & lambda_prime_derivative() + //std::vector & lambda_prime_derivative() //{ return m_lambda_prime_derivative; } - + /** * alpha parameters for the perturbed energy derivatives. */ @@ -745,11 +774,11 @@ namespace topology */ //std::vector & perturbed_energy_derivative_alpha() //{ return m_perturbed_energy_derivative_alpha; } - + /** - * individual lambda values + * individual lambda values */ - std::vector< std::vector< double > > & individual_lambda(int i) + std::vector< std::vector< double > > & individual_lambda(int i) { return m_individual_lambda[i]; } @@ -775,7 +804,7 @@ namespace topology { return m_individual_lambda_derivative[i]; } - + /** * position restraints accessor. */ @@ -966,7 +995,7 @@ namespace topology std::vector const & xray_sym_restraints() const { return m_xray_sym_restraints; } - + /** * atom numbers of the atoms to be symmetry restraint. */ @@ -1030,7 +1059,7 @@ namespace topology std::vector & distance_restraints() { return m_distance_restraint; - } + } /** * const perturbed distance restraints accessor. */ @@ -1058,7 +1087,7 @@ namespace topology disfield_restraint_struct & disfield_restraints() { return m_disfield_restraint; - } + } /** * const perturbed distancefield restraints accessor. */ @@ -1086,7 +1115,7 @@ namespace topology std::vector & eds_distance_restraints() { return m_eds_distance_restraint; - } + } /** * const dihedral restraints accessor. @@ -1184,11 +1213,11 @@ namespace topology /** * virtual grains accessor */ - std::vector & virtual_grains() + std::vector & virtual_grains() { return m_virtual_grain; } - + /** * const virtual grains accessor */ @@ -1211,13 +1240,13 @@ namespace topology { return m_le_coordinates; } - + /** * initialise the topology. * - adjust submolecules if empty */ void init(simulation::Simulation const & sim, - std::ostream & os = std::cout, + std::ostream & os = std::cout, bool quiet = false); /** @@ -1319,7 +1348,7 @@ namespace topology * the perturbed solute. */ Perturbed_Solute m_perturbed_solute; - + /** * the eds-perturbed solute */ @@ -1329,12 +1358,12 @@ namespace topology * is the atom perturbed? */ std::vector m_is_perturbed; - + /** * is the atom eds-perturbed? */ - std::vector m_is_eds_perturbed; - + std::vector m_is_eds_perturbed; + /** * is the atom polarisable? */ @@ -1344,23 +1373,23 @@ namespace topology * is the atom polarisable? */ std::vector m_is_coarse_grained; - + /** * the number of solvent molecules. */ std::vector m_num_solvent_molecules; - + /** * the number of solvent atoms. * vector for multiple solvents. */ std::vector m_num_solvent_atoms; - + /** * the solvents (multiple solvent). */ std::vector m_solvent; - + /** * the integer atom code. */ @@ -1374,7 +1403,7 @@ namespace topology * the inverse of the atomic masses. */ math::SArray m_inverse_mass; - + /** * the atom charges. */ @@ -1384,37 +1413,37 @@ namespace topology * stochastic dynamics variables */ stochastic_struct m_stochastic; - + /** * the atom exclusions. */ excl_cont_t m_exclusion; - + /** * the atom 1-4 interactions. */ excl_cont_t m_one_four_pair; - + /** * atom exclusions and 1-4 interactions. */ excl_cont_t m_all_exclusion; - + /** * chargegroup exclusions */ std::vector > m_chargegroup_exclusion; - + /** * the molecules. */ std::vector m_molecule; - + /** * the temperature groups */ std::vector m_temperature_group; - + /** * the pressure groups */ @@ -1424,27 +1453,27 @@ namespace topology * the chargegroups. */ std::vector m_chargegroup; - + /** * the number of solute chargegroups. */ unsigned int m_num_solute_chargegroups; - + /** * the number of solute molecules. */ unsigned int m_num_solute_molecules; - + /** * the number of solute temperature groups */ unsigned int m_num_solute_temperature_groups; - + /** * the number of solute pressure groups */ unsigned int m_num_solute_pressure_groups; - + /** * residue names (solute and solvent). */ @@ -1455,21 +1484,43 @@ namespace topology */ std::map m_atom_name; + /** + * store all available bond types with harmonic/quartic force constant + */ + std::vector m_bond_types_harm; + std::vector m_bond_types_quart; + + /** + * store all available angle types with harmonic/cosine harmonic force constant + */ + std::vector m_angle_types_harm; + std::vector m_angle_types_cosharm; + + /** + * store all available dihedral types + */ + std::vector m_dihedral_types; + + /** + * store all available improper dihedral types + */ + std::vector m_impdihedral_types; + /** * energy groups. */ std::vector m_energy_group; - + /** * energy group of atom */ std::vector m_atom_energy_group; - + /** * lambda. */ double m_lambda; - + /** * old lambda */ @@ -1483,26 +1534,26 @@ namespace topology /** * interaction matrix for scaled interactions */ - std::map, std::pair > + std::map, std::pair > m_energy_group_scaling; /** * interaction matrix for interactions with * changed lambda dependence */ - //std::map, std::pair > + //std::map, std::pair > //m_energy_group_lambdadep; /** * lambda primes for current lambda */ //std::vector m_lambda_prime; - + /** * lambda prime / lambda derivatives */ //std::vector m_lambda_prime_derivative; - + /** * alpha parameter values for the perturbed energy derivatives */ @@ -1532,48 +1583,48 @@ namespace topology */ std::vector< std::map< std::pair, double> > e; } /** individual_lambdas_struct */ m_individual_lambda_parameters; - + /** * lambda-values for individual lambdas */ std::vector< std::vector< std::vector< double > > > m_individual_lambda; - + /** * lambda-derivative for individual lambdas */ std::vector< std::vector< std::vector< double > > > m_individual_lambda_derivative; - + /** * position restraints / constraints */ std::vector m_position_restraint; /** - * distance restraints + * distance restraints */ std::vector m_distance_restraint; /** - * perturbed distance restraints + * perturbed distance restraints */ std::vector m_perturbed_distance_restraint; /** - * distancefield restraints + * distancefield restraints */ disfield_restraint_struct m_disfield_restraint; /** - * perturbed distancefield restraints + * perturbed distancefield restraints */ perturbed_disfield_restraint_struct m_perturbed_disfield_restraint; /** - * eds distance restraints + * eds distance restraints */ std::vector m_eds_distance_restraint; /** - * dihedral restraints + * dihedral restraints */ std::vector m_dihedral_restraint; /** - * perturbed dihedral restraints + * perturbed dihedral restraints */ std::vector m_perturbed_dihedral_restraint; /** @@ -1641,7 +1692,7 @@ namespace topology /** * the last atom of roto-translational constraints */ - int m_rottrans_last_atom; + unsigned int m_rottrans_last_atom; /** * order parameter restraints */ @@ -1655,27 +1706,27 @@ namespace topology * virtual grains */ std::vector m_virtual_grain; - + /** * the atom polarisabilities */ - math::SArray m_polarisability; - + math::SArray m_polarisability; + /** * the polarisation cos-charge. */ math::SArray m_coscharge; - + /** * the polarisability damping electric field offsef @f$ E_0 @f$ */ math::SArray m_damping_level; - + /** * the polarisabiliy damping power @f$ p @f$ */ math::SArray m_damping_power; - + /** * the polarisability damping electric field offsef @f$ E_0 @f$ */ @@ -1730,9 +1781,9 @@ namespace topology * the QM zone */ std::set m_qm_zone; - + }; // topology - + } // topology #endif diff --git a/gromosXX/src/util/bs_coordinate.cc b/gromosXX/src/util/bs_coordinate.cc index dc0fbccaa..cbce88eea 100644 --- a/gromosXX/src/util/bs_coordinate.cc +++ b/gromosXX/src/util/bs_coordinate.cc @@ -413,7 +413,7 @@ void util::BS_Lambda::addForces(configuration::Configuration& conf, BS_Vector& derivatives){ assert(derivatives.size() == m_dimension); DEBUG(10, "Derivative: " << derivatives.str()); - double deriv = derivatives[0]; + //double deriv = derivatives[0]; // TODO: Add biasing force // conf.current().lambda_force += - deriv / m_red_fac; diff --git a/gromosXX/src/util/bs_potentials.cc b/gromosXX/src/util/bs_potentials.cc index 8d6788b5f..1e8f245cf 100644 --- a/gromosXX/src/util/bs_potentials.cc +++ b/gromosXX/src/util/bs_potentials.cc @@ -589,9 +589,9 @@ std::string util::BS_Distorted_Stick::str() { util::BS_Pipe::BS_Pipe(int id, int num_gp_long, int num_gp_perp, double force_const, util::BS_Pipe_Param start, util::BS_Pipe_Param end) : - BS_Potential(id, num_gp_long * num_gp_perp, force_const), - m_num_long_gp(num_gp_long), m_num_perp_gp(num_gp_perp), - m_start(start), m_end(end) + BS_Potential(id, num_gp_long * num_gp_perp, force_const), + m_start(start), m_end(end), + m_num_long_gp(num_gp_long), m_num_perp_gp(num_gp_perp) { m_unitLongitudinal = m_end.point - m_start.point; m_length = m_unitLongitudinal.normalize(); diff --git a/gromosXX/src/util/bs_vector.cc b/gromosXX/src/util/bs_vector.cc index e7e859ec0..8bc47b003 100644 --- a/gromosXX/src/util/bs_vector.cc +++ b/gromosXX/src/util/bs_vector.cc @@ -103,7 +103,7 @@ util::BS_Vector util::BS_Vector::operator +(const BS_Vector& summand) { util::BS_Vector util::BS_Vector::operator -(const BS_Vector &subtrahend){ assert(this->size() == subtrahend.size()); BS_Vector result; - for (int i = 0; i < this->size(); i++){ + for (unsigned int i = 0; i < this->size(); i++){ result.push_back((*this)[i] - subtrahend[i]); } return result; diff --git a/gromosXX/src/util/replica.cc b/gromosXX/src/util/replica.cc index 639bdaecf..727b33d4f 100644 --- a/gromosXX/src/util/replica.cc +++ b/gromosXX/src/util/replica.cc @@ -167,7 +167,7 @@ void util::replica::run_MD() { int error; sim.steps() = steps; sim.time() = time; - while (int(sim.steps()) < maxSteps + steps) { + while ((unsigned int)(sim.steps()) < maxSteps + steps) { traj->write(conf, topo, sim, io::reduced); // run a step if ((error = md.run(topo, conf, sim))) { @@ -271,22 +271,22 @@ void util::replica::swap(const unsigned int partnerID, const unsigned int partne // this we can store as the partner energy of the current replica epot_partner = E21; // E22: Energy with configuration 2 and lambda 2(own one) +#ifdef XXMPI const double E22 = epot; // send E21 and E22 double energies[2] = {E22, E21}; //this send operation is matched in calc_probability() -#ifdef XXMPI MPI_Send(&energies[0], 2, MPI_DOUBLE, partnerRank, SWITCHENERGIES, MPI_COMM_WORLD); #endif } else { // sameLambda - double energies[2] = {epot, 0.0}; #ifdef XXMPI + double energies[2] = {epot, 0.0}; MPI_Send(&energies[0],2,MPI_DOUBLE, partnerRank, SWITCHENERGIES, MPI_COMM_WORLD); #endif } if (sim.param().pcouple.scale != math::pcouple_off) { - math::Box box_replica = conf.current().box; #ifdef XXMPI + math::Box box_replica = conf.current().box; MPI_Send(&box_replica(0)[0], 1, MPI_BOX, partnerRank, BOX, MPI_COMM_WORLD); #endif } @@ -639,7 +639,7 @@ void util::replica::velscale(int i){ double T2 = sim.param().replica.temperature[i]; if (T1 != T2) { double factor = sqrt(T1/T2); - for (int k = 0; k < topo.num_atoms(); ++k) { + for (unsigned int k = 0; k < topo.num_atoms(); ++k) { conf.current().vel(k) *= factor; } } diff --git a/gromosXX/src/util/replica_exchange_master.cc b/gromosXX/src/util/replica_exchange_master.cc index b1eaa3675..e539f590b 100644 --- a/gromosXX/src/util/replica_exchange_master.cc +++ b/gromosXX/src/util/replica_exchange_master.cc @@ -45,9 +45,10 @@ util::replica_exchange_master::replica_exchange_master(io::Argument & args, std::map & repMap) : replica_exchange_base(args, cont, rank, repIDs, repMap), -repParams(replicas[0]->sim.param().replica), size(_size), -numReplicas(_numReplicas) { +numReplicas(_numReplicas), +repParams(replicas[0]->sim.param().replica) +{ assert(rank == 0); assert(numReplicas > 0); replicaData.resize(numReplicas);
\@topoX<molecular topology file for box X> in
\@pttopoX<@ref pttopoX "molecular perturbation topology file for box X"> in
\@pttopoX<@ref pttopo "molecular perturbation topology file for box X"> in
\@confX<coordinates and restart data for box X> in
\@inputX<@ref inputX "input parameters for box X">in
\@inputX<@ref input "input parameters for box X">in
\@finX<final configuration for box X> out
\@trcX<coordinate trajectory for box X> out
\@trvX<velocity trajectory for box X> out