Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overide API #74

Closed
mikemhenry opened this issue Feb 24, 2017 · 4 comments
Closed

Overide API #74

mikemhenry opened this issue Feb 24, 2017 · 4 comments

Comments

@mikemhenry
Copy link
Member

I'm working on using Foyer to generate a forcefield file for PCBM. Since I'm using an all atom model, I want to use the OPLSAA forcefield file built into foyer:

pdb_path = get_fn("/Users/mikehenry/Downloads/PCBM.pdb")
untyped_pcbm = pmd.load_file(pdb_path, structure=True)
oplsaa = Forcefield(name='oplsaa')
pcbm = oplsaa.apply(untyped_pcbm)

I get an error when I apply the forcefield:
FoyerError: Found multiple types for atom 2 (carbon): ['opls_139', 'opls_713']

In order to fix this I need to do some overrides, but I'm not sure if there is a way to do that on oplsaa just with code, or if I need to modify the oplsaa.xml file.

@summeraz
Copy link
Contributor

I'm guessing this is the atom that Foyer is finding multiple types for. Determining which atom types get precedence (and thus which overrides you need) when an atom is part of multiple functional groups gets a bit tricky. In this case, however, my opinion would be that 'opls_713' should override 'opls_139'. This is something you would need to change in oplsaa.xml (and could submit a PR while you're at it!). The OPLS force field in Foyer is obviously fairly incomplete, so we're hoping that as users begin to use various atom types it will begin to fill out.

@mikemhenry
Copy link
Member Author

mikemhenry commented Feb 24, 2017

I wasn't sure if there was a way to do this without editing the oplsaa.xml file by hand/if there was a way to do this programmatically, something like oplsaa.override(['opls_713'],['opls_139'])

@summeraz
Copy link
Contributor

I don't think you can manually add overrides to a Forcefield object as this is intended to all be handled within the XML file.

@ctk3b
Copy link
Member

ctk3b commented Feb 24, 2017

Yeah as @summeraz said, the intention is to have this contained in the xml file. We could think about implementing an interactive prompt for resolving overrides when you're creating a new forcefield but at the end of the day all the logic is intended to be captured in the file itself.

@ctk3b ctk3b closed this as completed Mar 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants