GithubHelp home page GithubHelp logo

rinikerlab / pygromostools Goto Github PK

View Code? Open in Web Editor NEW
16.0 3.0 14.0 223.23 MB

This package is a python library with tools for the Molecular Simulation - Software Gromos. It allows you to easily set up, manage and analyze simulations in python.

Home Page: https://rinikerlab.github.io/PyGromosTools/

License: MIT License

Python 99.79% Shell 0.21%
md molecular-dynamics api wrapper simulation gromos python stochastic-dynamics energy-minimization computational-chemistry

pygromostools's People

Contributors

askamenik avatar candidechamp avatar katzberger avatar laurianejd avatar lgtm-migrator avatar mtlehner avatar ppoliak avatar pultar avatar riesben avatar robinwuff avatar salomeronja avatar schroederb avatar sriniker avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

pygromostools's Issues

Change title in imd files

Would it make sense to support syntax that allows the following:

grom_system.imd.TITLE = "My new title"

in analogy to

grom_system.imd.STEP.NSTLIM = 3000

I feel like it would make the workflow more natural.

Implement missing subblocks for tre files

Implement some sub-sub-blocks which are missing at the moment:

  • eds
  • numstates <- not a real subblock
  • precalclam
  • nr_lambdas <- not a real subblock
  • ABdih

Can somebody add a tre file which contains all these sub-sub-blocks to the example section for demonstration?

DocStringUpdate

To be checked:

-[x] hpc_queuing

  • _submission_system

  • dummy

  • local

  • lsf

  • files

  • [ ]blocks

  • simulations

-[ ] utils

  • visualization

gromos++ wrapper functions, prefer list over concatenated strings if there is more than one argument

Some gromos++ functions take several arguments of the same category. For some functions, this is represented through the use of list, e.g. for com_top:

@gromosTypeConverter
    def com_top(self, in_topo_paths:(str or List[str]), topo_multiplier:(int or List[int])=1, out_top_path:str= "combined_out.top",
                take_topology_params_of_file:int=1, take_solvent_parameters_of_file:int=1,
                _binary_name:str="com_top")->str: #Todo: also take lists as input ! bschroed

Other functions only support a concatenated string, e.g. ran_box. In that particular case, in_top_path, in_cnf_path, and nmolecule would be better represented by list:

@gromosTypeConverter
    def ran_box(self, in_top_path:str, in_cnf_path:str, out_cnf_path:str= "",
                periodic_boundary_condition: str = "r", nmolecule:int = 1, dens:float = 1.0, threshold:float=None, layer:bool = False, 
                boxsize:float=None, fixfirst:bool = False, seed:float=None, _binary_name="ran_box", verbose=False, return_command_only=False)->str:

Is that something we want to change?

new repdat format

In the new parallel GromosXX RE-EDS code, the format of the repdat output file changed slightly. The changes are related to the column names and the indices starting at 0 instead of 1. I described it in more detail here: rinikerlab/reeds#47

Once we make the switch to the new parallel code, we should also adapt the functions which depend on repdat s.t. the new format is the default, but the old format is still supported.

Check Examples

We need to checkout the jupyter notebooks of the example folder for our relase :)

What needs to be done?

  • check if code is running
  • nice descriptive text about what is happening and theory
  • maybe adding some additional cells? (analysis or something?)

ToDos - Check:

Add:

fix __eq__ for special blocks

Some blocks need special attention and should maybe override the eq methode the inherit from the generic_block

  • FORCEFIELD
  • MAKETOPVERSION
  • DISTANCERESSPEC
  • MPERTATOM
  • PERTATOMPARAM
  • TIMESTEP
  • TITLE
  • GENBOX
  • PERTDATA
  • RESIDUENAMELIB
  • ATOMNAMELIB
  • _topology_block
  • _iterable_gromos_block
  • repex_system

Writing test for new Submission System

maybe? ;)Automatic testing is important and the testing files are already present for this, but need to be filled with test.
The files you can find in pygromos/tests

