Test custom nonbonded force

The functionality of OpenMM will (eventually) include everything that one would need to run modern molecular simulation.
POST REPLY
User avatar
Ommair Ishaque
Posts: 11
Joined: Sun Feb 18, 2018 10:22 am

Test custom nonbonded force

Post by Ommair Ishaque » Mon Mar 05, 2018 10:14 pm

Code: Select all

<ForceField>
 <AtomTypes>
  <Type name="tip4pew-O" class="OW" element="O" mass="15.99943"/>
  <Type name="tip4pew-H" class="HW" element="H" mass="1.007947"/>
  <Type name="tip4pew-M" class="MW" mass="0"/>
 </AtomTypes>
 <Residues>
  <Residue name="HOH">
   <Atom name="O" type="tip4pew-O"/>
   <Atom name="H1" type="tip4pew-H"/>
   <Atom name="H2" type="tip4pew-H"/>
   <Atom name="M" type="tip4pew-M"/>
   <VirtualSite type="average3" siteName="M" atomName1="O" atomName2="H1" atomName3="H2" weight1="0.786646558" weight2="0.106676721" weight3="0.106676721"/>
   <Bond atomName1="O" atomName2="H1"/>
   <Bond atomName1="O" atomName2="H2"/>
  </Residue>
 </Residues>
 <HarmonicBondForce>
  <Bond class1="OW" class2="HW" length="0.09572" k="462750.4"/>
 </HarmonicBondForce>
 <HarmonicAngleForce>
  <Angle class1="HW" class2="OW" class3="HW" angle="1.82421813418" k="836.8"/>
 </HarmonicAngleForce>

<Script>
import simtk.openmm as mm

Force = mm.CustomNonbondedForce('(A/r^12)-(B/r^6)')
Force.setNonbondedMethod(NonbondedForce.CutoffPeriodic)
Force.setCutoffDistance(nonbondedCutoff)
Force.addPerParticleParameter('A')
Force.addPerParticleParameter('B')
Force.addPaticle([2.5104e-6, 2.55224e-3])
Force.addPaticle([0, 0])
Force.addPaticle([0, 0])
system.addForce(Force)
<Script>

</ForceField>

User avatar
Ommair Ishaque
Posts: 11
Joined: Sun Feb 18, 2018 10:22 am

Re: Test custom nonbonded force

Post by Ommair Ishaque » Mon Mar 05, 2018 10:19 pm

Above mentioned is a test custom nonbonded force with two parameters. I am trying use it for tip4p water. Kindly guide me whether it is correct or not? And also I am not sure where to include charges of atoms? As you can see I have added three addparticle class for different atom interactions but not sure how specify first one is for O-O and all others are zero. Please guide me or give example file.

User avatar
Peter Eastman
Posts: 2593
Joined: Thu Aug 09, 2007 1:25 pm

Re: Test custom nonbonded force

Post by Peter Eastman » Fri Mar 09, 2018 6:43 pm

I'm not completely clear on what you want to do, but I suspect you really want to use a <CustomNonbondedForce> tag instead of the script. See http://docs.openmm.org/latest/userguide ... ondedforce. If you define charge as a per-particle parameter, then you just specify it as an attribute on each <Atom> tag. Am I understanding your question correctly? If you haven't already read it, you will probably also find it helpful to look over http://docs.openmm.org/latest/userguide ... c-concepts.

POST REPLY