Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into v2.6
Browse files Browse the repository at this point in the history
  • Loading branch information
GiovanniBussi committed Oct 11, 2019
2 parents e71c017 + aadf342 commit fbf345d
Show file tree
Hide file tree
Showing 26 changed files with 10,232 additions and 11,528 deletions.
6 changes: 4 additions & 2 deletions CHANGES/v2.5.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,10 @@ For users:
## Version 2.5.3 (to be released)

For users:
- Fixed a bug with \ref CONVERT_TO_FES and periodic variables, see \issue{441}
- New patch for GROMACS 2019.4
- Fixed a bug with \ref CONVERT_TO_FES and periodic variables, see \issue{441}
- Fixed a bug with \ref FOURIER_TRANSFORM
- Updated patch for GROMACS 2019.4
- Updated patch for GROMACS 2018.8
- Python module:
- Fixed building with clang-8.
- Set `language_level` for cython to the actually used language level.
Expand Down
4 changes: 0 additions & 4 deletions CHANGES/v2.6.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ Changes from version 2.5 which are relevant for users:
- \ref EEFSOLV is now faster in scalar and also mpi/openmp parallel
- New shortcuts are available for selecting protein atoms: `@sidechain-#`, `@back-#`

- Python module:
- Added capability to read and write pandas dataset from PLUMED files (see \issue{496}).


- New contributed modules:
- A new Maze module by Jakub Rydzewski
- \ref MAZE_LOSS
Expand Down
File renamed without changes.
20,614 changes: 10,205 additions & 10,409 deletions regtest/analysis/rt-fftw/f.grid.reference

Large diffs are not rendered by default.