Write tests:

  • gromos System
  • HPC_Queueing
    • Scheduler
    • Worker
      -[ ] Analysis
      -[ ] Simulation
  • Submission System
    • DUMMY
    • LOCAL
    • LSF
  • Simulation Blocks
    • simulation block
    • emin
    • md
    • sd

Improve speed of unit tests

Can we improve the speed of the unit test?

A few points possible points:

  • reduce size of trajectories
    • trc
    • tre
    • trg (seem to take the longest)
  • remove unnecessary dependencies from conda incubator
  • TI submission
  • dummy submissions

adding tops very slow

adding multiple tops together is very slow. Especially for easy task like multiplying a top for a condensed phase simulation this is not necessary. A lot of overhead could be avoided by adding a multiply option.

  • top1.multiply(512) (multiply one top 512 time = add 511 copies of itself)
  • top1 *= 512 (should do same thing as above)

This would significantly speed up the creation of topologies

examples: trajectories

I'm checking the trajectory example jupyter notebook at the moment.

I think this is probably now even an issue, but at the very beginning when the first instance of a traj_trc.Trc class is instantiated, there is the following warning:

/home/mlehner/anaconda3/envs/gromos/lib/python3.7/site-packages/pandas/core/generic.py:2621: PerformanceWarning: 
your performance may suffer as PyTables will pickle object types that it cannot
map directly to c-types [inferred_type->mixed,key->block2_values] [items->Index(['POS_1', 'POS_2', 'POS_3', 'POS_4', 'POS_5', 'POS_6', 'POS_7', 'POS_8',
       'POS_9', 'POS_10', 'POS_11', 'POS_12', 'POS_13', 'POS_14', 'POS_15',
       'POS_16', 'POS_17', 'POS_18'],
      dtype='object')]

  encoding=encoding,

I thought I'd report it just to be thorough

Hvap calculation

  • Analysis from tre
  • Auto simulation
    • make gas/liquid simulations
      • create files
      • schedule simulations
    • auto evaluation

NRE in imd FORCE Block is written as float

The NRE value of the FORCE Block is written out as a float resulting in an value error.

I believe this is due to it being read in as a float in the read_content_from_str function.

setattr(self, self._order[0][1][1], list(map(float, content[3].split()[1:])))

This could be fixed by replacing the float by int.

setattr(self, self._order[0][1][1], list(map(int, content[3].split()[1:])))

Too much biology

By @MTLehner
Can we please change the system information block that is shown when printing a gromos_system???

@bschroed when I simulate a simple Cyclohexane molecule it's not my ligand and I also don't expect to see a protein! If anything we should stick to the gromos convention of distinguishing between solute and solvent.

Automatic detection of submission system

@mlehner
we talked about this before, I just found, that I already started the automatic detection of the submission system:

from pygromos.hpc_queuing.submission_syste.Submission_System import SubmissionSystem

Trajectory Types

Hi,
I had a look at the trc-pandas coumn types, and wonder if the object types are good?

TIMESTEP_step int64
TIMESTEP_time float64
POS_1 object
POS_2 object
POS_3 object
...
POS_4580 object
POS_4581 object
POS_4582 object
POS_4583 object
POS_4584 object
Length: 4586, dtype: object

Trajecotries: Coordinates - Lattice Shifts

Hi
I found one issue with the lattice shifts.
If I have a coord. traj with a pbc, it results in issues when I want to write out the coordinates as pdb, as the system is not centered and the pbc was not removed.

examples: TI

In the TI example notebook examples/example_TI_gromos_simulation.ipynb, the file /examples/example_files/TI_Calculation/TI_input/M030_6KET.disres is specified, but this file isn't in the repository. This leads to the following error:

---------------------------------------------------------------------------
OSError                                   Traceback (most recent call last)
<ipython-input-13-14f2d2d90c97> in <module>
      6 grom_system = Gromos_System(in_cnf_path=cnf_path, in_top_path=top_path,
      7                             in_disres_path=disres_path,
----> 8                             system_name=sys_name, work_folder=input_dir)
      9 
     10 

