[CPMD-list] serious(?) cpmd qm/mm bug and fix
Axel Kohlmeyer
akohlmey at cmm.chem.upenn.edu
Thu Aug 2 23:06:18 CEST 2007
hi everybody,
since there are quite a few cpmd/gromos qm/mm users here on
the list, i'd like to make you aware of a bug with potentially
serious consequences that matteo dal peraro and i have found
and hopefully fixed a couple of days ago. most people will
have gotten lucky, some may have become subject a spurious error
message, 'MAXSP is too small, I am sorry...' and recompiled CPMD
without need with a larger MAXSP and thus wasted a lot of memory,
and some may have generated (silently) corrupted trajectories or
become subject to spurious segmentation faults.
please see below for an explanation of the problem
and how the attached patch tries to fix it. if you
are running qm/mm trajectories or have run them, please
read on, so you can check whether you are affected or not.
the bug is in the subroutine MM_Interface/mm_get_NSX.F
(which actually computes NAX and NSX) and concerns the
mapping of the classical atom types in the gromos code
to the cpmd atom types in the cpmd part of the code.
in cpmd NSX is the number of species (=number of
pseudopotential entries in the &ATOM section) and NAX
is the maximum number of atoms for any species in the
input. MAXSP is the largest allowed value for NSX and
has to be increased if one wants to use more atom species
in a single run. all coordinate related data is stored
in 3-dimensional arrays of the shape (3,MAXSP,*), and
in qm/mm runs the classical atom types are mapped to
cpmd atom types for MD, coordinate output etc. in classical
MD you frequently have a large number of atoms for a
few atom types, e.g. water, so those arrays would become
huge while still mostly empty. so cpmd mapps those atom
types to multiple cpmd atom species and the code in mm_get_NSX.F
calculates how many unused atom species are available and
how many atoms per species are needed after this re-mapping.
the currently released version and all older ones i could
get my hands on, use the NAX from the QM system to determine
NAX for the whole system but instead should use NSX. now in
general, this should not be so much of a problem, since NAX
(the maximum number of atoms per cpmd species) is almost all
the time larger than NAX (the number of cpmd species). but if
you have, say, five QM atoms and each of them is of a different
type/element, the re-mapping of the MM atoms types in the
qm/mm code is wrong. OTOH, when you have many (~100 or more)
QM atoms for a single element (e.g. hydrogen) the code may tell
you that you have to increast MAXSP, even though you don't really
need it and generally the larger the ratio NAX:NSX the
more memory is wasted on coordinates.
the attached patch should correct this and also adds an additional
check to make sure that NSX does not overflow.
in short, if you are running qm/mm calculations or have run them,
you should check for two things:
1) is the largest number of atoms
per pseudopotential entry in the &ATOMS section larger than the
number of pseudopotential entries?
2) is in the output block written by the following code snippets
write(6,*)' QUANTUM SYSTEM:'
write(6,*)' NAX:',NAX
write(6,*)' NSX:',NSX
write(6,*)' FULL SYSTEM:'
write(6,*)' NAX:',NAX
write(6,*)' NSX:',NSX
the NSX for FULL SYSTEM smaller or equal than
the value of MAXSP. for cpmd 3.7.x and 3.9.x
MAXSP was 80 and for cpmd 3.11.x it is 140.
hope that you all got lucky...
ciao,
axel.
--
=======================================================================
Axel Kohlmeyer akohlmey at cmm.chem.upenn.edu http://www.cmm.upenn.edu
Center for Molecular Modeling -- University of Pennsylvania
Department of Chemistry, 231 S.34th Street, Philadelphia, PA 19104-6323
tel: 1-215-898-1582, fax: 1-215-573-6233, office-tel: 1-215-898-5425
=======================================================================
If you make something idiot-proof, the universe creates a better idiot.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cpmd-cmm-qmmm-bugfix.diff.gz
Type: application/x-gzip
Size: 944 bytes
Desc:
Url : http://cpmd.org/pipermail/cpmd-list/attachments/20070802/4410dfdf/attachment.gz
More information about the CPMD-list
mailing list