Skip to content

Commit

Permalink
fixed 0.1.6 merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
Reza committed Sep 23, 2013
2 parents 4f20381 + 5d357f6 commit d031740
Show file tree
Hide file tree
Showing 11 changed files with 896 additions and 103 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ output/*/index.html
# Sphinx
docs/_build

#
#
*.itp
*.top
*.log
Expand All @@ -57,3 +57,5 @@ test/systems/8*
test/systems/9*
test/systems/archive
.DS_Store

*sublime-project
2 changes: 1 addition & 1 deletion HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ History
0.1.3 (2013-09-16)
++++++++++++++++++

* The conversion part wa rewritten to make it more flexible.
* The conversion part was rewritten to make it more flexible.
* Cholestrol test is now passed.


Expand Down
20 changes: 8 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,10 @@ reverse conversion of GROMACS topologies to NAMD is planned an will be implement


### Current stage
PyTopol is currently in *alpha stage*. The results for several
systems are shown below which are encouraging. However, before using it for
production simulations, more testing is needed.

Current version is 0.1.5. All 0.1.x versions will be considered alpha.
Current version is 0.1.6.

All 0.1.x versions will be considered **alpha**. See the results for the current tests below.


### Feedback
Expand All @@ -36,17 +35,14 @@ PyTopol is licensed under [GNU GPLv3](http://www.gnu.org/licenses/gpl.html).

## Quickstart

[How to install PyTopol](https://github.com/resal81/PyTopol/wiki/PyTopol-Installation).

[How to use psf2top.py](https://github.com/resal81/PyTopol/wiki/psf2top-Usage).

[Comparison of NAMD and GROMACS for converted PSF topologies](https://github.com/resal81/PyTopol/wiki/psf2top-Tests).
#### Installation
[How to install PyTopol](https://github.com/resal81/PyTopol/wiki/PyTopol-Installation)

## Summary of test results

#### psf2top.py
#### PSF to GROMACS topology conversion
[How to use psf2top.py](https://github.com/resal81/PyTopol/wiki/psf2top-Usage)

**Table 1**. Summary of the rmsd of potential terms between GROMACS 4.6.3 and NAMD 2.9. Single and double correspond to the single and double-precision versions of GROMCAS. Energies are in kcal/mol.
**Table 1**. Summary of the rmsd of potential energy terms between GROMACS 4.6.3 and NAMD 2.9 (kcal/mol). Single and double correspond to the single and double-precision versions of GROMCAS.

```
-------------------------- ----------------- -----------------
Expand Down
2 changes: 1 addition & 1 deletion pytopol/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@

__author__ = 'Reza Salari'
__email__ = '[email protected]'
__version__ = '0.1.5'
__version__ = '0.1.6'
143 changes: 89 additions & 54 deletions pytopol/parsers/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@ def __init__(self):
self.impropertypes = []
self.cmaptypes = []
self.interactiontypes = []
self.pairtypes = []
self.constrainttypes = []
self.forcefield= None

self.information = {} # like 'atomtypes': self.atomtypes



class Molecule(object):
Expand All @@ -26,8 +30,17 @@ def __init__(self):
self.angles = []
self.dihedrals = []
self.impropers = []

self.cmaps = []
self.pairs = []
self.exclusion_numb = None # 0, 1, 2, ..
self.exclusions = []
self.settles = []
self.constraints= []

self.information = {} # like 'atoms': self.atoms

self.name = None

self._anumb_to_atom = {}

Expand Down Expand Up @@ -105,7 +118,7 @@ class Atom(object):
altlocs = list,
atomtype= str,
radius = float,
charge = radius,
charge = float,
mass = float,
chain = str,
resname = str,
Expand All @@ -130,50 +143,6 @@ def get_atomtype(self):
return False



class Bond:
def __init__(self):
self.atom1 = None
self.atom2 = None

class Angle:
def __init__(self):
self.atom1 = None
self.atom2 = None
self.atom3 = None

class Dihedral:
def __init__(self):
self.atom1 = None
self.atom2 = None
self.atom3 = None
self.atom4 = None

class Improper:
def __init__(self):
self.atom1 = None
self.atom2 = None
self.atom3 = None
self.atom4 = None

class CMap:
def __init__(self):
self.atom1 = None
self.atom2 = None
self.atom3 = None
self.atom4 = None
self.atom5 = None
self.atom6 = None
self.atom7 = None
self.atom8 = None

class Pair:
def __init__(self):
self.atom1 = None
self.atom2 = None



class Param:
def convert(self, reqformat):
assert reqformat in ('charmm', 'gromacs')
Expand Down Expand Up @@ -242,9 +211,18 @@ def convert(self, reqformat):

elif isinstance(self, ImproperType):
if reqformat == 'gromacs' and self.format == 'charmm':
self.gromacs['param']['kpsi'] = self.charmm['param']['kpsi'] * 2 * 4.184
self.gromacs['param']['psi0'] = self.charmm['param']['psi0']
for imp in self.charmm['param']:
convimp = {}
convimp['kpsi'] = imp['kpsi'] * 2 * 4.184
convimp['psi0'] = imp['psi0']
if imp.get('n', False):
convimp['n'] = imp['n']
self.gromacs['param'].append(convimp)
self.gromacs['func'] = 2

# self.gromacs['param']['kpsi'] = self.charmm['param']['kpsi'] * 2 * 4.184
# self.gromacs['param']['psi0'] = self.charmm['param']['psi0']
# self.gromacs['func'] = 2
else:
raise NotImplementedError

Expand All @@ -261,8 +239,12 @@ def convert(self, reqformat):

elif isinstance(self, InteractionType):
if reqformat == 'gromacs' and self.format == 'charmm':
self.gromacs['param']['lje'] = abs(self.charmm['param']['lje']) * 4.184
self.gromacs['param']['ljl'] = self.charmm['param']['ljl'] * 0.1 / (2**(1.0/6.0)) # no *2
if self.charmm['param']['lje'] is not None:
self.gromacs['param']['lje'] = abs(self.charmm['param']['lje']) * 4.184
self.gromacs['param']['ljl'] = self.charmm['param']['ljl'] * 0.1 / (2**(1.0/6.0)) # no *2
else:
self.gromacs['param']['lje'] = None
self.gromacs['param']['ljl'] = None

if self.charmm['param']['lje14'] is not None:
self.gromacs['param']['lje14'] = abs(self.charmm['param']['lje14']) * 4.184
Expand Down Expand Up @@ -293,31 +275,47 @@ class BondType(Param):
def __init__(self, format):
assert format in ('charmm', 'gromacs')
self.format = format


self.atom1 = None
self.atom2 = None

self.atype1 = None
self.atype2 = None

self.charmm = {'param': {'kb':None, 'b0':None} }
self.gromacs= {'param': {}, 'func':None}
self.gromacs= {'param': {'kb':None, 'b0':None}, 'func':None}


class AngleType(Param):
def __init__(self, format):
assert format in ('charmm', 'gromacs')
self.format = format


self.atom1 = None
self.atom2 = None
self.atom3 = None

self.atype1 = None
self.atype2 = None
self.atype3 = None

self.charmm = {'param':{'ktetha':None, 'tetha0':None, 'kub':None, 's0':None} }
self.gromacs= {'param':{}}
self.gromacs= {'param':{'ktetha':None, 'tetha0':None, 'kub':None, 's0':None}, 'func':None}


class DihedralType(Param):
def __init__(self, format):
assert format in ('charmm', 'gromacs')
self.format = format


self.atom1 = None
self.atom2 = None
self.atom3 = None
self.atom4 = None

self.atype1 = None
self.atype2 = None
self.atype3 = None
Expand All @@ -337,15 +335,24 @@ def __init__(self, format):
self.atype3 = None
self.atype4 = None

self.charmm = {'param': {'kpsi': None, 'psi0':None} }
self.gromacs= {'param':{}, 'func':None}
self.charmm = {'param':[]}
self.gromacs= {'param':[], 'func': None} # {'kpsi': None, 'psi0':None}


class CMapType(Param):
def __init__(self, format):
assert format in ('charmm', 'gromacs')
self.format = format

self.atom1 = None
self.atom2 = None
self.atom3 = None
self.atom4 = None
self.atom5 = None
self.atom6 = None
self.atom7 = None
self.atom8 = None

self.atype1 = None
self.atype2 = None
self.atype3 = None
Expand All @@ -364,9 +371,37 @@ def __init__(self, format):
assert format in ('charmm', 'gromacs')
self.format = format

self.atom1 = None
self.atom2 = None

self.atype1 = None
self.atype2 = None

self.charmm = {'param': {'lje':None, 'ljl':None, 'lje14':None, 'ljl14':None} }
self.gromacs= {'param': {'lje':None, 'ljl':None, 'lje14':None, 'ljl14':None} }
self.gromacs= {'param': {'lje':None, 'ljl':None, 'lje14':None, 'ljl14':None}, 'func':None }


class SettleType(Param):
def __init__(self, format):
assert format in ('gromacs',)
self.atom = None
self.dOH = None
self.dHH = None

class ConstraintType(Param):
def __init__(self, format):
assert format in ('gromacs',)

self.atom1 = None
self.atom2 = None

self.atype1 = None
self.atype2 = None

self.gromacs= {'param': {'b0':None}, 'func':None}


class Exclusion:
def __init__(self):
self.main_atom = None
self.other_atoms = []
10 changes: 8 additions & 2 deletions pytopol/parsers/charmmpar.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,8 +444,14 @@ def add_params_to_system(self, system, panic_on_missing_param=True):
newimp.atype3 = at3
newimp.atype4 = at4

newimp.charmm['param']['kpsi'] = kpsi
newimp.charmm['param']['psi0'] = psi0
# newimp.charmm['param']['kpsi'] = kpsi
# newimp.charmm['param']['psi0'] = psi0

m = {}
m['kpsi'] = kpsi
m['psi0'] = psi0

newimp.charmm['param'].append(m)

system.impropertypes.append(newimp)

Expand Down
Loading

0 comments on commit d031740

Please sign in to comment.