58 changes: 20 additions & 38 deletions src/gridtools/FourierTransform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ The default values of these parameters are: \f$a=1\f$ and \f$b=1\f$.
The following example tells Plumed to compute the complex 2D 'backward' Discrete Fourier Transform by taking the data saved on a grid called 'density', and normalizing the output by \f$ \frac{1}{\sqrt{N_x\, N_y}}\f$, where \f$N_x\f$ and \f$N_y\f$ are the number of data on the grid (it can be the case that \f$N_x\neq N_y\f$):
\plumedfile
FOURIER_TRANSFORM STRIDE=1 GRID=density FT_TYPE=complex FOURIER_PARAMETERS=0,-1
FOURIER_TRANSFORM STRIDE=1 GRID=density FT_TYPE=complex FOURIER_PARAMETERS=0,-1
\endplumedfile
*/
Expand All @@ -70,11 +70,11 @@ class FourierTransform : public ActionWithInputGrid {
private:
std::string output_type;
bool real_output, store_norm;
std::vector<unsigned> gdirs;
std::vector<int> fourier_params;
public:
static void registerKeywords( Keywords& keys );
explicit FourierTransform(const ActionOptions&ao);
void clearAverage();
#ifndef __PLUMED_HAS_FFTW
void performOperations( const bool& from_update ) override {}
#else
Expand Down Expand Up @@ -138,27 +138,20 @@ FourierTransform::FourierTransform(const ActionOptions&ao):

// Create the input from the old string
std::string vstring;
unsigned n=0; gdirs.resize( ingrid->getDimension() );
for(unsigned i=0; i<ingrid->getDimension(); ++i) {
gdirs[n]=i; n++;
}

plumed_assert( n==ingrid->getDimension() );

if (real_output) {
if (!store_norm) vstring="COMPONENTS=" + getLabel() + "_abs";
else vstring="COMPONENTS=" + getLabel() + "_norm";
} else vstring="COMPONENTS=" + getLabel() + "_real," + getLabel() + "_imag";

// Set COORDINATES keyword
vstring += " COORDINATES=" + ingrid->getComponentName( gdirs[0] );
for(unsigned i=1; i<gdirs.size(); ++i) vstring += "," + ingrid->getComponentName( gdirs[i] );
vstring += " COORDINATES=" + ingrid->getComponentName( 0 );
for(unsigned i=1; i<ingrid->getDimension(); ++i) vstring += "," + ingrid->getComponentName( i );

// Set PBC keyword
vstring += " PBC=";
if( ingrid->isPeriodic(gdirs[0]) ) vstring+="T"; else vstring+="F";
for(unsigned i=1; i<gdirs.size(); ++i) {
if( ingrid->isPeriodic(gdirs[i]) ) vstring+=",T"; else vstring+=",F";
if( ingrid->isPeriodic(0) ) vstring+="T"; else vstring+="F";
for(unsigned i=1; i<ingrid->getDimension(); ++i) {
if( ingrid->isPeriodic(i) ) vstring+=",T"; else vstring+=",F";
}


Expand All @@ -171,32 +164,21 @@ FourierTransform::FourierTransform(const ActionOptions&ao):
#endif
}

void FourierTransform::clearAverage() {
std::vector<double> fspacing;
std::vector<std::string> ft_min( ingrid->getMin() ), ft_max( ingrid->getMax() );
for(unsigned i=0; i<ingrid->getDimension(); ++i) {
Tools::convert( 0.0, ft_min[i] ); Tools::convert( 2.0*pi*ingrid->getNbin()[i]/ ingrid->getGridExtent(i), ft_max[i] );
}
mygrid->setBounds( ft_min, ft_max, ingrid->getNbin(), fspacing); resizeFunctions();
ActionWithAveraging::clearAverage();
}

#ifdef __PLUMED_HAS_FFTW
void FourierTransform::performOperations( const bool& from_update ) {

// Spacing of the real grid
std::vector<double> g_spacing ( ingrid->getGridSpacing() );
// Spacing of the k-grid
std::vector<double> ft_spacing;
// Extents of the k-grid
std::vector<std::string> ft_min( ingrid->getMin() ), ft_max( ingrid->getMax() );
// Number of bins in the k-grid (equal to the number of bins in the real grid)
std::vector<unsigned> ft_bins ( ingrid->getNbin() );

for (unsigned i=0; i<ingrid->getDimension(); ++i) {
// Check PBC in current grid dimension
if( !ingrid->isPeriodic(i) ) ft_bins[i]++;
// Compute k-grid extents
double dmin, dmax;
Tools::convert(ft_min[i],dmin); Tools::convert(ft_max[i],dmax);
// We want to have the min of k-grid at point (0,0)
dmin=0.0;
dmax=2.0*pi*ft_bins[i]/( ingrid->getGridExtent(i) );
Tools::convert(dmin,ft_min[i]); Tools::convert(dmax,ft_max[i]);
}

// This is the actual setup of the k-grid
mygrid->setBounds( ft_min, ft_max, ft_bins, ft_spacing); resizeFunctions();

// *** CHECK CORRECT k-GRID BOUNDARIES ***
//log<<"Real grid boundaries: \n"
Expand All @@ -206,11 +188,11 @@ void FourierTransform::performOperations( const bool& from_update ) {
// <<" min_x: "<<ft_min[0]<<" min_y: "<<ft_min[1]<<"\n"
// <<" max_x: "<<ft_max[0]<<" max_y: "<<ft_max[1]<<"\n";



// Get the size of the input data arrays (to allocate FFT data)
size_t fft_dimension=static_cast<size_t>( ingrid->getNumberOfPoints() );
std::vector<unsigned> N_input_data( ingrid->getNbin() );
size_t fft_dimension=1; for(unsigned i=0; i<N_input_data.size(); ++i) fft_dimension*=static_cast<size_t>( N_input_data[i] );
for(unsigned i=0; i<N_input_data.size(); ++i) if( !ingrid->isPeriodic(i) ) N_input_data[i]++;
// size_t fft_dimension=1; for(unsigned i=0; i<N_input_data.size(); ++i) fft_dimension*=static_cast<size_t>( N_input_data[i] );

// FFT arrays
std::vector<std::complex<double> > input_data(fft_dimension), fft_data(fft_dimension);
Expand Down
2 changes: 1 addition & 1 deletion src/tools/MolDataClass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ void MolDataClass::getBackboneForResidue( const std::string& type, const unsigne
atoms.resize(5);
atoms[0]=mypdb.getNamedAtomFromResidue("N",residuenum);
atoms[1]=mypdb.getNamedAtomFromResidue("CA",residuenum);
atoms[2]=mypdb.getNamedAtomFromResidue("HA1",residuenum);
atoms[2]=mypdb.getNamedAtomFromResidue("HA2",residuenum);
atoms[3]=mypdb.getNamedAtomFromResidue("C",residuenum);
atoms[4]=mypdb.getNamedAtomFromResidue("O",residuenum);
} else if( residuename=="ACE") {
Expand Down
4 changes: 2 additions & 2 deletions user-doc/tutorials/others/isdb-2.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Once this tutorial is completed users will be able to:
\section isdb-2-resources Resources

The \tarball{isdb-2} for this project contains the following files:
- martiniFormFactor_p2.py and martiniFormFactor_p3.py: two helpful python scripts to be used with python 2 or python 3, respectively. These are based on the martinize.py script (http://cgmartini.nl/index.php/tools2/proteins-and-bilayers/204-martinize)
- martiniFormFactor_p3.py: a python script to be used with python 3. This is based on the martinize.py script (http://cgmartini.nl/index.php/tools2/proteins-and-bilayers/204-martinize)
- start.pdb and samplextc.xtc: PDB and trajectory files on which you can perform the calculations;
- SASDAB7.dat: a file containing SAXS intensities, downloaded from the SASDB database \cite Valentini:2015ki .

Expand All @@ -31,7 +31,7 @@ The Martini form factors can be exploited within a hybrid multi-resolution strat
\section isdb-2-comp1 Computing SAXS intensities with the hybrid coarse-grained/atomistic approach

Given a PDB file, PLUMED is able to compute SAXS intensities for the molecule in the PDB and to compare these intensities with the experimental ones stored in a data file. It is possible to apply the same procedure to all the conformations visited during a MD trajectory. This is achieved by using the PLUMED \ref driver utility and the \ref SAXS variable of the ISDB module.
While computing scattering intensities with a full atomistic representation is quite easy (see the \ref SAXS keyword and later in this tutorial), in order to adopt the hybrid coarse-grained/atomistic approach a more elaborated procedure is needed, requiring the generation of few specific files to be used as input by \ref driver. To facilitate this step, it is possible to use this script (martiniFormFactor_p2.py for python 2 or martiniFormFactor_p3.py for python 3) and type in the bash shell:
While computing scattering intensities with a full atomistic representation is quite easy (see the \ref SAXS keyword and later in this tutorial), in order to adopt the hybrid coarse-grained/atomistic approach a more elaborated procedure is needed, requiring the generation of few specific files to be used as input by \ref driver. To facilitate this step, it is possible to use this script (martiniFormFactor_p3.py for python 3) and type in the bash shell:

\verbatim
python martiniFormFactor_p3.py -f start.pdb -dat SASDAB7.dat [-unit Ang/nm -nq 15]
Expand Down
Loading

0 comments on commit fbf345d

Please sign in to comment.