foyer: FoyerError: Found no types for atom 0 (carbon).

I’m working on a ‘hello world’ example for using foyer + mbuild + hoomd to run a hoomd simulation. I ran into an issue when trying to create a forcefield file. I created a minimal example below:

import mbuild as mb

class CH2(mb.Compound):
    def __init__(self):
        super(CH2, self).__init__()
        self.add(mb.Particle(name='C', pos=[0,0,0]), label='C[$]')
        self.add(mb.Particle(name='H', pos=[-0.109, 0, 0.0]), label='HC[$]')    
        self.add(mb.Particle(name='H', pos=[0.109, 0, 0.0]), label='HC[$]')
ch2 = CH2()
ch2.save("poly_gen.hoomdxml", overwrite=True, forcefield_name="oplsaa")
Traceback (most recent call last):
  File "test.py", line 13, in <module>
    ch2.save("poly_gen.hoomdxml", overwrite=True, forcefield_name="oplsaa")
  File "/home/mike/Projects/mbuild/mbuild/compound.py", line 1300, in save
    structure = ff.apply(structure)
  File "/home/mike/Projects/foyer/foyer/forcefield.py", line 239, in apply
    system = self.createSystem(topology, *args, **kwargs)
  File "/home/mike/Projects/foyer/foyer/forcefield.py", line 301, in createSystem
    find_atomtypes(atoms=list(topology.atoms()), forcefield=self)
  File "/home/mike/Projects/foyer/foyer/atomtyper.py", line 42, in find_atomtypes
    _resolve_atomtypes(atoms)
  File "/home/mike/Projects/foyer/foyer/atomtyper.py", line 95, in _resolve_atomtypes
    n, atom.element.name))
foyer.exceptions.FoyerError: Found no types for atom 0 (carbon).

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 26 (26 by maintainers)

Most upvoted comments

So I was was able to create a usable forcefield.xml file by feeding this file into parmed:

#define _FF_OPLS
#define _FF_OPLSAA

; This force field uses a format that requires Gromacs 3.1.4 or later.
;
; References for the OPLS-AA force field: 
;
; W. L. Jorgensen, D. S. Maxwell, and J. Tirado-Rives,
; J. Am. Chem. Soc. 118, 11225-11236 (1996).
; W. L. Jorgensen and N. A. McDonald, Theochem 424, 145-155 (1998).
; W. L. Jorgensen and N. A. McDonald, J. Phys. Chem. B 102, 8049-8059 (1998).
; R. C. Rizzo and W. L. Jorgensen, J. Am. Chem. Soc. 121, 4827-4836 (1999).
; M. L. Price, D. Ostrovsky, and W. L. Jorgensen, J. Comp. Chem. (2001).
; E. K. Watkins and W. L. Jorgensen, J. Phys. Chem. A 105, 4118-4125 (2001).
; G. A. Kaminski, R.A. Friesner, J.Tirado-Rives and W.L. Jorgensen, J. Phys. Chem. B 105, 6474 (2001).
;
[ defaults ]
; nbfunc	comb-rule	gen-pairs	fudgeLJ	fudgeQQ
1		3		yes		0.5	0.5

#include "ffnonbonded.itp"
#include "lps-nb.itp"
#include "lighthavestingcofactors-nb.itp"
#include "ffoplsaa-add-nb.itp"
#include "ffbonded.itp"
#include "ffoplsaa-add-bon.itp"
#include "gbsa.itp"
#include "lighthavestingcofactors-bon.itp"

I’ll then pull out the parameters I need and merge them into the oplsaa parameters from foyer (to take advantage of the atom typing work that’s already done).