/cluster/work/igc/wsalome/anaconda3/envs/pygromos/lib/python3.7/site-packages/PyGromos-0+untagged.176.g9b9886d-py3.7.egg/pygromos/files/gromos_system/gromos_system.py in __init__(self, work_folder, system_name, in_smiles, in_top_path, in_cnf_path, in_imd_path, in_disres_path, in_ptp_path, in_posres_path, in_refpos_path, in_gromosXX_bin_dir, in_gromosPP_bin_dir, rdkitMol, readIn, Forcefield, auto_convert, adapt_imd_automatically, verbose)
    136                         "refpos": in_refpos_path,
    137                         }
--> 138         self.parse_attribute_files(file_mapping, readIn=readIn, verbose=verbose)
    139 
    140         ##System Information:

/cluster/work/igc/wsalome/anaconda3/envs/pygromos/lib/python3.7/site-packages/PyGromos-0+untagged.176.g9b9886d-py3.7.egg/pygromos/files/gromos_system/gromos_system.py in parse_attribute_files(self, file_mapping, readIn, verbose)
    523         [check_file_paths.append(x) for k, x in file_mapping.items() if (not x is None)]
    524         if (len(check_file_paths) > 0):
--> 525             bash.check_path_dependencies(check_file_paths, verbose=verbose)
    526 
    527         # SET Attribute-FILES

/cluster/work/igc/wsalome/anaconda3/envs/pygromos/lib/python3.7/site-packages/PyGromos-0+untagged.176.g9b9886d-py3.7.egg/pygromos/utils/bash.py in check_path_dependencies(check_required_paths, check_warn_paths, verbose)
    123         print("\n==================\nAUTSCH\n==================\n")
    124         missing_str = "\n\t".join(map(str, missing))
--> 125         raise IOError("COULD NOT FIND all DEPENDENCY!\n\t Could not find path to: \n\t" + str(missing_str), "\n\n")
    126     elif verbose:
    127         print("All dependencies are correct!", "\n\n")

OSError: [Errno COULD NOT FIND all DEPENDENCY!
	 Could not find path to: 
	./example_files/TI_Calculation/TI_input/M030_6KET.disres] 

@schroederb I think you originally wrote this tutorial. Do you still have the file on one of your local branches?

Copy functions: __copy__ & __deepcopy__

We should introduce a copy and a __deepcopy__function to all files and trajs, so we are able to copy the obj:

lam_system = copy.deepcopy(sd_gromos_system)

to be implemented in :

  • gromos_system
  • _general_gromos_file
  • _general_gromos_block

Minor fix tutorial_gromos_pipeline.ipynb

In tutorial_gromos_pipeline.ipynb, template files are not consequently copied with rebase_files(). As a consequence, the templates are overwritten. I opened a PR with a fix.

imd blocks: str-to-bool conversion

in the FORCE class in files/blocks/imd_blocks.py (probably also in the other classes, I didn't check further) there is a conversion of parameters to booleans, but the parameters seem to be strings instead of integers and in my case both "1" and "0" are converted to "True"

Imd not updated from simulation

in_imd_path Argument in pygromos.simulattion.modules.general_simulation_modules::simulation does not work or is counter intuitive. The Argument is only used if the gromos_system.imd is a future_file.

This should either be explicitly written in the documentation or changed (always used if not None). Alternatively a force_imd_override option would be nice.

fix repdat

Repdate got modified with the change to the new trajectories (pandas) and needs some rework

Consider upgrading to OpenFF Toolkit v0.10.0+

I noticed this package was using the slightly older openforcefield namespace, which is no longer being updated. I'm unaware of anything glaringly incorrect with v0.8.3, but migrating to the new namespace will allow for new features and fixes to be applied with new versions of the toolkit.

If making this change, the omnia channel can be dropped from the environment. This might make solving environments quicker. Also, omnia in general is out of service so dropping it would avoid accidentally pulling in old package.

In my experience, it's as simple as replacing every openforcefield in code with openff.toolkit. I'd be happy to help with or directly submit a patch myself if any issues arise.

Automatic detection of submission system

@mlehner
we talked about this before, I just found, that I already started the automatic detection of the submission system:

from pygromos.hpc_queuing.submission_syste.Submission_System import SubmissionSystem

Documentation of Topo helper function

Topo offers many helper functions, to create and modify the files (add atoms, change solvent, change LJ Parameters, ....)

Write a Example Notebook with all these functions Documented

Error in tutorial, AttributeError: module 'pygromos.analysis.coordinate_analysis' has no attribute '_periodic_distance'

In tutorial_gromos_pipeline.ipynb, cell 16 causes an error:

cnf = Cnf(cnf_eq_NVP)
trc = Trc(out_eq_NVP+".trc")
trc.cog_reframe(cnf)
trc.visualize(cnf)

The error reads:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
/tmp/ipykernel_31664/325201585.py in <module>
      1 cnf = Cnf(cnf_eq_NVP)
      2 trc = Trc(out_eq_NVP+".trc")
----> 3 trc.cog_reframe(cnf)
      4 trc.visualize(cnf)

~/Documents/repos/PyGromosTools/pygromos/files/trajectory/trc.py in cog_reframe(self, cnf, index_list)
    316 
    317         # cog calculation: select POS -> apply pbc -> average all positions
--> 318         pbc_pos = self.database[col_list].applymap(lambda x: ca._periodic_distance(x, grid))
    319         cog = pbc_pos.sum(axis=1) / len(col_list)
    320         #print("COG:", cog)

~/miniconda3/envs/pultar-dev/lib/python3.9/site-packages/pandas/core/frame.py in applymap(self, func, na_action, **kwargs)
   8823             return lib.map_infer(x.astype(object)._values, func, ignore_na=ignore_na)
   8824 
-> 8825         return self.apply(infer).__finalize__(self, "applymap")
   8826 
   8827     # ----------------------------------------------------------------------

~/miniconda3/envs/pultar-dev/lib/python3.9/site-packages/pandas/core/frame.py in apply(self, func, axis, raw, result_type, args, **kwargs)
   8738             kwargs=kwargs,
   8739         )
-> 8740         return op.apply()
   8741 
   8742     def applymap(

~/miniconda3/envs/pultar-dev/lib/python3.9/site-packages/pandas/core/apply.py in apply(self)
    686             return self.apply_raw()
    687 
--> 688         return self.apply_standard()
    689 
    690     def agg(self):

~/miniconda3/envs/pultar-dev/lib/python3.9/site-packages/pandas/core/apply.py in apply_standard(self)
    810 
    811     def apply_standard(self):
--> 812         results, res_index = self.apply_series_generator()
    813 
    814         # wrap results

~/miniconda3/envs/pultar-dev/lib/python3.9/site-packages/pandas/core/apply.py in apply_series_generator(self)
    826             for i, v in enumerate(series_gen):
    827                 # ignore SettingWithCopy here in case the user mutates
--> 828                 results[i] = self.f(v)
    829                 if isinstance(results[i], ABCSeries):
    830                     # If we have a view on v, we need to make a copy because

~/miniconda3/envs/pultar-dev/lib/python3.9/site-packages/pandas/core/frame.py in infer(x)
   8821             if x.empty:
   8822                 return lib.map_infer(x, func, ignore_na=ignore_na)
-> 8823             return lib.map_infer(x.astype(object)._values, func, ignore_na=ignore_na)
   8824 
   8825         return self.apply(infer).__finalize__(self, "applymap")

~/miniconda3/envs/pultar-dev/lib/python3.9/site-packages/pandas/_libs/lib.pyx in pandas._libs.lib.map_infer()

~/Documents/repos/PyGromosTools/pygromos/files/trajectory/trc.py in <lambda>(x)
    316 
    317         # cog calculation: select POS -> apply pbc -> average all positions
--> 318         pbc_pos = self.database[col_list].applymap(lambda x: ca._periodic_distance(x, grid))
    319         cog = pbc_pos.sum(axis=1) / len(col_list)
    320         #print("COG:", cog)

AttributeError: module 'pygromos.analysis.coordinate_analysis' has no attribute '_periodic_distance'

The same error occurs in cell 20:

trc = Trc(out_md+".trc")
trc.TITLE = "\n".join(trc.TITLE)
trc.cog_reframe(cnf)
trc.visualize(cnf)

The error message reads:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
/tmp/ipykernel_31664/153322794.py in <module>
      1 trc = Trc(out_md+".trc")
      2 trc.TITLE = "\n".join(trc.TITLE)
----> 3 trc.cog_reframe(cnf)
      4 trc.visualize(cnf)

~/Documents/repos/PyGromosTools/pygromos/files/trajectory/trc.py in cog_reframe(self, cnf, index_list)
    316 
    317         # cog calculation: select POS -> apply pbc -> average all positions
--> 318         pbc_pos = self.database[col_list].applymap(lambda x: ca._periodic_distance(x, grid))
    319         cog = pbc_pos.sum(axis=1) / len(col_list)
    320         #print("COG:", cog)

~/miniconda3/envs/pultar-dev/lib/python3.9/site-packages/pandas/core/frame.py in applymap(self, func, na_action, **kwargs)
   8823             return lib.map_infer(x.astype(object)._values, func, ignore_na=ignore_na)
   8824 
-> 8825         return self.apply(infer).__finalize__(self, "applymap")
   8826 
   8827     # ----------------------------------------------------------------------

~/miniconda3/envs/pultar-dev/lib/python3.9/site-packages/pandas/core/frame.py in apply(self, func, axis, raw, result_type, args, **kwargs)
   8738             kwargs=kwargs,
   8739         )
