Skip to content

cmelab/forcefields

Repository files navigation

forcefields

This repo is designed to aid in the proccess of creating forcefield files from scratch using the Espaloma Program written by the Chodera Lab (https://github.com/choderalab/espaloma).

Example

from functions import MonToSmiles from functions.MonToSmiles import mon_to_smiles

#you can either import a preexisting monomer class: from monclasses.py import P3HT

#or you can build the monomer class:

class P3HT(mb.Compound): def init(self): super(P3HT,self).init() self.add(mb.load("CCCCCCC1=C(SC(=C1))",smiles=True)) self.bond_indices = [24,25] self.orientations = [[0,0,1],[0,0,-1]] self.separation = 0.14 self.replace = True

#The monomer class must include the atomic indices where the polymerizing bonds will be formed as well as the orientations of the #bonds, the bond separation, and whether you are replacing the atoms where the bond will be formed or not.

smiles = mon_to_smiles(fragment=P3HT())[1] #this line must be run before importing the espaloma function.

#The mon_to_smiles function returns both the mbuild compound including both the monomer and dimer as well as the smiles string of the monomer and dimer

from functions import EspalomaFxn from functions.EspalomaFxn import espaloma

espaloma(SMILES=smiles, #from mon_to_smiles function XML_FILEPATH='INSERT DESIRED XML FILEPATH', TYPED_FILEPATH='INSERT DESIRED MOL2 FILEPATH')

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published