[MMTK] Reading of Amber Parameters

Konrad Hinsen hinsen@cnrs-orleans.fr
06 Nov 2001 16:15:57 +0100


Berit Hinnemann <Berit.Hinnemann@fysik.dtu.dk> writes:

> Where does the caching of the parameters from the main file
> (amber_parm94) take place exactly? As far as I can see, the storage of
> the parameters in the dictionaries AmberParameters.atom_types, .bonds,
> .bond_angles, etc. does not distinguish between parameters coming from
> the main file or from the modification files, and after that, only those
> dictionaries are processed. So I don't understand, where the copies of
> the parameters of the main file are taken.

They aren't. Whenever you create an Amber force field object with
modification files, both the main file and the modification files are
read again. Only when no modification files are given, the data from
the main file is read and cached.

> The reason for my question is that I've modified AmberData.py and
> AmberForceField.py such that when the Amber force field is created, it
> also takes a dictionary of Amber parameters as input (I'd like to change
> the parameters frequently while running MMTK and with file I/O it takes
> too long time). That works fine, only, that when I create a new universe
> and force field, the parameters of the list are not reread, and I'd like
> them to be reread each time I create a new universe. I've attached the
> modified files to this mail.

With the modifications you have made, the list is reread when the files
are reread, which is probably not your intention. Here is a suggestion:

import copy

class Amber94ListForceField(MMForceField.MMForceField):

    def __init__(self, lj_options = None, es_options = None,
                 amber_params = None,
                 bonded_scale_factor = 1., **kwargs):
	self.arguments = (lj_options, es_options, bonded_scale_factor)
        main_file = kwargs.get('parameter_file', None)
        mod_files = kwargs.get('mod_files', None)
        parameters = copy.deepcopy(readAmber94(main_file, mod_files))
        parameters.setParameters(amber_params)
        MMForceField.MMForceField.__init__(self, 'Amber94', parameters,
                                           lj_options, es_options,
                                           bonded_scale_factor)


This makes a copy of the cached parameter files each time a force
field object is created, and then modifies that copy.

Konrad.
-- 
-------------------------------------------------------------------------------
Konrad Hinsen                            | E-Mail: hinsen@cnrs-orleans.fr
Centre de Biophysique Moleculaire (CNRS) | Tel.: +33-2.38.25.56.24
Rue Charles Sadron                       | Fax:  +33-2.38.63.15.17
45071 Orleans Cedex 2                    | Deutsch/Esperanto/English/
France                                   | Nederlands/Francais
-------------------------------------------------------------------------------