Request for code change in SireMM/internalparameters.cpp

13 views
Skip to first unread message

julien

unread,
Apr 14, 2014, 7:49:29 AM4/14/14
to sire-de...@googlegroups.com
When adding to an InternalFF a molecule group that contains some monoatomic molecules the code will throw the exception

        throw SireFF::missing_function( QObject::tr( 
           "There are no internal functions for the molecule! The " 
          "molecule will have an internal energy of zero!"), CODELOC ); 

around lines 2963 and 3013

However the correct internal of a monoatomic molecule is zero kcal/mol, so the default behaviour is acceptable. 

If the exception is removed, a benefit is that a single molecule group containing all molecules in the system can be used to define an internal force field. This simplifies Sire python scripts. 

Would the proposed code change triggers bugs elsewhere in the code ? 





Christopher Woods

unread,
Apr 14, 2014, 9:13:52 AM4/14/14
to Sire Developers
Hi Julien,

Yes, that sounds like a really good idea. The code was written to
throw an exception because I was worried that users who forgot to add
intramolecular energy terms to a molecule would not notice that the
internal energy was zero. I think that the benefit of having a single
molecule group that can contain monoatomics outweighs the negative of
losing the warning from adding empty molecules.

I've updated both the devel branch and your branch with a small fix
(removed the exception in internalparameters.cpp). I've tested this
with some ions and it looks like everything is ok. Let me know if
there are any problems.

Cheers,

Christopher
> --
> You received this message because you are subscribed to the Google Groups
> "Sire Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sire-develope...@googlegroups.com.
> To post to this group, send email to sire-de...@googlegroups.com.
> Visit this group at http://groups.google.com/group/sire-developers.
> For more options, visit https://groups.google.com/d/optout.



--
---------------------------------------------------------
Christopher Woods
Centre for Computational Chemistry
School of Chemistry
University of Bristol, BS8 1TS, UK
+44 (0) 7786 264562
http://chryswoods.com
http://uk.linkedin.com/in/chryswoods

julien

unread,
Apr 14, 2014, 10:32:39 AM4/14/14
to sire-de...@googlegroups.com
Hi Chris, 

I am working with gaetano's branch at the moment. I have also commented out the exception to see what happens. I now get another exception thrown out later, this time for the intra_clj force field. 

julien@ubuntu:/mnt/hgfs/sims/gac/sommmd-freenrg-tests/04-3E_3C_Bound/lambda-0.50000$ ~/sire.app/bin/python -i -c "%run ~/sire.app/share/Sire/scripts/sommmd-freenrg.py -C sim.cfg"
Starting /home/julien/sire.app/bin/python: number of threads equals 1
WARNING: IPython History requires SQLite, your history will not be saved
Python 3.3.3 (default, Apr 10 2014, 18:10:13) 
Type "copyright", "credits" or "license" for more information.

IPython 2.0.0 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

Loading configuration information from file sim.cfg
Reading in parameters...
morphfile = MORPH.pert
nmoves = 20
ncycles = 2
save coordinates = True
constraint = allbonds
cutoff type = cutoffperiodic
cutoff distance = 10 angstrom
barostat = True
center of mass frequency = 10
buffered coordinates frequency = 10
lambva_val = 0.5

 
Running a sommmd-freenrg calculation using files system.top, system.crd and MORPH.pert.
 ### Running Single Topology Molecular Dynamics Free Energy on unknown ### 
New run. Loading input and creating restart
lambda is 0.0
Reading topology file "system.top" 
Reading coordinate file "system.crd" 
Building 9546 molecule(s)... 
...building molecule 1000 ... 
...building molecule 2000 ... 
...building molecule 3000 ... 
...building molecule 4000 ... 
...building molecule 5000 ... 
...building molecule 6000 ... 
...building molecule 7000 ... 
...building molecule 8000 ... 
...building molecule 9000 ... 
 Getting space information  
Read space "PeriodicBox( ( 67.8211, 68.487, 71.4287 ) )" 
...complete 
Create the System...
Selecting dummy groups
Creating force fields... 
---------------------------------------------------------------------------
UserWarning                               Traceback (most recent call last)
    138 
    139 # Now lets run the OpenMMMD free energy calculation