-> 8740         return op.apply()
   8741 
   8742     def applymap(

~/miniconda3/envs/pultar-dev/lib/python3.9/site-packages/pandas/core/apply.py in apply(self)
    686             return self.apply_raw()
    687 
--> 688         return self.apply_standard()
    689 
    690     def agg(self):

~/miniconda3/envs/pultar-dev/lib/python3.9/site-packages/pandas/core/apply.py in apply_standard(self)
    810 
    811     def apply_standard(self):
--> 812         results, res_index = self.apply_series_generator()
    813 
    814         # wrap results

~/miniconda3/envs/pultar-dev/lib/python3.9/site-packages/pandas/core/apply.py in apply_series_generator(self)
    826             for i, v in enumerate(series_gen):
    827                 # ignore SettingWithCopy here in case the user mutates
--> 828                 results[i] = self.f(v)
    829                 if isinstance(results[i], ABCSeries):
    830                     # If we have a view on v, we need to make a copy because

~/miniconda3/envs/pultar-dev/lib/python3.9/site-packages/pandas/core/frame.py in infer(x)
   8821             if x.empty:
   8822                 return lib.map_infer(x, func, ignore_na=ignore_na)
-> 8823             return lib.map_infer(x.astype(object)._values, func, ignore_na=ignore_na)
   8824 
   8825         return self.apply(infer).__finalize__(self, "applymap")

~/miniconda3/envs/pultar-dev/lib/python3.9/site-packages/pandas/_libs/lib.pyx in pandas._libs.lib.map_infer()

~/Documents/repos/PyGromosTools/pygromos/files/trajectory/trc.py in <lambda>(x)
    316 
    317         # cog calculation: select POS -> apply pbc -> average all positions
--> 318         pbc_pos = self.database[col_list].applymap(lambda x: ca._periodic_distance(x, grid))
    319         cog = pbc_pos.sum(axis=1) / len(col_list)
    320         #print("COG:", cog)

AttributeError: module 'pygromos.analysis.coordinate_analysis' has no attribute '_periodic_distance'

Conformation Conversion

Conversion from trc/cnf to

  • Gromacs gro
  • Pdb
  • xyz
  • sdf
  • mol
  • rdkit

and back

  • Gromacs gro
  • Pdb
  • xyz
  • sdf
  • mol
  • rdkit

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.