--> 140 OpenMMMD.runFreeNrg(params)

    133         Parameter.push(params)
    134         try:
--> 135             retval = func()
    136         except:
    137             sys.exc_info()[0]

   1149             system = freezeResidues(system)
   1150 
-> 1151         system = setupForcefieldsFreeEnergy(system, space)
   1152 
   1153         if random_seed.val:

/home/julien/sire.app/bundled/lib/python3.3/site-packages/Sire/Tools/OpenMMMD.py in setupForcefieldsFreeEnergy(system, space)
    737         solvent_intra_clj.setUseReactionField(True)
    738         solvent_intra_clj.setReactionFieldDielectric(rf_dielectric.val)
--> 739     solvent_intra_clj.add(solvent)
    740 
    741     # Solute intramolecular CLJ energy

UserWarning: Exception 'SireBase::missing_property' thrown by the thread ''.
There is no property with name "intrascale". Available properties are [ ambertype, LJ, coordinates, charge, mass ].
Thrown from FILE: /home/julien/software/devel/siregac/corelib/src/libs/SireBase/properties.cpp, LINE: 468, FUNCTION: const SireBase::Property& SireBase::Properties::operator[](const SireBase::PropertyName&) const
__Backtrace__
No backtrace available. Recompile the SireError library with -DSIRE_ENABLE_BACKTRACE to enable backtraces.
__EndTrace__
Exception 'SireBase::missing_property' thrown by the thread ''.
There is no property with name "intrascale". Available properties are [ ambertype, LJ, coordinates, charge, mass ].
Thrown from FILE: /home/julien/software/devel/siregac/corelib/src/libs/SireBase/properties.cpp, LINE: 468, FUNCTION: const SireBase::Property& SireBase::Properties::operator[](const SireBase::PropertyName&) const


The issue is that ions don't have the intrascale property because the code in SireIO/amber.cpp only sets nonbonded pairs for molecules with more than one atom

        if (natoms >1)
        {
            //qDebug() << " Setting up non bonded pairs";

            setNonBondedPairs(editmol, pointers[NEXT],
                              num_excluded_atoms, exc_atom_list,
                              nbpairs, nb_property,
                              atoms14, coul_14scl, lj_14scl);
        }

* One fix would be to change the code in SireIO/amber.cpp so that setNonBondedPairs is called even if there is only one atom. The code will set all scale factors to 0. 

static void setNonBondedPairs(MolEditor &editmol, int pointer,
(...)
    if (editmol.nAtoms() <= 3)
    {
        nbpairs = CLJNBPairs(editmol.data().info(), CLJScaleFactor(0,0));
        editmol.setProperty( nb_property, nbpairs );
        return;
    }


* Another option would be to change the code in IntraCLJ force field to not thrown an exception if the property intrascale is missing. 


I favour the first option as I think the consequences of changing the code in SireIO/amber.cpp are more predictable. 

What do you think?
> email to sire-developers+unsubscribe@googlegroups.com.
> To post to this group, send email to sire-developers@googlegroups.com.

Christopher Woods

unread,
Apr 14, 2014, 10:35:40 AM4/14/14
to Sire Developers
Hi Julien,

I agree - the first option is better (adding an intrascale property in
Amber and setting all values to 0). I think I should also look at
removing the exception if there is no intrascale property but the
number of atoms is one.

Cheers,

Christopher
>> > email to sire-develope...@googlegroups.com.
>> > To post to this group, send email to sire-de...@googlegroups.com.
>> > Visit this group at http://groups.google.com/group/sire-developers.
>> > For more options, visit https://groups.google.com/d/optout.
>>
>>
>>
>> --
>> ---------------------------------------------------------
>> Christopher Woods
>> Centre for Computational Chemistry
>> School of Chemistry
>> University of Bristol, BS8 1TS, UK
>> +44 (0) 7786 264562
>> http://chryswoods.com
>> http://uk.linkedin.com/in/chryswoods
>
> --
> You received this message because you are subscribed to the Google Groups
> "Sire Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sire-develope...@googlegroups.com.
> To post to this group, send email to sire-de...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages